Skip to main content

Database Troubleshooting

Updating a database that was transferred from a different database server

In the output file of the installer, you may encounter the following error message when you attempt to update a database that used to be on a different database sever:

Error SQL72014: .Net SqlClient Data Provider: Msg 33009, Level 16, State 2, Line 1 The database owner SID recorded in the master database differs from the database owner SID recorded in database 'Dime.Scheduler'. You should correct this situation by resetting the owner of database 'Dime.Scheduler' using the ALTER AUTHORIZATION statement.

This can be resolved by running the following query. Make sure to replace to <<DatabaseName>> and <<LoginName>> placeholders with the actual values of the database and login name.

DECLARE @Command VARCHAR(MAX) = 'ALTER AUTHORIZATION ON DATABASE::[<<DatabaseName>>] TO 
[<<LoginName>>]'

SELECT @Command = REPLACE(REPLACE(@Command
, '<<DatabaseName>>', SD.Name)
, '<<LoginName>>', SL.Name)
FROM master..sysdatabases SD
JOIN master..syslogins SL ON SD.SID = SL.SID
WHERE SD.Name = DB_NAME()

PRINT @Command
EXEC(@Command)