You want to write a trigger that executes on a system event such as a login. For example, you want to increase security a bit for your database and ensure that users are logging into the database only during the week. In an effort to help control security, you want to receive an e-mail alert if someone logs into the database on the weekend.
Create a system-level trigger that will log an event into a table if anyone logs into the database during off-hours. To notify you as promptly as possible, it may also be a good idea to send an e-mail when this event occurs. To create a system-level trigger, use the
AFTER LOGON ON DATABASE clause in your trigger definition.
The first step in creating this ...