Hello. I am trying to create an event, based on user answering questions on a Vb screen, that will create a scheduled backup event. The script that is being created is:

 create event 'weekly Backup'
    schedule  'weekly backup'
      start time '1200'
      on 'monday'
      handler
         begin
           backup database to 'c:\dbbackup'
           update config set backupdate = dateformat(getdate(),'yymmdd')   
           /*  a table that will store the date of the backup  */
         end;

One issue I am having is that when the backup script itself runs, I am getting the message: unable to open c:program filessqlanywhere 12backup.syb but the directory location does exist.

Secondly, is this the most efficient way to create timed backups of Sybase. I am currently running SQLANywhere 11.1 and appreciate comments & help.

Gary Tinkel Profession Software Consortium

asked 14 Jan '13, 16:04

Gary%20T's gravatar image

Gary T
16112
accept rate: 0%

edited 15 Jan '13, 10:37

Mark%20Culp's gravatar image

Mark Culp
22.5k9129264

FWIW, the last backup date is also available from system table syshistory:

select max(last_time) from syshistory
   where operation = 'last_backup';
(15 Jan '13, 06:17) Volker Barth

Try this way:

 IF NOT exists(select null from SYSEVENT where SYSEVENT.EVENT_NAME = 'BACKUP_11') then
           CREATE EVENT BACKUP__11
           SCHEDULE daily_backup
           START TIME '11:00AM'
           ON ('Mon')
           START DATE '2008-04-23'
           HANDLER
              BEGIN
                 Backup Database Directory 'c:\\dbbackup\\Backup_11'
              END;
    END IF;
permanent link

answered 15 Jan '13, 06:21

Walmir%20Taques's gravatar image

Walmir Taques
600283143
accept rate: 13%

Gary, we're doing something similar and it works like a charm. One point of interest though: Try using double-slashes when creating your event. I.e.

.... backup database to 'c:\\dbbackup\\...'
permanent link

answered 15 Jan '13, 05:29

Liam's gravatar image

Liam
36191118
accept rate: 0%

edited 15 Jan '13, 06:17

Volker%20Barth's gravatar image

Volker Barth
29.5k291441646

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:

×71

question asked: 14 Jan '13, 16:04

question was seen: 569 times

last updated: 15 Jan '13, 10:37