We had a crash in the sql server and the database remained in inconsistent mode. We lost the transaction log file and the last generated backup is too old.
I googled this issue but mostly relevant posts I saw refer to SQL 2000
I saw this post https://stackoverflow.com/questions/773059/how-to-recover-database-from-mdf-in-sql-server-2005 and run the steps:
- Detach database and move your mdf to save location.
- Create new database of same name, same files, same file location and same file size.
- Stop SQL server.
- Swap mdf file of just created DB to your save one.
- Start SQL. DB will go suspect.
- ALTER DATABASE yourdb SET EMERGENCY
- ALTER DATABASE yourdb SET SINGLE_USER
- DBCC CHECKDB (yourdb, REPAIR_ALLOW_DATA_LOSS)
- ALTER DATABASE yourdb SET MULTI_USER
- ALTER DATABASE yourdb SET ONLINE "
I got till step 8 [DBCC CHECKDB (yourdb, REPAIR_ALLOW_DATA_LOSS)] but each time I repeat the processes "DBCC CHECKDB" does not seems to do the job .
I get error "query completed with errors" and that the "Database 'dbname' is being recovered. Waiting until recovery is finished."
Any Help will be greatly appreciated Thanks Ron