WHAT IF THE LDF GET DELETED OR CORRUPTED….
If the log file get deleted or corrupted in sql server 2000 we can rebuild the log file with
SQL
DBCC REBUILD LOG
But in sql server 2005 this DBCC command is not there. So we should follow series of steps
When the log file gets corrupted we should check the status of the database. It can be done through following sql statement
select state_desc,* from sys.databases where name='LogDB'
//here LogDB is the database name
The status of the database would be “RECOVERY PENDING”
Then we should set the database in Emergency mode followed by single user mode with the following sql statement
ALTER database LogDB set EMERGENCY
ALTER database LogDB set single_user
Then we should run a DBCC command that allows the Loss of Data
DBCC CHECKDB(LogDB,REPAIR_ALLOW_DATA_LOSS)
DBCC CHECKDB(LogDB)
Then the last step is to bring it online through making the database multi user
ALTER database LogDB set multi_user
...Happy SQLing
Thanks for Visiting and Sharing your Views
No comments:
Post a Comment