错误提示
./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得出
[[email protected] DBD-Oracle-1.74]# export ORACLE_HOME=/home/oracle/app/oracle/product/11.2.0/dbhome_1
[[email protected] DBD-Oracle-1.74]# echo $ORACLE_HOME
然后Make&&Make install
再su - oracle用户下执行check_oracle_health命令查看结果
[[email protected] 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
表明已经成功!