ITPub博客

首页 > Linux操作系统 > Linux操作系统 > 静默方式安装、升级oracle(一): 安装oracle软件

静默方式安装、升级oracle(一): 安装oracle软件

原创 Linux操作系统 作者:space6212 时间:2019-06-09 11:27:05 0 删除 编辑

本文简单阐述在Linux AS 4中如何不用启动界面的情况下安装oracle 10g软件、创建数据库以及升级数据库,这就是oracle的静默安装。


一、安装oracle软件
1、安装oracle必须的包
在as 4安装oracle 10g必须包含下面的包:
make-3.79
binutils-2.11
openmotif-2.2.2-16
setarch-1.3-1
compat-db-4.0.14.5
compat-gcc-7.3-2.96.122
compat-gcc-c++-7.3-2.96.122
compat-libstdc++-7.3-2.96.122
libstdc++-devel-7.3-2.96.122

包的版本可以不一致,但是对应的包一定要存在。可以用如下命令来检查包是否安装:
rpm -q make binutils openmotif setarch compat-db compat-gcc compat-gcc-c++ compat-libstdc++ libstdc++-devel

2、创建用户组和用户
[root@tdata ~]# groupadd oinstall
[root@tdata ~]# useradd -g oinstall oracle
[root@tdata ~]# passwd oracle
Changing password for user oracle.
New UNIX password:
BAD PASSWORD: it is based on a dictionary word
Retype new UNIX password:
passwd: all authentication tokens updated successfully.

3、修改内核参数
[root@tdata ~]# vi /etc/sysctl.conf

kernel.shmall = 2097152
kernel.shmmax = 4294967296
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.file-max = 65536
net.ipv4.ip_local_port_range = 1024 65000
net.core.rmem_default = 1048576
net.core.rmem_max = 1048576
net.core.wmem_default = 262144
net.core.wmem_max = 262144

修改后用sysctl -p使得修改立即生效:
[root@tdata ~]# sysctl -p
net.ipv4.ip_forward = 0
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.default.accept_source_route = 0
kernel.sysrq = 0
kernel.core_uses_pid = 1
kernel.shmall = 2097152
kernel.shmmax = 4294967296
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.file-max = 65536
net.ipv4.ip_local_port_range = 1024 65000

4、修改oracle用户的环境变量
[root@tdata ~]# su - oracle
[oracle@tdata ~]$
[oracle@tdata ~]$ vi .bash_profile
export ORACLE_BASE=/oradata
export ORACLE_HOME=/opt/oracle/product/10.2
export ORACLE_SID=testzj
export NLS_LANG='SIMPLIFIED CHINESE_CHINA.ZHS16GBK'
export PATH=$ORACLE_HOME/bin:$PATH
export PATH

5、创建相应密码并授权
[root@tdata ~]# mkdir -p /opt/oracle/product/10.2
[root@tdata ~]# chown -R oracle:oinstall /opt/oracle/
[root@tdata ~]# chown -R oracle:oinstall /oradata/
[root@tdata oradata]# chmod -R 755 /opt/oracle/
[root@tdata oradata]# chmod -R 755 /oradata/testzj/

6、生成响应文件

用静默方式安装oracle最关键是写响应文件,响应文件至少可以只设置4个参数就可以完成静默安装:
ORACLE_HOME
ORACLE_HOME_NAME
s_nameForDBAGrp
s_nameForOPERGrp

可以有3种方式设置安装oracle软件的响应文件,下面我们以自定义安装oracle为例说明如何设置响应文件:
1)用OUI生成响应文件

[root@tdata soft]# xhost +
[root@tdata soft]# export DISPLAY=172.25.4.89:1.0
[root@tdata soft]# su - oracle
[oracle@tdata ~]$ cd /oradata/soft/database/
--生成响应文件
[oracle@tdata database]$ ./runInstaller -record -destinationFile /tmp/install_10201.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.

Preparing to launch Oracle Universal Installer from /tmp/OraInstall2007-10-22_01-26-00PM. Please wait ...[oracle@tdata database]$ Oracle Universal Installer, Version 10.2.0.1.0 Production
Copyright (C) 1999, 2005, Oracle. All rights reserved.


弹出界面后,一路下一步,我这里只选择安装必须安装的rdbms和OCI以及分区组件,其他的一概不安装,最后选择只安装oracle软件,当安装界面到达最后一步时选择cancel.


2)修改ORACLE自带的模板
ORACLE自带的响应文件模板在oracle安装文件主目录下的response目录下的custom.rsp,修改这个文件部分参数即可。
需要修改的参数和参数值参考下文:3)自己配置响应文件
3)自己配置响应文件(名字可随便起)
#-------------------------------------------------------------------
RESPONSEFILE_VERSION=2.2.1.0.0

#oracle用户组
UNIX_GROUP_NAME=oinstall

#products.xml的完整路径
FROM_LOCATION="/soft/database/stage/products.xml"

#ORACLE_HOME的完整路径
ORACLE_HOME="/opt/oracle/product/10g"

#ORACLE_HOME名称
ORACLE_HOME_NAME="OraDb10g_home1"

#安装类型
INSTALL_TYPE="Custom"

#设置ORACLE软件安装完成后是否重启系统
RESTART_SYSTEM=false

#设置ORACLE软件安装完成后是否重启远端系统
RESTART_REMOTE_SYSTEM = false

#这个参数用于卸载ORACLE,这里留空即可
REMOVE_HOMES={}

#设置oracle所在操作系统的主机名
ORACLE_HOSTNAME=testzj

#设置节点名称
CLUSTER_NODES={}

#安装类型
#INSTALL_TYPE="Custom"

#安装的最顶层组件
TOPLEVEL_COMPONENT={"oracle.server","10.2.0.1.0"}

#设置要安装的数据库组件,其中oracle.rdbms和oracle.rdbms.oci为必装组件,本例是除了安装必须安装的组件外,仅仅添加一个可选组件
#如果不想要某个组件,只需要在大括号的列表中把对应的组件名称删除即可(每一个部分都被双引号包围)
oracle.server:DEPENDENCY_LIST={"oracle.rdbms:10.2.0.1.0","oracle.options:10.2.0.1.0","oracle.rdbms.oci:10.2.0.1.0"}

#设置可选的企业级组件,这里只选择分区
oracle.options:DEPENDENCY_LIST={"oracle.rdbms.partitioning:10.2.0.1.0"}

#设置dba组名
s_nameForDBAGrp=oinstall

#设置oper组名
s_nameForOPERGrp=oinstal

#设置安装类型,1为创建数据库;2为配置ASM实例;3为仅安装软件,这里选择仅安装软件
#如果选择创建数据库,则还需要指定oracle.assistants.server:s_responseFileName参数
varSelect=3
#----------------------------------------------------------------------------------


7、安装oracle软件
[root@tdata soft]# xhost +
[root@tdata soft]# export DISPLAY=172.25.4.89:1.0
[root@tdata soft]# su - oracle
[oracle@tdata 10.2]$ cd /oradata/soft/database/
--静默方式安装数据库、需要指定响应文件路径及名称
[oracle@tdata database]$ ./runInstaller -silent -responseFile /tmp/install_10201.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.

Preparing to launch Oracle Universal Installer from /tmp/OraInstall2007-10-22_02-29-14PM. Please wait ...
[oracle@tdata database]$ Oracle Universal Installer, Version 10.2.0.1.0 Production
Copyright (C) 1999, 2005, Oracle. All rights reserved.

You can find a log of this install session at:
/oradata/oraInventory/logs/installActions2007-10-22_02-29-14PM.log
.................................................................................................... 100% Done.


Loading Product Information
................................................................................................................... 100% Done.


Analyzing dependencies
......................................................................
Starting execution of Prerequisites...
Total No of checks: 9

Performing check for CertifiedVersions
Checking operating system requirements ...
Expected result: One of redhat-3,redhat-4,SuSE-9,asianux-1,asianux-2
Actual Result: redhat-4
Check complete. The overall result of this check is: Passed


Check complete: Passed
=======================================================================
Performing check for Packages
Checking operating system package requirements ...
Checking for make-3.79; found make-1:3.80-6.EL4. Passed
Checking for binutils-2.14; found binutils-2.15.92.0.2-21. Passed
Checking for gcc-3.2; found gcc-3.4.6-3. Passed
Checking for libaio-0.3.96; found libaio-0.3.105-2. Passed
Check complete. The overall result of this check is: Passed


Check complete: Passed
=======================================================================
Performing check for Security
Checking security kernel parameters
Checking for semmsl=250; found semmsl=250. Passed
Checking for semmns=32000; found semmns=32000. Passed
Checking for semopm=100; found semopm=100. Passed
Checking for semmni=128; found semmni=128. Passed
Checking for shmmax=536870912; found shmmax=0. Failed <<<<
Checking for shmmni=4096; found shmmni=4096. Passed
Checking for shmall=2097152; found shmall=2097152. Passed
Checking for file-max=65536; found file-max=65536. Passed
Checking for VERSION=2.6.9; found VERSION=2.6.9-42.ELsmp. Passed
Checking for ip_local_port_range=1024 - 65000; found ip_local_port_range=1024 - 65000. Passed
Checking for rmem_default=262144; found rmem_default=1048576. Passed
Checking for rmem_max=262144; found rmem_max=1048576. Passed
Checking for wmem_default=262144; found wmem_default=262144. Passed
Checking for wmem_max=262144; found wmem_max=262144. Passed
Check complete. The overall result of this check is: Failed <<<<


Check complete: Failed <<<<
Problem: The security parameters in the kernel do not meet the minimum requirements (see above).
Recommendation: Perform operating system specific instructions to update the kernel parameters, namely BIT_SIZE and noexec_user_stack.

=======================================================================
Performing check for GLIBC
Checking Recommended glibc version
Expected result: ATLEAST=2.3.2-95.27
Actual Result: 2.3.4-2.25
Check complete. The overall result of this check is: Passed


Check complete: Passed
=======================================================================
Performing check for TotalMemory
Checking physical memory requirements ...
Expected result: 922MB
Actual Result: 4052MB
Check complete. The overall result of this check is: Passed


Check complete: Passed
=======================================================================
Performing check for SwapSpace
Checking available swap space requirements ...
Expected result: 4052MB
Actual Result: 8997MB
Check complete. The overall result of this check is: Passed


Check complete: Passed
=======================================================================
Performing check for OracleBase
Validating ORACLE_BASE location (if set) ...
Check complete. The overall result of this check is: Passed


Check complete: Passed
=======================================================================
Performing check for DetectAnyInvalidASMHome
Checking for proper system clean-up....
Check complete. The overall result of this check is: Passed


Check complete: Passed
=======================================================================
Performing check for CompatibilityChecks_Custom
Checking for Oracle Home incompatibilities ....
Actual Result: NEW_HOME
Check complete. The overall result of this check is: Passed


Check complete: Passed
=======================================================================
PrereqChecks complete

............................................. 100% Done.


-----------------------------------------------------------------------------
Summary
Global Settings
Source: /oradata/soft/database/stage/products.xml
Oracle Home: /opt/oracle/product/10.2 (OraDb10g_home1)
Installation Type: Custom
Product Languages
English
Space Requirements
/oradata/ Required 176KB : Available 445.63GB
/ Required 100MB (only as temporary space) : Available 10.66GB
/opt/ Required 1.09GB : Available 18.17GB
New Installations (90 products)
Oracle Database 10g 10.2.0.1.0
Enterprise Edition Options 10.2.0.1.0
Oracle Partitioning 10.2.0.1.0
Oracle Database 10g 10.2.0.1.0
Oracle Net Listener 10.2.0.1.0
HAS Files for DB 10.2.0.1.0
Oracle Internet Directory Client 10.2.0.1.0
Oracle Call Interface (OCI) 10.2.0.1.0
Oracle interMedia 10.2.0.1.0
Oracle JVM 10.2.0.1.0
Database Configuration and Upgrade Assistants 10.2.0.1.0
Oracle interMedia Locator 10.2.0.1.0
Oracle XML Development Kit 10.2.0.1.0
Oracle Text 10.2.0.1.0
Oracle Database Utilities 10.2.0.1.0
Generic Connectivity Common Files 10.2.0.1.0
PL/SQL 10.2.0.1.0
Oracle Net 10.2.0.1.0
Assistant Common Files 10.2.0.1.0
Enterprise Manager plugin Common Files 10.2.0.1.0 Beta
Buildtools Common Files 10.2.0.1.0
Installation Common Files 10.2.0.1.0
Oracle LDAP administration 10.2.0.1.0
Oracle Java Client 10.2.0.1.0
Precompiler Common Files 10.2.0.1.0
Oracle Recovery Manager 10.2.0.1.0
SQL*Plus 10.2.0.1.0
HAS Common Files 10.2.0.1.0
Oracle Clusterware RDBMS Files 10.2.0.1.0
Oracle Wallet Manager 10.2.0.1.0
Enterprise Manager Minimal Integration 10.2.0.1.0
Oracle Database User Interface 2.2.13.0.0
Secure Socket Layer 10.2.0.1.0
Required Support Files 10.2.0.1.0
Database SQL Scripts 10.2.0.1.0
OLAP SQL Scripts 10.2.0.1.0
PL/SQL Embedded Gateway 10.2.0.1.0
Oracle Globalization Support 10.2.0.1.0
Character Set Migration Utility 10.2.0.1.0
LDAP Required Support Files 10.2.0.1.0
Oracle JDBC Thin Driver for JDK 1.4 10.2.0.1.0
Oracle JDBC Thin Driver for JDK 1.2 10.2.0.1.0
Oracle interMedia Client Option 10.2.0.1.0
Oracle Notification Service 10.1.0.3.0
Oracle Code Editor 1.2.1.0.0I
Perl Interpreter 5.8.3.0.2
JDBC Common Files 10.2.0.1.0
Oracle Locale Builder 10.2.0.1.0
Oracle Containers for Java 10.2.0.1.0
Database Workspace Manager 10.2.0.1.0
Oracle Core Required Support Files 10.2.0.1.0
Platform Required Support Files 10.2.0.1.0
Oracle interMedia Locator RDBMS Files 10.2.0.1.0
Oracle JDBC/OCI Instant Client 10.2.0.1.0
Oracle interMedia Annotator 10.2.0.1.0
SQLJ Runtime 10.2.0.1.0
Oracle interMedia Java Advanced Imaging 10.2.0.1.0
Oracle Database 10g interMedia Files 10.2.0.1.0
Oracle Data Mining RDBMS Files 10.2.0.1.0
Enterprise Manager Baseline 10.2.0.1.0
Oracle Help For Java 4.2.6.1.0
Oracle UIX 2.1.22.0.0
XML Parser for Java 10.2.0.1.0
Precompiler Required Support Files 10.2.0.1.0
XML Parser for Oracle JVM 10.2.0.1.0
Oracle Message Gateway Common Files 10.2.0.1.0
Oracle Starter Database 10.2.0.1.0
Sample Schema Data 10.2.0.1.0
Parser Generator Required Support Files 10.2.0.1.0
Agent Required Support Files 10.2.0.1.0
Oracle RAC Required Support Files-HAS 10.2.0.1.0
RDBMS Required Support Files 10.2.0.1.0
RDBMS Required Support Files for Instant Client 10.2.0.1.0
XDK Required Support Files 10.2.0.1.0
DBJAVA Required Support Files 10.2.0.1.0
SQL*Plus Required Support Files 10.2.0.1.0
Oracle JFC Extended Windowing Toolkit 4.2.33.0.0
Oracle Ice Browser 5.2.3.6.0
Oracle Display Fonts 9.0.2.0.0
Oracle Extended Windowing Toolkit 3.4.38.0.0
Oracle Net Required Support Files 10.2.0.1.0
SSL Required Support Files for InstantClient 10.2.0.1.0
regexp 2.1.9.0.0
Bali Share 1.1.18.0.0
Oracle Universal Installer 10.2.0.1.0
Oracle One-Off Patch Installer 10.2.0.1.0
Installer SDK Component 10.2.0.1.0
Java Runtime Environment 1.4.2.8.0
Sun JDK 1.4.2.0.8
Sun JDK extensions 10.1.2.0.0
-----------------------------------------------------------------------------


Installation in progress (Mon Oct 22 14:29:29 CST 2007)
............................................................... 21% Done.
............................................................... 42% Done.
............................................................... 63% Done.
..................... 70% Done.
Install successful

Linking in progress (Mon Oct 22 14:30:33 CST 2007)
. 70% Done.
Link successful

Setup in progress (Mon Oct 22 14:31:09 CST 2007)
............ 100% Done.
Setup successful

End of install phases.(Mon Oct 22 14:31:12 CST 2007)
WARNING:A new inventory has been created in this session. However, it has not yet been registered as the central inventory of this system.
To register the new inventory please run the script '/oradata/oraInventory/orainstRoot.sh' with root privileges.
If you do not register the inventory, you may not be able to update or patch the products you installed.

The following configuration scripts
/opt/oracle/product/10.2/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 '/oradata/oraInventory/logs/silentInstall2007-10-22_02-29-14PM.log' for more details.

--最后运行两个脚本完成oracle数据库软件的安装。

[root@tdata tmp]# /oradata/oraInventory/orainstRoot.sh
Changing permissions of /oradata/oraInventory to 770.
Changing groupname of /oradata/oraInventory to oinstall.
The execution of the script is complete

[root@tdata tmp]# /opt/oracle/product/10.2/root.sh
Running Oracle10 root.sh script...

The following environment variables are set as:
ORACLE_OWNER= oracle
ORACLE_HOME= /opt/oracle/product/10.2

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.

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/231499/viewspace-63875/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2005-01-25

  • 博文量
    245
  • 访问量
    170547