The database owner SID recorded in the master database differs from the database owner SID recorded in database 'DB_NAME'
The database owner SID recorded in the master database differs from the database owner SID recorded in database 'DB_NAME'. You should correct this situation by resetting the owner of database 'DB_NAME' using the ALTER AUTHORIZATION statement.
主数据库中记录的数据库所有者SID与数据库'DB_NAME'中记录的数据库所有者SID不同。 您应该通过使用ALTER AUTHORIZATION语句重新设置数据库“DB_NAME”的所有者来纠正这种情况。
解决办法:
DECLARE @Command VARCHAR(MAX) = 'ALTER AUTHORIZATION ON DATABASE::<<DatabaseName>> TO [<<LoginName>>]' SELECT @Command = REPLACE(REPLACE(@Command , '<<DatabaseName>>', DB_NAME()) , '<<LoginName>>', sp.name) FROM sys.databases db JOIN sys.server_principals sp ON sp.sid = db.owner_sid WHERE db.name = 'master' EXEC(@Command) GO