Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SQL Server 2008 log of dropped stored procs

I am using SQL Server 2008 and noticed that an important stored procedure was missing.

How do I find out when and by whom a stored procedure was dropped.

like image 427
tom Avatar asked Jun 30 '13 17:06

tom


People also ask

Who deleted stored procedure in SQL Server?

Right click SQL Server Instance and Select Reports -> Standard Reports -> Schema Changes History as shown in the below snippet. 3. This will open up Scheme Changes History report which will have the details about who deleted the SQL Server Database along with the timestamp when the database was deleted.

Can I retrieve a deleted stored procedure SQL Server?

You can recover deleted stored procedure in SQL Server through two methods- by using Backup and Restore wizard of SQL Server Management Studio and by using enterprise software.


1 Answers

First you get location of admintrace:

select * from fn_trace_getinfo(NULL)
where property=2
and traceid in (1,2,3,4,5) --sometime several logs available

and then you check all details:

select DatabaseName,ObjectName,LoginName,StartTime,* 
from fn_trace_gettable('c:\path_to_log\MSSQL\Log\log_2.trc', -1)
where EventClass = 47  --Object:Deleted
like image 177
revoua Avatar answered Sep 21 '22 16:09

revoua