July 3, 2010 at 7:11 am
I am trying to restore all my production databases onto dev server which i will be doing very often, is there a way to get this done through a stored proc and all my databases have atleast 50 file groups.
July 3, 2010 at 7:27 am
Why so many filegroups?
There's no procedure that let's you restore without specifying things like files. I suggest that you write a script that generates the restore statement for each database before you take the backups. Use sys.master_files, sys.databases and sys.filegroups. Combined they should have the info you need.
Then you can save the restore scripts to file, and load them up and run any time it's necessary.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
July 4, 2010 at 10:19 am
If you are not familiar enough with coding it in T-SQL, you can use the GUI to setup the restore and select all the files & locations. Before hitting the final "OK", select "Script to new Query Window". That will generate the SQL script you need and you can then save and/or modify it as you need.
July 4, 2010 at 2:10 pm
If you can make sure the directory structures in dev and prod are identical and you don't change the logical file names you can restore with only the replace clause.
---------------------------------------------------------------------
July 4, 2010 at 4:15 pm
I would second homebrew01's method. That is a good way to get this saved as a job/script and learn something.
July 5, 2010 at 12:42 am
In my company, we just developed a structure to do some admin tasks like setting up mirroring, log shipping, Backup and restore DB etc. we maintain all data path , log path, endpoint values, server name, IP address in a meta data table and fetch/use it in generic SP/script which does all admin tasks.
-------Bhuvnesh----------
I work only to learn Sql Server...though my company pays me for getting their stuff done;-)
Viewing 6 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply