oracle审计例子

栏目: 数据库 · Oracle · 发布时间: 7年前

1.数据库开启审计

alter system set audit_trail=db,extended scope=spfile;

shutdown immediate

startup

2.对某个表进行审计

connect / as sysdba

SQL> show user;

USER is "SYS"

SQL> audit select table by hxl by session;

Audit succeeded.

以上语句执行后在 dba_stmt_audit_opt 视图会有相应的记录

SQL> set linesize 1000;

SQL> select user_name, audit_option, success, failure from dba_stmt_audit_opts;

USER_NAME                      AUDIT_OPTION                             SUCCESS    FAILURE

------------------------------ ---------------------------------------- ---------- ----------

HXL                            SELECT TABLE                             BY SESSION BY SESSION

3.使用hxl用户登录,查询该用户下的一个表

SQL> connect hxl/oracle

Connected.

SQL> select count(1) from tb_test;

COUNT(1)

----------

18

然后查询审计日志表,发现已经有记录了

SQL> Select Count(1) From dba_audit_trail  Where obj_name In ('TB_TEST');

COUNT(1)

----------

1

4.取消审计

若我想把上面的审计取消,步骤如下

connect / as sysdba

SQL> noaudit select table by hxl;

Noaudit succeeded.

发现配置表dba_stmt_audit_opt相应的记录已经取消

退出原有的hxl查询会话(必须退出,pl/sql需要关闭再登录,否则还会一直有审计),再次登陆查询就不会有审计记录了.

-- The End --


以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

The Art of Computer Programming, Volume 2

The Art of Computer Programming, Volume 2

Knuth, Donald E. / Addison-Wesley Professional / 1997-11-04 / USD 79.99

Finally, after a wait of more than thirty-five years, the first part of Volume 4 is at last ready for publication. Check out the boxed set that brings together Volumes 1 - 4A in one elegant case, and ......一起来看看 《The Art of Computer Programming, Volume 2》 这本书的介绍吧!

SHA 加密
SHA 加密

SHA 加密工具

RGB HSV 转换
RGB HSV 转换

RGB HSV 互转工具

HEX CMYK 转换工具
HEX CMYK 转换工具

HEX CMYK 互转工具