7developers blog

Useful articles, videos and code examples from professional developers

Database recovery on SQL server 2005-2008

You could get data loss but it could be done.
1. Detach database and move your mdf to save location.
2. Create new database of same name, same files, same file location and same file size.
3. Stop SQL server.
4. Swap mdf file of just created DB to your save one.
5. Start SQL. DB will go suspect.
6. ALTER DATABASE yourdb SET EMERGENCY7. ALTER DATABASE yourdb SET SINGLE_USER8. DBCC CHECKDB (yourdb, REPAIR_ALLOW_DATA_LOSS)
9. ALTER DATABASE yourdb SET MULTI_USER10. ALTER DATABASE yourdb SET ONLINE


source

Loading