473,385 Members | 1,370 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

SS 2000 Backup programatically

Hi,
I am writing a remote update app, and I'd like to programmatically backup
the SQL Server 2000 database before running the SQL files over it.
Can anyone tell me a command that does a hot backup of the DB and puts it
somewhere, which I would shell exec from my program.

eg
ShellExec("hotbackup mydb c:\tmp\backups\todaysBackup.bak")

I'm not concerned with how long it takes to restore. ie preferably a quick
backup and if necessary a long restore.
Cheers,
Dirk
Jul 20 '05 #1
7 5568

"Dirk McCormick" <di**@acquirer.nospam.com> wrote in message
news:9d******************************@news.meganet news.com...
Hi,
I am writing a remote update app, and I'd like to programmatically backup
the SQL Server 2000 database before running the SQL files over it.
Can anyone tell me a command that does a hot backup of the DB and puts it
somewhere, which I would shell exec from my program.

eg
ShellExec("hotbackup mydb c:\tmp\backups\todaysBackup.bak")
You do it from within SQL Server.

Look for backup database in Books On-Line.


I'm not concerned with how long it takes to restore. ie preferably a quick
backup and if necessary a long restore.
Cheers,
Dirk

Jul 20 '05 #2
> > I am writing a remote update app, and I'd like to programmatically
backup
the SQL Server 2000 database before running the SQL files over it.
...
You do it from within SQL Server.

Look for backup database in Books On-Line.

Actually I want to do it from within the remote update program, ie
automatically, no user intervention.
The program downloads sql scripts from the internet, and runs them over the
database. So before this happens, I want the program to backup the database
from code.

eg

getSQLFiles();
ShellExec("hotbackup mydb c:\tmp\backups\todaysBackup.bak", ...);
executeSQLFiles();

An online search for how to backup SQL server only gives me manual methods
and training courses. I am assuming, perhaps incorrectly, that there is
command line utility that can do hot backups.
Cheers,
Dirk
Jul 20 '05 #3

"Dirk McCormick" <di**@acquirer.nospam.com> wrote in message
news:da******************************@news.meganet news.com...
I am writing a remote update app, and I'd like to programmatically backup the SQL Server 2000 database before running the SQL files over it.
...
You do it from within SQL Server.

Look for backup database in Books On-Line.

Actually I want to do it from within the remote update program, ie
automatically, no user intervention.
The program downloads sql scripts from the internet, and runs them over

the database. So before this happens, I want the program to backup the database from code.
Right. You write the backup command as a script and execute that as you
would your other scripts.

No human intervention required.

eg

getSQLFiles();
ShellExec("hotbackup mydb c:\tmp\backups\todaysBackup.bak", ...);
executeSQLFiles();

An online search for how to backup SQL server only gives me manual methods
and training courses. I am assuming, perhaps incorrectly, that there is
command line utility that can do hot backups.
Cheers,
Dirk

Jul 20 '05 #4
> Right. You write the backup command as a script and execute that as you
would your other scripts.

No human intervention required.


I suppose I could write a script to copy the existing tables to temporary
tables, but I would prefer to actually output the data to a file.
Is this what you mean, or do you mean send SQL commands that backup the
database? (eg "BACKUP DBNAME TO <FILEPATH>")
I don't know of any such commands, but if there are this solution would be
fine.
I should point out by the way that the SQL scripts I'm running are not
PL/SQL or any other SQL programming script, just plain old DDL and SQL
As you may have gathered I don't know much about databases, so pretend
you're talking to a novice =)

Thanks for your help.
Dirk
Jul 20 '05 #5
>> Right. You write the backup command as a script and execute that as you
would your other scripts.

No human intervention required.


I suppose I could write a script to copy the existing tables to temporary
tables, but I would prefer to actually output the data to a file.
Is this what you mean, or do you mean send SQL commands that backup the
database? (eg "BACKUP DBNAME TO <FILEPATH>")
I don't know of any such commands, but if there are this solution would be
fine.
I should point out by the way that the SQL scripts I'm running are not
PL/SQL or any other SQL programming script, just plain old DDL and SQL
As you may have gathered I don't know much about databases, so pretend
you're talking to a novice =)

Thanks for your help.
Dirk


There is a backup database command that you can
run thru Tsql. Here is what is in the Tsql online documentation.

-- Create a logical backup device for the full MyNwind backup.
USE master
EXEC sp_addumpdevice 'disk', 'MyNwind_1',
DISK ='c:\Program Files\Microsoft SQL Server\MSSQL\BACKUP\MyNwind_1.dat'

-- Back up the full MyNwind database.
BACKUP DATABASE MyNwind TO MyNwind_1


Randy
http://members.aol.com/rsmeiner
Jul 20 '05 #6
Perfect.
Thanks!
dirk
There is a backup database command that you can
run thru Tsql. Here is what is in the Tsql online documentation.

-- Create a logical backup device for the full MyNwind backup.
USE master
EXEC sp_addumpdevice 'disk', 'MyNwind_1',
DISK ='c:\Program Files\Microsoft SQL Server\MSSQL\BACKUP\MyNwind_1.dat'
-- Back up the full MyNwind database.
BACKUP DATABASE MyNwind TO MyNwind_1

Jul 20 '05 #7
"RSMEINER" <rs******@aol.comcrap> wrote in message
news:20***************************@mb-m14.aol.com...
Right. You write the backup command as a script and execute that as you would your other scripts.

No human intervention required.
I suppose I could write a script to copy the existing tables to temporary
tables, but I would prefer to actually output the data to a file.
Is this what you mean, or do you mean send SQL commands that backup the
database? (eg "BACKUP DBNAME TO <FILEPATH>")
I don't know of any such commands, but if there are this solution would befine.
I should point out by the way that the SQL scripts I'm running are not
PL/SQL or any other SQL programming script, just plain old DDL and SQL
As you may have gathered I don't know much about databases, so pretend
you're talking to a novice =)

Thanks for your help.
Dirk


There is a backup database command that you can
run thru Tsql. Here is what is in the Tsql online documentation.

-- Create a logical backup device for the full MyNwind backup.
USE master
EXEC sp_addumpdevice 'disk', 'MyNwind_1',
DISK ='c:\Program Files\Microsoft SQL

Server\MSSQL\BACKUP\MyNwind_1.dat'
-- Back up the full MyNwind database.
BACKUP DATABASE MyNwind TO MyNwind_1


You dont need to add a dump device, you can backup direct to a file :-

BACKUP DATABASE MyNwind to disk = 'c:\Program Files\Microsoft SQL
Server\MSSQL\BACKUP\MyNwind_1.dat'

Ian.
Jul 20 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: trotter | last post by:
I want to know if there is a "best-practice" for setting up Database Maintenance Plans in SQL Server 7 or 2000. To be more specific, I want to know the order in which I complete the tasks. Do I...
2
by: Chirath Fernando | last post by:
Hi We are running SQL 2000 Enterprice version with SP3a on a Dell Poweedge 5600 server running Advance Server. It has Tape drive PowerVault 110T (DLT VS80 Tape Drive) & uses DLT tapeIV tapes. A...
10
by: Dirk McCormick | last post by:
Hi, I am writing a remote update app, and I'd like to programmatically backup the SQL Server 2000 database before running the SQL files over it. Can anyone tell me a command that does a hot backup...
1
by: kg7poe | last post by:
I'm trying to install SQL server 2000 inside SBS 2000. Actually I think I already did it. I just don't know how to run/start it up. I want to upgrade my SQL 6.5 database backup into 2000. I...
2
by: Robert Kruk | last post by:
Hello, Recently I've tried to restore backup made on SQL Server 6.5. Unfortunately, the only version of SQL Server I currently possess is SQL Server 2000. I have access only to that backup,...
6
by: A.Y. Xu | last post by:
Environment: Win Server 2003 Standard Version, SQL Server 2000, HP DDS3 Tape(local). Backup procedure: 1. open SQL Server Enterprise Manager 2. find the database i want to backup 3. right click...
3
by: datapro01 | last post by:
I am a DB2 DBA that has been asked to become familiar enough with SQL Server in order to become actively involved in its installation, implementation, and to review database backup/recovery...
1
by: Robbert van Geldrop | last post by:
Hello, I have a problem restoring Exchange 2000 files. Our software has an interface to ESEBCLI2.dll for online backup and restore features. Everything works fine with Exchange 2003 and also...
9
by: dpatel75 | last post by:
I am trying to copy a database from a SQL 2000 SP3 Windows 2000 server to a 2005 SP2 Windows 2003 server. I am trying to use detach and attach method (have tried both within Management Studio and...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.