cancel
Showing results for 
Search instead for 
Did you mean: 

looking for a better backup strategy

Former Member
0 Kudos
3,156

Here's the code that I use to create a backup event...

CREATE EVENT DailyBackup
SCHEDULE daily_backup
START TIME '11:00 PM' EVERY 24 HOURS
HANDLER
BEGIN

DECLARE day_of_week VARCHAR(9);
DECLARE backup_stmt LONG VARCHAR;
SET day_of_week = substr(dayname(today()),1,3);
SET backup_stmt = 'BACKUP DATABASE DIRECTORY '
|| '''c:\\app\\backups\\' || day_of_week || ''' '
|| 'TRANSACTION LOG TRUNCATE ';
EXECUTE IMMEDIATE backup_stmt;

END

Does anyone have code which will backup the database and validate the backed-up database?

Thanks,
Doug

Accepted Solutions (0)

Answers (2)

Answers (2)

thomas_duemesnil
Participant

Did you check on Brecks Blog. He has more as a handful of Entries that show Backup stratagies.

As an Example Demonstrating Full and Incremental Backups

VolkerBarth
Contributor

Besides Breck's many articles on that, you may also have a look at the maintenance plans facility that let you create events to backup and validate databases in the Sybase Central GUI. After they have been created by the GUI, you can have a look at the SYSEVENT table to study the created event handlers.

I have used them as starting points for own events and modify them for my own requirements.

Note that some folks (apparently including Breck, cf. this discussion) would not use events to backup a database but prefer an automatically executed external batch that calls DBBACKUP. (That's not my opinion, FWIW...)

Some more discussions are available here, e.g. this one - or simply look for the "backup", "validation" or "maintenance-plan" tags...