Env
[[email protected] ~]$ uname -alinux 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 [[email protected] ~]$ lsb_release -alsb version: : CORE-3.1-AMD64:CORE-3.1-IA32:CORE-3.1-NOARCH:GRAPHICS-3.1-AMD64:GRAPHICS-3.1-IA32: Graphics-3.1-noarchdistributor id: redhatenterpriseserverdescription: red Hat Enterprise Linux Server release 5.5 (Tikanga) release: 5.5Codename: TikangaSQL> select * from v$version; BANNER--------------------------------------------------------------------------------Oracle database 11g enterprise edition release 11.2.0.4.0 - 64bit productionpl/sql release 11.2.0.4.0 - production
Audit by Access
sql> show parameter auditname TYPE VALUE------------------------------------ ------------------------------ --------------------------- ---audit_file_dest string /u01/oracle/admin/ ocp11g/adumpaudit_sys_operations boolean TRUEaudit_syslog_level stringaudit_trail string db, extendedsql> 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, execute twice
SELECT * from Dba_common_audit_trail where object_schema= ' Daidai ' and object_name= ' T ' and audit_type= ' standard audit ' ord ER by extended_timestamp desc;
650) this.width=650; "Src=" Http://s3.51cto.com/wyfs02/M01/82/92/wKioL1dbssmSU4B_AAAYujEybSc245.png-wh_500x0-wm_3 -wmp_4-s_3844035195.png "title=" capture. PNG "alt=" Wkiol1dbssmsu4b_aaayujeybsc245.png-wh_50 "/>
Audit by Access produces two records.
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 usertable truncated.
Sql> select * from T; --conn Daidai user, executes two times select * from Dba_common_audit_trail where object_schema= ' Daidai ' and object_name= ' T ' and audit_ty Pe= ' Standard Audit ' ORDER by extended_timestamp Desc;
650) this.width=650; "Src=" Http://s5.51cto.com/wyfs02/M00/82/94/wKiom1dbsrKjwAlMAAAbvRF5nlQ658.png-wh_500x0-wm_3 -wmp_4-s_84406926.png "title=" capture. PNG "alt=" Wkiom1dbsrkjwalmaaabvrf5nlq658.png-wh_50 "/>
The same audit by session produces two records.
Audit Default Condition
Sql> select * from dba_obj_audit_opts;no rows selectedsql> 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 default is by session
In summary, for the same SQL in the same session, Access & session will produce multiple records, and audit default is by session.
This article is from the "90SirDB" blog, be sure to keep this source http://90sirdb.blog.51cto.com/8713279/1787930
Audit by Access VS by session