In a new environment, I noted that not all the SQL Server databases are owned by the 'sa 'account. I know this isn't a good practice, but in addition to that reason, some of the databases have to be owned by particular accounts.
there is a way to script this so that we can set the proper owners for databases in case of disaster recovery.
SELECT D.name AS 'Database', P.name AS 'Owner'
FROM sys.databases D
JOIN sys.server_principals P
ON D.owner_sid = P.sid
--where P.name <> 'sa'
ORDER BY D.name;
No comments:
Write commentsPlease do not enter spam links