Oracle 11g R2 在linux静默命令行安装失败报错处理
【报错信息】
oracle安装后查看$oracle_HOME/oraInventory/log/ installActions2019-05-31_07-58-37PM.log,信息如下:
信息: Since the option is to overwrite the existing /home/oracle/app/oracle/product/11.2.0/dbhome_1/cfgtoollogs/configToolAllCommands file, backing it up
信息: The backed up file name is /home/oracle/app/oracle/product/11.2.0/dbhome_1/cfgtoollogs/configToolAllCommands.bak
信息: Entering ConfigClient.executeToolsInAggregate method
信息: ConfigClient.executeToolsInAggregate oAggregate=oracle.server:oracle.server:11.2.0.1.0:common
信息: Entering ConfigClient.assignAction method
信息: ConfigClient.assignAction actionref=[Loracle.sysman.emCfg.common.IActionReference;@6ccf3e
信息: ConfigClient.assignAction action is of type :configuration
信息: Exiting ConfigClient.assignAction method
信息: ConfigClient.executeToolsInAggregate action assigned
信息: Started Plugin named: Oracle Net Configuration Assistant
信息: Found associated job
信息: Starting ‘Oracle Net Configuration Assistant’
信息: Starting ‘Oracle Net Configuration Assistant’
信息: UnsatisfiedLinkError exception loading native library: njni11
信息: java.lang.UnsatisfiedLinkError: /home/oracle/app/oracle/product/11.2.0/dbhome_1/lib/libnjni11.so: libclntsh.so.11.1: cannot open shared object file: No such file or directory
警告: java.lang.UnsatisfiedLinkError: jniGetOracleHome
警告: at oracle.net.common.NetGetEnv.jniGetOracleHome(Native Method)
警告: at oracle.net.common.NetGetEnv.getOracleHome(Unknown Source)
警告: at oracle.net.ca.NetCALogger.getOracleHome(NetCALogger.java:230)
警告: at oracle.net.ca.NetCALogger.initOracleParameters(NetCALogger.java:215)
警告: at oracle.net.ca.NetCALogger.initLogger(NetCALogger.java:130)
警告: at oracle.net.ca.NetCA.main(NetCA.java:404)
信息: Error: jniGetOracleHome
信息: Oracle Net Services 配置失败。退出代码是1
信息:
警告:
信息: Completed Plugin named: Oracle Net Configuration Assistant
信息: Oracle Net Configuration Assistant 失败。
信息: Oracle Net Configuration Assistant 失败。
信息: ConfigClient.executeToolsInAggregate action performed
信息: Exiting ConfigClient.executeToolsInAggregate method
信息: Calling event ConfigToolsExecuted
……
信息: Exit Status is 0
信息: Shutdown Oracle Database 11g 发行版 2 安装程序
从日志可知,oracle安装失败。
【分析】
参考:https://blog.csdn.net/qyweiyy88/article/details/6362429查找系统库文件情况:
root@oracle logs]# rpm -qa|grep glib*
glibc-common-2.17-260.el7_6.5.x86_64
glibc-2.17-260.el7_6.5.i686
glib2-2.40.0-4.el7.x86_64
glibc-2.17-260.el7_6.5.x86_64
glibc-devel-2.17-260.el7_6.5.x86_64
dbus-glib-0.100-7.el7.x86_64
glib-networking-2.40.0-1.el7.x86_64
glibc-headers-2.17-260.el7_6.5.x86_64
glibc和glibc-devel包已安装,搜索glibc-devel,未找到源,注意64位的系统需要安装32位对应的包。
手动下载glibc-devel 32位包,地址如下:
https://centos.pkgs.org/7/centos-updates-x86_64/glibc-devel-2.17-260.el7_6.5.i686.rpm.html
下载包:glibc-devel-2.17-260.el7_6.5.i686.rpm
安装:rpm -i glibc-devel-2.17-260.el7_6.5.i686.rpm
重新连一下:su - oracle然后$ORACLE_HOME/bin/relink all
3分钟后执行结束,可查看以下信息提示的log文件验证:
writing relink log to: /home/oracle/app/oracle/product/11.2.0/dbhome_1/install/relink.log
【处理】
1、将下载好的包通过lrzsz命令工具中的rz上传到oracle主机中,rpm -i安装
2、删除$ORACLE_HOME/下所有文件,重新创建目录:
#mkdir -p /home/oracle/app/oracle //主程序目录
#mkdir /home/oracle/app/oradata //数据文件存放目录(应至少大于20G);也可存放数据库控制文件和 -新增redo日志组成员文件;但考虑冗余,一般分开存放,且不同分区
#mkdir -p /home/oracle/app/oracle/product/11.2.0/dbhome_1 //安装目录,即主(家)目录
#mkdir -p /home/oracle/app/oracle/recovery_data //数据恢复目录,
#mkdir -p /home/oracle/app/oraInventory //数据库创建及使用过程中的日志目录
3、重新授予这些目录权限:
#chown -R oracle:dba /home/oracle/app
#chmod -R 775 /home/oracle/app
4、重新安装oracle:
#su - oracle
$./runInstaller -silent -ignorePrereq -responseFile /var/tmp/database/response/db_install.rsp
注:
其中-silent指的是静默安装,-ignorePrereq忽略prerequisite的检查结果,responseFile是安装文件。
等待20分钟左右,或新开一终端查看/home/oracle/app/oraInventory/logs/installActions2019-05-31_09-42-39PM.log
在日志尾部会看到以下内容:
信息: 安装阶段 2 JRE files in Scratch :0
信息: Checkpoint:Failed Checkpoint found returning it for getAllFailedCheckPoints.
信息: Checkpoint:Failed Checkpoint found returning null for getLastFailedCheckPoint.
信息: Checkpoint:Index file written and updated
信息: OiicSaveInvWCCE:Before saving the inventory. This is a install session.
信息: OiicSaveInvWCCE:Before saving the inventory. The platform is unix.
信息: OiicSaveInvWCCE:Before saving the inventory. The root.sh location is /home/oracle/app/oracle/product/11.2.0/dbhome_1/root.sh
信息: OiicSaveInvWCCE:Before saving the inventory. The root.sh location exists.
信息: 初始化 OUI 存储产品清单
5、查看两个脚本文件:
1)$ORACLE_HOME/root.sh文件:
2)……/oraInventory/orainstRoot.sh文件:
至此可初步判断oracle安装成功,接下来需要执行这两个脚本文件
6、执行脚本(以root身份执行):
1)执行结果:
[root@oracle oraInventory]# ./orainstRoot.sh
更改权限/home/oracle/app/oraInventory.
添加组的读取和写入权限。
删除全局的读取, 写入和执行权限。
更改组名/home/oracle/app/oraInventory 到 dba.
脚本的执行已完成
2)执行结果:
[root@oracle dbhome_1]# ./root.sh
Check /home/oracle/app/oracle/product/11.2.0/dbhome_1/install/root_oracle_2019-05-31_22-38-03.log for the output of root script
查看日志信息如下:
Running Oracle 11g root.sh script…
The following environment variables are set as:
ORACLE_OWNER= oracle
ORACLE_HOME= /home/oracle/app/oracle/product/11.2.0/dbhome_1
Creating /etc/oratab file…
Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root.sh script.
Now product-specific root actions will be performed.
Finished product-specific root actions.
启动监听:------------>报错了,oracle还是安装没成功
[oracle@oracle ~]$ lsnrctl start
LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 31-MAY-2019 22:47:15
Copyright © 1991, 2009, Oracle. All rights reserved.
Starting /home/oracle/app/oracle/product/11.2.0/dbhome_1/bin/tnslsnr: please wait…
TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Log messages written to /home/oracle/app/diag/tnslsnr/oracle/listener/alert/log.xml
Error listening on: (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
TNS-12545: Connect failed because target host or object does not exist
TNS-12560: TNS:protocol adapter error
TNS-00515: Connect failed because target host or object does not exist
Linux Error: 11: Resource temporarily unavailable
回想安装文件有报错日志:
这是因Linux系统无法解析oracle所引起的,编辑/etc/hosts文件加入oracle解析,ping oracle测试通,再次启动监听:
[oracle@oracle logs]$ lsnrctl start
LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 31-MAY-2019 23:05:07
Copyright © 1991, 2009, Oracle. All rights reserved.
Starting /home/oracle/app/oracle/product/11.2.0/dbhome_1/bin/tnslsnr: please wait…
TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Log messages written to /home/oracle/app/diag/tnslsnr/oracle/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oracle)(PORT=1521)))
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date 31-MAY-2019 23:05:07
Uptime 0 days 0 hr. 0 min. 20 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Log File /home/oracle/app/diag/tnslsnr/oracle/listener/alert/log.xml
Listening Endpoints Summary…
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oracle)(PORT=1521)))
The listener supports no services
The command completed successfully
检查端口也是正常的,但web无法访问:
关于The listener supports no services说明:
这是因为没有启动数据库实例,oracle用户下执行:
查看监听日志有报错:
msg time=‘2019-05-31T22:49:16.637+08:00’ org_id=‘oracle’ comp_id=‘tnslsnr’
type=‘UNKNOWN’ level=‘16’ host_id='oracle’host_addr=‘UNKNOWN’>
TNS-12545: Connect failed because target host or object does not exist
TNS-12560: TNS:protocol adapter error
TNS-00515: Connect failed because target host or object does not exist
Linux Error: 11: Resource temporarily unavailable
检查$ORACLE_HOME/network/admin/listener.ora和tnsnames.ora
手动配置监听实例,即修改tnsnames.ora文件,增加:
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = 你的service name)
(SID_NAME = 你的SID)
)
)
保存后,执行:lsnrctl reload&&lsnrctl status;
执行后应该会看到结果:监听的实例名会显示,状态为UNknown,该状态表示实例是静态注册到监听的;正常是 Instance “orcl”, status READY这样显示的,即实例启动后自动注册(动态)到监听服务的。同样前者也可表示为实例启动异常,应该查看相应日志(alert和trace),我的环境中出现了ora-12547的报错。
错误日志路径: $ORACLE_BASE/目录下:
less /oracle/app/oracle/diag/tnslsnr/mes/listener/trace/listener.log可看到如下报错:
该问题较难排除,查询相关资料,结合其他技术前辈经验,还是重新编译最好,但这之前可以trace sqlplus / as sysdba检查下系统相关文件是否配置错误;
执行:cd $ORACLE_HOME/bin
然后:relink all
正常,执行完成后再次启动监听,会显示ready,正常,登录数据库正常。
我在安装过程中国犯了个特低级错误,没有看安装文件的readme,后来才发现安装的linux安装包为x86平台使用,relink all时报错确实很多lib文件。我的系统是64位的,浪费很多时间,哎!