Change Database Ownership

It’s a common issue with DBA’s to forget changing the database ownership after restoring the database.Below are couple of methods by which database ownership can be changed. Scripts: use master go EXEC sp_MSforeachdb ‘IF ”?” NOT IN (”tempDB”,”model”,”msdb”,”master”) EXEC [?]..sp_changedbowner ”sa”’ go Change database ownership for single database use database_name go sp_changedbowner ‘sa’ Change Database […]