Monday, October 7, 2013

How to change the owner of a SQL database when the owner has been removed.


On a  server some of the databases are inaccessible to the SA user.
This requires running this command to see who the owner is

sp_helpdb DBNAME

Once you know how to change the owner just run this to change the owner to the SA and you can then perform the admin you require


USE dbname
EXEC sp_changedbowner 'SA'

No comments:

Post a Comment