﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / SQL Server 2008 / SQL Server 2008 Administration  / Using ::fn_dblog() to find  who deleted the rows in a table. / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Thu, 23 May 2013 03:53:47 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: Using ::fn_dblog() to find  who deleted the rows in a table.</title><link>http://www.sqlservercentral.com/Forums/Topic1382711-1550-1.aspx</link><description>I am aware of that.However you can deduce who is doing what based on the entries in the default trace.</description><pubDate>Fri, 28 Dec 2012 14:31:22 GMT</pubDate><dc:creator>arnipetursson</dc:creator></item><item><title>RE: Using ::fn_dblog() to find  who deleted the rows in a table.</title><link>http://www.sqlservercentral.com/Forums/Topic1382711-1550-1.aspx</link><description>[quote][b]arnipetursson (12/28/2012)[/b][hr]If you have default trace records from around the time of the delete, you may be able to compile a list of suspects.  Hopefully you do not too may people that have sysadmin access on your system.[/quote] That won't help, I'm afraid.the default trace captured DDL changes..CREATE TABLE/INDEX etc kinds of things.it does not capture any DML statements like INSERT/UPDATE/DELETE; for that you need a different custom trace set up prior to the changes occurring to get any relevant info from any trace.</description><pubDate>Fri, 28 Dec 2012 13:20:16 GMT</pubDate><dc:creator>Lowell</dc:creator></item><item><title>RE: Using ::fn_dblog() to find  who deleted the rows in a table.</title><link>http://www.sqlservercentral.com/Forums/Topic1382711-1550-1.aspx</link><description>If you have default trace records from around the time of the delete, you may be able to compile a list of suspects.  Hopefully you do not too may people that have sysadmin access on your system.</description><pubDate>Fri, 28 Dec 2012 12:42:55 GMT</pubDate><dc:creator>arnipetursson</dc:creator></item><item><title>RE: Using ::fn_dblog() to find  who deleted the rows in a table.</title><link>http://www.sqlservercentral.com/Forums/Topic1382711-1550-1.aspx</link><description>[quote][b]dedicatedtosql (12/26/2012)[/b][hr]Thank you very much for the advice.Actualy We have both CDC as well as Auditing in place for the prod database. But this was a local environment. Where we have many sysadmins. I know it is a worst practice. I am new here and I adviced them not to. But they want it to stay this way.Regards[/quote]Looks to me like you need to set up auditing and CDC in this environment as well.</description><pubDate>Thu, 27 Dec 2012 06:50:20 GMT</pubDate><dc:creator>Lynn Pettis</dc:creator></item><item><title>RE: Using ::fn_dblog() to find  who deleted the rows in a table.</title><link>http://www.sqlservercentral.com/Forums/Topic1382711-1550-1.aspx</link><description>[quote][b]krishnarajeesh (12/23/2012)[/b][hr]That is OPERATION 'LOP_DELETE_ROWS' will not have have the login info, where as "LOP_BEGIN_XACT" for that delete will have.[/quote]No, it won't. It has the database user info, not the login info.</description><pubDate>Thu, 27 Dec 2012 02:37:51 GMT</pubDate><dc:creator>GilaMonster</dc:creator></item><item><title>RE: Using ::fn_dblog() to find  who deleted the rows in a table.</title><link>http://www.sqlservercentral.com/Forums/Topic1382711-1550-1.aspx</link><description>Thank you very much for the advice.Actualy We have both CDC as well as Auditing in place for the prod database. But this was a local environment. Where we have many sysadmins. I know it is a worst practice. I am new here and I adviced them not to. But they want it to stay this way.Regards</description><pubDate>Wed, 26 Dec 2012 17:59:22 GMT</pubDate><dc:creator>dedicatedtosql</dc:creator></item><item><title>RE: Using ::fn_dblog() to find  who deleted the rows in a table.</title><link>http://www.sqlservercentral.com/Forums/Topic1382711-1550-1.aspx</link><description>If it is important to know who did something, you should look at setting up auditing so that you can capture this in the future.  You may also want to look at CDC if you need to capture the actual changes to data.</description><pubDate>Wed, 26 Dec 2012 17:41:58 GMT</pubDate><dc:creator>Lynn Pettis</dc:creator></item><item><title>RE: Using ::fn_dblog() to find  who deleted the rows in a table.</title><link>http://www.sqlservercentral.com/Forums/Topic1382711-1550-1.aspx</link><description>Yeah I did the same thing. But the problem here is the SID was showing 0x01 which is a dbo user. i.e.. a sysadmin mapped to dbo with have SID 0x01. SO it is has not possible(to my knowledge) to get which login performed the delete. </description><pubDate>Wed, 26 Dec 2012 17:39:08 GMT</pubDate><dc:creator>dedicatedtosql</dc:creator></item><item><title>RE: Using ::fn_dblog() to find  who deleted the rows in a table.</title><link>http://www.sqlservercentral.com/Forums/Topic1382711-1550-1.aspx</link><description>SELECT[Current LSN],[Operation],[Transaction ID],[Description], SPID,[Begin Time], [Transaction SID],name 'LoginName'FROM fn_dblog (NULL, NULL),(select sid,name from sys.syslogins) slwhere [Transaction Name] LIKE '%delete%' and [Transaction SID] = sl.sid  this query is not showing any results though the rows got deleted from the table. I have few rows from the table and checked it. Its not giving any results with details who has deleted them.Can you please help on this.</description><pubDate>Tue, 25 Dec 2012 17:44:40 GMT</pubDate><dc:creator>ravinder.881986</dc:creator></item><item><title>RE: Using ::fn_dblog() to find  who deleted the rows in a table.</title><link>http://www.sqlservercentral.com/Forums/Topic1382711-1550-1.aspx</link><description>Just try searching for  [Transaction Name] LIKE '%delete%'.  That is OPERATION 'LOP_DELETE_ROWS' will not have have the login info, where as "LOP_BEGIN_XACT" for that delete will have.Sample querySELECT    [Current LSN],    [Operation],    [Transaction ID],    [Description], SPID,[Begin Time], [Transaction SID],    name 'LoginName'FROM fn_dblog (NULL, NULL),(select sid,name from sys.syslogins) slwhere [Transaction Name] LIKE '%delete%' and [Transaction SID] = sl.sid Operation	                Transaction ID	       Description	                                                      SPID	Allocunitname	nameLOP_BEGIN_XACT	0000:00000207	DELETE;0x01	                                                        55	NULL	          saLOP_BEGIN_XACT	0000:00000215	DELETE;0xdd56d0e1cfe9fd42bafe0aac916518eb	55	NULL	          testloginLOP_BEGIN_XACT	0000:00000221	DELETE;0x80f4a1243a4e6e439fffe00be23c086a	55	NULL	          testThis worked for me. Thanks,Krishna</description><pubDate>Sun, 23 Dec 2012 20:26:09 GMT</pubDate><dc:creator>krishnarajeesh</dc:creator></item><item><title>RE: Using ::fn_dblog() to find  who deleted the rows in a table.</title><link>http://www.sqlservercentral.com/Forums/Topic1382711-1550-1.aspx</link><description>Nope. All that's in the log is the user id. The transaction log is not an audit log. Rollbacks and database recovery do not require any information on the login, host, app or any other such information.</description><pubDate>Thu, 08 Nov 2012 15:28:40 GMT</pubDate><dc:creator>GilaMonster</dc:creator></item><item><title>RE: Using ::fn_dblog() to find  who deleted the rows in a table.</title><link>http://www.sqlservercentral.com/Forums/Topic1382711-1550-1.aspx</link><description>I am sorry for the repost. I will make point that I will not do it future. The reason I did that was since it was security question I wanted to do there as well. So coming to the issue there is no way to track thye dbo back to thr login with sysadmin privilages right? No other column returned by ::fn_dblog() helps in tracking it back.Any way thanks for the help.</description><pubDate>Thu, 08 Nov 2012 15:19:18 GMT</pubDate><dc:creator>dedicatedtosql</dc:creator></item><item><title>RE: Using ::fn_dblog() to find  who deleted the rows in a table.</title><link>http://www.sqlservercentral.com/Forums/Topic1382711-1550-1.aspx</link><description>Please don't cross post. It just results in people answering already answered questions.Alspo asked at [url]http://www.sqlservercentral.com/Forums/Topic1382719-1526-1.aspx[/url]</description><pubDate>Thu, 08 Nov 2012 15:06:06 GMT</pubDate><dc:creator>GilaMonster</dc:creator></item><item><title>RE: Using ::fn_dblog() to find  who deleted the rows in a table.</title><link>http://www.sqlservercentral.com/Forums/Topic1382711-1550-1.aspx</link><description>0x01 as a user sid is DBO, that's the user mapped to all sysadmin logins, sa and any other member of the sysadmin role. The log does not contain login sids, just database user sids.</description><pubDate>Thu, 08 Nov 2012 15:05:17 GMT</pubDate><dc:creator>GilaMonster</dc:creator></item><item><title>RE: Using ::fn_dblog() to find  who deleted the rows in a table.</title><link>http://www.sqlservercentral.com/Forums/Topic1382711-1550-1.aspx</link><description>[quote][b]dedicatedtosql (11/8/2012)[/b][hr]Hi All,Recently some one deleted some rows from a table. I was asked to find out who did it. Since the log has not been backed up since the time the DB was created I took the help of undocumented Table valued function [b]::fn_dblog()[/b] which gives me the contents of the active portion of the log. I filtered on AlocUnitName and operation column.Allocunitname being the table name and OPERATION being the 'LOP_DELETE_ROWS'.I was looking fior the column TRANSACTION SID to find out the SID of the user that started the transaction that deleted the rows. I did get it. But the problem is the value of the SID is 0x01 which is the dbo user. It is evident that a server level login with sysadmin privilages did the delets. Is there any way I can find out the server login mapped to the dbo user? Any idea would be appriciated.[/quote]0x01 is always SA. Not going to provide much in the way of help there I'm afraid.</description><pubDate>Thu, 08 Nov 2012 15:02:22 GMT</pubDate><dc:creator>Sean Lange</dc:creator></item><item><title>Using ::fn_dblog() to find  who deleted the rows in a table.</title><link>http://www.sqlservercentral.com/Forums/Topic1382711-1550-1.aspx</link><description>Hi All,Recently some one deleted some rows from a table. I was asked to find out who did it. Since the log has not been backed up since the time the DB was created I took the help of undocumented Table valued function [b]::fn_dblog()[/b] which gives me the contents of the active portion of the log. I filtered on AlocUnitName and operation column.Allocunitname being the table name and OPERATION being the 'LOP_DELETE_ROWS'.I was looking fior the column TRANSACTION SID to find out the SID of the user that started the transaction that deleted the rows. I did get it. But the problem is the value of the SID is 0x01 which is the dbo user. It is evident that a server level login with sysadmin privilages did the delets. Is there any way I can find out the server login mapped to the dbo user? Any idea would be appriciated.</description><pubDate>Thu, 08 Nov 2012 14:09:52 GMT</pubDate><dc:creator>dedicatedtosql</dc:creator></item></channel></rss>