重庆思庄Oracle、Redhat认证学习论坛

标题: 利用ORACLE自身功能查错误 [打印本页]

作者: 郑全    时间: 2023-8-30 18:59
标题: 利用ORACLE自身功能查错误
有些时候,手头没有官方文档,也不能上网时,遇到一个错误,还挺麻烦的,

还好,安装了ORACLE数据库的机器,自带查错的脚本,就是oerr 。

文件位置在:

[oracle@host01 ~]$ which oerr
/u01/app/oracle/product/19.3.0/db_1/bin/oerr
[oracle@host01 ~]$ ls -ltr /u01/app/oracle/product/19.3.0/db_1/bin/oerr
-rwxr-xr-x 1 oracle oinstall 703 Jan  1  2000 /u01/app/oracle/product/19.3.0/db_1/bin/oerr
[oracle@host01 ~]$
[oracle@host01 ~]$ file /u01/app/oracle/product/19.3.0/db_1/bin/oerr
/u01/app/oracle/product/19.3.0/db_1/bin/oerr: POSIX shell script, ASCII text executable
[oracle@host01 ~]$
[oracle@host01 ~]$
[oracle@host01 ~]$ cat /u01/app/oracle/product/19.3.0/db_1/bin/oerr
#!/bin/sh
#
# $Id: oerr.sh /linuxamd64/4 2011/10/09 12:09:37 pkharter Exp $
# Copyright (c) 1994, 2011, Oracle and/or its affiliates. All rights reserved.
#
# Usage: oerr facility error
#
# This shell script is a driver to invoke oerr.pl using the perl shipped in
# Oracle home.  
#

#
# Turn on script tracing if, requested
[ "$ORACLE_TRACE" = "T" ] && set -x

#
# If ORACLE_HOME is not set, we will not be able to locate
# the facilities file or message text file.
if [ ! "$ORACLE_HOME" ]
then
        echo "ORACLE_HOME not set.  Please set ORACLE_HOME and try again." 1>&2
        exit 1
fi

PERL_DIR=$ORACLE_HOME/perl
PERL_BIN=$PERL_DIR/bin
export PERL_BIN

$PERL_BIN/perl $ORACLE_HOME/bin/oerr.pl "$@"

exit 0


可以看出,是使用PERL写的一段代码,有兴趣的可以去看看。

具体使用,比如我们遇到一个错误,比如引用分区创建报错:

ORA-14652: 不支持引用分区外键


这个时候,就可以直接使用oerr ora 14652 ,马上就可以看到错误了。


[size=18.6667px][oracle@host01 ~]$ oerr ora 14652
14652, 00000, "reference partitioning foreign key is not supported"
// *Cause:  The specified partitioning foreign key was not supported
//          for reference-partitioned tables. All columns of the
//          partitioning foreign key must be constrained NOT NULL with
//          enabled, validated, and not deferrable constraints. Furthermore,
//          a virtual column cannot be part of the partitioning foreign key.
//* Action: Correct the statement to specify a supported
//          partitioning foreign key.

是不是很方便。








欢迎光临 重庆思庄Oracle、Redhat认证学习论坛 (http://bbs.cqsztech.com/) Powered by Discuz! X3.2