Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2011-03-07
4
Medium Priority
?
302 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 40

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 2000 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 Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Naughty Me. While I was changing the database name from DB1 to DB_PROD1 (yep it's not real database name ^v^), I changed the database name and notified my application fellows that I did it. They turn on the application, and everything is working. A …
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…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…

926 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