Home  >  Article  >  Database  >  Ubuntu 10.04下64位编译环境下安装Oracle Instant Client

Ubuntu 10.04下64位编译环境下安装Oracle Instant Client

WBOY
WBOYOriginal
2016-06-07 17:03:28872browse

最近想复习下oci编程。以前要想在开发环境下搭建oci开发环境至少需要oracle client。甚是麻烦阿。既然oracle推荐使用instant cli

最近想复习下oci编程。以前要想在开发环境下搭建oci开发环境至少需要Oracle client。甚是麻烦阿。既然oracle推荐使用instant client那就试试吧。昨晚搞好了。把安装过程记录下来:

1.下载instant client 前,注意查看你的编译器是64位的,还是32位的。起初没有在意,下载instant client for linux x86了。结果编译报错,告诉找不到libclntsh.so。所以找不到libclntsh.so不光是环境变量LD_LIBRARY_PATH没有设置对的问题,也可能是32位库文件不能被64位编译器链接的问题。查看编译器版本就能看出是32位还是64位的问题:

    gcc -v:

    Target: x86_64-linux-gnu

2.下载oralce -instantclient11.2-basic -11.2.0.2.0.x86_64.rpm 、oralce -instantclient11.2-sqlplus -11.2.0.2.0.x86_64.rpm、oralce -instantclient11.2-devel-11.2.0.2.0.x86_64.rpm. 然后用 rpm -ivh 命令安装。如果提示需加强制选项,那就加吧。这里用rpm包安装或许不被推荐使用,Ubuntu用压缩包方式安装更简单些。

3.rpm包安装成功后,设置LD_LIBRARY_PATH,ubuntu 10.04下设置.bashrc文件而不是bash_profile

4.最后编译程序,,出人意料的又报错:找不到libaio.so,这个库是干什么用的呢?该包的解释是:This library enables userspace to use Linux kernel asynchronous I/O
system calls, important for the performance of databases and other advanced applications。这个很简单,用新立得找到libaio.so 安装上就ok。

5.最后,最后,编译通过。所需的头文件和库文件也就占了几十兆。头文件用rpm安装后在/usr/include/oracle/11.2/client目录中。库文件用rpm安装后在/usr/lib/oracle/11.2目录下。一定要注意是32位的库还是64位的库。在11.2目录下有client 、client64这两个目录,一个是32位库,一个是64位库。11.2就是用instant client版本号命名的。  

注:下载的版本是version 11.2.0.2.0

linux

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn