我是 Perl 新手,在 Linux OEL 5x 服务器上工作。我正在尝试配置 Perl DB 模块以实现 Oracle 连接(DBD 和 DBI 模块)。有人能帮我完成安装过程吗?
我试过 CPAN,但效果并不好。任何帮助都非常感谢。我不太确定我需要初始化除和之外的任何$LD_LIBRARY_PATH
变量$ORACLE_HOME
以下是我的观察:
问题:使用 DBI 模块连接到 Oracle 时遇到以下问题:
install_driver(Oracle) failed: Can't locate loadable object for module DBD::Oracle in @INC (@INC contains: /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi /usr/lib/perl5/site_perl/5.8.8 /usr/lib/perl5/site_perl /usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.8 /usr/lib/perl5/vendor_perl /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi /usr/lib/perl5/5.8.8 .) at (eval 3) line 3
Compilation failed in require at (eval 3) line 3.
Perhaps a module that DBD::Oracle requires hasn't been fully installed
at connectdb.pl line 57
我已经安装了 Oracle 的 DBD/usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/DBD/DBD-Oracle-1.50
您能否看一下这些步骤并纠正我,如果我错了:
观察结果:
$ echo $LD_LIBRARY_PATH
/opt/CA/UnicenterAutoSysJM/autosys/lib:/opt/CA/SharedComponents/Csam/SockAdapter/lib:/opt/CA/SharedComponents/ETPKI/lib:/opt/CA/CAlib
$ echo $ORACLE_HOME
/usr/local/oracle/ORA
这是我尝试安装 DBD 模块的方法:
- 下载适用于 Oracle 的 DBD 1.50 文件
- 复制到 /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/DBD
- 解压并 Makefile.PL
。
Message: Using DBI 1.52 (for perl 5.008008 on x86_64-linux-thread-multi) installed in /usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi/auto/DBI/
Configuring DBD::Oracle for perl 5.008008 on linux (x86_64-linux-thread-multi)
Remember to actually *READ* the README file! Especially if you have any problems.
Installing on a linux, Ver#2.6
Using Oracle in /opt/oracle/product/10.2
DEFINE _SQLPLUS_RELEASE = "1002000400" (CHAR)
Oracle version 10.2.0.4 (10.2)
Found /opt/oracle/product/10.2/rdbms/demo/demo_rdbms.mk
Found /opt/oracle/product/10.2/rdbms/demo/demo_rdbms64.mk
Found /opt/oracle/product/10.2/rdbms/lib/ins_rdbms.mk
Using /opt/oracle/product/10.2/rdbms/demo/demo_rdbms.mk
Your LD_LIBRARY_PATH env var is set to '/usr/local/oracle/ORA/lib:/usr/dt/lib:/usr/openwin/lib:/usr/local/oracle/ORA/ows/cartx/wodbc/1.0/util/lib:/usr/local/oracle/ORA/lib:/usr/local/sybase/OCS-12_0/lib:/usr/local/sybase/lib:/home/oracle/jdbc/jdbcoci73/lib:./'
WARNING: Your LD_LIBRARY_PATH env var doesn't include '/opt/oracle/product/10.2/lib' but probably needs to.
Reading /opt/oracle/product/10.2/rdbms/demo/demo_rdbms.mk
Reading /usr/local/oracle/ORA/rdbms/lib/env_rdbms.mk
Attempting to discover Oracle OCI build rules
sh: make: command not found
by executing: [make -f /opt/oracle/product/10.2/rdbms/demo/demo_rdbms.mk build ECHODO=echo ECHO=echo GENCLNTSH='echo genclntsh' CC=true OPTIMIZE= CCFLAGS= EXE=DBD_ORA_EXE OBJS=DBD_ORA_OBJ.o]
WARNING: Oracle build rule discovery failed (32512)
Add path to make command into your PATH environment variable.
Oracle oci build prolog:
[sh: make: command not found]
Oracle oci build command:
[]
WARNING: Unable to interpret Oracle build commands from /opt/oracle/product/10.2/rdbms/demo/demo_rdbms.mk.
(Will continue by using fallback approach.)
Please report this to [email protected]. See README for what to include.
Found header files in /opt/oracle/product/10.2/rdbms/public.
client_version=10.2
DEFINE= -Wall -Wno-comment -DUTF8_SUPPORT -DORA_OCI_VERSION=\"10.2.0.4\" -DORA_OCI_102
Checking for functioning wait.ph
System: perl5.008008 linux ca-build9.us.oracle.com 2.6.20-1.3002.fc6xen #1 smp thu apr 30 18:08:39 pdt 2009 x86_64 x86_64 x86_64 gnulinux
Compiler: gcc -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -Wdeclaration-after-statement -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm
Linker: not found
Sysliblist: -ldl -lm -lpthread -lnsl -lirc
Oracle makefiles would have used these definitions but we override them:
CC: cc
CFLAGS: $(GFLAG) $(OPTIMIZE) $(CDEBUG) $(CCFLAGS) $(PFLAGS)\
$(SHARED_CFLAG) $(USRFLAGS)
[$(GFLAG) -O3 $(CDEBUG) -m32 $(TRIGRAPHS_CCFLAGS) -fPIC -I/usr/local/oracle/ORA/rdbms/demo -I/usr/local/oracle/ORA/rdbms/public -I/usr/local/oracle/ORA/plsql/public -I/usr/local/oracle/ORA/network/public -DLINUX -D_GNU_SOURCE -D_LARGEFILE64_SOURCE=1 -D_LARGEFILE_SOURCE=1 -DSLTS_ENABLE -DSLMXMX_ENABLE -D_REENTRANT -DNS_THREADS -fno-strict-aliasing $(LPFLAGS) $(USRFLAGS)]
build: $(CC) $(ORALIBPATH) -o $(EXE) $(OBJS) $(OCISHAREDLIBS)
[ cc -L$(LIBHOME) -L/usr/local/oracle/ORA/rdbms/lib/ -o $(EXE) $(OBJS) -lclntsh $(EXPDLIBS) $(EXOSLIBS) -ldl -lm -lpthread -lnsl -lirc -ldl -lm $(USRLIBS) -lpthread]
LDFLAGS: $(LDFLAGS32)
[-m32 -o $@ -L/usr/local/oracle/ORA/rdbms//lib32/ -L/usr/local/oracle/ORA/lib32/ -L/usr/local/oracle/ORA/lib32/stubs/]
Linking with /usr/local/oracle/ORA/rdbms/lib/defopt.o -lclntsh -ldl -lm -lpthread -lnsl -lirc -ldl -lm -lpthread [from $(DEF_OPT) $(OCISHAREDLIBS)]
Checking if your kit is complete...
Looks good
LD_RUN_PATH=/usr/local/oracle/ORA/lib
Using DBD::Oracle 1.50.
Using DBD::Oracle 1.50.
Using DBI 1.52 (for perl 5.008008 on x86_64-linux-thread-multi) installed in /usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi/auto/DBI/
Writing Makefile for DBD::Oracle
Writing MYMETA.yml and MYMETA.json
*** If you have problems...
read all the log printed above, and the README and README.help.txt files.
(Of course, you have read README by now anyway, haven't you?)
答案1
这是 Perl 的一个相当老的版本(2006 年 1 月发布)。我确实设法让每个组件的类似版本都运行起来,但它从未通过构建测试。除了您的 LD_LIBRARY_PATH(某些系统使用 64 位版本)和 ORACLE_HOME 之外,我还必须小心使用默认字符集和语言环境才能使其正常工作。还要小心拥有多个主目录。最后,我单独安装了 Oracle 的 Instant Client,并通过 tnsnames 定义了真实实例。
稍后使用较新的软件在非常相似的系统上重新执行此操作要容易得多。因此,如果可能的话,请升级或使用 Instant Client 以获得更简单的环境。
答案2
请阅读我撰写的这篇文章如何安装 DBD::Oracle。
它包含安装 DBD::Oracle CPAN 模块所需的所有步骤,这不是一个简单的安装。目的是减少麻烦并将其变成可重复的过程。
希望它能够有所帮助,同时也让我为伟大的 Perl 社区做出贡献。