Oracle 11.1.0.6 for linux X86 64的SILENT安裝
首先是檢查系統硬件情況:
代碼:
[root@enterprice64 ~]# grep MemTotal /proc/meminfo
MemTotal: 8178836 kB
[root@enterprice64 ~]# grep SwapTotal /proc/meminfo
SwapTotal: 8385888 kB
[root@enterprice64 ~]# free
total used free shared buffers cached
Mem: 8178836 5297744 2881092 0 122512 4773424
-/+ buffers/cache: 401808 7777028
Swap: 8385888 0 8385888
[root@enterprice64 ~]# df -k /dev/shm
Filesystem 1K-blocks Used Available Use% Mounted on
tmpfs 4089416 0 4089416 0% /dev/shm
[root@enterprice64 ~]# df -k /tmp
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda7 10153988 428132 9201740 5% /
[root@enterprice64 ~]# df -k /data
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda9 207275064 3933228 192642952 3% /data
要求內存不小於1G,在內存小於2G,SWAP應該是內存的1.5倍,內存2到8G,
SWAP和內存相同大小即可,內存超過8G,SWAP是內存的0.75倍。
由於11g對於共享內存要求變大,因此系統共享內存應該大於512*進程數,
如果共享內存不足的話,會造成ORA-845或ORA-1078錯誤。
要求臨時表空間不少於200M,安裝目錄應大於4G。
下面檢查系統軟件情況:
代碼:
[root@enterprice64 ~]# cat /proc/version
Linux version 2.6.18-8.el5 (mockbuild@ca-build14)
(gcc version 4.1.1 20070105 (Red Hat 4.1.1-52)) #1
SMP Tue Jun 5 23:25:19 EDT 2007
[root@enterprice64 ~]# uname -a
Linux enterprice64 2.6.18-8.el5 #1 SMP Tue Jun 5
23:25:19 EDT 2007 x86_64 x86_64 x86_64 GNU/Linux
[root@enterprice64 ~]# more /etc/issue
Enterprise Linux Enterprise Linux Server release 5 (Carthage)
Kernel r on an m
.
對操作系統要求:
Asianux 2.0
Asianux 3.0
Oracle Enterprise Linux 4.0
Oracle Enterprise Linux 5.0
Red Hat Enterprise Linux 4.0
Red Hat Enterprise Linux 5.0
SUSE Enterprise Linux 10.0
系統內核為2.6.9(Asianux 2.0、Oracle Enterprise Linux
4.0、Red Hat Enterprise Linux 4.0),2.6.18
(Asianux 3.0、Oracle Enterprise Linux 5.0、
Red Hat Enterprise Linux 5.0),或2.6.16.21(SUSE Enterprise Linux 10.0)。
對於ES4,oracle需要一下包:
binutils-2.17.50.0.6
compat-libstdc++-33-3.2.3
compat-libstdc++-33-3.2.3 (32 bit)
elfutils-libelf-0.125
elfutils-libelf-devel-0.125
gcc-4.1.1
gcc-c++-4.1.1
glibc-2.5-12
glibc-2.5-12 (32 bit)
glibc-common-2.5
glibc-devel-2.5
glibc-devel-2.5-12 (32 bit)
libaio-0.3.106
libaio-0.3.106 (32 bit)
libaio-devel-0.3.106
libgcc-4.1.1
libgcc-4.1.1 (32 bit)
libstdc++-4.1.1
libstdc++-4.1.1 (32 bit)
libstdc++-devel 4.1.1
make-3.81
sysstat-7.0.0
通過rpm –qa查詢是否所有需要的包都以及安裝,如果沒有安裝的通過
rpm –ivh命令進行安裝。
檢查網絡情況:
代碼:
[root@enterprice64 ~]# cat /etc/nsswitch.conf|grep hosts
#hosts: db files nisplus nis dns
hosts: files dns
[root@enterprice64 ~]# hostname
enterprice64
[root@enterprice64 ~]# domainname
(none)
[root@enterprice64 ~]# more /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 enterprice64 localhost.localdomain localhost
172.25.13.195 enterprice64
建立Oracle用戶和dba組:
代碼:
[root@enterprice64 ~]# groupadd oinstall
[root@enterprice64 ~]# groupadd dba
[root@enterprice64 ~]# groupadd asadmin
[root@enterprice64 ~]# useradd -g oinstall -G dba,asadmin oracle
[root@enterprice64 ~]# 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.
[root@enterprice64 ~]# id nobody
uid=99(nobody) gid=99(nobody) groups=99(nobody) context=root:system_r:unconfined_t:SystemLow-SystemHigh
建立oinstall、dba和asadmin組。創建好用戶後,檢查nobody用戶是否存在。
不存在的話,建立該用戶。
檢測並修改系統的核心參數,編輯/etc/sysctl.conf文件,添加下面的配置,
保存後重啟系統。注意,如果系統默認的配置比這裡給出的值大,不要修改原有配置。
fs.file-max = 512 * PROCESSES
kernel.shmall = 2097152
kernel.shmmax = 2147483648
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 1024 65000
net.core.rmem_default = 4194304
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 262144
配置oracle用戶的環境變量和shell限制,編輯/etc/security/limits.conf,添加下面的內容:
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
編輯/etc/pam.d/login文件,添加下面的內容:
session required /lib/security/pam_limits.so
session required pam_limits.so
編輯oracle用戶目錄下的.bash_rc文件,添加下列環境變量:
umask 022
if [ $USER = "oracle" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi
export TMP=/tmp
export TMPDIR=/tmp
export ORACLE_BASE=/data/oracle
export ORACLE_SID=ora11g64
export ORACLE_HOME=/data/oracle/product/11.1
最後建立安裝Oracle所需的目錄結構。
代碼:
[root@enterprice64 ~]# mkdir -p /data/oracle/product/11.1
[root@enterprice64 ~]# chown -R oracle.oinstall /data
准備工作做完了下面開始進行Silent方式的安裝。
首先設置oraInst.loc文件:
代碼:
[root@enterprice64 ~]# ls -l /etc/oraInst.loc
-rw-rw-r-- 1 oracle dba 61 Oct 19 17:25 /etc/oraInst.loc
[root@enterprice64 ~]# more /etc/oraInst.loc
inventory_loc=/data/oracle/oraInventory
inst_group=oinstall
確保/etc/oraInst.loc中包含上面的信息,且Oracle包含訪問權限。
根據希望安裝的數據庫類型選擇Silent的response_file文件的類似,
比如:enterprise.rsp、standard.rsp還是custom.rsp。
這裡選擇enterpise.rsp類型,
安裝盤中的database/response目錄下對應的response文件拷貝出來,
根據文件裡面的提示對輸入值進行修改。
比如這個例子中對如下的參數進行設置:
UNIX_GROUP_NAME="oinstall"
FROM_LOCATION="/data/database/stage/products.xml"
ORACLE_BASE="/data/oracle"
ORACLE_HOME="/data/oracle/product/11.1"
ORACLE_HOME_NAME="ORADBHOME11"
SHOW_ROOTSH_CONFIRMATION=false
RESTART_SYSTEM=false
RESTART_REMOTE_SYSTEM=false
COMPONENT_LANGUAGES={"zh_CN"}
s_nameForDBAGrp="dba"
s_nameForOPERGrp="oinstall"
s_nameForASMGrp="asadmin"
n_configurationOption=3
s_ASMSYSPassword="asm"
s_ASMSYSPasswordAgain="asm"
注意,所有的字符串需要放在雙引號中,注意大小寫。數字和布爾變量直接寫就可以。
由於這裡沒有選擇建立數據庫而只安裝軟件,因此沒有設置數據庫相關的配置參數。
代碼:
[oracle@enterprice64 data]$ chmod 700 enterprise.rsp
下面可以開始SILENT安裝了:
注意,響應文件需要使用絕對路徑。
代碼:
[oracle@enterprice64 database]$ ./runInstaller -silent -noconfig -responseFile /data/database/enterprise.rsp
Starting Oracle Universal Installer...
Checking Temp space: must be greater than 120 MB.
Actual 8886 MB Passed
Checking swap space: must be greater than 150 MB.
Actual 8189 MB Passed
Preparing to launch Oracle Universal
Installer from /tmp/OraInstall2007-10-19_06-40-04PM.
Please wait ...[oracle@enterprice64 database]$
Oracle Universal Installer, Version 11.1.0.6.0 Production
Copyright (C) 1999, 2007, Oracle. All rights reserved.
You can find the log of this install session at:
/data/oracle/oraInventory/logs/installActions2007-10-19_06-40-04PM.log
............................................................ 100% Done.
Loading Product Information
..........................................................100% Done.
Starting execution of Prerequisites...
Total No of checks: 14
Performing check for CertifiedVersions
Checking operating system requirements ...
Expected result: One of enterprise-4,enterprise-5,redhat-4,
redhat-5,SuSE-10,asianux-2,asianux-3
Actual Result: enterprise-5
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.81; found make-1:3.81-1.1-x86_64. Passed
Checking for binutils-2.17.50.0.6;
found binutils-2.17.50.0.6-2.el5-x86_64. Passed
Checking for gcc-4.1.1; found gcc-4.1.1-52.el5-x86_64. Passed
.
.
.
Check complete. The overall result of this check is: Passed
Check complete: Passed
========================================================
Performing check for Kernel
Checking kernel parameters
Checking for semmsl=250; found semmsl=250. Passed
.
.
.
Checking for wmem_max=262144; found wmem_max=262144. Passed
Check complete. The overall result of this check is: Passed
Check complete: Passed
========================================================
Performing check for GLIBC
Checking Recommended glibc version
Expected result: ATLEAST=2.5-12
Actual Result: 2.5-12
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: 7984MB
Check complete. The overall result of this check is: Passed
Check complete: Passed
========================================================
Performing check for SwapSpace
Checking available swap space requirements ...
Expected result: 7984MB
Actual Result: 8189MB
Check complete. The overall result of this check is: Passed
Check complete: Passed
========================================================
Performing check for DetectIfDHCPAssignedIP
Checking Network Configuration requirements ...
Check complete. The overall result of this check is: Not executed <<<<
Check complete: Not executed <<<<
Recommendation: Oracle supports installations on systems with
DHCP-assigned public IP addresses. However, the primary
network interface on the system should be configured with
a static IP address in order for the Oracle Software to
function properly. See the Installation Guide for more
details on installing the software on systems configured with DHCP.
========================================================
Performing check for CheckPathForOtherOracleHomes
Checking PATH environment variable...
Check complete. The overall result of this check is: Passed
Check complete: Passed
========================================================
Performing check for CheckTempDiskSpace
Checking for sufficient diskspace in TEMP location...
Check complete. The overall result of this check is: Passed
Check complete: Passed
========================================================
Performing check for CheckLdLibraryPath
Checking LD_LIBRARY_PATH environment variable...
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 OracleHomeSpace
Checking Oracle Home path for spaces...
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_DB
Checking for Oracle Home incompatibilities ....
Actual Result: NEW_HOME
Check complete. The overall result of this check is: Passed
Check complete: Passed
========================================================
PrereqChecks complete
Analyzing dependencies
.....................................................100% Done.
--------------------------------------------------------------
Summary
Global Settings
Source: /data/database/stage/products.xml
Oracle Base: /data/oracle
Oracle Home: /data/oracle/product/11.1 (ORADBHOME11)
Installation Type: Enterprise Edition
Product Languages
Simplified Chinese
English
Space Requirements
/ Required 226MB (only as temporary space) : Available 8.56GB
/data/ Required 3.63GB : Available 181.86GB
New Installations (126 products)
Oracle Database 11g 11.1.0.6.0
Enterprise Edition Options 11.1.0.6.0
Oracle Partitioning 11.1.0.6.0
.
.
.
Oracle Universal Installer 11.1.0.6.0
Oracle One-Off Patch Installer 11.1.0.6.0
Installer SDK Component 11.1.0.6.0
Sun JDK 1.5.0.11.0
----------------------------------------------------------
Installation in progress (Fri Oct 19 18:40:20 CST 2007)
............................................................... 6% Done.
............................................................... 12% Done.
............................................................... 19% Done.
............................................................... 25% Done.
............................................................... 31% Done.
............................................................... 38% Done.
............................................................... 44% Done.
............................................................... 50% Done.
............................................................... 57% Done.
............................................................... 63% Done.
............................................................... 69% Done.
............................................................... 76% Done.
................................................. 81% Done.
Install successful
Linking in progress (Fri Oct 19 18:42:27 CST 2007)
.. 81% Done.
Link successful
Setup in progress (Fri Oct 19 18:43:33 CST 2007)
................................... 100% Done.
Setup successful
End of install phases.(Fri Oct 19 18:43:36 CST 2007)
WARNING:
The following configuration scripts need to be executed as the "root" user.
#!/bin/sh
#Root script to run
/data/oracle/product/11.1/root.sh
To execute the configuration scripts:
1. Open a terminal window
2. Log in as "root"
3. Run the scripts
The installation of Oracle Database 11g was successful.
Please check '/data/oracle/oraInventory/logs/
silentInstall2007-10-19_06-40-04PM.log' for more details.
最後使用root執行一下$ORACLE_HOME/root.sh腳本就可以了。
不過這裡Oracle存在一個bug,在root.sh腳本中,自動將OUI_SILENT參數設置為TRUE,
而後的檢查中,如果發現這個值為TRUE,那麼這個腳本運行會自動退出了。
這裡需要手工將其修改為FALSE,然後使用root執行:
代碼:
[root@enterprice64 11.1]# ./root.sh
Running Oracle 11g root.sh script...
The following environment variables are set as:
ORACLE_OWNER= oracle
ORACLE_HOME= /data/oracle/product/11.1
Enter the full pathname of the local bin directory: [/usr/local/bin]:
The file "dbhome" already exists in /usr/local/bin. Overwrite it? (y/n)
[n]: y
Copying dbhome to /usr/local/bin ...
The file "oraenv" already exists in /usr/local/bin. Overwrite it? (y/n)
[n]: y
Copying oraenv to /usr/local/bin ...
The file "coraenv" already exists in /usr/local/bin. Overwrite it? (y/n)
[n]: y
Copying coraenv to /usr/local/bin ...
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.
Finished product-specific root actions.
對於root.sh的執行不要使用. root.sh的方式,這種方式可能造成腳本陷入死循環。
至此,數據庫軟件的安裝已經完成,如果系統啟動了SELINUX,那麼這裡還需要處理一個bug:
利用root改變SELINUX的設置:
代碼:
[root@enterprice64 ~]# setenforce 0
至此,Oracle軟件已經安裝完畢:
代碼:
[oracle@enterprice64 ~]$ sqlplus "/ as sysdba"
SQL*Plus: Release 11.1.0.6.0 - Production on Mon Oct 22 14:07:28 2007
Copyright (c) 1982, 2007, Oracle. All rights reserved.
Connected to an idle instance.
SQL>
上面介紹了如何在SILENT方式下安裝11.1.0.6:http://yangtingkun.itpub.net/post/468/407375
這篇繼續介紹SILENT模式下的數據庫建立過程。
通過SILENT模式安裝數據庫之後,下面繼續使用SILENT模式進行數據庫的建立,仍然是拷貝安裝目錄下的/database/reponse/dbca.rsp到安裝目錄,並進行編譯,根據數據庫建立方式的不同編輯不同的數據庫庫選項。
比如在本次安裝過程中設置了下列參數:
RESPONSEFILE_VERSION = "11.1.0"
OPERATION_TYPE = "createDatabase"
GDBNAME = "ora11g64.us.oracle.com"
SID = "ora11g64"
TEMPLATENAME = "New_Database.dbt"
SYSPASSWORD = "test"
SYSTEMPASSWORD = "test"
SYSMANPASSWORD = "test"
DBSNMPPASSWORD = "test"
DATAFILEDESTINATION ="/data/oracle/oradata/ora11g64"
RECOVERYAREADESTINATION="/data/oracle/flash_recovery_area"
CHARACTERSET = "ZHS16GBK"
TOTALMEMORY = "6000"
TEMPLATENAME = "ora11g64"
GDBNAME = "ora11g64.us.oracle.com"
SCRIPTDESTINATION ="/data/oracle/admin/ora11g64/scripts"
其中最後三項不是必須的,這個的目的是在建立數據庫的同時生成腳本。
下面就可以開始SILENT模式的數據庫創建了:
代碼:
[oracle@enterprice64 database]$ dbca -silent -responseFile /data/database/dbca.rsp
Creating and starting Oracle instance
1% complete
3% complete
Creating database files
6% complete
Creating data dictionary views
7% complete
8% complete
9% complete
10% complete
11% complete
12% complete
14% complete
16% complete
17% complete
18% complete
Adding Oracle JVM
23% complete
28% complete
33% complete
35% complete
Adding Oracle Text
36% complete
37% complete
38% complete
Adding Oracle XML DB
40% complete
41% complete
42% complete
45% complete
Adding Oracle Multimedia
46% complete
47% complete
56% complete
Adding Oracle OLAP
57
% complete
58% complete
59% complete
Adding Oracle Spatial
60% complete
61% complete
62% complete
63% complete
66% complete
Adding Oracle Ultra Search
67% complete
73% complete
Adding Enterprise Manager Repository
75% complete
76% complete
Adding Oracle Application Express
80% complete
83% complete
Adding Oracle Warehouse Builder
87% complete
90% complete
Completing Database Creation
91% complete
92% complete
93% complete
94% complete
97% complete
100% complete
Look at the log file "/data/oracle/cfgtoollogs/dbca/ora11g64/ora11g64.log" for further details.
數據庫建立完成:
代碼:
[oracle@enterprice64 database]$ sqlplus "/ as sysdba"
SQL*Plus: Release 11.1.0.6.0 - Production on Mon Oct 22 17:28:02 2007
Copyright (c) 1982, 2007, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> select * from v$version;
BANNER
----------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - 64bit Production
PL/SQL Release 11.1.0.6.0 - Production
CORE 11.1.0.6.0 Production
TNS for Linux: Version 11.1.0.6.0 - Production
NLSRTL Version 11.1.0.6.0 - Production
最後可以利用netca來SILENT方式設置網絡部分,同樣的方法設置netca.rsp:
RESPONSEFILE_VERSION="11.1"
CREATE_TYPE= "CUSTOM"
SHOW_GUI=false
LOG_FILE=""/data/oracle/product/11.1/network/tools/log/netca.log""
INSTALLED_COMPONENTS={"server","net8","javavm"}
INSTALL_TYPE=""typical""
LISTENER_NUMBER=1
LISTENER_NAMES={"LISTENER"}
LISTENER_PROTOCOLS={"TCP;1521"}
LISTENER_START=""LISTENER""
NAMING_METHODS={"TNSNAMES","ONAMES","HOSTNAME"}
設置的參數包括上面的部分,然後就可以使用netca啟動silent配置:
代碼:
[oracle@enterprice64 database]$ netca /silent /responseFile /data/database/netca.rsp
Mon Oct 22 18:26:40 CST 2007 Oracle Net Configuration Assistant
Parsing command line arguments:
Parameter "silent" = true
Parameter "responsefile" = /data/database/netca.rsp
Parameter "log" = /data/oracle/product/11.1/network/tools/log/netca.log
Done parsing command line arguments.
Oracle Net Services Configuration:
Profile configuration complete.
Listener started at port:1521
Oracle Net Listener Startup:
Running Listener Control:
/data/oracle/product/11.1/bin/lsnrctl start LISTENER
Listener Control complete.
Listener started successfully.
Listener configuration complete.
Oracle Net Services configuration successful. The exit code is 0
[oracle@enterprice64 database]$ lsnrctl status
LSNRCTL for Linux: Version 11.1.0.6.0 - Production on 22-OCT-2007 18:31:20
Copyright (c) 1991, 2007, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.1.0.6.0 - Production
Start Date 22-OCT-2007 18:26:40
Uptime 0 days 0 hr. 4 min. 39 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /data/oracle/product/11.1/network/admin/listener.ora
Listener Log File /data/oracle/diag/tnslsnr/enterprice64/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=enterprice64)(PORT=1521)))
Services Summary...
Service "ora11g64.us.oracle.com" has 1 instance(s).
Instance "ora11g64", status READY, has 1 handler(s) for this service...
Service "ora11g64XDB.us.oracle.com" has 1 instance(s).
Instance "ora11g64", status READY, has 1 handler(s) for this service...
Service "ora11g64_XPT.us.oracle.com" has 1 instance(s).
Instance "ora11g64", status READY, has 1 handler(s) for this service...
The command completed successfully
至此,SILENT安裝方式完成