Error: Transaction log file got damaged or corrupted
Once we had an issue in our environment. We had a maintenance activity on the Database server during a weekend and the server was shutdown for a Storage level snapshot backup. After the backup the server was brought back online. But unfortunately the user database was in suspect mode and could not be accessed. SQL Server Error Log says
Solution
Below is what I did to rescue my beloved database.
1. Enabled emergency mode for that database.
ALTER DATABASE set EMERGENCY
2. Then brought the database into single user mode.
ALTER DATABASE set SINGLE_USER
3. Executed DBCC CHECKDB with repair_allow_data_loss.
DBCC CHECKDB (<databasename>,repair_allow_data_loss) with no_infomsgs
I got below warning in Error Log right after I triggered the CHECKDB command.
And once the CHECKDB completed, The errorlog log reported below message which made me very happy.
After the CHECKDB completed, I reverted back the database into multiuser mode with below command.
ALTER DATABASE <databasename> SET MULTI_USER
Now the application was successfully able to access the database and everything was function very well as expected. A full backup has to be triggered to reset LSN numbers and to take transaction log backups.