Google Answers Logo
View Question
 
Q: How do I BACKUP/DUMP my SQL Server 2005 DB with SQL queries? ( No Answer,   3 Comments )
Question  
Subject: How do I BACKUP/DUMP my SQL Server 2005 DB with SQL queries?
Category: Computers > Programming
Asked by: paul_t-ga
List Price: $20.00
Posted: 11 Nov 2006 14:25 PST
Expires: 29 Nov 2006 16:30 PST
Question ID: 781934
I want to store a copy of my gate.com-hosted SQL Server 2005 database
table structure and data onto my home computer, essentially to serve
as a backup. Preferably, I'd like to create a file that contains SQL
statements which could be used to recreate my database.

I'm fairly inexperienced with database work, and maybe that's why I
thought that it might be a simple matter of executing an appropriate
SQL query to get the resulting file into a directory on my gate.com
account, then simply ftp that file onto my home computer. However,
I've had no luck in executing any such SQL query to create a
backup/dump file.

I suspect that the non-free version of Microsoft's SQL Server
Management Studio might be a good tool for this, but I'd rather not
have to buy it, plus I'd prefer to take a simple route (if it exists)
rather than have to buy and install that software.

Searching the web has made me believe that creating a file with the
SQL statements to recreate my database could be done with a statement
similar to:
BACKUP DATABASE '222222_default' TO DISK = '~/database/DUMP.BAK'

However, this and other variations of queries that I've tried to
execute (with the help of Visual Studio) always seem to fail.
Answer  
There is no answer at this time.

Comments  
Subject: Re: How do I BACKUP/DUMP my SQL Server 2005 DB with SQL queries?
From: runskyrun-ga on 16 Nov 2006 04:53 PST
 
Management studio is the best way to go.  You essentially generate
scripts for the database, run them locally, and then export the data
(with identity insert set ON).  It is generally best to do it in two
steps.

If this isn't an option (due to cost) I'd suggest:

1. Ask your database host to create a backup of the file and make this
available to you.  You can then restore locally.

2. Get an evaluation copy of the fantastic dbghost
(http://www.dbghost.com/home.aspx) and use this.
Subject: Re: How do I BACKUP/DUMP my SQL Server 2005 DB with SQL queries?
From: paul_t-ga on 16 Nov 2006 10:18 PST
 
OK, thanks very much for the feedback!
Subject: Re: How do I BACKUP/DUMP my SQL Server 2005 DB with SQL queries?
From: tonyp4-ga on 29 Nov 2006 15:32 PST
 
You need to add a dump device first.  Try this:
EXEC sp_addumpdevice 'disk','222222_DUMP','c:\database\222222_DUMP.BAK'
BACKUP DATABASE 222222_default TO 222222_DUMP

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy