Linux RHEL6 x64 命令行静默安装 Oracle 12c - 1

3 minute read

背景

安装详见

http://docs.oracle.com/database/121/LADBI/app_nonint.htm#LADBI7832

http://docs.oracle.com/database/121/LADBI/pre_install.htm#LADBI222

下载软件.

drwxr-xr-x 7 digoal users       4096 Jul  7  2014 database  
-rw-r--r-- 1 digoal users 1673544724 Dec 22 17:19 linuxamd64_12102_database_1of2.zip  
-rw-r--r-- 1 digoal users 1014530602 Dec 22 17:29 linuxamd64_12102_database_2of2.zip  

解压

静默安装分5步

0. 系统配置(预条件)  
  
1. Prepare a response file.  
  
2. Run Oracle Universal Installer in silent or response file mode.  
  
3. Run the root scripts as prompted by Oracle Universal Installer.  
  
4. If you completed a software-only installation, then run Net Configuration Assistant and Database Configuration Assistant in silent or response file mode, if required.  

下面开始吧

系统配置

yum install -y binutils \  
compat-libcap1 \  
compat-libstdc* \  
gcc \  
gcc-c++ \  
glibc \  
glibc-devel \  
ksh \  
libgcc \  
libstdc++ \  
libstdc++-devel \  
libaio \  
libaio-devel \  
libXext \  
libXtst \  
libX11 \  
libXau \  
libxcb \  
libXi \  
make \  
sysstat  
  
vi /etc/sysctl.conf  
kernel.shmmax=101204146176  
net.core.rmem_max = 4194304  
net.core.wmem_max = 4194304  
net.core.rmem_default = 262144  
net.core.wmem_default = 262144  
net.ipv4.ip_local_port_range = 9000 65535  
  
# sysctl -p  

准备模板

cd database/response  
ll  
-rwxrwxr-x 1 digoal users 74822 Apr  4  2014 dbca.rsp  
-rw-rw-r-- 1 digoal users 25036 Jul  7  2014 db_install.rsp  
-rwxrwxr-x 1 digoal users  6038 Jan 24  2014 netca.rsp  
  
cd ~  
cp oracle/database/response/db_install.rsp ./  
vi db_install.rsp   
  
oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v12.1.0  
oracle.install.option=INSTALL_DB_SWONLY  
ORACLE_HOSTNAME=digoal_host.sqa.zmf  
UNIX_GROUP_NAME=users  
INVENTORY_LOCATION=  
SELECTED_LANGUAGES=en  
ORACLE_HOME=/home/digoal/oracle/product/12.1.0/db_1  
ORACLE_BASE=/home/digoal/oracle/product  
oracle.install.db.InstallEdition=EE  
oracle.install.db.DBA_GROUP=users  
oracle.install.db.OPER_GROUP=users  
oracle.install.db.BACKUPDBA_GROUP=users  
oracle.install.db.DGDBA_GROUP=users  
oracle.install.db.KMDBA_GROUP=users  
oracle.install.db.rac.configurationType=  
oracle.install.db.CLUSTER_NODES=  
oracle.install.db.isRACOneInstall=  
oracle.install.db.racOneServiceName=  
oracle.install.db.rac.serverpoolName=  
oracle.install.db.rac.serverpoolCardinality=  
oracle.install.db.config.starterdb.type=  
oracle.install.db.config.starterdb.globalDBName=  
oracle.install.db.config.starterdb.SID=  
oracle.install.db.ConfigureAsContainerDB=  
oracle.install.db.config.PDBName=  
oracle.install.db.config.starterdb.characterSet=AL32UTF8  
oracle.install.db.config.starterdb.memoryOption=  
oracle.install.db.config.starterdb.memoryLimit=16384  
oracle.install.db.config.starterdb.installExampleSchemas=  
oracle.install.db.config.starterdb.password.ALL=  
oracle.install.db.config.starterdb.password.SYS=  
oracle.install.db.config.starterdb.password.SYSTEM=  
oracle.install.db.config.starterdb.password.DBSNMP=  
oracle.install.db.config.starterdb.password.PDBADMIN=  
oracle.install.db.config.starterdb.managementOption=  
oracle.install.db.config.starterdb.omsHost=  
oracle.install.db.config.starterdb.omsPort=  
oracle.install.db.config.starterdb.emAdminUser=  
oracle.install.db.config.starterdb.emAdminPassword=  
oracle.install.db.config.starterdb.enableRecovery=  
oracle.install.db.config.starterdb.storageType=  
oracle.install.db.config.starterdb.fileSystemStorage.dataLocation=  
oracle.install.db.config.starterdb.fileSystemStorage.recoveryLocation=  
oracle.install.db.config.asm.diskGroup=  
oracle.install.db.config.asm.ASMSNMPPassword=  
MYORACLESUPPORT_USERNAME=  
MYORACLESUPPORT_PASSWORD=  
SECURITY_UPDATES_VIA_MYORACLESUPPORT=  
DECLINE_SECURITY_UPDATES=true  
PROXY_HOST=  
PROXY_PORT=  
PROXY_USER=  
PROXY_PWD=  
COLLECTOR_SUPPORTHUB_URL=  
  
chmod 700 db_install.rsp  
  
$ mkdir -p /home/digoal/oracle/product/12.1.0/db_1  
  
$cd oracle/database/  

创建一个配置文件,包含oraInventory目录位置,最好放在ORACLE_BASE下面

# vi /etc/oraInst.loc  
# chown digoal:users /etc/oraInst.loc   
inventory_loc=/home/digoal/oracle/product/oraInventory  
inst_group=users  
  
$./runInstaller -silent -responseFile /home/digoal/db_install.rsp   

如果安装遇到错误,比如前提条件未满足,可以通过日志查看,搜索FAIL

例如

INFO: *********************************************  
INFO: OS Kernel Parameter: wmem_default: This is a prerequisite condition to test whether the OS kernel parameter "wmem_default" is properly set.  
INFO: Severity:IGNORABLE  
INFO: OverallStatus:WARNING  
INFO: -----------------------------------------------  
INFO: Verification Result for Node:digoal_host  
INFO: Expected Value:262144  
INFO: Actual Value:Current=262144; Configured=unknown  
INFO: Error Message:PRVG-1201 : OS kernel parameter "wmem_default" does not have expected configured value on node "digoal_host" [Expected = "262144" ; Current = "262144"; Configured = "unknown"].  
INFO: Cause: A check of the configured value for an OS kernel parameter did not find the expected value.  
INFO: Action: Modify the kernel parameter configured value to meet the requirement.  
INFO: -----------------------------------------------  

以上说明对应的OS内核参数需要配置一下。

正常情况下,结束时会输出如下

The installation of Oracle Database 12c was successful.  
Please check '/home/digoal/oracle/product/oraInventory/logs/silentInstall2015-12-22_07-49-44PM.log' for more details.  
  
As a root user, execute the following script(s):  
        1. /home/digoal/oracle/product/12.1.0/db_1/root.sh  

切到root用户下执行

# /home/digoal/oracle/product/12.1.0/db_1/root.sh  
Check /home/digoal/oracle/product/12.1.0/db_1/install/root_digoal_host.sqa.zmf_2015-12-22_19-53-04.log for the output of root script  

日志

# less /home/digoal/oracle/product/12.1.0/db_1/install/root_digoal_host.sqa.zmf_2015-12-22_19-53-04.log   
Performing root user operation.  
  
The following environment variables are set as:  
    ORACLE_OWNER= digoal  
    ORACLE_HOME=  /home/digoal/oracle/product/12.1.0/db_1  
   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 script.  
Now product-specific root actions will be performed.  
  
  
  
  
# cat /etc/oratab  
#  
  
  
  
# This file is used by ORACLE utilities.  It is created by root.sh  
# and updated by either Database Configuration Assistant while creating  
# a database or ASM Configuration Assistant while creating ASM instance.  
  
# A colon, ':', is used as the field terminator.  A new line terminates  
# the entry.  Lines beginning with a pound sign, '#', are comments.  
#  
# Entries are of the form:  
#   $ORACLE_SID:$ORACLE_HOME:<N|Y>:  
#  
# The first and second fields are the system identifier and home  
# directory of the database respectively.  The third field indicates  
# to the dbstart utility that the database should , "Y", or should not,  
# "N", be brought up at system boot time.  
#  
# Multiple entries with the same $ORACLE_SID are not allowed.  
#  
#  

其他

1. 错误解答

$./runInstaller -silent -responseFile /home/digoal/db_install.rsp   
Starting Oracle Universal Installer...  
  
Checking Temp space: must be greater than 500 MB.   Actual 43700 MB    Passed  
Checking swap space: 0 MB available, 150 MB required.    Failed <<<<  
  
Some requirement checks failed. You must fulfill these requirements before  
  
continuing with the installation,  
  
  
Exiting Oracle Universal Installer, log for this session can be found at /tmp/OraInstall2015-12-22_05-47-47PM/installActions2015-12-22_05-47-47PM.log  

处理,增加swap

# dd if=/dev/zero of=./swap bs=8k count=102400  
102400+0 records in  
102400+0 records out  
838860800 bytes (839 MB) copied, 1.57573 s, 532 MB/s  
  
# mkswap ./swap   
mkswap: ./swap: warning: don't erase bootbits sectors  
        on whole disk. Use -f to force.  
Setting up swapspace version 1, size = 819196 KiB  
no label, UUID=6b67c44e-8239-4451-8c6b-c5d82190b96a  
  
# swapon ./swap   

不够可以再加。

后面再讲数据库初始化。

Flag Counter

digoal’s 大量PostgreSQL文章入口