暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

成功恢复案例:解决字典表误Truncate故障

原创 eygle 2008-01-22
939
昨天,成功帮助客户恢复了一个故障数据库。



故障的原因是技术人员将数据库中的几个数据字典表Truncate掉,这直接导致了数据库不可用。

数据库环境为Oracle 9.2.0.7 RAC环境。由于数据库的事务量巨大,所以数据库没有备份。



现场检查确认,主要被截断的表有这样一些:

SQL> select object_name,object_type from dba_objects where object_name like 'IDL%';



OBJECT_NAME                    OBJECT_TYPE

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

IDL_CHAR$                      TABLE

IDL_SB4$                      TABLE

IDL_UB1$                      TABLE

IDL_UB2$                      TABLE



关于IDL_UB1$表,我以前讨论过,这是非常重要的字典表,一旦出现故障,数据库会出现大量的ORA-00600错误,所有事务不能进行:

ORA-00600: internal error code, arguments: [17069], [0xC0000000DDDFA690], [], [], [], [], [], []



ORA-600 17069错误是最头疼的,客户当时数据库的一个跟踪日志已经暴涨到5G左右。



IDL系列字典表是记录数据库对象编译信息的,丢失了其中的数据,所有过程、Package等都将无法执行。

摘引一点关于这几个字典表作用的说明:

IDL_UB1$ is one of four tables that hold compiled PL/SQL code:



IDL_UB1$

IDL_CHAR$

IDL_UB2$

IDL_SB4$



"PL/SQL is based on the programming language Ada. As a result, PL/SQL uses
a
variant of Descriptive Intermediate Attributed Notation for Ada (DIANA),
which
is a tree-structured intermediate language. It is defined using a
meta-notation
called Interface Definition Language (IDL). DIANA provides for
communication
internal to compilers and other tools.


"At compile time, PL/SQL source code is translated into machine-readable

m-code.Both the DIANA and m-code for a procedure or package are stored in the

database.At run time, they are loaded into the shared (memory) pool. The DIANA is

used to compile dependent procedures; the m-code is simply executed."


These four tables hold the DIANA and the so-code m-code. I think "m-code"
is
short for machine-dependent byte code but there is a sizable
machine-indenpendent part as well. If you have a look at sql.bsq, you can
see
that Oracle documents the "type" column of these tables as follows:


part number not null,

/* part: 0 = diana, 1 = portable pcode, 2 = machine-dependentpcode */


更严重的情况可能会导致大量系统DBMS包失效,其重新编译将更加复杂。



恢复进行了6个小时,成功帮助用户恢复了数据库,消除了所有ORA-600错误。

恢复最主要的是通过运行相关的脚本,重建和重新编译所有Procedure/Trigger/Package等对象,重新生成这些对象的DIANA和so-code m-code,这些主要的脚本包括catlog.sql,catproc.sql等。


当然最重要的是,一些ORA-00600错误需要解决,这可能会花费大量的时间。



这一案例的恢复过程并不重要,重要的是DBA应该学会永远不要让我们的数据库置于这样的危险境地。

DBA四大守则之一:备份重于一切



DBA的基本素质之一:严谨



-The End-


「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论