前言:
过去一直认为:Oracle在必要的时候用图形是比较省事的,就算是远程支持,国内的宽带线路通常也能提供较为满意的速度,借助于此,利用xshell之类的东西完全可以将图形呈现在自己的电脑屏幕上,因此“静默部署” 只知其物,认为几乎不可能用上。 某人:“如果服务器上没装x11怎么办”? 我:"既然是管理员,可以自己装嘛......." 也就是说可以 “绕过去!”
本次客户系统升级,我又尝试去使用相同的方法,但是令我大跌眼镜:国外VPN的效率几乎只能回显命令行,即使这样也有500ms以上的延迟。图形界面嘛。。。想都别想,等到他出来,黄花菜都凉了,并且随时有断开的危险,总之极不稳定。 但是项目就在眼前了,怎么办呢? “静默部署”成为了唯一方案。
因此,永远不要尝试去绕过一些问题,就算你本次能绕过,今后它仍然会适时地出现在你面前!
本次仅以个人角度进行记录,更多的信息,请参看官方文档 《 Installing and Upgrading》
正文:
Oracle的静默部署无外乎几个方面,官方文档也有明确提到,分别包括:软件静默安装、静默建库、静默升级 这几个主要环节。 其他的如静默监听配置等完全可以直接通过编辑完成。
趁着国庆长假,我们先来记录第一部分:Oracle 11.2.0.3 software静默部署
应该说这是比较简单的一部分,成功的核心在于:
1. 必须做好一切prerequirements check
这一步,不再赘述,请参考 《Centos5.7x64 上部署 oracle11R2 重点概要》
注意: 在生产环境中曾遇到 因为两个包互相依赖,而不能通过常规手段安装。 可以使用--nodeps参数安装,作用是忽略依赖关系。
例如: rpm -ivh --nodeps elfutils-libelf-devel-static-x86_64.rpm
2. 准备一个正确的 response file ,注意如果当前版本的路径规划很乱,那么此时升级将是一个调整的绝佳机会。
2.2 关于response file的获得,最简单的方法是 在本次使用相同版本图形化安装一次,最后会出现 “是否保存response file”
You can use Oracle Universal Installer in interactive mode to save a response file, which you can then edit and use to complete silent mode or response file mode installations. This method is useful for custom or software-only installations.
Starting with Oracle Database 11g Release 2 (11.2), you can save all the installation steps into a response file during installation. You can click theSave Response File button on the Summary page to do this. Later, this file can be used for a silent installation.
When you save the response file, you can either complete the installation, or you can exit from Oracle Universal Installer on the Summary page, before it starts to copy the software to the system.
If you save a response file during a silent installation, then Oracle Universal Installer saves the variable values that were specified in the original source response file into the new response file.
2.3 或者通过模板编辑
To copy and modify a response file:
Copy the response file from the response file directory to a directory on your system:
$ cp /directory_path/response/response_file.rsp local_directory
In this example, directory_path
is the path to thedatabase
directory on the installation media. If you copy the software to a hard drive, then edit the file in theresponse
directory.
Open the response file in a text editor:
$ vi /local_dir/response_file.rsp
Remember that you can specify sensitive information, such as passwords, at the command line rather than within the response file."How Response Files Work" explains this method
Follow the instructions in the file to edit it.
Note:
The installer or configuration assistants fail if you do not correctly configure the response file. See the "Silent-Mode Response File Error Handling" section for more information about troubleshooting a failed response file mode installation.Change the permissions on the file to 700:
$ chmod 700 /local_dir/response_file.rsp
Note:
A fully specified response file for an Oracle Database installation contains the passwords for database administrative accounts and for a user who is a member of the OSDBA group (required for automated backups). Ensure that only the Oracle software owner user can view or modify response files or consider deleting them after the installation succeeds. 我们要注意,虽然文档说“You do not have to set the DISPLAY
environment variable if you are completing a silent mode installation”,但是根据我遇到的情况,最好强行将DISPLAY unset掉,否则即使是用的silent mode, 仍然可能会调用图形。
eg: runInstaller -silent -responseFile /home/oracle/install_swonly_11.2.0.3.rsp
Now, you are ready to run Oracle Universal Installer at the command line, specifying the response file you created, to perform the installation. The Oracle Universal Installer executable,runInstaller
, provides several options. For help information about the full set of these options, run therunInstaller
command with the-help
option, for example:
$ directory_path/runInstaller -help
The help information appears in a window after some time.
To run Oracle Universal Installer using a response file:
Complete the preinstallation tasks listed in Chapter 2.
Log in as the Oracle software owner user (typically, oracle
).
If you are completing a response file mode installation, set the DISPLAY
environment variable.
Note:
You do not have to set theDISPLAY
environment variable if you are completing a silent mode installation.
To start Oracle Universal Installer in silent or response file mode, enter a command similar to the following:
$ /directory_path/runInstaller [-silent] [-noconfig] \ -responseFile responsefilename
Note:
Do not specify a relative path to the response file. If you specify a relative path, then Oracle Universal Installer fails.In this example:
directory_path
is the path of thedatabase
directory on the DVD or on the hard drive.
-silent
runs Oracle Universal Installer in silent mode.
-noconfig
suppresses running the configuration assistants during installation, and a software-only installation is performed instead.
responsefilename
is the full path and file name of the installation response file that you configured.
When the installation completes, log in as the root
user and run theroot.sh
script:
$ sudo sh
password:
# /oracle_home_path/root.sh
当最后,我们会被要求以root执行 root.sh,做完这一步,软件部署就搞一段落了。
4. 查看安装过程日志:
在安装日志中查找 Error Message 可以确认有问题的requirement,但是例如tmp与swap的问题都是IGNORABLE的,不影响software静默安装,例如:
INFO: *********************************************
INFO: Swap Size: This is a prerequisite condition to test whether sufficient total swap space is available on the system.
INFO: Severity:IGNORABLE
INFO: OverallStatus:VERIFICATION_FAILED
INFO: -----------------------------------------------
INFO: Verification Result for Node:gtn100b
INFO: Expected Value:7.7957GB (8174400.0KB)
INFO: Actual Value:4GB (4194296.0KB)
INFO: Error Message:PRVF-7573 : Sufficient swap size is not available on node "gtn100b" [Required = 7.7957GB (8174400.0KB) ; Found = 4GB (4194296.0KB)]
INFO: Cause: The swap size found does not meet the minimum requirement.
INFO: Action: Increase swap size to at least meet the minimum swap space requirement.
INFO: -----------------------------------------------
INFO: *********************************************
INFO: Free Space: gtn100b:/tmp: This is a prerequisite condition to test whether sufficient free space is available in the file system.
INFO: Severity:IGNORABLE
INFO: OverallStatus:VERIFICATION_FAILED
INFO: -----------------------------------------------
INFO: Verification Result for Node:gtn100b
INFO: Expected Value:1GB
INFO: Actual Value:727MB
INFO: -----------------------------------------------
INFO: Error Message:PRVF-7501 : Sufficient space is not available at location "/tmp" on node "gtn100b" [Required space = 1GB ]
INFO: Cause: Not enough free space at location specified.
INFO: Action: Free up additional space or select another location.
INFO: *********************************************
也可以通过 Severity:IGNORABLE 直接定位到selfcheck段落
5. 接下来,是升级instance与database的过程。这时候先不要急于更改本地oracle环境变量。
请看下回分解《离开图形界面的那些日子 之二:Oracle 11.2.0.3 命令行升级instance与database》
最后补充一点:在某些有特殊安全规则的环境中,不允许有很多用户组,那马安装中仅有oracle用户与dba组就足够了,静默配置中将所有的group都指定为dba即可。 当然oracle_home相关的目录,其用户应该为oracle:dba. 而且/u01/app/oracle/oraInventory/oraInst.loc中的inst_group=dba也是与默认安装不相同的地方。完全不会影响使用的。