This topic contains examples of Database Trigger jobs that monitor Oracle database tables.
Example: Monitor an Oracle Database Table for an Added or Deleted Row
Suppose that you want a job to monitor the emp table for an added row or a deleted row. The job runs under the user named scott, who has the authority to create triggers on the schema the table belongs to. The job remains in a running state while waiting for an added or deleted row. When a row is either added or deleted, the job completes.
AGENT DB_AGENT USER scott DB_URL jdbc:oracle:thin:@myhost:1521:orcl TRIG_TYPE 'INSERT OR DELETE' TABLE_NAME emp
Example: Monitor an Oracle Database Table for Deleted Rows with a Trigger Condition
Suppose that you want a job to monitor the emp table for deleted rows. The job runs under a user who has the authority to create triggers on the schema the table belongs to. When a row containing department 75 is deleted, the job completes.
AGENT DB_AGENT USER scott DB_URL jdbc:oracle:thin:@myhost:1521:orcl TRIG_TYPE DELETE TABLE_NAME emp TRIG_COND old.deptno=75
Example: Monitor an Oracle Database Table for Added Rows with a Trigger Condition
Suppose that you want a job to monitor the emp table for added rows. The job runs under a user who has the authority to create triggers on the schema the table belongs to. When a row containing a name beginning with the letter g is added, the job completes.
AGENT DB_AGENT USER scott DB_URL jdbc:oracle:thin:@myhost:1521:orcl TRIG_TYPE INSERT TABLE_NAME emp TRIG_COND 'new.ename like ''g%%'''
Example: Monitor an Oracle Database Table for Added or Updated Rows with a Trigger Condition
Suppose that you want a job to monitor the emp table for added or updated rows. The job runs under a user who has the authority to create triggers on the schema the table belongs to. The job completes when a new or updated row does not contain a job field equal to sales.
Note: The <> symbol indicates not equal to.
AGENT DB_AGENT USER scott DB_URL jdbc:oracle:thin:@myhost:1521:orcl TRIG_TYPE 'INSERT OR UPDATE' TABLE_NAME emp TRIG_COND new.job<>'sales'
Example: Monitor an Oracle Database Table for Deleted Rows
Suppose that you want a job to monitor the emp table for deleted rows. When a row is deleted, the job changes from a running state to a monitoring state. Each time a row is deleted from the table, the scheduling manager sends the alert named alrt. The job remains in a monitoring state until it is forced complete or cancelled. The job runs under the user named scott, who has the authority to create triggers on the schema the table belongs to.
AGENT DB_AGENT USER scott DB_URL jdbc:oracle:thin:@myhost:1521:orcl TRIG_TYPE DELETE TABLE_NAME emp CONTINUOUS(alrt)
|
Copyright © 2013 CA Technologies.
All rights reserved.
|
|