日期:2014-05-16 浏览次数:20519 次
主要就是通过它的Event功能来实现,Event如同定时任务,到时间就触发,触发时你可以调用很多东西。
看看下边两个简单示例:
看看下边的两个简单的例子:
1. 从第一个磁带开始自动备份,每天零晨1点开始自动执行。
Instruct the database server to carry out an automatic backup to tape using the first tape drive, every day at 1 A.M. CREATE EVENT DailyBackup SCHEDULE daily_backup START TIME '1:00AM' EVERY 24 HOURS HANDLER BEGIN BACKUP DATABASE TO '\\\\.\\tape0' ATTENDED OFF END;
Instruct the database server to carry out an automatic backup of the transaction log only, every hour, Monday to Friday between 8 A.M. and 6 P.M. CREATE EVENT HourlyLogBackup SCHEDULE hourly_log_backup BETWEEN '8:00AM' AND '6:00PM' EVERY 1 HOURS ON ('Monday','Tuesday','Wednesday','Thursday','Friday') HANDLER BEGIN BACKUP DATABASE DIRECTORY 'c:\\database\\backup' TRANSACTION LOG ONLY TRANSACTION LOG RENAME END;