Sql-server – How did the databases shrink

shrinksql server

I have a nightly job that monitors database and log file sizes. Over time the databases grow. Last night some databases actually shrank in size. The logs show no SHRINKFILE OR SHRINKDATABASE events. AUTOSHRINK is OFF. Is there any other way these databases could have shrank?

Best Answer

You can use the Power of Default Trace to find out the culprit.

provided the default trace files are not rolled over

-- find out the default trace location



SELECT * 
FROM fn_trace_getinfo(default);
GO

   --- check the events

SELECT 
    TextData,
    HostName,
    ApplicationName,
    LoginName, 
    StartTime  
FROM 
[fn_trace_gettable]('Location of Tracefile.trc', DEFAULT) 
WHERE TextData LIKE '%SHRINKFILE%';