oracle -239报错,解决: ./check_oracle_health --connect orcl --mode connection-time 报错的问题...

错误提示

./check_oracle_health --connect orcl --mode connection-time

CRITICAL - cannot connect to orcl. install_driver(Oracle) failed: Can't locate DBD/Oracle.pm in @INC (@INC contains: . /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5) at (eval 18) line 3.

Perhaps the DBD::Oracle perl module hasn't been fully installed,

or perhaps the capitalisation of 'Oracle' isn't right.

Available drivers: DBM, ExampleP, File, Gofer, Proxy, Sponge, mysql.

at ./check_oracle_health line 5891

解决 install_driver oracle failed can't locate dbd/oracle.pm in @inc

两种方法,这个可以用上面的方法下截

cpan[1]:install DBD::Oracle  可能不能直接安装原因如下:

……

Running make install

Make had some problems, won't install

Could not read '/root/.cpan/build/DBD-Oracle-1.74-Zrp_Am/META.yml'. Falling back to other methods to determine prerequisites

Failed during this command:

PYTHIAN/DBD-Oracle-1.74.tar.gz               : writemakefile NO '/usr/bin/perl Makefile.PL INSTALLDIRS=site' returned status 512

但是包已经下载下来了,可以查看下载记录

正在保存至: “/root/.cpan/sources/authors/id/P/PY/PYTHIAN/DBD-Oracle-1.74.tar.tmp27681”

可以以find查找可得 /root/.cpan/sources/authors/id/P/PY/PYTHIAN/DBD-Oracle-1.74.tar.gz

然后移动当前目录 :mv /root/.cpan/sources/authors/id/P/PY/PYTHIAN/DBD-Oracle-1.74.tar.gz ../

tar xvzf DBD-Oracle-1.74.tar.gz 注意文件夹权限

cd 后make提示:make: *** 没有指明目标并且找不到 makefile。 停止。

查询后得之:要先编译:这里用perl编译:perl Makefile.PL  [.PL是perl的可执行文件,可以ll查看,其它安装方法可以查看解压包里的INSTALL文件说明]

因为要与oracle的目录相关 即环境变量要加载$ORACLE_HOME 可以echo得出

[root@localhost DBD-Oracle-1.74]# export ORACLE_HOME=/home/oracle/app/oracle/product/11.2.0/dbhome_1

[root@localhost DBD-Oracle-1.74]# echo $ORACLE_HOME

然后Make&&Make install

再su - oracle用户下执行check_oracle_health命令查看结果

[oracle@localhost libexec]$ ./check_oracle_health --connect orcl --mode connection-time --user ****** --password ******

OK - 0.08 seconds to connect as YOUGOU_CC | connection_time=0.0832;1;5

表明已经成功!

cbdb4e6728f981f91891310a075a5334.png

如果报以下错误可以检查一下相应的目录文件

1、CRITICAL - cannot connect to orcl. install_driver(Oracle) failed: DBD::Oracle object version 1.20 does not match bootstrap parameter 1.74 at /usr/lib64/perl5/DynaLoader.pm line 239.

Compilation failed in require at (eval 18) line 3.

at ./check_oracle_health line 5891

可能是安装的DBD::Oracle模块的版本问题,看一下目录/usr/local/nagios/DBD-Oracle-1.74/blib/arch/auto/DBD/Oracle/Oracle.so 文件与安装的Oracle版本自带的Oracle.so不一置,这个和程序的环境变量有关看你用那一个了,最好是一置,我的是DBD-Oracle.tar.gz故执行文件也得是这个1.74的Oracle.so

一定不要cp $ORACLE_HOME/perl/lib/site_perl/5.10.0/x86_64-linux-thread-multi/auto/DBD/Oracle/Oracle.so

# echo $ORACLE_HOME/lib >> /etc/ld.so.conf

# ldconfig

类似

ldconfig: 文件 /home/oracle/app/product/11.2.0/dbhome_1/lib/libnmefdms.so.0 为空,未检查。

……

ldconfig: /home/oracle/app/product/11.2.0/dbhome_1/lib/libexpat.so.1 不是符号连接

再次执行命令一般都OK了……

OK - 0.29 seconds to connect as YOUGOU_CC | connection_time=0.2922;1;5

显示成功;

-------------------

2、Time::HiRes object version 1.9726 does not match $Time::HiRes::XS_VERSION 1.9712 at /usr/lib64/perl5/DynaLoader.pm line 239.

Compilation failed in require at ./check_oracle_health line 4746.

BEGIN failed--compilation aborted at ./check_oracle_health line 4746.

类似这样的报错是因为HiRes.pm模块版本问题,要么重装要么拷一下之前perl -MCPAN -s shell 下载来的那个文件/root/.cpan/build/Time-HiRes-1.9726-euaQ_5/HiRes.pm覆盖目录 /usr/local/lib64/perl5/Time/下的解决之。

3、./check_oracle_health --connect orcl --mode tnsping

DynaLoader object version 1.10 does not match $DynaLoader::VERSION 1.08 at /usr/lib64/perl5/DynaLoader.pm line 93.

Compilation failed in require at /usr/local/lib64/perl5/Time/HiRes.pm line 7.

Compilation failed in require at ./check_oracle_health line 4746.

BEGIN failed--compilation aborted at ./check_oracle_health line 4746.

表示DynaLoader索引版本不一致需要1.10的版本,当前为1.08,下载相应版本解决,或者直接替换DynaLoader.pm解决。附文件 存放或者替换目录/usr/lib64/perl5/DynaLoader.pm即可。

你可能感兴趣的:(oracle,-239报错)