靜默方式安裝、升級oracle(一): 安裝oracle軟體

space6212發表於2019-06-09

本文簡單闡述在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/,如需轉載,請註明出處,否則將追究法律責任。

相關文章