February 8, 2013 at 3:49 am
Hi Friends,
Is there any way to find which user has dropped the table. My database recovery model is simple. There is no audit enabled. Is there any possibilities to find which user has dropped the table by sql query.
Thanks in advance.
February 8, 2013 at 3:51 am
Could check the default trace, but thats it, if its not in the trace your out of luck.
February 8, 2013 at 4:32 am
Is there any other dynamic view where I can get which user has dropped the table.
February 8, 2013 at 4:38 am
Nope the information is not logged anywhere, so you would have to do custom auditing.
February 8, 2013 at 5:37 am
Like Anthony mentioned, the default trace has the information you are looking for, if not to much time has passed.
SSMS has a handy report which queries the trace for you:
Additionally, i think it's a good practice to create a view for every trace you create, so that you can more easily access it via TSQL or an applicaiton if necessary:
USE master;
declare @sql varchar(1000)
declare @path nvarchar(256)
SELECT @path = path FROM sys.traces WHERE is_default = 1
IF EXISTS(select * from master.dbo.sysobjects where xtype='V' and name='VW_DefaultTrace')
BEGIN
SET @sql = 'ALTER VIEW VW_DefaultTrace AS SELECT * FROM ::fn_trace_gettable(''' + @path +''', default)'
exec(@sql)
END
ELSE
BEGIN
SET @sql = 'CREATE VIEW VW_DefaultTrace AS SELECT * FROM ::fn_trace_gettable(''' + @path + ''', default)'
exec(@sql)
END
Lowell
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply