fga使用时参数handler注意事项

Handler
An optional event handler is a PL/SQL procedure that defines any additional actions that must be
taken during auditing. For example, the event handler can send an alert page to the administrator.
If it is not defined, then an audit event entry is inserted into the audit trail. If an audit event
handler is defined, then the audit entry is inserted into the audit trail and the audit event handler
is executed.
The audit event entry includes the FGA policy that caused the event, the user executing the SQL
statement, and the SQL statement and its bind variables.
The event handler is passed as two arguments:
• The schema that contains the PL/SQL program unit
• The name of the PL/SQL program unit
The example in the slide executes the SECURE.LOG_EMPS_SALARY procedure by using the
following arguments:
handler_schema => 'secure'
handler_module => 'log_emps_salary'
By default, audit trail always writes the SQL text and SQL bind information to LOBs. The
default can be changed (for example, if the system would suffer performance degradation).
Status
The status indicates whether the FGA policy is enabled. In the slide example, the following
argument enables the policy:
enable => TRUE[@more@]

http://download.oracle.com/docs/cd/B19306_01/network.102/b14266/cfgaudit.htm#sthref1774

参考文档:http://space.itpub.net/519536/viewspace-700427

SQL> EXEC dbms_fga.add_policy (object_schema => 'TEST',object_name => 'T',policy_name => 'audit_T_salary1',audit_condition=> 'SALARY>=3000',audit_colu
mn => 'SALARY',handler_schema => 'TEST1',handler_module => 'PROC_TEST',enable => TRUE,statement_types => 'SELECT' );

PL/SQL 过程已成功完成。
--=============================
test1用户下的过程如下:
CREATE OR REPLACE PROCEDURE PROC_TEST
IS
BEGIN
DBMS_OUTPUT.PUT_LINE('TEST!');
END;
--=============================

SQL> select * from t;
ERROR:
ORA-06550: 第 1 行, 第 7 列:
PLS-00306: 调用 'PROC_TEST' 时参数个数或类型错误
ORA-06550: 第 1 行, 第 7 列:
PL/SQL: Statement ignored

未选定行

--==============================
错误的原因在于fga中handler触发的过程需要定义参数,调整test1下的过程proc_test如下,错误消除:
CREATE OR REPLACE PROCEDURE PROC_TEST(schema_name varchar2,table_name varchar2,policy varchar2)
IS
BEGIN
DBMS_OUTPUT.PUT_LINE('TEST!');
END;
--===============================
SQL> select * from t;

ID NAME SALARY
---------- ---------- ----------
1 a 1000
2 a 3000

SQL> set serveroutput on
SQL> select * from t;

ID NAME SALARY
---------- ---------- ----------
1 a 1000
2 a 3000

TEST!
SQL>

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/19602/viewspace-1051508/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/19602/viewspace-1051508/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值