I'm trying to restore a database from a validated backup (through RESTORE VERIFYONLY).
The command I've used :
RESTORE DATABASE [RESTORE] FILE = N'SharePoint_Config_3c0993c1866f419e9f8e906a920a6ae8'
FROM DISK = N'0000008B.bak'
WITH
FILE = 1,
MOVE N'SharePoint_Config_3c0993c1866f419e9f8e906a920a6ae8' TO N'F:\RESTORE.mdf',
MOVE N'SharePoint_Config_3c0993c1866f419e9f8e906a920a6ae8_log' TO N'F:\RESTORE_log.ldf',
NOUNLOAD,
REPLACE,
STATS = 10
GO
At the end of the restore operation, I got this error :
...
100 percent processed.
Processed 16888 pages for database 'RESTORE', file 'SharePoint_Config_3c0993c1866f419e9f8e906a920a6ae8' on file 1.
Processed 1707474 pages for database 'RESTORE', file 'SharePoint_Config_3c0993c1866f419e9f8e906a920a6ae8_log' on file 1.
Msg 9004, Level 16, State 3, Line 1
An error occurred while processing the log for database 'RESTORE'. If possible, restore from backup. If a backup is not available, it might be necessary to rebuild the log.
Msg 3013, Level 16, State 1, Line 1
RESTORE DATABASE is terminating abnormally.
Then the database is stuck in RESTORING status. The error message suggest to rebuild the log, BUT in RESTORING state I can't do anything : the database can't be accessed for repair with DBCC CHECKDB.
I've tried :
RESTORE DATABASE [RESTORE] WITH RECOVERY
GO
Result :
Msg 4333, Level 16, State 1, Line 1
The database cannot be recovered because the log was not restored.
Msg 3013, Level 16, State 1, Line 1
RESTORE DATABASE is terminating abnormally.
I've googled It many times, searching on this forum, but can't find a solution to apply suggested procedure "it might be necessary to rebuild the log."
My question is : how to get rid of this status, ie make the database status to be EMERGENCY so I can try to run repair tools on it ?
Hope somebody can help me.
Regards.
Update 1
I've managed to get our database in "SUSPECT" status, with Sahnky's tweak. From there, and with some external help, I have run DDBCC CHECKDB with REPAIR_ALLOW_DATALOSS and got our database out of SUSPECT status.
I've omitted to mention that I've tried to RESTORE without the FILE option to perform a full restore, but it hangs with errors (I can't remember which ones).
Best Answer
Please note that restore 'verifyonly' does not checks consistency of backup completely only a successful restore will guarantee that you backup is in consistent state. There is a option to use Continue_after_error can you please use that in your restore script.
Please note that this is a temporary workaround if it works. You should get a fresh backup from production again. Also I highly recommend you to run dbcc checkdb on production database