Oracle 審計的初步操作

genweihua發表於2012-11-12
     現在開始學習Oracle資料庫,看到審計這塊,就想知道審計是怎麼回事。看了看,知道了審計就是監控使用者對資料庫的操作,並把這些操作放到作業系統檔案中或者資料庫中。
     下邊簡單演示一下審計操作的步驟:
                 準備資料:
                 我自己在實驗的時候,把scott的密碼更改為windows。
                  conn scott/windows
                  create table test as select * from emp;

啟用審計

Conn / as sysdba

Show parameter audit_sys_operstions

alter system set audit_sys_operations=true scope=spfile;

alter system set audit_trail=db scope=spfile;

startup force

show parameter audit_sys_operations

show parameter audit_trail

定義審計表

execute dbms_fga.add_policy(object_schema=>'scott',object_name=>'test',policy_name=>'chk_test',statement_types=>'insert,update,delete');

grant select on dba_fga_audit_trail to scott;

conn  scott/windows

delete from test where empno=7900;

delete from test where empno=7902;

update test set job='noter' where empno=7934;

檢視審計內容

select timestamp,sql_text from sys.dba_fga_audit_trail;

取消審計

conn / as sysdba

execute dbms_fga.drop_policy(object_schema=>'scott',object_name=>'test',policy_name=>'chk_test');

Normal 0 7.8 磅 0 2 false false false EN-US ZH-CN X-NONE

相關文章