服务热线:13616026886

技术文档 欢迎使用技术文档,我们为你提供从新手到专业开发者的所有资源,你也可以通过它日益精进

位置:首页 > 技术文档 > 数据库技术 > Oracle技术 > Oracle开发 > 查看文档

数据字典表truncate掉将导致数据库不可用

【赛迪网-it技术报道】在实际的工作环境下,如果你在操作时将数据库内的几个数据字典表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错误是一个特别难解决的问题,问题出现后数据库的某个跟踪日志很快就会出现暴涨的情况,因为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包失效,其重新编译也将更为复杂。

恢复数据库,消除所有ora-600错误的方法:

恢复的方法是通过运行相关的脚本,重建和重新编译所有procedure/trigger/package等对象,重新生成这些对象的diana和so-code m-code,主要包括catlog.sql,catproc.sql等脚本。

注意:即使以花费大量的时间为代价,一些ora-00600错误也必须解决。

扫描关注微信公众号