Who Deleted My SQL Server Database?

sqlserver2014

Who dropped your SQL Server database? If they dropped the database using Transact-SQL, this script will return the user name.

SELECT Operation, 
       SUSER_SNAME([Transaction SID]) As UserName,  
       [Transaction Name], 
       [Begin Time], 
       [SPID], 
       Description
FROM   fn_dblog (NULL, NULL)  
WHERE  [Transaction Name] = ‘dbdestroy’

This will not return data if the person dropped the database using the SQL Server Management Studio GUI.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s