I have a Sharepoint server. We had an issue with our backup tool and now some of my databases are stuck in restoring state!
Is it possible to stop the restoring process? and also, How can I make sure the database integrity has not been compromised?
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It only takes a minute to sign up.
Sign up to join this communityThis is likely caused by the restore script adding the WITH NORECOVERY
parameter, to make the database ready for a transaction log apply after the restore.
The database is now waiting for the latest transaction log file.
You can either:
RESTORE LOG database_name FROM backup_device WITH RECOVERY;
... or... WITH RECOVERY;
... orRESTORE DATABASE YourDb WITH RECOVERY;
Before you do this, please make sure you understand the implications of these options. You may cause data loss if you are not careful.
See this for details:
Simple T-SQL Script for Solving this problem :
write this script on New Query window and execute :
RESTORE DATABASE [DataBase Name] WITH RECOVERY;
I just had this situation, and the cure was quite surprising:
ALTER DATABASE DBName SET ONLINE;
Apparently the NetBackup restore that broke left it in a weird state. No other solution worked (though I hadn't yet tried restarting the SQL Server service)
I'd be careful with the database, though, as theoretically once a restore starts, then fails, you could have corrupted data. I'm just going to restore the database again anyway, so it doesn't matter to me.
ALTER DATABASE
not being permitted, I assure you that in my case, the database was in fact showing as in restoring state, and using SET ONLINE
in fact worked. So realize that you are calling me mistaken or lying. Is that what you really need to do when an alternative is available?
ONLINE
state. So long story short, I think your comment and downvote are out of line for this site and your information is factually incorrect because it is not properly qualified with the data I have presented.
As we know, the default database restore option is with Recovery which ensures the database is available and Online for use after completion of database restore.
Example:
RESTORE DATABASE YourDB FROM DISK= 'C:\\Data\\YourDBBackup.bak'
WITH RECOVERY
GO
Let’s see the important points about Restore with NO Recovery
Restore With NoRecovery
This option especially used when multiple backup are to be restored. It means, when you execute the restore command with norecovery option that means, the database is not released to the users until last backup in sequence is restored. With last backup, the Recovery option is used and database goes online.
Example:
RESTORE DATABASE YourDB FROM DISK - 'C:\\Data\\Backup_part1.bak'
WITH NORECOVERY
GO
And then:
RESTORE LOG YourDB FROM DISK = 'C:\\Data\\BackupLog-part2.trn'
WITH RECOVERY
GO