Cannot insert the value NULL into column 'owner', table 'tempdb.dbo'

Email It to Me Print this Page
Symptoms The change report from Netwrix Auditor for SQL Server contains the following warning:
Collect 'Database' information warning on server: MSSQLSERVER DB: master.
Cannot insert the value NULL into column 'owner', table 'tempdb.dbo'
Cause Netwrix Auditor for SQL Server uses the “sp_helpdb” stored procedure. This stored procedure will fail if any database on the SQL server does not have an owner.
Resolution Perform the following steps to find the database(s) with the “NULL” owner:

1. Connect to the “MSSQLSERVER” server.

2. Run the following script:

use master
select name, suser_sname(sid) from sysdatabases


3. Look for database without username in second field.

4. Please run the following script to change the owner of the database:

use problematic_database_name
exec sp_changedbowner 'user name'


Note: Replace ‘user name’ with the user name of the account for the database

Example:
use problematic_database
exec sp_changedbowner 'sa'
(*) Netwrix Auditor replaces former Change Reporter products
Was this information helpful?