数据库静默安装总结

  1. 云栖社区>
  2. 博客>
  3. 正文

数据库静默安装总结

jeanron100 2014-11-18 21:17:53 浏览799
展开阅读全文

在学习数据库的时候,不知道dbca的命令用了多少遍,但是越是安装也是觉得自己会的越少,因为图形界面的清晰直白反而不知道哪些准备工作是需要特别准备的,如果在远程支持的环境中,图形界面就会受到网络带宽的影响,如果在本地的环境中学习的时候,总是提示少这个包,那个包的。其实有很多的安装包如果不使用图形界面都不是必须的。个人感触比较深的一个例子就是安装的时候缺少报了libXp.so相关的错误,结果自己折腾了半天,从网上下载安装包费了很大的周折才算搞定,最后发现使用静默安装就不需要这个包了,基于学习的环境,摆脱图形界面也是一个好的开始,你需要考虑的东西越多,你就学到的越多。

说到静默安装,就不得不提到响应文件,就是所谓的response file。在oracle,db2的安装中都有提供响应文件,这个响应文件其实就是一个配置文件。里面可以配置一些安装的细节,像dbca里面能够看到的安装选项,在响应文件中都有体现。你可以通过响应文件来设置安装企业版,个人版,标准被,安装的语言包,安装的字符集等等。

响应文件可以通过安装目录获得,比如得到解压后的安装包。响应文件的模板就是db_install.rsp

[oracle@rac1 database]$ pwd
/u02/ora11g/database
[oracle@rac1 database]$ ll
total 64
drwxr-xr-x 12 ora11g dba  4096 Sep 18  2011 doc
drwxr-xr-x  4 ora11g dba  4096 Sep 22  2011 install
-rwxr-xr-x  1 ora11g dba 28122 Sep 22  2011 readme.html
drwxr-xr-x  2 ora11g dba  4096 Sep 22  2011 response
drwxr-xr-x  2 ora11g dba  4096 Sep 22  2011 rpm
-rwxr-xr-x  1 ora11g dba  3226 Sep 22  2011 runInstaller
drwxr-xr-x  2 ora11g dba  4096 Sep 22  2011 sshsetup
drwxr-xr-x 14 ora11g dba  4096 Sep 22  2011 stage
-rwxr-xr-x  1 ora11g dba  5466 Aug 22  2011 welcome.html
[oracle@rac1 database]$ cd response
[oracle@rac1 response]$ ll
total 80
-rwxr-xr-x 1 ora11g ora11g 44533 Sep 22  2011 dbca.rsp
-rwxr-xr-x 1 ora11g ora11g 24992 Sep 22  2011 db_install.rsp
-rwxr-xr-x 1 ora11g ora11g  5871 Sep 22  2011 netca.rsp
以下标黄的部分是在响应文件中需要格外注意的。可以根据自己的需求和环境来设置
####################################################################
## Copyright(c) Oracle Corporation 1998,2011. All rights reserved.##
##                                                                ##
## Specify values for the variables listed below to customize     ##
## your installation.                                             ##
##                                                                ##
## Each variable is associated with a comment. The comment        ##
## can help to populate the variables with the appropriate        ##
## values.                                                        ##
##                                                                ##
## IMPORTANT NOTE: This file contains plain text passwords and    ##
## should be secured to have read permission only by oracle user  ##
## or db administrator who owns this installation.                ##
##                                                                ##
####################################################################

#------------------------------------------------------------------------------
# Do not change the following system generated value.
#------------------------------------------------------------------------------
oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v11_2_0

#------------------------------------------------------------------------------
# Specify the installation option.
# It can be one of the following:
# 1. INSTALL_DB_SWONLY
# 2. INSTALL_DB_AND_CONFIG
# 3. UPGRADE_DB
#-------------------------------------------------------------------------------
oracle.install.option=INSTALL_DB_SWONLY

#-------------------------------------------------------------------------------
# Specify the hostname of the system as set during the install. It can be used
# to force the installation to use an alternative hostname rather than using the
# first hostname found on the system. (e.g., for systems with multiple hostnames
# and network interfaces)
#-------------------------------------------------------------------------------
ORACLE_HOSTNAME=rac1

#-------------------------------------------------------------------------------
# Specify the Unix group to be set for the inventory directory. 
#-------------------------------------------------------------------------------
UNIX_GROUP_NAME=dba

#-------------------------------------------------------------------------------
# Specify the location which holds the inventory files.
# This is an optional parameter if installing on
# Windows based Operating System.
#-------------------------------------------------------------------------------
INVENTORY_LOCATION=/home/oracle

#-------------------------------------------------------------------------------
# Specify the languages in which the components will be installed.            
#
# en   : English                  ja   : Japanese                 
# fr   : French                   ko   : Korean                   
# ar   : Arabic                   es   : Latin American Spanish   
# bn   : Bengali                  lv   : Latvian                  
# pt_BR: Brazilian Portuguese     lt   : Lithuanian               
# bg   : Bulgarian                ms   : Malay                    
# fr_CA: Canadian French          es_MX: Mexican Spanish          
# ca   : Catalan                  no   : Norwegian                
# hr   : Croatian                 pl   : Polish                   
# cs   : Czech                    pt   : Portuguese               
# da   : Danish                   ro   : Romanian                 
# nl   : Dutch                    ru   : Russian                  
# ar_EG: Egyptian                 zh_CN: Simplified Chinese       
# en_GB: English (Great Britain)  sk   : Slovak                   
# et   : Estonian                 sl   : Slovenian                
# fi   : Finnish                  es_ES: Spanish                  
# de   : German                   sv   : Swedish                  
# el   : Greek                    th   : Thai                     
# iw   : Hebrew                   zh_TW: Traditional Chinese      
# hu   : Hungarian                tr   : Turkish                  
# is   : Icelandic                uk   : Ukrainian                
# in   : Indonesian               vi   : Vietnamese               
# it   : Italian                                                  
#
# all_langs   : All languages
#
# Specify value as the following to select any of the languages.
# Example : SELECTED_LANGUAGES=en,fr,ja
#
# Specify value as the following to select all the languages.
# Example : SELECTED_LANGUAGES=all_langs 
#------------------------------------------------------------------------------
SELECTED_LANGUAGES=en,zh_CN,th,zh_TW

#------------------------------------------------------------------------------
# Specify the complete path of the Oracle Home.
#------------------------------------------------------------------------------
ORACLE_HOME=/home/oracle/ORAHOME

#------------------------------------------------------------------------------
# Specify the complete path of the Oracle Base.
#------------------------------------------------------------------------------
ORACLE_BASE=/home/oracle

#------------------------------------------------------------------------------
# Specify the installation edition of the component.                       
#                                                            
# The value should contain only one of these choices.       
# EE     : Enterprise Edition                               
# SE     : Standard Edition                                 
# SEONE  : Standard Edition One
# PE     : Personal Edition (WINDOWS ONLY)
#------------------------------------------------------------------------------
oracle.install.db.InstallEdition=EE

#------------------------------------------------------------------------------
# This variable is used to enable or disable custom install and is considered
# only if InstallEdition is EE.
#
# true  : Components mentioned as part of 'optionalComponents' property
#         are considered for install.
# false : Value for 'optionalComponents' is not considered.
#------------------------------------------------------------------------------
oracle.install.db.EEOptionsSelection=true

#------------------------------------------------------------------------------
# This variable is considered only if 'EEOptionsSelection' is set to true.
#
# Description: List of Enterprise Edition Options you would like to enable.
#
#              The following choices are available. You may specify any
#              combination of these choices.  The components you choose should
#              be specified in the form "internal-component-name:version"
#              Below is a list of components you may specify to enable.
#       
#              oracle.oraolap:11.2.0.3.0 - Oracle OLAP
#              oracle.rdbms.dm:11.2.0.3.0 - Oracle Data Mining
#              oracle.rdbms.dv:11.2.0.3.0 - Oracle Database Vault
#              oracle.rdbms.lbac:11.2.0.3.0 - Oracle Label Security
#              oracle.rdbms.partitioning:11.2.0.3.0 - Oracle Partitioning
#              oracle.rdbms.rat:11.2.0.3.0 - Oracle Real Application Testing
#------------------------------------------------------------------------------
oracle.install.db.optionalComponents=oracle.rdbms.partitioning:11.2.0.3.0,oracle.oraolap:11.2.0.3.0,oracle.rdbms.dm:11.2.0.3.0,oracle.rdbms.dv:11.2.0.3.0,oracle.rdbms.lbac:11.2.0.3.0,oracle.rdbms.rat:11.2.0.3.0

###############################################################################
#                                                                             #
# PRIVILEGED OPERATING SYSTEM GROUPS                                          #
# ------------------------------------------                                  #
# Provide values for the OS groups to which OSDBA and OSOPER privileges       #
# needs to be granted. If the install is being performed as a member of the   #
# group "dba", then that will be used unless specified otherwise below.       #
#                                                                             #
# The value to be specified for OSDBA and OSOPER group is only for UNIX based #
# Operating System.                                                           #
#                                                                             #
###############################################################################

#------------------------------------------------------------------------------
# The DBA_GROUP is the OS group which is to be granted OSDBA privileges.
#------------------------------------------------------------------------------
oracle.install.db.DBA_GROUP=dba

#------------------------------------------------------------------------------
# The OPER_GROUP is the OS group which is to be granted OSOPER privileges.
# The value to be specified for OSOPER group is optional.
#------------------------------------------------------------------------------
oracle.install.db.OPER_GROUP=dba

#------------------------------------------------------------------------------
# Specify whether user doesn't want to configure Security Updates.
# The value for this variable should be true if you don't want to configure
# Security Updates, false otherwise.
#
# The value can be either true or false. If left blank it will be assumed
# to be false.
#
# Example    : DECLINE_SECURITY_UPDATES=false
#------------------------------------------------------------------------------
DECLINE_SECURITY_UPDATES=true

对于静默安装 runInstaller是必须的执行文件,脚本本身提供了大量的选项。可以通过./runInstaller -help
来看到
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2014-11-18_04-00-22AM. Please wait ...[oracle@rac1 database]$ Usage:
runInstaller  [-options] [()*]

Where options include:
  -clusterware oracle.crs, 
        Version of Cluster ready services installed.

  -crsLocation  
        Used only for cluster installs, specifies the path to the crs home location. Specifying this overrides CRS information obtained from central inventory.

  -invPtrLoc  
        Unix only. To point to a different inventory location. The orainst.loc file contains:
inventory_loc=
inst_group=

  -jreLoc  
。。。。。


安装的时候,可以使用如下命令。

[oracle@rac1 database]$ ./runInstaller -silent -responsefile /home/oracle/new.rsp -ignoreSysPrereqs
Starting Oracle Universal Installer...

Checking Temp space: must be greater than 120 MB.   Actual 993 MB    Passed
Checking swap space: must be greater than 150 MB.   Actual 3967 MB    Passed
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2014-11-18_04-15-07AM. Please wait ...[oracle@rac1 database]$ [WARNING] [INS-32008] Oracle base location cant be same as the user home directory.
   CAUSE: The specified Oracle base is same as the user home directory.
   ACTION: Provide an Oracle base location other than the user home directory.
[WARNING] [INS-13014] Target environment do not meet some optional requirements.
   CAUSE: Some of the optional prerequisites are not met. See logs for details. /u04/app/oraInventory/logs/installActions2014-11-18_04-15-07AM.log
   ACTION: Identify the list of failed prerequisite checks from the log: /u04/app/oraInventory/logs/installActions2014-11-18_04-15-07AM.log. Then either from the log file or from installation manual find the appropriate configuration to meet the prerequisites and fix it manually.
You can find the log of this install session at:
 /u04/app/oraInventory/logs/installActions2014-11-18_04-15-07AM.log

如果响应文件出现问题,就会出现类似下面的问题。

Preparing to launch Oracle Universal Installer from /tmp/OraInstall2014-11-18_04-06-16AM. Please wait ...[oracle@rac1 database]$ [FATAL] [INS-10105] The given response file /home/oracle/new.rsp is not valid.
   CAUSE: Syntactically incorrect response file. Either unexpected variables are specified or expected variables are not specified in the response file.
   ACTION: Refer the latest product specific response file template
   SUMMARY:
       - cvc-enumeration-valid: Value '1' is not facet-valid with respect to enumeration '[INSTALL_DB_SWONLY, INSTALL_DB_AND_CONFIG, UPGRADE_DB]'. It must be a value from the enumeration.
cvc-type.3.1.3: The value '1' of element 'oracle.install.option' is not valid.

 这个问题很明显就是因为响应文件中的设置错误。有INSTALL_DB_SWONLY, INSTALL_DB_AND_CONFIG, UPGRADE_DB3个选项,但是相应文件里设置错误。
查看响应文件的配置,确实有问题。
# Specify the installation option.
# It can be one of the following:
# 1. INSTALL_DB_SWONLY
# 2. INSTALL_DB_AND_CONFIG
# 3. UPGRADE_DB
#-------------------------------------------------------------------------------
oracle.install.option=1  --这个地方设置错误,需要写为INSTALL_DB_SWONLY..不是数字

如果大体没有问题,就可以看到
一个后台进程在执行安装。
  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND                                                                                                   
12298 oracle    20   0 1494m 160m  22m R 194.5  8.1   0:40.84 /tmp/OraInstall2014-11-18_04-15-07AM/jdk/jre/bin/java -Doracle.installer.library_loc=/tmp/OraInstall2014-1
通过日志文件也能看到安装的一些细节。

查看安装目录,也会看到在逐渐增大。
 [oracle@rac1 ORAHOME]$ du -sh .
1.8G    .
[oracle@rac1 ORAHOME]$ du -sh .
2.2G    .
[oracle@rac1 ORAHOME]$ du -sh .
4.0G   
如果在日志文件中看到如下的内容,证明安装已经完成。
INFO: Finding the most appropriate exit status for the current application
INFO: Exit Status is 6
INFO: List of warnings encountered in this Application:
INFO: PREREQS_FAILED_WITH_WARNING
INFO: Shutdown Oracle Database 11g Release 2 Installer
INFO: Unloading Setup Driver

同时,也可以通过sqlplus来测试安装进度
[oracle@rac1 bin]$ ./sqlplus
./sqlplus: error while loading shared libraries: libsqlplus.so: cannot open shared object file: No such file or directory  --这个时候说明安装还在继续
[oracle@rac1 bin]$ ./sqlplus
Error 6 initializing SQL*Plus
SP2-0667: Message file sp1.msb not found                                   --这个时候说明安装已经完成,需要设置的就是ORACLE_HOME了
SP2-0750: You may need to set ORACLE_HOME to your Oracle software directory

[oracle@rac1 ~]$ export ORACLE_SID=A                    --设置ORACLE_HOME以后,可以简单的测试是否sqlplus一切正常
[oracle@rac1 ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.3.0 Production on Tue Nov 18 04:34:08 2014

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

Connected to an idle instance.

网友评论

登录后评论
0/500
评论
jeanron100
+ 关注