Met onderstaande T-SQL kun je de vulling in procent van het transaction log bestand van een specifieke database opvragen en monitoren. Dit is alleen handig in specifieke situaties. Bij een correct database onderhoudsplan zal dit niet nodig zijn.
CREATE TABLE #tTLSpace
(
DBName sysname,
TLSize decimal(18,5),
TLUsed decimal(18,5),
status INT
)
GO
INSERT INTO #tTLSpace
exec ('DBCC SQLPERF(logspace)')
GO
DECLARE @dTLUsed decimal
SELECT @dTLUsed = TLUsed from #tTLSpace WHERE DBName = 'DATABASE'
IF ( @dTLUsed > 90)
BEGIN
PRINT @dTLUsed
PRINT 'TransactionLog bestand 90 procent vol...'
END
GO
DROP TABLE #tTLSpace
GO