Restoring Database with Ext Stored Proc

Compresses, encrypts, secures and monitors SQL Server backups.

Moderators: Chris Auckland, eddie davis, Colin Millerchip, Brian Harris, james.billings, RBA, petey

Restoring Database with Ext Stored Proc

Postby philfry » Mon Jun 04, 2012 2:06 am

I've been trying to figure out how to restore databases with .SQB files. I can run the Ext SP fine but if I try to put the database into single user mode, restore database, and then put it back to multi user, it will fail. Has anyone run into this problem?

When I try to do this, it seems to restore the database but will be stuck in single user mode. I think this is because the alter database statement attempts before the restore is complete. Any thoughts or ideas?
philfry
 
Posts: 1
Joined: Mon Jun 04, 2012 2:03 am

Postby petey » Mon Jun 04, 2012 3:29 pm

Have you considered using the DISCONNECT_EXISTING option to disconnect all existing users to the database so that the restore can proceed? E.g.

Code: Select all
EXEC master..sqlbackup '-sql "RESTORE LOG AdventureWorks FROM DISK = [g:\\backups\\AdventureWorks_log_*.sqb] WITH STANDBY = [g:\\standby\\AdventureWorks.und], DISCONNECT_EXISTING"'
Peter Yeoh
SQL Backup Consultant Developer
Associate, Yohz Software
Beyond compression - SQL Backup goodies under the hood, updated for version 7
petey
 
Posts: 2233
Joined: Sun Apr 24, 2005 12:34 pm


Return to SQL Backup 6

Who is online

Users browsing this forum: No registered users and 0 guests