Showing posts with label database owner. Show all posts
Showing posts with label database owner. Show all posts

Saturday, December 29, 2012

Query to Set MSSQL Database Owner

This resolves an error encountered disabling the ability to view database properties via SQL Management Studio: "Property Owner is not available for Database '[DB_name]'. This property may not exist for this object, or may not be retrievable due to insufficient access rights. (Microsoft.SqlServer.Smo)" And a related error: "The database owner SID recorded in the master database differs from the database owner SID recorded in database 'XYZ'. You should correct this situation by resetting the owner of database 'XYZ' using the ALTER AUTHORIZATION statement."

Where !DBNAME= database name, and the default System Administrator remains 'sa': 

use !DBNAME
EXEC dbo.sp_changedbowner @loginame = N'sa', @map = false
GO

RAT Bastard

Earlier this week, several servers I maintain were targeted by automated attempts to upload a remote access trojan (RAT). The RAT is a simpl...