When the data file or log file is damaged or goes to suspect mode, how to bring online?
First we have to check which file is missing or damaged by using error log
xp_readerrorlog.
It clearly shows .mdf is damaged of .ldf is missing/damaged
In case of data file(.mdf) is missing/damaged follow these steps to bring back online
- Take the tail log backup from that database.
- Restore recent full backup, differential backup(if any) and log backups with no recovery and finally restore tail log backup with recovery.
- Then the database comes online.
In case of log file(.ldf) is missing/damaged follow these steps to bring back online
- alter database <db name> set emergency
- alter database <db name> set single_user
- dbcc checkdb ('db name', repair_allow_data_loss)
- alter database <db name> set multi_user
No comments:
Post a Comment