Solved

How do i take a backup of a database with multiple filegroups

Posted on 2011-03-07
4
294 Views
Last Modified: 2012-05-11
Hei!
  i need to export a new database from en existing one. The old db consists of appros 120 tables, over 3 file groups.
I need a selection of approx 55 tables which is spread over these 3 filegroups.
how do i do it

//shanj
0
Comment
Question by:shanj
  • 2
4 Comments
 
LVL 39

Expert Comment

by:lcohan
ID: 35059683
You cab issue a FULL database backup like below:

--Add dump devices for all db's on E:\ drive
exec sp_addumpdevice @devtype = 'disk' , @logicalname = 'MyDB_bak'      ,@physicalname = 'H:\SQL_BACKUP\MyDB.bak'

--backup db
BACKUP DATABASE [MyDB] TO  [MyDB_bak] WITH COPY_ONLY, NOFORMAT, INIT,  NAME = N'MyDB-Full Database Backup', SKIP, NOREWIND, NOUNLOAD,  STATS = 10
GO
0
 

Author Comment

by:shanj
ID: 35066297
Tried this approach , but when i try to restore the backup i get en error.
Logical file 'STAGE_RT_HIST' is not part of database 'STAGE_RT_HIST'. Use RESTORE FILELISTONLY to list the logical file names.

//shan
0
 
LVL 14

Accepted Solution

by:
Daniel_PL earned 500 total points
ID: 35066993
Hello.
As far as I understand you would like to extract only about half of tables from your current database.
To extract only some tables you can restore full database backup and drop unwanted tables, export data to files and then import it back to new db or use SQL Server Import and Export Wizard.

About error you are getting.
Where do you want to restore your backup - at the same server?
How do you perform restore operation?

You need to be aware of that SQL Server create files in the same locations as they are in the backup.
If you want to restore database files to other locations you need to use WITH MOVE clause and provide new files locations.

You can check logical file names in your backup by running following command:

RESTORE FILELISTONLY FROM MyDB_bak
--OR
RESTORE FILELISTONLY FROM DISK=N'<path to your backup file>'

0
 

Author Closing Comment

by:shanj
ID: 35067232
Thanks
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
This video discusses moving either the default database or any database to a new volume.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now