FGA審計及audit_trail引數
透過這個案例我只想記錄以下在我的測試過程中出現的錯誤和異常,今天想測試FGA特性,結果發生瞭如下兩個錯誤:
1、執行報錯誤,是因為
audit_trail => DBMS_FGA.DB_EXTENDED, 語句前面沒加sys使用者名稱導致,即應該是如下:
audit_trail => sys.DBMS_FGA.DB_EXTENDED,
2、執行成功,dba_fga_audit_trail試圖中無資料但在dba_common_audit_trail檢視有資料;
另外,要啟用FGA審計,需要配置audit_trail初始化引數,該引數是靜態引數,需要重啟例項。如下問題本人操作的具體過程:
[@more@]SQL> conn sys as sysdba
Enter password:
Connected.
SQL> select timestamp,db_user,userhost,sql_text from dba_fga_audit_trail;
no rows selected
SQL> show parameter audit_trail
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
audit_trail string NONE
SQL> alter system set audit_trail=db_extended scope=spfile;
System altered.
SQL> show parameter autdit_trail
SQL> show parameter audit_trail
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
audit_trail string NONE
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.
Total System Global Area 524288000 bytes
Fixed Size 1220336 bytes
Variable Size 159383824 bytes
Database Buffers 356515840 bytes
Redo Buffers 7168000 bytes
Database mounted.
Database opened.
SQL> show parameter audit_trail
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
audit_trail string DB_EXTENDED
SQL>
SQL> exec dbms_fga.drop_policy(object_schema=>'HR',object_name=>'EMPLOYEES',policy_name=>'my2');
PL/SQL procedure successfully completed.
SQL> begin
2 DBMS_FGA.ADD_POLICY (
3 object_schema => 'HR',
4 object_name => 'EMPLOYEES',
5 policy_name => 'my2',
6 audit_condition => 'SALARY is not null or COMMISSION_PCT is not null',
7 audit_column => 'SALARY,COMMISSION_PCT',
8 handler_schema => NULL,
9 handler_module => NULL,
10 enable => TRUE,
11 statement_types => 'SELECT',
12 audit_trail => SYS.DBMS_FGA.DB+SYS.DBMS_FGA.DB_EXTENDED,
13 audit_column_opts => DBMS_FGA.ANY_COLUMNS);
14 end;
15 /
PL/SQL procedure successfully completed.
SQL> conn hr/hr
Connected.
SQL> select salary from employees where rownum <10;
SALARY
----------
24000
17000
17000
9000
6000
4800
4800
4200
12000
9 rows selected.
SQL> conn sys as sysdba
Enter password:
Connected.
SQL> select timestamp,db_user,userhost,sql_text from dba_fga_audit_trail;
no rows selected
SQL> select count(*) from dba_common_audit_trail;
COUNT(*)
----------
5
SQL>select lsqltext from fga_log$;
no rows selected
以上語句錯誤就在
audit_trail => SYS.DBMS_FGA.DB+SYS.DBMS_FGA.DB_EXTENDED, 語句中,將該語句改為
audit_trail => YS.DBMS_FGA.DB_EXTENDED, 後重新執行,如下:
SQL> exec dbms_fga.drop_policy(object_schema=>'HR',object_name=>'EMPLOYEES',policy_name=>'my2');
PL/SQL procedure successfully completed.
SQL> begin
2 DBMS_FGA.ADD_POLICY (
3 object_schema => 'HR',
4 object_name => 'EMPLOYEES',
5 policy_name => 'my2',
6 audit_condition => 'SALARY is not null or COMMISSION_PCT is not null',
7 audit_column => 'SALARY,COMMISSION_PCT',
8 handler_schema => NULL,
9 handler_module => NULL,
10 enable => TRUE,
11 statement_types => 'SELECT',
12 audit_trail => SYS.DBMS_FGA.DB_EXTENDED,
13 audit_column_opts => DBMS_FGA.ANY_COLUMNS);
14 end;
/
PL/SQL procedure successfully completed.
SQL> conn hr/hr
Connected.
SQL> select * from employees;
........
SQL> select salary from hr.employees;
SALARY
----------
24000
17000
SQL> col userhost for a10
SQL> col db_user for a12
SQL> set wrap off;
SQL> /
TIMESTAMP DB_USER USERHOST SQL_TEXT
--------- ------------ ---------- ----------------------------------------------
15-AUG-13 HR dbserv1 select * from employees
15-AUG-13 SYSTEM dbserv1 select salary from hr.employees
SQL> conn sys as sysdba
Enter password:
Connected.
SQL> select lsqltext from fga_log$;
LSQLTEXT
--------------------------------------------------------------------------------
select * from employees
select salary from hr.employees
當以上結果執行成功後,想重現第一步的錯誤號,再把audit_trail => sys.DBMS_FGA.DB_EXTENDED中的sys去掉執行fga指令碼時,結果執行成功,具體原因待查。
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/31444259/viewspace-2155478/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- oracle 細粒度審計(fga)Oracle
- oracle fga審計(欄位級)Oracle
- Oracle 標準審計,設定AUDIT_SYSLOG _LEVEL引數Oracle
- 如何用FGA得到繫結變數的值變數
- 【AUDIT]Oracle審計配置及常用sqlOracleSQL
- Fine Grained Auditing (FGA)AI
- laravel hasManyThrough用法及引數LaravelASM
- python自動化審計及實現Python
- Oracle優化案例-IB網及會話登陸審計引發的效能問題(十七)Oracle優化會話
- maven的指令及常用引數Maven
- 檢視JVM預設引數及微調JVM啟動引數JVM
- 聊聊FluxFlatMap的concurrency及prefetch引數UX
- curl常用引數詳解及示例
- 函式引數傳遞及返回函式
- (C++模板程式設計):通過遞迴組合、tuple及基類引數包展開引數包C++程式設計遞迴
- DM7審計之物件審計物件
- 10G FGA的增強
- impdp和expdp用法及引數介紹
- SOLIDWORKS引數化設計方法Solid
- DM7審計之語句序列審計
- DM7審計之語句級審計
- Python語法—函式及引數傳遞Python函式
- solaris記憶體引數調整及管理記憶體
- Python 中 key 引數的含義及用法Python
- Python中key引數的含義及用法Python
- Java程式碼審計篇 - ofcms系統審計思路講解 - 篇4 - XXE漏洞審計Java
- 留存統計 引數聚合函式函式
- python之深入講解變數與名稱空間及資料引數與容器引數區別Python變數
- AUDIT審計(2)
- Oracle審計(轉)Oracle
- Kubernetes 審計(Auditing)
- IT審計隨想
- Oracle:審計清理Oracle
- MySQL審計auditMySql
- Hibernate中的自動建表及引數作用
- 【測試】Android Studio 相關下載及引數Android
- RESTFUL風格的URL請求及引數接收REST
- (4)caffe總結之視覺層及引數視覺