<< Click to Display Table of Contents >> Automatic backup |
|
Dispatch can schedule periodic, automatic backups. Automatic backups can scheduled using the On/Off toggle switch.
Folder
Folder is the name of the base backup folder. Scheduled backups are made to a sub-folder of Folder according to the day of the week the backup is performed. Monday is represented by 1, Tuesday is 2, Wednesday is 3 and so on.
Given example property values shown in the image above, the database engine would create backups in a directory structure like the one below:
As with manual backups, if a folder contains a previous backup, the previous backup will be over-written without prompting the user.
Start time
Start time determines when the database backup will start. It is a value from 00:00 (midnight) to 23:59.
Interval
Interval determines how often a backup is performed. Interval is specified in hours and minutes. For example, the value 01:30 is 1 hour and 30 minutes or 90 minutes.
To schedule a backup for once per day beginning at Start time, check Daily.
Examples
If you would like to perform a backup once per day at 6pm (every 24 hours), set Start time to 18:00 and check Daily.
If you would like to perform a backup once per hour beginning at 30 minutes past the hour, set Start time to 00:30 and interval to 1:00.
If you would like help setting up a backup schedule, please contact us.
Default Backup Event code for SQL Anywhere
CREATE EVENT daily_backup SCHEDULE START TIME '&start_time' EVERY &interval MINUTES
HANDLER
BEGIN
--
-- DOW returns a number from 1 to 7 representing the day of the week of a date, where Sunday=1, Monday=2, and so on.
-- The DOW function is not affected by the value specified for the first_day_of_week database option.
-- For example, even if first_day_of_week is set to Monday, the DOW function returns a 2 for Monday.
--
IF DOW(CURRENT DATE) = 1 THEN
BEGIN
MESSAGE 'Backing up to ', '&backup_folder_1';
BACKUP DATABASE DIRECTORY '&backup_folder_1' TRANSACTION LOG RENAME;
END;
ELSEIF DOW(CURRENT DATE) = 2 THEN
BEGIN
MESSAGE 'Backing up to ', '&backup_folder_2';
BACKUP DATABASE DIRECTORY '&backup_folder_2' TRANSACTION LOG RENAME;
END;
ELSEIF DOW(CURRENT DATE) = 3 THEN
BEGIN
MESSAGE 'Backing up to ', '&backup_folder_3';
BACKUP DATABASE DIRECTORY '&backup_folder_3' TRANSACTION LOG RENAME;
END;
ELSEIF DOW(CURRENT DATE) = 4 THEN
BEGIN
MESSAGE 'Backing up to ', '&backup_folder_4';
BACKUP DATABASE DIRECTORY '&backup_folder_4' TRANSACTION LOG RENAME;
END;
ELSEIF DOW(CURRENT DATE) = 5 THEN
BEGIN
MESSAGE 'Backing up to ', '&backup_folder_5';
BACKUP DATABASE DIRECTORY '&backup_folder_5' TRANSACTION LOG RENAME;
END;
ELSEIF DOW(CURRENT DATE) = 6 THEN
BEGIN
MESSAGE 'Backing up to ', '&backup_folder_6';
BACKUP DATABASE DIRECTORY '&backup_folder_6' TRANSACTION LOG RENAME;
END;
ELSEIF DOW(CURRENT DATE) = 7 THEN
BEGIN
MESSAGE 'Backing up to ', '&backup_folder_7';
BACKUP DATABASE DIRECTORY '&backup_folder_7' TRANSACTION LOG RENAME;
END;
END IF;
END;