前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >【基础知识】ORACLE数据库错误概述

【基础知识】ORACLE数据库错误概述

作者头像
SQLplusDB
发布2020-03-26 10:43:41
7430
发布2020-03-26 10:43:41
举报

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数据库错误主要可以分为内部错误和外部错误,也可细分为以下几类:

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

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

1.官方在线文档

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

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

2. oerr命令

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

oerr <错误组件> <错误号>

例:


对于ORA-00001错误,可以通过如下查询:-bash-4.1$ oerr ora 1
00001, 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 *.msg
amduus.msg    diaus.msg  kfedus.msg  kopus.msg  ocius.msg  rmanus.msg  udius.msg
asmcmdus.msg  expus.msg  kfodus.msg  kupus.msg  opwus.msg  sbtus.msg   ulus.msg
dbvus.msg     gimus.msg  kfsgus.msg  lcdus.msg  oraus.msg  smgus.msg
dgmus.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.msg
////////////////////////////////////////////////////////////////////////////
65530, 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';

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

本文参与 腾讯云自媒体分享计划,分享自微信公众号。
原始发表:2019-05-05,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 Oracle数据库技术 微信公众号,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • Keyword:
  • 概述
  • ORACLE错误的表示形式
  • ORACLE错误分类
  • 错误的一般原因和处理方法
    • 1.官方在线文档
      • 2. oerr命令
      • ORACLE错误原因的进一步调查
      相关产品与服务
      数据库
      云数据库为企业提供了完善的关系型数据库、非关系型数据库、分析型数据库和数据库生态工具。您可以通过产品选择和组合搭建,轻松实现高可靠、高可用性、高性能等数据库需求。云数据库服务也可大幅减少您的运维工作量,更专注于业务发展,让企业一站式享受数据上云及分布式架构的技术红利!
      领券
      问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档