Sql Server Change the ownership of a database
- Posted by Sqltimes
- On March 21, 2014
- 0 Comments
Another quick one today:
Sometimes, when we receive a new application environment (with in database servers) into our scope of responsibility, there are a list of “sanity” checks we run on them to be sure things are configured correctly. It is a big list, but some of them are listed here:
- Appropriate backup jobs
- Maintenance Jobs
- System documentation
- Optimal storage architecture configuration
- Appropriate ownership of the database
- Permissions
- Health Checks
- Monitors
- …etc.
In the past, there were some blog posts that talked about some of these. In today’s post we’ll cover database ownership
This is a common mistake that happens on my part sometimes, where when a database is created or restored, Sql Server by default set the owner of the database to my login name. So, after letting it run like that for a few days, I realize my mistake and then attempt to change it to ‘sa’ or some other dedicated account using this script.
1
2
3
4
5
|
USE [ database name ] GO EXEC sp_changedbowner 'sa' GO |
Hope this helps,
_Sqltimes
0 Comments