I have a database (recovery mode = full), its transaction log is full. I know that I can solve it by shrinking the transaction log to fix the issue.
But, I would like to know the reason why it became full?
Since I read others and they said large amount of insertion & deletion can increase the transaction log size. But I cannot replicate the issue to reproduce the error of full transaction log (it somehow able to reallocate the space)
The questions are: How to simulate the issue of "transaction log full"? How to check the physical transaction log?
This query is applied to trace the current occupied log space but it is properly not the actual transaction log, as the occupied space of the query is trembling instead of static increase in the process of bulk insertion & deletion
it is supposed that the log space will just increment as long as backup is not executed
DECLARE @TMPTBL AS TABLE (
DatabaseName nvarchar(500),
LogSize decimal(18,2),
LogSpaceUsed decimal (18,2),
[Status] int
)
INSERT INTO @TMPTBL
EXEC ('DBCC SQLPERF(LOGSPACE)')
SELECT * FROM @TMPTBL WHERE DATABASENAME LIKE '%MYDBNAME%'
GO