博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
ORA-04098错误处理
阅读量:4659 次
发布时间:2019-06-09

本文共 1885 字,大约阅读时间需要 6 分钟。

ORA-04098错误的文档说明如下:

ORA-04098: trigger 'string.string' is invalid and failed re-validation

Cause: A trigger was attempted to be retrieved for execution and was found to be invalid. This also means that compilation/authorization failed for the trigger.

Action: Options are to resolve the compilation/authorization errors, disable the trigger, or drop the trigger.

如果触发器可以disable或drop,那么disable或drop掉就可以了,但是如果不能disableh和drop那么常规方法不就能处理这个错误,需要使用隐藏参数。

测试如下:

创建序列

create sequence seq minvalue 0 maxvalue 999;

创建触发器

create or replace trigger test_trigger

after ddl on database

  declare   seqnum number;

begin  

  select seq.nextval into seqnum from dual;

end;

create or replace trigger test_trigger1

before ddl on database

  declare   seqnum number;

begin  

  select seq.nextval into seqnum from dual;

end;

删除序列使触发器失效 drop sequence seq;

删除时就会触发ORA-04098错误但是序列还是能删掉。之后执行ddl就会失败

SQL> create table test1(id int);  

create table test1(id int)  

ORA-04098: 触发器 'CHENJP.TEST_TRIGGER' 无效且未通过重新验证

disable或drop触发器

SQL> alter trigger CHENJP.TEST_TRIGGER disable;  

alter trigger CHENJP.TEST_TRIGGER disable  

ORA-04098: 触发器 'CHENJP.TEST_TRIGGER1' 无效且未通过重新验证  

SQL> alter trigger CHENJP.TEST_TRIGGER1  disable;  

alter trigger CHENJP.TEST_TRIGGER1  disable  

ORA-04098: 触发器 'CHENJP.TEST_TRIGGER' 无效且未通过重新验证

SQL> drop  trigger CHENJP.TEST_TRIGGER ;  

drop  trigger CHENJP.TEST_TRIGGER  

ORA-04098: 触发器 'CHENJP.TEST_TRIGGER1' 无效且未通过重新验证  

SQL> drop trigger CHENJP.TEST_TRIGGER1;  

drop trigger CHENJP.TEST_TRIGGER1  

ORA-04098: 触发器 'CHENJP.TEST_TRIGGER' 无效且未通过重新验证  

这时需要使用隐藏参数_system_trig_enabled禁用触发器,然后disable或drop触发器,操作如下:

SQL> alter system set "_system_trig_enabled"=false;

System altered.

SQL> drop  trigger CHENJP.TEST_TRIGGER ;  

Trigger dropped  

SQL> drop trigger CHENJP.TEST_TRIGGER1;  

Trigger dropped

SQL> alter system set "_system_trig_enabled"=true;

System altered.

转载于:https://www.cnblogs.com/andyboy/archive/2013/05/30/3108707.html

你可能感兴趣的文章
返本求源——DOM元素的特性与属性
查看>>
4、C#进阶:MD5加密、进程、线程、GDI+、XML、委托
查看>>
部署DLL webservices 若干费脑点
查看>>
zabbix监控报错zabbix server is not running解决方法
查看>>
python面向对象实例
查看>>
java基础之 创建对象的几种方式
查看>>
[HNOI2008]明明的烦恼
查看>>
Navicat不能连接linux数据库问题
查看>>
centos7关闭防火墙
查看>>
《C#高级编程》 读书笔记 -索引
查看>>
session cookie原理及应用
查看>>
ID3算法详解
查看>>
BZOJ1925: [Sdoi2010]地精部落
查看>>
学习进度条第十一周
查看>>
linux常用命令
查看>>
设置SQL PLUS环境
查看>>
关于虚拟机VM
查看>>
eclipse、tomca和jvm的相关内存配置
查看>>
python的迭代器
查看>>
spy memcached spring demo
查看>>