Oracle8i Application Developer's Guide - Fundamentals
Release 8.1.5

A68003-01

Library

Product

Contents

Index

Prev Next

14
Working With System Events

System events, like LOGON and SHUTDOWN, provide a mechanism for tracking system changes. With Oracle, this tracking can be combined with database event notification. Database event notification provides a simple and elegant method of delivering asynchrononous messaging to an application.

This chapter includes descriptions of the various events on which triggers can be created. It also provides the list of event attribute functions.

See Also:

Chapter 13, "Using Triggers"  

Event Attribute Functions

You can obtain certain event-specific attributes when a trigger is fired. These attributes can be used as standalone functions.

Usage Notes

List of Events

Resource Manager Events

Resource manager events are related to instance startup and shutdown.Triggers created on resource manager events must be associated with the database object.

Table 14-2 contains a list of resource manager events.

Table 14-2 Resource Manager Events
Event  Description  Conditions  Restrictions  Transaction  Attributes 
STARTUP
 

This event is fired when the database is open.  

None allowed  

No database operations allowed

Return status ignored.  

Starts a separate transaction and commits it after firing the triggers.  

sysevent
login_user
instance_num 
database_name
 
SHUTDOWN
 

This event is fired just before the server starts the shutdown of an instance.

This lets the cartridge shutdown completely. For abnormal instance shutdown, this event may not be fired.  

None allowed  

No database operations allowed

Return status ignored.  

Starts a separate transaction and commits it after firing the triggers.  

sysevent
login_user 
instance_num 
database_name
 
SERVERERROR
 

This event is fired when the error eno occurs. If no condition is given, then this event fires when any error occurs.  

ERRNO = eno  

Depends on the error

Return status ignored.  

Starts a separate transaction and commits it after firing the triggers.  

sysevent
login_user
instance_num 
database_name 
server_error 
is_servererror
 

Client Events

Client events are the events related to user logon/logoff, DML, and DDL operations. For example:

CREATE OR REPLACE TRIGGER On_Logon  
  AFTER LOGON  
  ON The_user.Schema  
BEGIN  
  Do_Something;  
END;  

Table 14-3 contains a list of client events.

Table 14-3 Client Events
Event  Description  Conditions  Restrictions  Transaction  Attributes 
LOGON
 

These events are fired after a successful logon of a user.  

Simple conditions on USERID() and USERNAME()  

None

Return status ignored.  

Starts a separate transaction and commits it after firing the triggers.  

sysevent
login_user
instance_num 
database_name
 
LOGOFF
 

These events are fired at the start of a user logoff  

Simple conditions on USERID() and USERNAME()  

None

Return status ignored.  

Fires the triggers in the existing user transaction.  

sysevent
login_user
instance_num 
database_name
 
BEFORE CREATE 

AFTER CREATE
 

These events are fired when a catalog object is created.  

Simple conditions on the type and name of the object; functions like USERID() and USERNAME()  

Cannot drop the object being created.  

Fires the triggers in the existing user transaction.  

sysevent 
login_user
instance_num 
database_name
dictionary_obj_type 
dictionary_obj_name
dictionary_obj_owner
 
BEFORE ALTER

AFTER ALTER
 

These events are fired when a catalog object is altered.  

Simple conditions on the type and name of the object; functions like USERID() and USERNAME()  

Cannot drop the object being altered.  

Fire the triggers in the existing user transaction.  

sysevent 
login_user
instance_num 
database_name
dictionary_obj_type 
dictionary_obj_name
dictionary_obj_owner
 
DROP

BEFORE DROP

AFTER DROP
 

These events are fired when a catalog object is dropped.  

Simple conditions on the type and name of the object; functions like USERID() and USERNAME()  

Cannot alter the object being dropped.  

Fire the triggers in the existing user transaction.  

sysevent
login_user
instance_num 
database_name
dictionary_obj_type 
dictionary_obj_name
dictionary_obj_owner
 



Prev

Next
Oracle
Copyright © 1999 Oracle Corporation.

All Rights Reserved.

Library

Product

Contents

Index