"

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

Last review: Jan 01, 2013
https://kb.netwrix.com/1409
Copy Article URL Copied

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’


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.


Perform the following steps to find the database(s) with the ‘NULL’ owner:

1. Connect to the ‘MSSQLSERVER’ server.

2. Run the following statement:
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’

Go Up