This is the most important part for DBAs or developers. Yesterday somebody dropped or deleted objects from my database, but no one will say who. And I want to track who did it. By using the transaction log we can track which user dropped or deleted my database objects.
Let’s create a small Test Environment using the Transaction Log and the undocumented function “fn_dblog”.
The following is the test environment.
-Tracking a user who a Deleted TSQL
Step 1: Now I will create a database and a table:
Step 2: Now insert some data into the Test table:


Step 4: Now I will find the deleted rows information using the Transaction Log and the function “fn_dblog”. Run the following command to get the info about all the deleted transactions.

Step 5: Now I will get the User Name that deleted the data from the “Test” table by using the Transaction SID and the preceding Transaction ID- 0000:00000513. Run the following command to get the information about the Transaction SID.

Now I can see the [Begin Time] of this transaction that will also help filter out the possibilities in determining the exact info like when the data was deleted by the user.
Step 1: Now to drop a table, the Test table


Now I can see the [Begin Time] of this transaction that will also help filter out the possibilities in determining the exact info, like when the table was dropped by the user.
Not a member yet? Register now
Are you a member? Login now