当前位置: 首页 > 工具软件 > Cego-DBD > 使用案例 >

linux下安装oracle-client 和 DBD::Oracle和DBD::Pg

戚俊人
2023-12-01

到http://www.oracle.com/technetwork/topics/linuxx86-64soft-092277.html下载四个文件:

oracle-instantclient11.2-basic-11.2.0.3.0-1.x86_64.rpm
oracle-instantclient11.2-odbc-11.2.0.3.0-1.x86_64.rpm
oracle-instantclient11.2-sqlplus-11.2.0.3.0-1.x86_64.rpm
oracle-instantclient11.2-devel-11.2.0.3.0-1.x86_64.rpm


安装下载的文件:

root@localhost:~# rpm -i oracle-instantclient11.2-basic-11.2.0.3.0-1.x86_64.rpm
root@localhost:~#rpm -i oracle-instantclient11.2-odbc-11.2.0.3.0-1.x86_64.rpm
root@localhost:~#rpm -i oracle-instantclient11.2-sqlplus-11.2.0.3.0-1.x86_64.rpm
root@localhost:~#rpm -i oracle-instantclient11.2-devel-11.2.0.3.0-1.x86_64.rpm


设置环境变量:

export ORACLE_HOME=/usr/lib/oracle/12.1/client64
export TNS_ADMIN=$ORACLE_HOME/network
export NLS_LANG=AMERICAN_AMERICA.UTF8
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export PATH=$ORACLE_HOME/bin:$PATH
export OCI_HOME=/usr/lib/oracle/12.1/client64
export OCI_LIB_DIR=$OCI_HOME/lib
export OCI_INCLUDE_DIR=/usr/include/oracle/12.1/client64
export OCI_VERSON=12
export ORA_SDTZ="+08:00"
export TZ="+08:00"

建立软链接:

创建软连接(如果安装不同版本,则相应的文件名也有变动):
cd /usr/lib/oracle/12.1/client64/lib/
ln –s libclntsh.so.12.1 libclntsh.so 
ln –s libocci.so.12.1 libocci.so


cd /usr/lib
ln –s /usr/lib/oracle/12.1/client64/lib/libclntsh.so.12.1 libclntsh.so.12.1
ln –s /usr/lib/oracle/12.1/client64/lib/libocci.so.12.1 libocci.so.12.1


下载DBD::Oracle的perl包:

$sudo yum install perl-CPAN

$sudo perl -MCPAN -e shell

cpan[1]>install YAML

cpan[1]>install DBI

cpan[1]>get DBD::Oracle


编译安装DBD::Oracle(使用CPAN安装会出错,手动编译时,加入参数-l):

$cd .cpan/sources/authors/id/P/PY/PYTHIAN

$tar xzvf .cpan/sources/authors/id/P/PY/PYTHIANDBD-Oracle-1.74.tar.gz

$cd DBD-Oracle-1.74

$perl Makefile.PL -l

$make && make test

$sudo make install


安装Postgresql:

#yum install postgresql postgresql-devel

安装DBD::Pg:

cpan[1]>install DBD::Pg

 类似资料: