I've found several similar questions in this forum, but none of the answers have resolved my problem: I have a SQL Server 2012 DB using simple recovery model. The MDF file is 12 GB and the LDF file is 10 GB. I'm trying to shrink the size of the LDF file. I've read that for simple recovery model DBs there are reasons for delaying log file shrinking, but I still can't find a solution based on these reasons.
When I try to shrink it using this command:
DBCC SHRINKFILE(MyDB_log, 1000000)
I get these results, and no change of file size:
DbId FileId CurrentSize MinimumSize UsedPages EstimatedPages
8 2 1241328 128 1241328 128
The same results running this:
DBCC SHRINKFILE(MyDB_log, 1000000, TRUNCATEONLY)
There doesn't appear to be any open transactions:
DBCC OPENTRAN()
No active open transactions.
DBCC execution completed. If DBCC printed error messages, contact your system administrator.
And this returns NOTHING:
SELECT name, database_id, log_reuse_wait_desc FROM sys.databases WHERE database_id = DB_ID()
name database_id log_reuse_wait_desc
MyDB 8 NOTHING
I've also tried running the following, but nothing useful is returned:
SELECT * FROM sys.dm_tran_database_transactions
SELECT * FROM sys.dm_exec_requests WHERE database_id=DB_ID()
SELECT * FROM sys.dm_tran_locks WHERE resource_database_id=DB_ID()
Any other suggestions of what I can do to shrink this log file? Or perhaps someone can justify its enormous size?
David Collacott