加入收藏 | 设为首页 | 会员中心 | 我要投稿 上饶站长网 (https://www.0793zz.com.cn/)- 数据库平台、视觉智能、智能搜索、决策智能、迁移!
当前位置: 首页 > 站长百科 > 正文

triggers – 创建侦听多个表的全局触发器

发布时间:2021-01-10 04:48:25 所属栏目:站长百科 来源:网络整理
导读:我想在Oracle 11g中创建一个全局触发器.哪个可用于审计约100个表.多个表可以触发单个触发器.如果是,那么我该如何实现呢? 解决方法 I want to create a global trigger in oracle 11g,which can be used for auditing of around 100 tables 你有没有理由重新

我想在Oracle 11g中创建一个全局触发器.哪个可用于审计约100个表.多个表可以触发单个触发器.如果是,那么我该如何实现呢?

解决方法

I want to create a global trigger in oracle 11g,which can be used for auditing of around 100 tables

你有没有理由重新发明轮子?为什么不利用Oracle内置的审计?

Oracle Base提供了有关如何开始审计的一些基本信息:

Auditing can enabled by setting the AUDIT_TRAIL static parameter,which has the following allowed values.

AUDIT_TRAIL = { none | os | db | db,extended | xml | xml,extended }

以下列表提供了每个设置的说明:

none or false - Auditing is disabled.
db or true - Auditing is enabled,with all audit records stored in the database audit trial (SYS.AUD$).
db,extended - As db,but the SQL_BIND and SQL_TEXT columns are also populated.
xml- Auditing is enabled,with all audit records stored as XML format OS files.
xml,extended - As xml,but the SQL_BIND and SQL_TEXT columns are also populated.
os- Auditing is enabled,with all audit records directed to the operating system's audit trail.

要启用对数据库审计跟踪的审计,请启用对数据库的审计

SQL> ALTER SYSTEM SET audit_trail=db,extended SCOPE=SPFILE;

System altered.

关机&重启db

SQL> SHUTDOWN
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> STARTUP
ORACLE instance started.

现在,通过用户多维数据集审核SELECTS,INSERTS,UPDATES,DELETES,执行以下操作:

CONNECT sys/password AS SYSDBA

AUDIT ALL BY cube BY ACCESS;
AUDIT SELECT TABLE,UPDATE TABLE,INSERT TABLE,DELETE TABLE BY cube BY ACCESS;

可以通过查询DBA_AUDIT_TRAIL来启动审计日志

进一步阅读:

> Auditing
> Fine grained auditing
> Configuring and administering auditing

(编辑:上饶站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    热点阅读