f 要怎麼查who and when 去縮小了sql server交易記錄檔 ~ 迪貝之家

Pages

要怎麼查who and when 去縮小了sql server交易記錄檔

 

系統的default trace就有記錄了
Using the Default Trace in SQL Server
可以看上述善心人士寫的文章
我節錄重點
1.trace file 的位置

SELECT traceid, value FROM [fn_trace_getinfo](NULL)
WHERE [property] = 2;

default trace

2.查看trace file的內容

SELECT *
FROM [fn_trace_gettable]('F:\MSSQL12.MSSQLSERVER\MSSQL\Log\log_230.trc', DEFAULT)
where StartTime between '2020-08-17 04:00:00' and '2020-08-17 06:00:00'
and textdata like '%shrink%'
order by starttime desc ;

default trace