I am simulating a database corruption for my own practice. What I did was editing the .LDF
file and messing it up and when I run SQL server, the database is in "Recovery Pending"
mode, meaning it has been corrupted.
Without any backup to be restored or without replacing the backup .LDF
file, is there any way I could recover my database?
Note: I am not interested in using any third party tools/software.
Would appreciate any suggestion.
Try to use these commands on the master database. It will reset the state of the database so you can work with it. This will put it into SINGLE USER MODE and ROLLBACK pending changes. After repair it will allow MULTIUSER AGAIN.
EXEC sp_resetstatus 'yourDBname';
ALTER DATABASE yourDBname SET EMERGENCY
DBCC checkdb('yourDBname')
ALTER DATABASE yourDBname SET SINGLE_USER WITH ROLLBACK IMMEDIATE
DBCC CheckDB ('yourDBname', REPAIR_ALLOW_DATA_LOSS)
ALTER DATABASE yourDBname SET MULTI_USER
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments