create TABLE drop_log (
user_name VARCHAR2(30),
machine varchar(30),
ddl_date DATE,
ddl_type VARCHAR2(30),
object_type VARCHAR2(18),
owner VARCHAR2(30),
object_name VARCHAR2(128))
;
CREATE OR REPLACE TRIGGER drop_trig
before drop
on kpi.schema
declare
machine varchar(30);
BEGIN
select machine into machine from v$session where sid = ( select sid from v$mystat where rownum=1 );
INSERT INTO drop_log
(user_name, machine, ddl_date, ddl_type,
object_type, owner,
object_name)
VALUES
(ora_login_user, machine, SYSDATE, ora_sysevent,
ora_dict_obj_type, ora_dict_obj_owner,
ora_dict_obj_name);
END drop_trig;
/
select * from drop_log;
user_name VARCHAR2(30),
machine varchar(30),
ddl_date DATE,
ddl_type VARCHAR2(30),
object_type VARCHAR2(18),
owner VARCHAR2(30),
object_name VARCHAR2(128))
;
CREATE OR REPLACE TRIGGER drop_trig
before drop
on kpi.schema
declare
machine varchar(30);
BEGIN
select machine into machine from v$session where sid = ( select sid from v$mystat where rownum=1 );
INSERT INTO drop_log
(user_name, machine, ddl_date, ddl_type,
object_type, owner,
object_name)
VALUES
(ora_login_user, machine, SYSDATE, ora_sysevent,
ora_dict_obj_type, ora_dict_obj_owner,
ora_dict_obj_name);
END drop_trig;
/
select * from drop_log;
Комментариев нет:
Отправить комментарий