语句审计+sql_statement_clause选项+查询对那些用户进行审计+取消审计

来源:互联网 发布:电脑风扇润滑油知乎 编辑:程序博客网 时间:2024/05/29 04:53

语句审计
表示只审计某类型的SQL语句
语法
audit sql_statement_clause 【by user_name】|
【by 【session | access】】
【whenever 【not】 successful】;

sql_statement_clause:sql语句或选项
by access :存取方式,每条语句被执行一次都要审计,不管语句是否相同
by session:会话方式,相同的语句只被审计一次,默认方式
whenever successful:只对成功语句进行审计
whenever not successfu:只对不成功语句进行审计
by user_name:针对某个用户语句审计,如果没有写用户,那就针对全体用户进行审计。

sql_statement_clause选项
alter system: 所有的alter system选项,例如动态改变实例参数,切换到下一个日志文件组,已经终止用户会话。
rollback segment: create,alter或drop回滚段
sequence:create或drop序列
table:create,drop, truncate 表
tablespace: create,drop, alter 表空间
users: create,drop , alter 用户
type: create,drop, alter 类型和类型主体
alter table: 任何alter table命令

举例
对scott用户的alter system语句进行审计,每条语句被执行一次都要审计,不管语句是否相同,并且只对成功语句进行审计
audit alter system by scott by access whenever successful;
这里写图片描述

查询对那些用户进行审计
column user_name format a10;
column audit_option format a20;
select user_name,audit_option,success,failure from dba_stmt_audit_opts;

这里写图片描述

取消审计
noaudit alter system by scott ;

原创粉丝点击