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

asked 04 Nov '11, 22:49

dejstone's gravatar image

dejstone
959405069
accept rate: 0%


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

permanent link

answered 05 Nov '11, 04:55

Thomas%20Duemesnil's gravatar image

Thomas Dueme...
2.7k293965
accept rate: 17%

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...

permanent link

answered 05 Nov '11, 18:32

Volker%20Barth's gravatar image

Volker Barth
40.0k361549819
accept rate: 34%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×84

question asked: 04 Nov '11, 22:49

question was seen: 2,714 times

last updated: 05 Nov '11, 18:32