oracle手册_【基础知识】ORACLE数据库错误概述

Keyword:

ORA- , ERROR, ORACLE数据库错误 ,ORA-nnnn,oerr

概述

本文为数据库错误(如ORA-nnnn等)的概要和一般处理方法的介绍。

ORACLE错误的表示形式

ORACLE数据库表示的错误,通常由3个字母加上5个数字来组成,如:ORA-nnnnn,TNS-nnnnn等,其中:

  • 前3个字母代表错误发生的组件,如:ORA代表是服务器端发生的错误,TNS代表是网络方面发生的错误。

  • 后5个数字则代表错误的具体含义,如:ORA-00001代表违反唯一约束条件等。

ORACLE错误分类

ORACLE数据库错误主要可以分为内部错误和外部错误,也可细分为以下几类:

d56b962a7091612601f182b24f6e5ce8.png

错误的一般原因和处理方法

对于ORACLE数据库错误,可以通过下面途径了解到简要的错误原因和处理方法。

1.官方在线文档

官方在线文档的错误手册中,对数据库常见的错误进行了简要的错误原因描述和处理意见,在遇到错误时可以第一时间进行查询。

参考:Home/Database/Oracle/Oracle Database/Release 12.2Error Messageshttps://docs.oracle.com/database/122/ERRMG/toc.htm

2. oerr命令

在安装了ORACLE数据库软件的机器上,可以通过在命令行中输入以下的命令查看。

oerr

例:

对于ORA-00001错误,可以通过如下查询:-bash-4.1$ oerr ora 100001, 00000, "unique constraint (%s.%s) violated"// *Cause: An UPDATE or INSERT statement attempted to insert a duplicate key.//         For Trusted Oracle configured in DBMS MAC mode, you may see//         this message if a duplicate entry exists at a different level.// *Action: Either remove the unique restriction or do not insert the key.

3.通过安装数据库后的如下文件查看

$ORACLE_HOME/rdbms/mesg/*.msg

所有错误相关的文件:
-bash-4.1$ cd $ORACLE_HOME/rdbms/mesg-bash-4.1$ ls *.msgamduus.msg    diaus.msg  kfedus.msg  kopus.msg  ocius.msg  rmanus.msg  udius.msgasmcmdus.msg  expus.msg  kfodus.msg  kupus.msg  opwus.msg  sbtus.msg   ulus.msgdbvus.msg     gimus.msg  kfsgus.msg  lcdus.msg  oraus.msg  smgus.msgdgmus.msg     impus.msg  kgpus.msg   nidus.msg  qsmus.msg  udeus.msg

ORA-错误相关的文件为oraus.msg,在Linux环境下可以通过more/cat/tail等命令查看:

tail -20 $ORACLE_HOME/rdbms/mesg/oraus.msg例:-bash-4.1$ tail -20 $ORACLE_HOME/rdbms/mesg/oraus.msg65530, 00000, "CELLCACHE feature not supported for IOTs"// *Document: NO// *Cause:    An attempt was made to enable the CELLCACHE feature for an//            index-organized table.// *Action:   None./65531, 00000, "maximum level reached in index segment with object id %s"// *Cause:    The attempted operation resulted in the number of index levels//            exceeding the maximum allowed.// *Action:   Reduce the size of the relevant index, for example, by using//            compression or partitioning./65535, 00000, "Oracle client cannot handle error code exceeding 65535. Actual error code and message follow:\n"// *Cause:  Oracle server encountered an error whose error code exceeded 65535.//          Older Oracle clients (prior to version 12) cannot handle error//          codes larger than 65535.// *Action: Actual Oracle error code and error message are a part of the error//          message for ORA-65535. Upgrade Oracle client to version 12 client//          libraries or higher.

ORACLE错误原因的进一步调查

通过简要的错误原因和处理方法,基本可以解决80%的问题。
如果需要的话,可以通过如下方法进一步调查。

1.查看告警日志(Alert Log)中服务器是否自动输出更详细的诊断信息及TRACE文件

2.查看错误发生时间附近相关TRACE文件,看是否能够获得有效信息

3.如果数据库服务器没有自动输出诊断信息,可尝试设置错误发生时的诊断事件取得errorstack等相关诊断信息

    例如,在ORA-00001错误发生时,输出errorstack诊断信息。    --有效     alter system set events '1  trace name errorstack level 3';    --无效     alter system set events '1 trace name errorstack off';

用碎片化的时间,一点一滴地学习一套系统化的知识。

87c7cd157726751cfb33e05c2327f357.png

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值