Query below lists:
(A)
- all triggers which are owned by the current user in Oracle database
- all triggers on objects owned by the current user in Oracle database
- for users having 'CREATE ANY TRIGGER' privilege - all triggers in Oracle database
(B) all triggers in Oracle database
Query was executed under the Oracle9i Database version.
Query
A. Triggers accessible to the current user
select owner as trigger_schema_name,
trigger_name,
trigger_type,
triggering_event,
table_owner as schema_name,
table_name as object_name,
base_object_type as object_type,
status,
trigger_body as script
from sys.all_triggers
-- excluding some Oracle maintained schemas
where owner not in ('ANONYMOUS','CTXSYS','DBSNMP','EXFSYS', 'LBACSYS',
'MDSYS', 'MGMT_VIEW','OLAPSYS','OWBSYS','ORDPLUGINS', 'ORDSYS','OUTLN',
'SI_INFORMTN_SCHEMA','SYS','SYSMAN','SYSTEM', 'TSMSYS','WK_TEST',
'WKPROXY','WMSYS','XDB','APEX_040000', 'APEX_PUBLIC_USER','DIP', 'WKSYS',
'FLOWS_30000','FLOWS_FILES','MDDATA', 'ORACLE_OCM', 'XS$NULL',
'SPATIAL_CSW_ADMIN_USR', 'SPATIAL_WFS_ADMIN_USR', 'PUBLIC')
order by trigger_name,
table_owner,
table_name,
base_object_type;
B. If you have privilege on dba_triggers
select owner as trigger_schema_name,
trigger_name,
trigger_type,
triggering_event,
table_owner as schema_name,
table_name as object_name,
base_object_type as object_type,
status,
trigger_body as script
from sys.dba_triggers
-- excluding some Oracle maintained schemas
where owner not in ('ANONYMOUS','CTXSYS','DBSNMP','EXFSYS', 'LBACSYS',
'MDSYS', 'MGMT_VIEW','OLAPSYS','OWBSYS','ORDPLUGINS', 'ORDSYS','OUTLN',
'SI_INFORMTN_SCHEMA','SYS','SYSMAN','SYSTEM', 'TSMSYS','WK_TEST',
'WKPROXY','WMSYS','XDB','APEX_040000', 'APEX_PUBLIC_USER','DIP', 'WKSYS',
'FLOWS_30000','FLOWS_FILES','MDDATA', 'ORACLE_OCM', 'XS$NULL',
'SPATIAL_CSW_ADMIN_USR', 'SPATIAL_WFS_ADMIN_USR', 'PUBLIC')
order by trigger_name,
table_owner,
table_name,
base_object_type;
Columns
- trigger_schema_name - trigger's owner, schema name
- trigger_name - trigger name
- trigger_type - type of the trigger explaining when the trigger fires, e.g. - BEFORE EACH ROW, AFTER STATEMENT
- triggering_event - event that fires the trigger, e.g. - INSERT, INSERT OR UPDATE
- schema_name - table's/view's owner, schema name
- object_name - table's/view's (on which the trigger is defined) name
- object_type - type of the object on which the trigger is defined
- status - trigger's status - ENABLED or DISABLED
- script - trigger's script
Rows
- One row represents one trigger in a database
- Scope of rows: (A) - all triggers which are owned by the current user in Oracle database, - all triggers on objects owned by the current user in Oracle database, - for users having 'CREATE ANY TRIGGER' privilege - all triggers in Oracle database, (B) all triggers in Oracle database
- Ordered by trigger name, table's/view's schema name, object name, object type