By scheduling activities you can ensure that a set of actions is executed at a set of preset times. The scheduling information and the event handler are both stored in the database itself.
You can define complex schedules by associating more than one schedule with a named event.
The following examples give some ideas for scheduled actions that may be useful.
Instruct the database server to carry out an automatic incremental backup, every day at 1 am:
CREATE EVENT IncrementalBackup SCHEDULE START TIME '1:00AM' EVERY 24 HOURS HANDLER BEGIN BACKUP DATABASE INCREMENTAL TO 'backups/daily.incr' END
Summarize orders at the end of each business day:
CREATE EVENT Summarize SCHEDULE START TIME '6:00 pm' ON ( 'Mon', 'Tue', 'Wed', 'Thu', 'Fri' ) HANDLER BEGIN INSERT INTO dba.OrderSummary SELECT MAX( date_ordered ), COUNT( * ), SUM( amount ) FROM dba.Orders WHERE date_ordered = current date END