Ads

28 July 2015

Could not redo log record - DB is SUSPECT Mode

We recently faced this issue after the maintenance window. The user database went to suspect mode and it was unable to bring online due to below error.
This case we rebuilt the logfile, to bring the DB online.

ERROR
Could not redo log record (1327929:29486:115), for transaction ID (1:1223281085), on page (1:1333024), database 'TestDB2 ' (database ID 8). Page: LSN = (1327558:113348:307), type = 2. Log: OpCode = 5, context 29, PrevPageLSN: (1327929:29486:18). Restore from a backup of the database, or repair the database.

Msg 3313, Level 21, State 2, Line 1

This case has only below options:

1. Restore the DB from the backup strategy.
2. Try DBCC REPAIR with REPAIR_FAST | REPAIR_REBUILD (No Data Loss)
3.  Final is REPAIR_ALLOW_DATA_LOSS

Alternate Solution:
===================

ALTER DATABASE TestDB2 REBUILD LOG ON (NAME=TestDB2_Log, FILENAME='D:\SQLLog\TestDB2_Log.ldf')
dbcc checkdb (testdb2)
ALTER DATABASE testdb2 SET MULTI_USER

Note: This approach might lead to data loss. Make sure we have enough backups in place.