Solved

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

Posted on 2011-03-07
4
296 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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
SQL Server merge records in one table 2 24
Webservices in T-SQL 3 31
Need help how to find where my error is in UFD 6 30
Query group by data in SQL Server - cursor? 3 34
This is basically a blog post I wrote recently. I've found that SARGability is poorly understood, and since many people don't read blogs, I figured I'd post it here as an article. SARGable is an adjective in SQL that means that an item can be fou…
How to leverage one TLS certificate to encrypt Microsoft SQL traffic and Remote Desktop Services, versus creating multiple tickets for the same server.
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

803 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