Need an advice from SQL Server Experts. I'm just a developer, not a DBA, so pardon my ignorance.
My environment consists of 2 equal instances (Node1 and Node2) of SQL Server 2008 R2 x64 (10.50.4339.0). I have 2 databases: DB1 and DB2 with Full
recovery model. Both databases participate in replication between each other within single SQL instance and also both of them get mirrored from Node1 to Node2. These are not production databases and I did take full DB backups before doing any changes.
However, I have ended up in trouble: the log file is not growing for both DB1 and DB2 at Principal and the execution of:
select log_reuse_wait_desc, name, * from sys.databases where name='DB1' or name='DB2'
shows that both DB1 and DB2 have `log_reuse_wait_desc='LOG_BACKUP' even though I did run log backup manually.
Here is the sequence of events which caused the current state:
- I needed to update DB1 and DB2 with year-worth set of changes which involved running many structure and data change scripts. Some of the data scripts were quite heavy, truncating tables and containing 70K+ INSERT calls. So, I've started applying changes at Principal (Node1) one by one in little chunks.
- Node1 already had limited disk space available at partition with DB1 and DB2 data and log files.
- When applying changes several times I've received
log file full...
message. So I've stopped and shrunk the log file of both DB1 and DB2 to 0Mb to free up some disk space to be able to finish the data/structure update task. - The log file of both DBs did get shrunk to minimal allowed however after I have continued with data changes I've got the following message:
Msg 9002, Level 17, State 2, Line 1 The transaction log for database 'DB2' is full. To find out why space in the log cannot be reused, see the log_reuse_wait_desc column in sys.databases
Sometime during running of data/structure change scripts the free disk space at relevant partition dropped to a few KBs and SQL Server sent out warning emails.
I did try to research how to get log_reuse_wait_desc
column to show NOTHING
. However, the suggested solutions prompted putting DB1 and DB2 into simple recovery mode or detach/re-attach them, something I cannot do because of the replication and mirroring.
I have also followed the advice from Paul S. Randal and have run log backup manually:
BACKUP LOG DB2 TO DISK = 'z:\DB2.TRN'
which completed successfully, however the log_reuse_wait_desc
still shows LOG_BACKUP
and the log file is not growing.
DBCC LOGINFO Output:
DB1: 421 records like:
DB2: 381 records like:
Initial loginfo records for DB2: https://i.stack.imgur.com/TTsVu.png
Note, the Field
column for DB1 contains values 2 and 4, while for DB2 Field
column contains only value 2. The file size and offset fields looks scary: 54GB+? I may not have so much free space. Currently there is 26GB of free space on the drive and it's not decreasing. So seems SQL Server has hung.
Is there any way to fix the current DB1 and DB2 without disabling replication/mirroring followed by a restore from backup?
Any help is greatly appreciated.
DBCC LOGINFO
return when ran within DB1 and DB2? Are you seeing a lot of records with a Status of2
?DBCC LOGINFO
I was more concerned about. I've posted an answer to try and better explain what I suspect may be occurring.DBCC LOGINFO
output. @SqlWorldWide How would I check that? Insys.dm_exec_requests
there is one suspendedDELETE
request with the following text:WAITFOR (RECEIVE message_body FROM WMIEventProviderNotificationQueue), TIMEOUT 5000