June 9, 2009 at 9:23 am
Is there a way to capture who and when someone runs a shrinkdb/shrinkfile on a database short of running a trace?
June 9, 2009 at 9:36 am
I think the default trace that is running in SQL Server will capture this information.
--Run this query to get the current file name and place it in the path for the query below
SELECT * FROM ::fn_trace_getinfo(0)
SELECT *
FROM ::fn_trace_gettable('E:\SQLData\MSSQL10.MSSQLSERVER\MSSQL\Log\log_21.trc',0)
INNER JOIN sys.trace_events e
ON eventclass = trace_event_id
INNER JOIN sys.trace_categories AS cat
ON e.category_id = cat.category_id
Here is an article that will help explain it a little more.
http://www.sqlservercentral.com/articles/SQL+Server+2005/64547/
June 9, 2009 at 9:47 am
Ken Simmons, you are a genius. Sadly enough, I spent quite some time googling on this to no avail. Clearly I wasn't searching for the right thing..
Thanks again.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply