create table audit_events(
event_date date,
event_user varchar2(30),
event_osuser varchar2(30),
event_machine varchar2(30),
event_terminal varchar2(30),
event_operation varchar2(30),
event_object_type varchar2(60),
event_object_name varchar2(60))
/
create or replace trigger object_change after
create or drop or alter on scott.schema
begin
declare
cursor c1 is
select sys_context('USERENV','OS_USER') osuser,
sys_context('USERENV','TERMINAL') terminal,
sys_context('USERENV','HOST') machine,
sys_context('USERENV','SESSION_USER') sess_user
from dual;
begin
for c2 in c1 loop
insert into system.audit_events
(event_date,event_user,event_osuser,event_machine,event_terminal,
event_operation,event_object_type,event_object_name)
values(sysdate,c2.sess_user,c2.osuser,c2.machine,c2.terminal,
ora_sysevent,ora_dict_obj_type,ora_dict_obj_name);
end loop;
end;
end;
01:46:28 SQL> select * from system.audit_events;
Search This Blog
Total Pageviews
Friday, 4 June 2010
Subscribe to:
Post Comments (Atom)
Oracle DBA
anuj blog Archive
- ► 2011 (362)
No comments:
Post a Comment