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

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 851|回复: 0
打印 上一主题 下一主题

[认证考试] 利用ORACLE自身功能查错误

[复制链接]
跳转到指定楼层
楼主
发表于 2023-8-30 18:59:29 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
有些时候,手头没有官方文档,也不能上网时,遇到一个错误,还挺麻烦的,

还好,安装了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.

是不是很方便。



分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 支持支持 反对反对
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|手机版|小黑屋|重庆思庄Oracle、Redhat认证学习论坛 ( 渝ICP备12004239号-4 )

GMT+8, 2024-4-30 11:36 , Processed in 0.088667 second(s), 20 queries .

重庆思庄学习中心论坛-重庆思庄科技有限公司论坛

© 2001-2020

快速回复 返回顶部 返回列表