5-9. Triggering on a System Event
Problem
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.
Solution
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 ...
Get Oracle and PL/SQL Recipes: A Problem-Solution Approach now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.