When you select the “owner_id” column from the [sys.databases] table, to find out who is the owner of each database in your server, the value show in the column is unreadable, like a line of hex value.
Use the built in “SUSER_SNAME” function to convert the hex value to meaningful owner name. Execute the following scripts to find out who is the database owner for each databases.
SELECT name, SUSER_SNAME(owner_sid) AS [Owner_Name]
Below is a nice quick sanity check showing all the dbs that have NOT been backed up for X days or have never been backed up at all.
DECLARE @num_of_days INT
SET @num_of_days = 1
, MAX(B.backup_finish_date) AS 'LastBackupDateTime'
master.dbo.sysdatabases A WITH(NOLOCK) LEFT OUTER JOIN
msdb.dbo.backupset B WITH(NOLOCK) ON A.name = B.database_name
WHERE (B.TYPE = 'D' OR B.TYPE IS NULL)
GROUP BY A.name
HAVING (MAX(B.backup_finish_date) < GETDATE() - @num_of_days OR MAX(B.backup_finish_date) IS NULL)
ORDER BY A.name
SQL DBs That Have Not Had A Full Backup in X Days