溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點(diǎn)擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

Audit by access VS by session

發(fā)布時間:2020-06-21 08:35:03 來源:網(wǎng)絡(luò) 閱讀:1092 作者:斷情漠 欄目:數(shù)據(jù)庫

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,執(zhí)行兩次
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產(chǎn)生兩條記錄。

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,執(zhí)行兩次
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產(chǎn)生兩條記錄。

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都會產(chǎn)生多條記錄,并且audit缺省是by session。

向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI