I noticed a jump in logfile size the other day and was wondering how to predict a autogrowth event.
I know old data is truncated after a log-backup but that’s internal and not normally visable.
I came up with this to run across production …
--LogSpace.sql
-- To help find near-full logfiles that may autogrow soon.
-- create table to hold raw data
CREATE TABLE #temp (DBName varchar(100), SizeMB int, UsedPct float, [STATUS] bit)
-- populate table
INSERT #temp EXEC('DBCC SQLPERF(logspace)')
-- output
SELECT DBName, SizeMB, UsedPct FROM #temp --WHERE UsedPct > 90 -- 90% full
-- clean-up
DROP TABLE #temp