22.10.2010

Implementing Fine Grained Audit

conn / as sysdba
create user zekeriya identified by oracle;
grant session,resource to zekeriya;
grant execute on dbms_session to zekeriya;
grant execute on dbms_fga to zekeriya;


conn zekeriya/oracle

create table kullanici (schema varchar2(20), name varchar2(30), policyname varchar2(30));

create procedure log (p_schema varchar2, p_name varchar2, p_policyname varchar2)
as
begin
insert into kullanici
values(p_schema,p_name,_p_policyname);
end;
/

BEGIN
dbms_fga.add_policy
( object_schema =>'hr'
object_name =>'employees'
policy_name =>policyismi
audit_condition =>null
audit_column =>salary
handler_schema =>'zekeriya'
handler_module => 'log'
enable =>true);
END;
/

now connect yeniuser/password

select salary from hr.employees;

conn zekeriya/oracle
select * from dba_fga_audit_trail;
you can see yeniuser
and

select * from kullanici
you can see record

also you can see all policy
select * from dba_audit_policy;

Hiç yorum yok: