tsql restore filegroups

sqlserverdba
sqlserverdba used Ask the Experts™
on
what is the tsql syntax  in sql 2000 to restore database that has 2 file groups - 'primary' and 'older'. both are mdf
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Guy Hengel [angelIII / a3]Billing Engineer
Most Valuable Expert 2014
Top Expert 2009

Commented:
do you want to restore the filegroups individually? or all the database, actually?
did you run filegroup backups?
please clarify

Author

Commented:
want to restore the database but it has 2 filegroups. i need to restore the full database.
Guy Hengel [angelIII / a3]Billing Engineer
Most Valuable Expert 2014
Top Expert 2009

Commented:
so, what is the problem? when do you a full restore, it will restore all filegroups.
what error do you run into?
do you have a backup file, actually?
Success in ‘20 With a Profitable Pricing Strategy

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

Author

Commented:
i dont know the syntax for the extra file groups.
i use with move 'logical filename' to 'path datafile'
, move 'logical file name' to ' path of log file'
i dont recollect the syntax for the file groups now .
Guy Hengel [angelIII / a3]Billing Engineer
Most Valuable Expert 2014
Top Expert 2009

Commented:
I repeat: when you do a full database restore, you do not need to care about the filegroups at all.

Author

Commented:
then how about the with move option??
thats where we specigy file names
do i just add the logical file name of the second data file in the 'with move'
Billing Engineer
Most Valuable Expert 2014
Top Expert 2009
Commented:
>then how about the with move option??
>thats where we specigy file names

when you want to "move" the files to another location, you write like this:



RESTORE DATABASE db_Name
  FROM  ....
 WITH REPLACE  ---- in case you replace the existing database
    , MOVE logical_name_1 TO 'C:\path\file_name_1.mdf'
    , MOVE logical_name_2 TO 'D:\path\file_name_2.mdf'
    --- etc more file names to move as needed. 
    --- a file that you do not specify will be restored to the path it was backed up from,
    --- note: the folders have to exist, the restore will NOT (try to) create the folders 

Open in new window

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial