dbTalk Databases Forums  

Using OSQL command to backup multiple databases in one instance.

microsoft.public.sqlserver.tools microsoft.public.sqlserver.tools


Discuss Using OSQL command to backup multiple databases in one instance. in the microsoft.public.sqlserver.tools forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Jota
 
Posts: n/a

Default Using OSQL command to backup multiple databases in one instance. - 11-04-2009 , 10:07 AM






Hello,

How can I backup multiple databases with the command OSQL from one instance,
creating one backup file for each database? Is it possible? If not how can I
acomplishe this? Wich command should I use?

Thanks.

Reply With Quote
  #2  
Old   
Erland Sommarskog
 
Posts: n/a

Default Re: Using OSQL command to backup multiple databases in one instance. - 11-05-2009 , 08:58 PM






Jota (kangona8 (AT) hotmail (DOT) com) writes:
Quote:
How can I backup multiple databases with the command OSQL from one
instance, creating one backup file for each database? Is it possible? If
not how can I acomplishe this? Wich command should I use?
The command you would use would obviously be BACKUP, and you would
need one command per database.

But you don't have to list all databases, but you could run a cursor over
sys.databases (or sysdatabases if you are on SQL 2000.) Note that you don't
necessarily have to use dynamic SQL to create the BACKUP commands,
as BACKUP accepts variables for many of its parameters.
--
Erland Sommarskog, SQL Server MVP, esquel (AT) sommarskog (DOT) se

Links for SQL Server Books Online:
SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx
SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx
SQL 2000: http://www.microsoft.com/sql/prodinf...ons/books.mspx

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.