ITPub博客

首页 > Linux操作系统 > Linux操作系统 > 禁止DDL执行的trigger

禁止DDL执行的trigger

原创 Linux操作系统 作者:myownstars 时间:2011-10-21 11:26:49 0 删除 编辑

禁止DDL执行的trigger
CREATE OR REPLACE TRIGGER disable_ddl
BEFORE DDL ON  SCHEMA
BEGIN
       IF ora_sysevent <> 'TRUNCATE'
         and  not (ora_sysevent = 'ALTER' AND ora_dict_obj_type = 'PROCEDURE')
         and not (ora_sysevent = 'CREATE' AND ora_dict_obj_type = 'PROCEDURE')
         and  not (ora_sysevent = 'ALTER' AND ora_dict_obj_type = 'TRIGGER')
         and not (ora_sysevent = 'CREATE' AND ora_dict_obj_type = 'TRIGGER')
         and  not (ora_sysevent = 'ALTER' AND ora_dict_obj_type = 'VIEW')
         and not (ora_sysevent = 'CREATE' AND ora_dict_obj_type = 'VIEW')
         and  not (ora_sysevent = 'ALTER' AND ora_dict_obj_type = 'FUNCTION')
         and not (ora_sysevent = 'CREATE' AND ora_dict_obj_type = 'FUNCTION')
       THEN
          RAISE_APPLICATION_ERROR(-20110,'No DDL in any time, please contact DBA team If you turly need it.',TRUE);
       END IF;
END;

SQL> create table justin (id number(10));
 
create table justin (id number(10))
 
ORA-00604: error occurred at recursive SQL level 1
ORA-20110: No DDL in any time, please contact DBA team If you turly need it.
ORA-06512: at line 12

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

上一篇: move分区表
请登录后发表评论 登录
全部评论

注册时间:2010-03-18

  • 博文量
    375
  • 访问量
    3320698