ITPub博客

首页 > 数据库 > Oracle > 用于审计的系统Triger简例

用于审计的系统Triger简例

原创 Oracle 作者:lifewise 时间:2007-09-29 13:49:58 0 删除 编辑
用于审计的系统Triger简例[@more@]
用于审计的系统Triger简例
===========================================================

删除、截取操作审计的系统triger--1026

--------------------------------------------------------------------

SQL> connect sys/sys as sysdba;

Connected.

create table event_table (

ora_sysevent varchar2(20),

ora_login_user varchar2(30),

machine_name varchar2(64),

os_username varchar(30),

ora_instance_num number,

ora_database_name varchar2(50),

ora_dict_obj_name varchar2(30),

ora_dict_obj_type varchar2(20),

ora_dict_obj_owner varchar2(30),

timestamp date) tablespace loadspace2

/

CREATE or REPLACE TRIGGER after_ddl AFTER DROP or truncate or alter on database

DECLARE

machinename VARCHAR2(64);

osuserid VARCHAR2(30);

CURSOR c1 IS

SELECT osuser, machine FROM v$session WHERE audsid = userenv('sessionid');

BEGIN

OPEN c1;

FETCH c1 INTO osuserid, machinename;

insert into event_table values

(ora_sysevent,

ora_login_user,

machinename,

osuserid,

ora_instance_num,

ora_database_name,

ora_dict_obj_name,

ora_dict_obj_type,

ora_dict_obj_owner,

sysdate);

CLOSE c1;

END;

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

请登录后发表评论 登录
全部评论

注册时间:2008-01-07

  • 博文量
    52
  • 访问量
    488416