September 4, 2009 at 5:33 am
hi all
i hav one database backup file which contain 2 mdf and 2 ldf file. now i want to restore it with 1 mdf & 1 ldf file, means i want to merge both mdf files into one. help me pls
thanx
nitin
September 4, 2009 at 5:40 am
nitin jain (9/4/2009)
hi alli hav one database backup file which contain 2 mdf and 2 ldf file. now i want to restore it with 1 mdf & 1 ldf file, means i want to merge both mdf files into one. help me pls
thanx
nitin
Are both files part of primary filegroup OR the 2nd mdf file is in a different filegroup?
September 4, 2009 at 5:47 am
thanx pradeep,
both mdf files having same primary filegroup
nitin
September 4, 2009 at 6:42 am
nitin jain (9/4/2009)
thanx pradeep,both mdf files having same primary filegroup
nitin
In this case you can use emplyfile parameter in dbcc shrinkfile
Use Mydb
dbcc shrinkfile(SecondaryFile, emptyfile)
--2nd file has been emptied, now remove that file from the database
Alter database mydb
remove file SecondaryFile
Refer : example D at http://msdn.microsoft.com/en-us/library/ms189493.aspx%5B/url%5D
September 4, 2009 at 6:43 am
SecondaryFile is the logical name of the 2nd file in the primary filegroup which you want to remove.
September 4, 2009 at 6:56 am
nitin jain (9/4/2009)
i hav one database backup file which contain 2 mdf and 2 ldf file. now i want to restore it with 1 mdf & 1 ldf file, means i want to merge both mdf files into one.
Can't be done as part of the restore. You'll have to restore first and then merge and drop the extra files. A restore puts the DB back into the state it was at the time of backup, same number of files, same distribution of data.
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
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply