Audit by access VS by session
admin
2023-06-09 13:22:21
0

ENV

[oracle@daidai ~]$ uname -a
Linux daidai.com 2.6.18-194.el5 #1 SMP Tue Mar 16 21:52:39 EDT 2010 x86_64 x86_64 x86_64 GNU/Linux
[oracle@daidai ~]$ lsb_release -a
LSB Version:    :core-3.1-amd64:core-3.1-ia32:core-3.1-noarch:graphics-3.1-amd64:graphics-3.1-ia32:graphics-3.1-noarch
Distributor ID: RedHatEnterpriseServer
Description:    Red Hat Enterprise Linux Server release 5.5 (Tikanga)
Release:        5.5
Codename:       Tikanga
SQL> select * from v$version;

BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
PL/SQL Release 11.2.0.4.0 - Production

Audit by access

SQL> show parameter audit

NAME                                 TYPE                           VALUE
------------------------------------ ------------------------------ ------------------------------
audit_file_dest                      string                         /u01/oracle/admin/ocp11g/adump
audit_sys_operations                 boolean                        TRUE
audit_syslog_level                   string
audit_trail                          string                         DB, EXTENDED
SQL> audit select on daidai.t by access;

Audit succeeded.

SQL> select * from DBA_OBJ_AUDIT_OPTS;

OWNER                          OBJECT_NAME                    OBJECT_TYPE             ALT   AUD   COM   DEL   GRA   IND   INS   LOC   REN   SEL
------------------------------ ------------------------------ ----------------------- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
UPD   REF EXE   CRE   REA   WRI   FBK
----- --- ----- ----- ----- ----- -----
DAIDAI                         T                              TABLE                   -/-   -/-   -/-   -/-   -/-   -/-   -/-   -/-   -/-   A/A
-/-   -/- -/-   -/-   -/-   -/-   -/-
SQL> select * from t;   --conn daidai user,执行两次
select * from dba_common_audit_trail where object_schema='DAIDAI' and object_name='T' and audit_type='Standard Audit' order by extended_timestamp desc;

Audit by access VS by session

audit by access产生两条记录。

Audit by Session

SQL> audit select on daidai.t by session;

Audit succeeded.

SQL> select * from DBA_OBJ_AUDIT_OPTS;

OWNER                          OBJECT_NAME                    OBJECT_TYPE             ALT   AUD   COM   DEL   GRA   IND   INS   LOC   REN   SEL
------------------------------ ------------------------------ ----------------------- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
UPD   REF EXE   CRE   REA   WRI   FBK
----- --- ----- ----- ----- ----- -----
DAIDAI                         T                              TABLE                   -/-   -/-   -/-   -/-   -/-   -/-   -/-   -/-   -/-   S/S
-/-   -/- -/-   -/-   -/-   -/-   -/-
SQL> truncate table aud$;    --sys user

Table truncated.
SQL> select * from t;   --conn daidai user,执行两次
select * from dba_common_audit_trail where object_schema='DAIDAI' and object_name='T' and audit_type='Standard Audit' order by extended_timestamp desc;

Audit by access VS by session

同样audit by session产生两条记录。

Audit 缺省情况

SQL> select * from dba_obj_audit_opts;

no rows selected

SQL> audit select on daidai.t;

Audit succeeded.

SQL> select * from dba_obj_audit_opts;

OWNER                          OBJECT_NAME                    OBJECT_TYPE             ALT   AUD   COM   DEL   GRA   IND   INS   LOC   REN   SEL
------------------------------ ------------------------------ ----------------------- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
UPD   REF EXE   CRE   REA   WRI   FBK
----- --- ----- ----- ----- ----- -----
DAIDAI                         T                              TABLE                   -/-   -/-   -/-   -/-   -/-   -/-   -/-   -/-   -/-   S/S
-/-   -/- -/-   -/-   -/-   -/-   -/-

Audit 缺省是by session

综上,针对同一SQL在同一SESSION中,Access & Session都会产生多条记录,并且audit缺省是by session。

相关内容

热门资讯

神舟二十三号飞船有多项创新 我国2026年度载人发射任务首战告捷——神舟二十三号飞船有多项创新本报记者 刘诗瑶 李君强《人民日报...
人民日报刊文:警惕日本军国主义... 警惕日本军国主义卷土重来(国际论坛)斯特凡·卢比奇《人民日报》(2026年05月25日 第 03 版...
一线调研|从太空到3000米深... 来源:券商中国 当一颗卫星以每秒7公里的速度驶入太空,或者一台机器人潜入3000米深的海底,它们在传...
第8次会师!神舟二十三号航天员... 新华社酒泉5月25日电(记者李国利、高蕊)神舟二十三号航天员乘组25日顺利进驻“天宫”,中国航天员完...
伊朗方面称现阶段伊尚未就核问题... △伊朗首都德黑兰(资料图)总台记者当地时间5月24日获悉,伊朗方面表示,以色列媒体此前关于伊朗在开始...
小米YU7 GT、小米17 M... 5月21日,小米连续发布全新小米YU7家族,新增小米YU7 GT、YU7 标准版两大车型。同场发布的...
持续深耕AI4S创新创业生态 ... 首期科学智能百团百项“科创训练营”近日在沪举办,来自近30个AI4S(AI for Science)...
特朗普:美伊协议“尚未完全谈妥... 新华社华盛顿5月24日电(记者颜亮 徐剑梅)美国总统特朗普24日说,美国和伊朗的协议“尚未完全谈妥”...
大幅升级改造!神舟二十三号飞船... 神舟二十三号飞船出征在即,作为新批次飞船的第二艘飞船,它有哪些改进?承担什么样的任务? 人机界面升...
原创 这... 在自然界,有一些动物通过模仿有毒的、有害的其它动物,来提高生存能力,也有一些动物通过模仿周围的环境来...