简介oracle oerr工具使用

Oracle OERR 是一个用于查找 Oracle 错误信息的实用工具。本文介绍了 OERR 的位置、如何查看其内容,以及如何使用 OERR 查询不同组件的错误信息。OERR 从 $ORACLE_HOME 下的组件目录中的 mesg 子目录下的 .msg 文件获取信息。通过示例展示了查询 TNS 错误代码的方法,提供了对 OERR 工具的基本理解。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

oracle oerr工具是查找oracle错误信息的小工具
这里主要是介绍下oerr 的使用以及oerr可以对什么报错使用

通过命令找到oerr命令的目录

whereis oerr
oerr: /u01/app/oracle/product/11.2.0/db_home1/bin/oerr

找到oerr命令是在$ORACLE_HOME/bin目录下:
使用 cat 命令查看oerr中的内容

cat oerr

我们可以看到oerr的介绍

# This shell script is used to get the description and the cause and action
# of an error from a message text file when a list of error numbers are passed
# to it.  It supports different language environments and errors from different
# facilities.

并且oerr并没有帮助命令,那我们怎么知道它支持哪些报错能
在下面的代码中,找到一段代码

# The message file searched is always the US English file
Msg_File=$ORACLE_HOME/$Component/mesg/${Facility}us.msg

这里说到了oerr的信息是从 mesg目录中的 .msg文件中查询的
从路劲结构上我们可以看到在$ORACLE_HOME下的组件(Component )中的mesg目录下
Facility是我们输入 oerr是所带的第一个参数,文件名称是 参数+us.msg

我们查找下mesg目录都在哪里和msg文件有多少

[oracle@orcl1 bin]$ find $ORACLE_HOME -name mesg
/u01/app/oracle/product/11.2.0/db_home1/crs/mesg
/u01/app/oracle/product/11.2.0/db_home1/csmig/mesg
/u01/app/oracle/product/11.2.0/db_home1/css/mesg
/u01/app/oracle/product/11.2.0/db_home1/ctx/mesg
/u01/app/oracle/product/11.2.0/db_home1/has/mesg
/u01/app/oracle/product/11.2.0/db_home1/ldap/mesg
/u01/app/oracle/product/11.2.0/db_home1/mesg
/u01/app/oracle/product/11.2.0/db_home1/network/mesg
/u01/app/oracle/product/11.2.0/db_home1/nls/mesg
/u01/app/oracle/product/11.2.0/db_home1/odbc/mesg
/u01/app/oracle/product/11.2.0/db_home1/olap/mesg
/u01/app/oracle/product/11.2.0/db_home1/opmn/mesg
/u01/app/oracle/product/11.2.0/db_home1/oracore/mesg
/u01/app/oracle/product/11.2.0/db_home1/ord/mesg
/u01/app/oracle/product/11.2.0/db_home1/plsql/mesg
/u01/app/oracle/product/11.2.0/db_home1/precomp/mesg
/u01/app/oracle/product/11.2.0/db_home1/racg/mesg
/u01/app/oracle/product/11.2.0/db_home1/rdbms/mesg
/u01/app/oracle/product/11.2.0/db_home1/slax/mesg
/u01/app/oracle/product/11.2.0/db_home1/sqlplus/mesg
/u01/app/oracle/product/11.2.0/db_home1/srvm/mesg
/u01/app/oracle/product/11.2.0/db_home1/usm/mesg
/u01/app/oracle/product/11.2.0/db_home1/xdk/mesg

我们查询到23个mesg目录(这里的环境是11.2.04)攘括了基本上所有的组件

我们选择一个目录查询下msg的文件,我们挨个查找会发现有些目录并不存在msg文件


/u01/app/oracle/product/11.2.0/db_home1/crs/mesg
[oracle@orcl1 mesg]$ ls *.msg
crsus.msg

/u01/app/oracle/product/11.2.0/db_home1/csmig/mesg
[oracle@orcl1 mesg]$ ls *.msg
ls: cannot access *.msg: No such file or directory

/u01/app/oracle/product/11.2.0/db_home1/css/mesg
[oracle@orcl1 mesg]$ ls *.msg
clssus.msg

/u01/app/oracle/product/11.2.0/db_home1/ctx/mesg
[oracle@orcl1 mesg]$ ls *.msg
drgus.msg

/u01/app/oracle/product/11.2.0/db_home1/has/mesg
[oracle@orcl1 mesg]$ ls *.msg
clsdus.msg  clsgnus.msg  clstus.msg  clsuus.msg  clswus.msg  gipcus.msg  rdeus.msg

/u01/app/oracle/product/11.2.0/db_home1/ldap/mesg
[oracle@orcl1 mesg]$ ls *.msg
ldapus.msg

/u01/app/oracle/product/11.2.0/db_home1/mesg
[oracle@orcl1 mesg]$ ls *.msg
ls: cannot access *.msg: No such file or directory

/u01/app/oracle/product/11.2.0/db_home1/network/mesg
[oracle@orcl1 mesg]$ ls *.msg
naukus.msg  niqus.msg  nmpus.msg  nnfus.msg  snlus.msg
ncrus.msg   nlus.msg   nmrus.msg  nnlus.msg  tnsus.msg

/u01/app/oracle/product/11.2.0/db_home1/nls/mesg
[oracle@orcl1 mesg]$ ls *.msg
lxeus.msg  lxius.msg

/u01/app/oracle/product/11.2.0/db_home1/odbc/mesg
[oracle@orcl1 mesg]$ ls *.msg
ls: cannot access *.msg: No such file or directory

/u01/app/oracle/product/11.2.0/db_home1/olap/mesg
[oracle@orcl1 mesg]$ ls *.msg
ls: cannot access *.msg: No such file or directory

/u01/app/oracle/product/11.2.0/db_home1/opmn/mesg
[oracle@orcl1 mesg]$ ls *.msg
ls: cannot access *.msg: No such file or directory

/u01/app/oracle/product/11.2.0/db_home1/oracore/mesg
[oracle@orcl1 mesg]$ ls *.msg
ldtus.msg  lfius.msg  lmmus.msg  lrmus.msg  ltmus.msg
lemus.msg  lhtus.msg  lpmus.msg  lsfus.msg  tlemus.msg

/u01/app/oracle/product/11.2.0/db_home1/ord/mesg
[oracle@orcl1 mesg]$ ls *.msg
audus.msg  imgus.msg  vidus.msg

/u01/app/oracle/product/11.2.0/db_home1/plsql/mesg
[oracle@orcl1 mesg]$ ls *.msg
pcmus.msg  plsus.msg  plwus.msg

/u01/app/oracle/product/11.2.0/db_home1/precomp/mesg
[oracle@orcl1 mesg]$ ls *.msg
o2fus.msg  o2us.msg   pccus.msg  pcgus.msg  pcsus.msg  pgous.msg  ppeus.msg  prous.msg
o2ius.msg  o2uus.msg  pcfus.msg  pcpus.msg  pg2us.msg  pgpus.msg  pr2us.msg  sqlus.msg

/u01/app/oracle/product/11.2.0/db_home1/racg/mesg
[oracle@orcl1 mesg]$ ls *.msg
clsrus.msg

/u01/app/oracle/product/11.2.0/db_home1/rdbms/mesg
[oracle@orcl1 mesg]$ 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

/u01/app/oracle/product/11.2.0/db_home1/slax/mesg
[oracle@orcl1 mesg]$ ls *.msg
pxus.msg

/u01/app/oracle/product/11.2.0/db_home1/sqlplus/mesg
[oracle@orcl1 mesg]$ ls *.msg
cpyus.msg  sp1us.msg  sp2us.msg

/u01/app/oracle/product/11.2.0/db_home1/srvm/mesg
[oracle@orcl1 mesg]$ ls *.msg
prcaus.msg  prcius.msg  prctus.msg  prkdus.msg  prkpus.msg   procus.msg  sclcus.msg
prccus.msg  prcnus.msg  prcwus.msg  prkeus.msg  prkrus.msg   prveus.msg  sclsus.msg
prcdus.msg  prcqus.msg  prifus.msg  prkhus.msg  prksus.msg   prvfus.msg
prcfus.msg  prcrus.msg  prkaus.msg  prknus.msg  prkuus.msg   prvgus.msg
prchus.msg  prcsus.msg  prkcus.msg  prkous.msg  proclus.msg  prvpus.msg

/u01/app/oracle/product/11.2.0/db_home1/usm/mesg
[oracle@orcl1 mesg]$ ls *.msg
acfskus.msg  acfsus.msg  advmkus.msg  okskus.msg

/u01/app/oracle/product/11.2.0/db_home1/xdk/mesg
[oracle@orcl1 mesg]$ ls *.msg
lpxus.ms  lsxus.msg

以上就是当前版本的所有可以用oerr的类型

cat tnsus.msg我们就可以看到管tns的很多报错代码和信息

这里我们测试下

[oracle@orcl1 mesg]$ oerr tns 12514
12514, 00000, "TNS:listener does not currently know of service requested in connect descri
ptor"// *Cause:  The listener received a request to establish a connection to a
// database or other service. The connect descriptor received by the listener
// specified a service name for a service (usually a database service)
// that either has not yet dynamically registered with the listener or has
// not been statically configured for the listener.  This may be a temporary
// condition such as after the listener has started, but before the database
// instance has registered with the listener.
// *Action:
//  - Wait a moment and try to connect a second time.
//  - Check which services are currently known by the listener by executing:
//    lsnrctl services <listener name>
//  - Check that the SERVICE_NAME parameter in the connect descriptor of the
//    net service name used specifies a service known by the listener.
//  - If an easy connect naming connect identifier was used, check that
//    the service name specified is a service known by the listener.
//  
- Check for an event in the listener.log file.

以上是对oerr的简单认识,有不足的地方还请指点。谢谢!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值