IPower
2004-09-03 16:52:44 UTC
I am an oracle newbie, I am looking for information on a current
problem I am coming across. I am trying to implement fga using a
procedure to populate a user-defined table to track audit information.
In this procedure I am trying to use
sys_context('USERENV','SESSIONID'), to retrieve the current session
id. When I view the data the audit session id is always zero. Why? I
am using a 10g oracle database. Here is my code:
begin
dbms_fga.add_policy(
object_schema=>'TEST',
object_name=>'DIARY',
policy_name=>'DIARY_ACCESS',
handler_schema => 'TEST',
handler_module => 'LOGERROR',
statement_types => 'SELECT, INSERT, DELETE, UPDATE',
enable => true
);
end;
CREATE OR REPLACE PROCEDURE LOGERROR(V_SCHEMA VARCHAR2,
V_TABLE VARCHAR2,
V_POLICY VARCHAR2) AS
BEGIN
--insert into test1 table
INSERT INTO test1
(
audit_session_id,
timestamp,
owner,
object_name,
policy_name
)
VALUES
(
sys_context('USERENV','SESSIONID'),
sysdate,
v_schema,
v_table,
v_policy);
END;
Went I select * from diary and check my table auditsessionId is
returned as zero. However when I select
sys_context('USERENV','SESSIONID') from dual I receive the correct
sessionId. If possible can someone explain why my audit_session_Id is
always zero in the test1 table.
problem I am coming across. I am trying to implement fga using a
procedure to populate a user-defined table to track audit information.
In this procedure I am trying to use
sys_context('USERENV','SESSIONID'), to retrieve the current session
id. When I view the data the audit session id is always zero. Why? I
am using a 10g oracle database. Here is my code:
begin
dbms_fga.add_policy(
object_schema=>'TEST',
object_name=>'DIARY',
policy_name=>'DIARY_ACCESS',
handler_schema => 'TEST',
handler_module => 'LOGERROR',
statement_types => 'SELECT, INSERT, DELETE, UPDATE',
enable => true
);
end;
CREATE OR REPLACE PROCEDURE LOGERROR(V_SCHEMA VARCHAR2,
V_TABLE VARCHAR2,
V_POLICY VARCHAR2) AS
BEGIN
--insert into test1 table
INSERT INTO test1
(
audit_session_id,
timestamp,
owner,
object_name,
policy_name
)
VALUES
(
sys_context('USERENV','SESSIONID'),
sysdate,
v_schema,
v_table,
v_policy);
END;
Went I select * from diary and check my table auditsessionId is
returned as zero. However when I select
sys_context('USERENV','SESSIONID') from dual I receive the correct
sessionId. If possible can someone explain why my audit_session_Id is
always zero in the test1 table.