Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Administration (2000)
 T-SQL Backup from command prompt.

Author  Topic 

vbabs02
Starting Member

4 Posts

Posted - 2003-11-21 : 00:14:36
SQL SERVER 2000 server.

I would like to schedule a backup of 3 database (in same SQL sever)
in one of the partition using SQL BACKUP statement but would like to run from DOS prompt, if that works then I would like to schedule the backup using Windows 2000 task scheduler.

How can I do that? It is very urgent.

Vbabs

robvolk
Most Valuable Yak

15732 Posts

Posted - 2003-11-21 : 07:42:56
Scheduled backups are better done using SQL Server Agent. You can create a job, add a T-SQL step, and enter the BACKUP command with the necessary parameters (database name, type of backup, etc...see Books Online under "BACKUP"). You can then run the job manually by using sp_start_job:

EXEC msdb..sp_start_job @job_name='myBackupJob'

You can also schedule it by right-clicking on the job in Enterprise Manager and modifying its schedule(s). You can also use the sp_add_job_schedule stored procedure to add schedules. Again Books Online describes all of these
Go to Top of Page

Sitka
Aged Yak Warrior

571 Posts

Posted - 2003-11-21 : 07:48:21
Use osql which is the command line utility to run Transct-SQL statements against an SQL server and place in a .bat file.
However the SQLAGENT can run your SQL related tasks for you in the form of jobs, handles command line functionality, has a more robust
scheduling mechanism that auto queues each to runin turn and a better reporting interface of success and failure. Unless you have very specific
requirements it seems the better approach would be to use the support for jobs in the native product, but I don't know why you mention partition or the relevence of it.

Tenacious O
Go to Top of Page
   

- Advertisement -