318
ZENworks 10 Configuration Management System Administration Reference
n
ov
do
cx (e
n)
16
Ap
ril 20
10
HANDLER
BEGIN
BACKUP DATABASE DIRECTORY
‘\\\\
shared_network_location_on_remote_machine
\\dbbackup’
TRANSACTION LOG TRUNCATE
END;
To back up the database at a 1:00 a.m. on the first, second, third, and fourth day of the
month to the
dbbackup
directory on a Windows server, execute the following query:
CREATE EVENT ZENDBbackup
SCHEDULE
START TIME '1:00 AM' EVERY 24 HOURS ON (1,2,3,4)
HANDLER
BEGIN
BACKUP DATABASE DIRECTORY
‘\\\\
shared_network_location_on_remote_machine
\\dbbackup’
TRANSACTION LOG TRUNCATE
END;
To back up the database to the
\dbbackup\
day_of_the_week
directory on a Windows
server, execute the following query:
CREATE EVENT ZENDBbackup
SCHEDULE
START TIME '1:00 AM' EVERY 24 HOURS
HANDLER
BEGIN
DECLARE backupDir varchar(256);
DECLARE backup_stmt varchar(512);
SET backupDir = DAYNAME(now());
SET backup_stmt = 'BACKUP DATABASE DIRECTORY '||
'''\\\\
shared_network_location_on_remote_machine
\\dbbackup/' ||
backupDir || ''''|| 'TRANSACTION LOG TRUNCATE';
EXECUTE IMMEDIATE backup_stmt;
END;
According to the backup schedule,
zenworks_
zone_name
.db
and
zenworks_
zone_name
.log
are
created in the network location on the remote machine. The backed-up database is stored in
zenworks_
zone_name
.db
. The result of the database backup is logged in
zenworks_
zone_name
.log
.
If you want to change the database backup location or the backup schedule at a later time, see
Section 36.2.2, “Changing the Backup Schedule and Location of the External Sybase Database
Subsequent to the Initial Backup,” on page 335
.