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 |
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; |
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\\...' |
FWIW, the last backup date is also available from system table syshistory: