首页 > 代码库 > Redhat 6.2安装Oracle 11gclient及遇到的问题分析

Redhat 6.2安装Oracle 11gclient及遇到的问题分析

昨天在Redhat6.2(64 bit)上安装oracle 11.2.0.1.0 client(32 bit),下面是安装中碰到的一些问题及处理过程记录

首先解压缩安装包,会生成一个client文件夹,执行runInstaller时报错,错误例如以下:

[oracle@Ptyjkweb oracle]$ ls -l
total 627612
drwxr-xr-x. 6 oracle oinstall      4096 Aug 19  2009 client
-rwxrwxr-x. 1 oracle oinstall 642016988 Jul  7 14:53 linux_11gR2_client.zip
drwxrwxr-x. 2 oracle oinstall     16384 Jul  7 11:01 lost+found
[oracle@Ptyjkweb oracle]$ cd client/
[oracle@Ptyjkweb client]$ ls -l
total 28
drwxr-xr-x.  8 oracle oinstall 4096 Aug 17  2009 doc
drwxr-xr-x.  4 oracle oinstall 4096 Aug 14  2009 install
drwxrwxr-x.  2 oracle oinstall 4096 Aug 14  2009 response
-rwxr-xr-x.  1 oracle oinstall 4356 Aug 14  2009 runInstaller
drwxr-xr-x. 14 oracle oinstall 4096 Aug 14  2009 stage
-rw-r--r--.  1 oracle oinstall 3891 Aug 18  2009 welcome.html

[oracle@Ptyjkweb client]$ ./runInstaller 
Starting Oracle Universal Installer...

Checking Temp space: must be greater than 80 MB.   Actual 11574 MB    Passed
Checking swap space: must be greater than 150 MB.   Actual 8191 MB    Passed
Checking monitor: must be configured to display at least 256 colors.    Actual 16777216    Passed
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2015-07-07_02-55-47PM. Please wait ...[oracle@Ptyjkweb client]$ Exception in thread "main" java.lang.UnsatisfiedLinkError: /tmp/OraInstall2015-07-07_02-55-47PM/jdk/jre/lib/i386/xawt/libmawt.so: libXext.so.6: cannot open shared object file: No such file or directory
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1751)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1647)
at java.lang.Runtime.load0(Runtime.java:769)
at java.lang.System.load(System.java:968)
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1751)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1668)
at java.lang.Runtime.loadLibrary0(Runtime.java:822)
at java.lang.System.loadLibrary(System.java:993)
at sun.security.action.LoadLibraryAction.run(LoadLibraryAction.java:50)
at java.security.AccessController.doPrivileged(Native Method)
at java.awt.Toolkit.loadLibraries(Toolkit.java:1509)
at java.awt.Toolkit.<clinit>(Toolkit.java:1530)
at com.jgoodies.looks.LookUtils.isLowResolution(Unknown Source)
at com.jgoodies.looks.LookUtils.<clinit>(Unknown Source)
at com.jgoodies.looks.plastic.PlasticLookAndFeel.<clinit>(PlasticLookAndFeel.java:122)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:242)
at javax.swing.SwingUtilities.loadSystemClass(SwingUtilities.java:1783)
at javax.swing.UIManager.setLookAndFeel(UIManager.java:480)
at oracle.install.commons.util.Application.startup(Application.java:758)
at oracle.install.commons.flow.FlowApplication.startup(FlowApplication.java:164)
at oracle.install.commons.flow.FlowApplication.startup(FlowApplication.java:181)
at oracle.install.commons.base.driver.common.Installer.startup(Installer.java:265)
at oracle.install.ivw.client.driver.ClientInstaller.startup(ClientInstaller.java:85)
at oracle.install.ivw.client.driver.ClientInstaller.main(ClientInstaller.java:95)

[oracle@Ptyjkweb client]$ cd /tmp/OraInstall2015-07-07_04-07-33PM/jdk/jre/lib/i386/xawt
[oracle@Ptyjkweb xawt]$ ls -l
total 3276
-rwxr-x---. 1 oracle oinstall 3149094 May  6  2009 libmawt_g.so
-rwxr-x---. 1 oracle oinstall  200888 May  6  2009 libmawt.so
[oracle@Ptyjkweb xawt]$ rpm -qa|grep libXext
libXext-devel-1.1-3.el6.x86_64
libXext-1.1-3.el6.x86_64

能够看到libmawt.so是有的,因为操作系统是64位的。之前也装了64位的libXert包,可是仍然报找不到libXext.so.6

[root@Ptyjkweb Packages]# rpm -ivh libXext-1.1-3.el6.i686 
Preparing...                ########################################### [100%]
   1:libXext                 ########################################### [100%]
[root@Ptyjkweb Packages]# rpm -ivh libXext-devel-1.1-3.el6.i686 
Preparing...                ########################################### [100%]
   1:libXext-devel           ########################################### [100%]

[oracle@Ptyjkweb ~]# rpm -qa|grep libXext
libXext-devel-1.1-3.el6.i686
libXext-devel-1.1-3.el6.x86_64
libXext-1.1-3.el6.x86_64
libXext-1.1-3.el6.i686

最后将32位的libXext包也安装上才得以解决,并顺利进入图形界面

在图形界面中报了一个OS内核设置错误。能够以root执行runfixup.sh脚本自己主动修复。pdksh-5.2.14这个包能够忽略,Swap Size也能够忽略

技术分享

[root@Ptyjkweb ~]# /tmp/CVU_11.2.0.1.0_oracle/runfixup.sh
Response file being used is :/tmp/CVU_11.2.0.1.0_oracle/fixup.response
Enable file being used is :/tmp/CVU_11.2.0.1.0_oracle/fixup.enable
Log file location: /tmp/CVU_11.2.0.1.0_oracle/orarun.log
Setting Kernel Parameters...
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 1024 65000
net.core.rmem_default = 262144
net.core.wmem_default = 262144
net.core.rmem_max = 4194304

然后依据提示运行orainstRoot.sh脚本赋予文件夹权限

[root@Ptyjkweb ~]# /oracle/oraInventory/orainstRoot.sh 
Changing permissions of /oracle/oraInventory.
Adding read,write permissions for group.
Removing read,write,execute permissions for world.

Changing groupname of /oracle/oraInventory to oinstall.
The execution of the script is complete.

加入环境变量时注意,因为之前安装的是InstantClient模式,所以在ORACLE_HOME中并没有bin文件夹和lib文件夹。因此指定PATH的时候是$ORACLE_HOME而不是$ORACLE_HOME/bin,以及LD_LIBRARY_PATH是$ORACLE_HOME,而不是$ORACLE_HOME/lib

[oracle@Ptyjkweb client_1]$ vi ~/.bash_profile

export TMP=/tmp
export TMPDIR=/tmp
export ORACLE_BASE=/oracle
export ORACLE_HOME=$ORACLE_BASE/client_1
export PATH=$ORACLE_HOME:$PATH
export TNS_ADMIN=$ORACLE_HOME
export LD_LIBRARY_PATH=$ORACLE_HOME

[oracle@Ptyjkweb client_1]$ source ~/.bash_profile
[oracle@Ptyjkweb client_1]$ sqlplus / as sysdba
sqlplus: error while loading shared libraries: libsqlplus.so: cannot open shared object file: No such file or directory

[oracle@Ptyjkweb ~]$ cd $ORACLE_HOME
[oracle@Ptyjkweb client_1]$ ls -l
total 145060
-rwxr-xr-x.  1 oracle oinstall    21865 Aug 13  2009 adrci
drwxr-xr-x.  3 oracle oinstall     4096 Jul  8 09:50 cfgtoollogs
drwxr-xr-x.  3 oracle oinstall     4096 Jul  8 09:49 install
-rw-r--r--.  1 oracle oinstall       37 Jul  8 09:49 install.platform
drwxrwx---. 13 oracle oinstall     4096 Jul  8 09:49 inventory
-rw-r--r--.  1 oracle oinstall 40088477 Aug 13  2009 libclntsh.so.11.1
-rw-r--r--.  1 oracle oinstall    11227 Jul 31  2009 libheteroxa11.so
-rw-r--r--.  1 oracle oinstall  6986848 Aug  2  2009 libnnz11.so
-rw-r--r--.  1 oracle oinstall  1879549 Aug 13  2009 libocci.so.11.1
-rw-r--r--.  1 oracle oinstall 89377610 Aug 13  2009 libociei.so
-rw-r--r--.  1 oracle oinstall   152304 Jul 31  2009 libocijdbc11.so
-rw-r--r--.  1 oracle oinstall  1501651 Aug  1  2009 libsqlplusic.so
-rw-r--r--.  1 oracle oinstall  1218075 Aug  1  2009 libsqlplus.so
-rw-r--r--.  1 oracle oinstall   777979 Aug 13  2009 libsqora.so.11.1
drwxr-xr-x.  2 oracle oinstall     4096 Jul  8 09:49 light
drwxr-xr-x.  3 oracle oinstall     4096 Jul  8 09:49 odbc
-rw-r--r--.  1 oracle oinstall  1996228 Jul 31  2009 ojdbc5.jar
-rw-r--r--.  1 oracle oinstall  2111220 Jul 31  2009 ojdbc6.jar
-rw-r--r--.  1 oracle oinstall  1656280 Aug  2  2009 orai18n.jar
-rw-r--r--.  1 oracle oinstall    82983 Aug  2  2009 orai18n-mapping.jar
-rw-r-----.  1 oracle oinstall       55 Jul  8 09:48 oraInst.loc
-rwxr-xr-x.  1 oracle oinstall     6909 Aug  1  2009 sqlplus
-rwxr-xr-x.  1 oracle oinstall   377507 Aug 13  2009 wrc
-rw-r--r--.  1 oracle oinstall    37807 Aug 13  2009 xstreams.jar

此处假设提示找不到libsqlplus.so文件,并非由于缺少包,而是由于没有指定LD_LIBRARY_PATH环境变量。或是指定错了位置(指定到了$ORALCE_HOME/lib下)

[oracle@Ptyjkweb client_1]$ ldd sqlplus
linux-gate.so.1 =>  (0x00322000)
libsqlplus.so => not found
libclntsh.so.11.1 => not found
libnnz11.so => not found
libdl.so.2 => /lib/libdl.so.2 (0x00bd3000)
libm.so.6 => /lib/libm.so.6 (0x00147000)
libpthread.so.0 => /lib/libpthread.so.0 (0x0021f000)
libnsl.so.1 => /lib/libnsl.so.1 (0x00110000)
libc.so.6 => /lib/libc.so.6 (0x00745000)
/lib/ld-linux.so.2 (0x00476000)
libaio.so.1 => not found

此时会发现有4个库文件为“not found”状态。而一旦LD_LIBRARY_PATH环境变量配置正确。上面3个库文件就会链接正常,例如以下:

[oracle@Ptyjkweb client_1]$ sqlplus / as sysdba
sqlplus: error while loading shared libraries: libaio.so.1: cannot open shared object file: No such file or directory

[oracle@Ptyjkweb logs]$ which sqlplus
/oracle/client_1/sqlplus
[oracle@Ptyjkweb logs]$ cd /oracle/client_1/
[oracle@Ptyjkweb client_1]$ ldd sqlplus
linux-gate.so.1 =>  (0x00322000)
libsqlplus.so => /oracle/client_1/libsqlplus.so (0x003ac000)
libclntsh.so.11.1 => /oracle/client_1/libclntsh.so.11.1 (0xf5a23000)
libnnz11.so => /oracle/client_1/libnnz11.so (0x004f8000)
libdl.so.2 => /lib/libdl.so.2 (0x00bd3000)
libm.so.6 => /lib/libm.so.6 (0x00147000)
libpthread.so.0 => /lib/libpthread.so.0 (0x0021f000)
libnsl.so.1 => /lib/libnsl.so.1 (0x00110000)
libc.so.6 => /lib/libc.so.6 (0x00745000)
/lib/ld-linux.so.2 (0x00476000)
libaio.so.1 => not found

如今仅仅剩下libio.so.1这个库文件无法正常链接,事实上也是由于缺少安装包,眼下也仅安装了64位的包

[oracle@Ptyjkweb client_1]$ rpm -qa --queryformat "%{NAME}-%{VERSION}.%{RELEASE} (%{ARCH})\n" | grep libaio
libaio-0.3.107-10.el6.x86_64
libaio-devel-0.3.107-10.el6.x86_64

曾尝试直接从别的11g库(64 bit)中将libaio.so.1文件复制到/oracle/client_1文件夹下,运行sqlplus时会报下面错误:
sqlplus: error while loading shared libraries: libaio.so.1: wrong ELF class: ELFCLASS64

[root@Ptyjkweb Packages]# pwd
/mnt/Server/Packages
[root@Ptyjkweb Packages]# ls -l |grep libaio
-r--r--r--. 201 root root    21664 Aug 17  2010 libaio-0.3.107-10.el6.i686.rpm
-r--r--r--. 149 root root    21752 Aug 17  2010 libaio-0.3.107-10.el6.x86_64.rpm
-r--r--r--. 173 root root    13580 Aug 17  2010 libaio-devel-0.3.107-10.el6.i686.rpm
-r--r--r--. 128 root root    13516 Aug 17  2010 libaio-devel-0.3.107-10.el6.x86_64.rpm
[root@Ptyjkweb Packages]# rpm -ivh libaio-0.3.107-10.el6.i686.rpm 
Preparing...                ########################################### [100%]
   1:libaio                 ########################################### [100%]
[root@Ptyjkweb Packages]# rpm -ivh libaio-devel-0.3.107-10.el6.i686.rpm 
Preparing...                ########################################### [100%]
   1:libaio-devel           ########################################### [100%]
[root@Ptyjkweb Packages]# rpm -qa --queryformat "%{NAME}-%{VERSION}.%{RELEASE} (%{ARCH})\n" | grep libaio
libaio-0.3.107.10.el6 (x86_64)
libaio-devel-0.3.107.10.el6 (x86_64)
libaio-0.3.107.10.el6 (i686)
libaio-devel-0.3.107.10.el6 (i686)
[oracle@Ptyjkweb ~]$ ldd `which sqlplus`
linux-gate.so.1 =>  (0x00747000)
libsqlplus.so => /oracle/client_1/libsqlplus.so (0x002c0000)
libclntsh.so.11.1 => /oracle/client_1/libclntsh.so.11.1 (0xf5a31000)
libnnz11.so => /oracle/client_1/libnnz11.so (0x00c35000)
libdl.so.2 => /lib/libdl.so.2 (0x00f51000)
libm.so.6 => /lib/libm.so.6 (0x00110000)
libpthread.so.0 => /lib/libpthread.so.0 (0x0013a000)
libnsl.so.1 => /lib/libnsl.so.1 (0x00a62000)
libc.so.6 => /lib/libc.so.6 (0x00498000)
libaio.so.1 => /lib/libaio.so.1 (0x009b0000)
/lib/ld-linux.so.2 (0x00476000)
[oracle@Ptyjkweb client_1]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Wed Jul 8 13:53:30 2015

Copyright (c) 1982, 2009, Oracle.  All rights reserved.

ERROR:
ORA-12162: TNS:net service name is incorrectly specified


Enter user-name: 

这是因为还未配置tnsnames.ora,使用/nolog登陆就不会报错

[oracle@Ptyjkweb client_1]$ sqlplus /nolog

SQL*Plus: Release 11.2.0.1.0 Production on Wed Jul 8 13:56:19 2015

Copyright (c) 1982, 2009, Oracle.  All rights reserved.

SQL> 

至此。Oracle 11gclient顺利安装完成,整个过程能够发现,出现的一些问题主要还是因为缺少安装包造成的。当然,环境变量配置不当也是一部分原因。




Redhat 6.2安装Oracle 11gclient及遇到的问题分析