最近同事报料,数据库无法执行一些关于数据字典的查询。即使是查询dba_users都会出现错误。从错误日志来看,全部是数据字典的一些错误信息,而用户数据还是ok的。Google了一下,看了看metalink,需要重建数据字典。那就执行catalog.sql吧。晕,竟然连执行这个SQL语句都报错!数据没有备份呢,汗!!! 如果你也是无法成功执行catalog.sql,接着往下看。
一、故障现象
--后台alert log日志出现大量的ORA-00604,ORA-04045的错误信息
Tue Nov 5 14:14:02 2013
Errors in file /u02/database/XA4701/udump/XA4701_ora_30871.trc:
ORA-00604: error occurred at recursive SQL level 1
ORA-04045: errors during recompilation/revalidation of LBACSYS.LBAC_EVENTS
ORA-04064: not executed, invalidated
ORA-04064: not executed, invalidated package body "LBACSYS.LBAC_EVENTS"
ORA-06508: PL/SQL: could not find program unit being called: "LBACSYS.LBAC_EVENTS"
ORA-06512: at line 2
ORA-06508: PL/SQL: could not find program unit being called: "LBACSYS.LBAC_EVENTS"
ORA-06512: at line 2
--下面是trace文件的具体信息
oracle@DBBK10P:~> more /u02/database/XA4701/udump/XA4701_ora_30871.trc
/u02/database/XA4701/udump/XA4701_ora_30871.trc
Oracle Database 10g Release 10.2.0.3.0 - 64bit Production
ORACLE_HOME = /users/oracle/OraHome10g
System name: Linux
Node name: linux-ejad
Release: 2.6.16.60-0.54.5-smp
Version: #1 SMP Fri Sep 4 01:28:03 UTC 2009
Machine: x86_64
Instance name: XA4701
Redo thread mounted by this instance: 1
Oracle process number: 22
Unix process pid: 30871, image: oracleXA4701@linux-ejad
*** SERVICE NAME:(XA4701) 2013-11-05 14:14:02.308
*** SESSION ID:(1092.3369) 2013-11-05 14:14:02.308
Skipped error 604 during the execution of LBACSYS.LBAC$LOGON
*** 2013-11-05 14:14:02.326
ksedmp: internal or fatal error
ORA-00604: error occurred at recursive SQL level 1
ORA-04045: errors during recompilation/revalidation of LBACSYS.LBAC_EVENTS
ORA-04064: not executed, invalidated
ORA-04064: not executed, invalidated package body "LBACSYS.LBAC_EVENTS"
ORA-06508: PL/SQL: could not find program unit being called: "LBACSYS.LBAC_EVENTS"
ORA-06512: at line 2
ORA-06508: PL/SQL: could not find program unit being called: "LBACSYS.LBAC_EVENTS"
ORA-06512: at line 2
--查询数据字典,收到类似的错误
SQL> select comp_id, comp_name, version, status from dba_registry;
select comp_id, comp_name, version, status from dba_registry
*
ERROR at line 1:
ORA-04045: errors during recompilation/revalidation of SYS.DBA_REGISTRY
ORA-04064: not executed, invalidated
ORA-04064: not executed, invalidated package body "LBACSYS.LBAC_EVENTS"
ORA-06508: PL/SQL: could not find program unit being called: "LBACSYS.LBAC_EVENTS"
ORA-06512: at line 2
ORA-06508: PL/SQL: could not find program unit being called: "LBACSYS.LBAC_EVENTS"
ORA-06512: at line 2
ORA-00904: "DBMS_REGISTRY"."SCHEMA_LIST_STRING": invalid identifier
二、故障分析
oracle@DBBK10P:~> oerr ora 4045
04045, 00000, "errors during recompilation/revalidation of %s.%s"
// *Cause: This message indicates the object to which the following
// errors apply. The errors occurred during implicit
// recompilation/revalidation of the object.
// *Action: Check the following errors for more information, and
// make the necessary corrections to the object.
--从前面的错误描述来看及所发生的对象来看,系统用户LBACSYS这个对象错误了,为无效对象
--尝试重新编译,问题依旧
--下面直接执行catalog,执行时其日志文件出现大量的错误提示。也就是说无法重建数据字典
--尝试了使用restirct 方式来重启DB后执行,依旧出现相同的错误
SQL> @?/rdbms/admin/catalog
create or replace
*
ERROR at line 1:
ORA-00604: error occurred at recursive SQL level 1
ORA-04045: errors during recompilation/revalidation of LBACSYS.LBAC_EVENTS
ORA-04064: not executed, invalidated
ORA-04064: not executed, invalidated package body "LBACSYS.LBAC_EVENTS"
ORA-06508: PL/SQL: could not find program unit being called:
"LBACSYS.LBAC_EVENTS"
ORA-06512: at line 2
ORA-06508: PL/SQL: could not find program unit being called:
"LBACSYS.LBAC_EVENTS"
ORA-06512: at line 2
--Author : Leshami
--Blog : http://blog.csdn.net/leshami
--折腾了一下下午,后来参照Doc ID 457415.1给出的解决方案搞定
三、故障解决
--下面直接列出Doc ID 457415.1文章给出的解决方案与步骤,具体不再演示
metalink上的文章:ORA-4045 Error During Recompilation/Revalidation Of SYS.DBMS_STANDARD (Doc ID 457415.1)
Symptoms
Catproc.sql fails with the following error:
ERROR at line 1:
ORA-04045: errors during recompilation/revalidation of SYS.DBMS_STANDARD
ORA-04021: timeout occurred while waiting to lock object SYS.CDC_ALTER_CTABLE_BEFORE
Cause
Trying to create a database from a database that already exists.
1. Modify init.ora to contain:
_system_trig_enabled=FALSE
job_queue_processes=0
aq_tm_processes=0
Save init.ora
The following instructions are to be completed from sqlplus as the SYS user:
2. Issue a shutdown immediate:
SQL> shutdown immediate
3. SQL> startup pfile='<insert full path of init.ora here>'
4. SQL> @catalog.sql
5. SQL> @catproc.sql
6. Check for invalids from dba_objects:
SQL> select owner, object_name from dba_objects where status='INVALID';
7. Run utlrp.sql:
SQL> @utlrp.sql
8. Check for invalids again.
SQL> select owner, object_name from dba_objects where status='INVALID';
更多参考
有关Oracle RAC请参考
使用crs_setperm修改RAC资源的所有者及权限
使用crs_profile管理RAC资源配置文件
RAC 数据库的启动与关闭
再说 Oracle RAC services
Services in Oracle Database 10g
Migrate datbase from single instance to Oracle RAC
Oracle RAC 连接到指定实例
Oracle RAC 负载均衡测试(结合服务器端与客户端)
Oracle RAC 服务器端连接负载均衡(Load Balance)
Oracle RAC 客户端连接负载均衡(Load Balance)
ORACLE RAC 下非缺省端口监听配置(listener.ora tnsnames.ora)
ORACLE RAC 监听配置 (listener.ora tnsnames.ora)
配置 RAC 负载均衡与故障转移
CRS-1006 , CRS-0215 故障一例
基于Linux (RHEL 5.5) 安装Oracle 10g RAC
使用 runcluvfy 校验Oracle RAC安装环境
有关Oracle 网络配置相关基础以及概念性的问题请参考:
配置非默认端口的动态服务注册
配置sqlnet.ora限制IP访问Oracle
Oracle 监听器日志配置与管理
设置 Oracle 监听器密码(LISTENER)
配置ORACLE 客户端连接到数据库
有关基于用户管理的备份和备份恢复的概念请参考
Oracle 冷备份
Oracle 热备份
Oracle 备份恢复概念
Oracle 实例恢复
Oracle 基于用户管理恢复的处理
SYSTEM 表空间管理及备份恢复
SYSAUX表空间管理及恢复
Oracle 基于备份控制文件的恢复(unsing backup controlfile)
有关RMAN的备份恢复与管理请参考
RMAN 概述及其体系结构
RMAN 配置、监控与管理
RMAN 备份详解
RMAN 还原与恢复
RMAN catalog 的创建和使用
基于catalog 创建RMAN存储脚本
基于catalog 的RMAN 备份与恢复
RMAN 备份路径困惑
使用RMAN实现异机备份恢复(WIN平台)
使用RMAN迁移文件系统数据库到ASM
linux 下RMAN备份shell脚本
使用RMAN迁移数据库到异机
有关ORACLE体系结构请参考
Oracle 表空间与数据文件
Oracle 密码文件
Oracle 参数文件
Oracle 联机重做日志文件(ONLINE LOG FILE)
Oracle 控制文件(CONTROLFILE)
Oracle 归档日志
Oracle 回滚(ROLLBACK)和撤销(UNDO)
Oracle 数据库实例启动关闭过程
Oracle 10g SGA 的自动化管理
Oracle 实例和Oracle数据库(Oracle体系结构)