Red Gate forums :: View topic - Restore database with wildcard in name
Return to www.red-gate.com RSS Feed Available

Search  | Usergroups |  Profile |  Messages |  Log in  Register 
Go to product documentation
SQL Virtual Restore 2
SQL Virtual Restore 2 forum

Restore database with wildcard in name

Search in SQL Virtual Restore 2 forum
Post new topic   Reply to topic
Jump to:  
Author Message
lculley



Joined: 29 Nov 2007
Posts: 21

PostPosted: Thu Jun 02, 2011 3:25 pm    Post subject: Restore database with wildcard in name Reply with quote

I am creating a dynamic script to restore a virtual database and I would like to use wildcard syntax, but I get a "cannot open backup device. Operating system error 123 ( the filename, directory name or volume lable syntax is incorrect)". Can I use wildcard values?

e.g.,
RESTORE DATABASE [test] FROM
DISK=N'C:\testfolder\test_20110602*.sqb'
WITH MOVE N'testdata' TO N'E:\test_virtual1.vmdf',
MOVE N'testlog' TO N'E:\test_log_virtual1.vldf',
NORECOVERY, STATS=1, REPACE
GO
RESTORE DATABASE [test] with RECOVERY
GO
Back to top
View user's profile Send private message
epetro



Joined: 31 May 2011
Posts: 55
Location: Zotec Partners

PostPosted: Fri Jun 03, 2011 7:53 pm    Post subject: spell chekc Reply with quote

If you copy/pasted your code, you misspelled REPLACE as REPACE.

I don't know if you can use wildcard, but I plan to write a similar script that will look for the last backup file and use dynamic sql. Consider finding an exact file. What would you expect if 2 files existed that matched?

Keep in mind you will use the "DISK=..." once per thread used in the backup. We have standardized (7) threads used. It is tough to track down, but is available via red-gate stored proc "Master..sqbdata".

If your going to recover right after the restore, consider 'recovery' in the first script.
Back to top
View user's profile Send private message
Andrew Hodge



Joined: 19 Jul 2007
Posts: 90
Location: Kent, UK

PostPosted: Thu Jul 21, 2011 11:17 am    Post subject: Reply with quote

Trying to do this as well.

Looks to me like you cant put the wildcards into virtual restore like you can with native sql backup.

Can we have this as a feature request?
Back to top
View user's profile Send private message
Colin Millerchip



Joined: 31 Oct 2007
Posts: 64
Location: Cambridge, UK

PostPosted: Wed Aug 17, 2011 3:01 pm    Post subject: Reply with quote

Sorry for the loooong delay in replying, this slipped through due to holiday breaks. The short version is that SQL Virtual Restore uses native T-SQL syntax, and as such the approach proposed by epetro is the way to do this. That said, we're working on making scheduling easier to do, but I can't provide details on this yet.
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Reply to topic All times are GMT + 1 Hour
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group