使用responseFile进行Oracle静默安装


我们通常使用的数据库,都是基于图形GUI界面进行的。在Windows和其他图形化操作系统中,图形交互式安装时很方便的安装手段。但是,在很多情况下,图形交互式安装时有很多的限制的。
 
首先,图形GUI界面要求显示图形能力较强。对很多异地安装需求或者无显示界面的服务器安装过程,交互安装时有一些困难的。
 
其次,很多实际运维人员在安装时,是需要同时安装多台机器,而且配置相同。逐个GUI交互安装,工作量大且容易出错。
 
针对这样的情况,Oracle软件产品在GUI图形界面的安装配置外,通常提供了静默安装silent和响应文件responseFile安装模式。
 
注意:远程Oracle安装,除了使用silent安装,还可以选择X Windows功能的产品,将远程的桌面映射到安装的客户端。笔者常常使用的产品是X Manager套件的Passive产品。
 
1、Silent安装模式
 
很多操作系统,如Windows、Linux都提供了服务器网络安装和批量安装,目的就是为了减少系统运维人员的安装负担和安装错误。原理其实都是相同的,都是将各种交互问题答案事先保存在一个文件(通常是文本文件)中,之后安装程序会去读取文件中的配置信息,用于安装过程。
 
在Oracle安装过程中,包括Oracle程序安装、Oracle Net配置和数据库创建,都提供了silent安装方法。只需要在安装程序中,指定responseFile的名字,就可以进行silent安装过程。
 
为了进行silent安装,在Oracle安装目录下,有一些提供的responseFile模板。我们在实际中,可以修改这些文件作为创建的模板。
 
 
[root@bspdev upload]# ls -l
total 4
drwxr-xr-x 6 root root 4096 Jul 3 2005 database
[root@bspdev upload]#
 
[root@bspdev response]# pwd
/upload/database/response
[root@bspdev response]# ls -l
total 244
-rwxr-xr-x 1 root root 25278 Jul 3 2005 custom.rsp
-rwxr-xr-x 1 root root 44600 Jul 3 2005 dbca.rsp
-rwxr-xr-x 1 root root 8476 Jul 3 2005 emca.rsp
-rwxr-xr-x 1 root root 71113 Jul 3 2005 enterprise.rsp
-rwxr-xr-x 1 root root 5742 Jul 3 2005 netca.rsp
-rwxr-xr-x 1 root root 71113 Jul 3 2005 standard.rsp
 
 
Response目录下,一共提供了6个rsp文件,分别作为几种组件的安装模板。Custom.rsp用于个性化安装的响应文件模板。Dbca用于database Configuration Assistant组件,emca.rsp用于Oracle Enterprise Management Configuration Assistant。而netca.rsp用于Net Configuration Assistant。
 
Enterprise和Standard分别适用于不同规模和版本的数据库软件安装。
 
我们可以选择不同的安装需求,来进行修改。
 
2、Database Software安装
 
在创建Software之前,我们需要单独的创建一个oraInst.loc文件,来指定资源库位置。
 
 
[root@bspdev ~]# cd /etc
[root@bspdev etc]# vi oraInst.loc
 
inventory_loc=/u01/app/oracle
inst_group=oinstall
~
 
[root@bspdev etc]# chown oracle:oinstall oraInst.loc
[root@bspdev etc]# chmod 664 oraInst.loc
[root@bspdev etc]# ls -l | grep oraInst.loc
-rw-rw-r--  1 oracle oinstall    50 Jun 30 11:02 oraInst.loc
 
 
注意:这个步骤在GUI版本时候,是不强制的。
 
我们首先需要安装Oracle软件,创建单独的响应文件。
 
 
[oracle@bspdev response]$ cp enterprise.rsp creat.rsp
[oracle@bspdev response]$ ls -l
total 320
-rwxr-xr-x 1 oracle oinstall 71113 Jun 30 10:55 creat.rsp
-rwxr-xr-x 1 oracle oinstall 25278 Jul 3 2005 custom.rsp
 
 
使用vi打开编辑,修改各种选项。模板响应文件设置的很好,每个选项都提供了详细的解释和设置法则。我们可以根据自己的需要进行修改,例如:
 
 
#------------------------------------------------------------------------------
#Name      : UNIX_GROUP_NAME
#Datatype  : String
#Description: Unix group to be set for the inventory directory.
#Example   : UNIX_GROUP_NAME = "install"
#------------------------------------------------------------------------------
UNIX_GROUP_NAME=ointall
 
 
在配置过程中,同GUI安装Oracle Software一样,我们是可以选择在安装Software过程中创建数据库的。注意,一般我们不推荐这样做。我们本篇中单独有介绍dbca的响应文件使用部分。
 
之后,我们就可以启动runInstaller程序进行安装。
 
 
[oracle@bspdev database]$ ./runInstaller -silent -force -noconfig-responseFile /upload/database/response/creat.rsp
Starting Oracle Universal Installer...
 
Checking installer requirements...
 
Checking operating system version: must be RedHat-3, SUSE-9, redhat-4, UnitedLinux-1.0, asianux-1 or asianux-2
                                     Passed
 
All installer requirements met.
 
 
注意,responseFile参数中指定的文件,一定是响应文件的绝对路径。
 
如果配置没有明确的错误信息,会持续下去,包括系列的验证和安装过程。
 
(篇幅原因,省略部分输出内容…..)
......................................................... 18% Done.
............................................................... 36% Done.
............................................................... 54% Done.
............................................................... 72% Done.
................                                                76% Done.
Install successful
 
Linking in progress (Sat Jun 30 11:13:55 CST 2012)
Link successful
 
Setup in progress (Sat Jun 30 11:15:55 CST 2012)
..............                                                 100% Done.
Setup successful
 
End of install phases.(Sat Jun 30 11:16:02 CST 2012)
WARNING:The following configuration scripts
/u01/app/oracle/product/10.2.0/db_1/root.sh
need to be executed as root for configuring the system. If you skip the execution of the configuration tools, the configuration will not be
complete and the product wont function properly. In order to get the product to function properly, you will be required to execute the scripts
and the configuration tools after exiting the OUI.
 
The installation of Oracle Database 10g was successful.
Please check '/u01/app/oracle/logs/silentInstall2012-06-30_11-12-13AM.log' for more details.
 
 
从提示信息来看,我们还需要使用root用户执行root.sh脚本。
 
 
[root@bspdev RPMS]# cd /u01/app/oracle/product/10.2.0/db_1/
[root@bspdev db_1]# ./root.sh
Running Oracle10 root.sh script...
 
The following environment variables are set as:
   ORACLE_OWNER= oracle
   ORACLE_HOME= /u01/app/oracle/product/10.2.0/db_1
 
Enter the full pathname of the local bin directory: [/usr/local/bin]:
  Copying dbhome to /usr/local/bin ...
  Copying oraenv to /usr/local/bin ...
  Copying coraenv to /usr/local/bin ...
 
 
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.
[root@bspdev db_1]#
 
 
至此,我们完成了安装Oracle Software过程。下面使用dbca静默安装过程,来创建数据库。
  • 1
  • 2
  • 下一页

相关内容