Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

backup sybase database automatically?

Status
Not open for further replies.

suhaimiyusoff

Programmer
Dec 10, 2002
5
MY
Hi all,
I am using sybase adaptive server version 11.xx running on winNT. I backup my database by using sybase central. So, I have to do it manually. It is not cool at all.

So, I wonder if sybase have a capability to do the backup by itself without human intervention OR may be writing a backup script and have the OS to run it on schedule.
If there is a way, could you please give me the instructions step by step.

TQ.
 
There are 2 important commands that are useful to know if you want to run backup scripts (I myself use 3 of them in mine)

1. First step is to validate if your database isn't corrupted or anything. For that, there is the isql command "dbvalid".

dbvalid -c "..." -o (path to .txt file to save the output message)

2. Second step (which is facultative) is to save the operation in the database, to keep track of the backups made inside the DB. Here's what the command looks like:

dbisql -q -c "..." backup.sql

-q for quiet mode and backup.sql is a sql insert command. In my DB, I have a table called "Consolidated_backup" that is only there to keep a trace on the operation (if it helps, I use the columns date(date), time(datetime), status(string), command_name(string))

3. The backup as such if the DB is valid. Here's what I use

dbbackup -y -x -c "..." -o (text file path) (backup location path)

For the descriptions of the different options availables, check out the help files in Interactive SQL for those 3 commands as they are pretty thorough.

Also, don't forget to script the error cases (if errorlevel 1 then ...)

If you have anymore questions or need clarifications, feel free to ask...
 
Oh... forgot to add (just to make sure)

This script is in a .cmd file and can be run like any other script with the task manager.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top