实验环境:

操作系统:Redhat 6.4 64

数  据 库:Oracle 12c R2

 

一、 安装前准备

1、 创建用户和组

[root@wjq ~]# groupadd -g 1000 oinstall 

//oinstall组:是清单目录组(Oracle Inventory group),用于管理清单目录(Inventory)

[root@wjq ~]# groupadd -g 1001 dba       //dba组:用于数据库管理

[root@wjq ~]# useradd -u 600 -g oinstall -G dba oracle

[root@wjq ~]# passwd oracle

Changing password for user oracle.

New password:

BAD PASSWORD: it is based on a dictionary word

BAD PASSWORD: is too simple

Retype new password:

passwd: all authentication tokens updated successfully.

2、 创建目录

[root@wjq ~]# mkdir -p /u01/app/oracle/product/12.2.0/dbhome_1

[root@wjq ~]# chown -R oracle:oinstall /u01

[root@wjq ~]# chmod -R 775 /u01/app/oracle

3、 查看物理内存、交换空间和文件系统大小

[root@wjq ~]# free -m

total       used       free     shared    buffers     cached

Mem:        3016        358       2657      0        19        158

-/+ buffers/cache:          180       2835

Swap:        3023          0       3023

[root@wjq ~]# df -h

Filesystem            Size  Used Avail Use% Mounted on

/dev/mapper/vg_wjq-lv_root

26G  2.8G   22G  12% /

tmpfs                 1.5G   72K  1.5G   1% /dev/shm

/dev/sda1             485M   38M  423M   9% /boot

/dev/mapper/vg_wjq-lv_home

4.0G  137M  3.7G   4% /home

/dev/mapper/vg_wjq-lv_u01

66G  180M   62G   1% /u01

4、 查看操作系统架构

[root@wjq ~]# cat /proc/version

Linux version 2.6.32-358.el6.x86_64 ([email protected]) (gcc version 4.4.7 20120313 (Red Hat 4.4.7-3) (GCC) ) #1 SMP Tue Jan 29 11:47:41 EST 2013

[root@wjq ~]# lsb_release -a

LSB Version:    :base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch

Distributor ID: RedHatEnterpriseServer

Description:    Red Hat Enterprise Linux Server release 6.4 (Santiago)

Release:        6.4

Codename:       Santiago

[root@wjq ~]# uname -r

2.6.32-358.el6.x86_64

5、 安装软件包

binutils-2.20.51.0.2-5.11.el6 (x86_64)
compat-libcap1-1.10-1 (x86_64)
compat-libstdc++-33-3.2.3-69.el6 (x86_64)
compat-libstdc++-33-3.2.3-69.el6.i686
gcc-4.4.4-13.el6 (x86_64)
gcc-c++-4.4.4-13.el6 (x86_64)
glibc-2.12-1.7.el6 (i686)
glibc-2.12-1.7.el6 (x86_64)
glibc-devel-2.12-1.7.el6 (x86_64)
glibc-devel-2.12-1.7.el6.i686
ksh
libgcc-4.4.4-13.el6 (i686)
libgcc-4.4.4-13.el6 (x86_64)
libstdc++-4.4.4-13.el6 (x86_64)
libstdc++-4.4.4-13.el6.i686
libstdc++-devel-4.4.4-13.el6 (x86_64)
libstdc++-devel-4.4.4-13.el6.i686
libaio-0.3.107-10.el6 (x86_64)
libaio-0.3.107-10.el6.i686
libaio-devel-0.3.107-10.el6 (x86_64)
libaio-devel-0.3.107-10.el6.i686
libXext-1.1 (x86_64)
libXext-1.1 (i686)
libXtst-1.0.99.2 (x86_64)
libXtst-1.0.99.2 (i686)
libX11-1.3 (x86_64)
libX11-1.3 (i686)
libXau-1.0.5 (x86_64)
libXau-1.0.5 (i686)
libxcb-1.5 (x86_64)
libxcb-1.5 (i686)
libXi-1.3 (x86_64)
libXi-1.3 (i686)
make-3.81-19.el6
sysstat-9.0.4-11.el6 (x86_64)

6、 禁用SELinux和防火墙

[root@wjq sofrware]# vim /etc/selinux/config

# This file controls the state of SELinux on the system.

# SELINUX= can take one of these three values:

#     enforcing - SELinux security policy is enforced.

#     permissive - SELinux prints warnings instead of enforcing.

#     disabled - No SELinux policy is loaded.

SELINUX=disabled

# SELINUXTYPE= can take one of these two values:

#     targeted - Targeted processes are protected,

#     mls - Multi Level Security protection.

SELINUXTYPE=targeted

SELinux 的不正确配置会影响网络

(1)enforcing --- SELinux security policy is enforced.代表记录警告且阻止可疑行为
(2)permissive --- SELinux prints warnings instead of 
代表仅记录安全警告但不阻止可疑行为
(3)disabled --- SELinux is fully disabled.SELinux 
被禁用

SELINUXTYPE设置
(1)targeted 
代表仅针对预制的几种网络服务和访问请求使用 SELinux 保护,
(2)strict 
代表所有网络服务和访问请求都要经过 SELinux

查看当前系统的安全策略

[root@wjq ~]# sestatus 

SELinux status:                 disabled

[root@wjq ~]# getenforce

Disabled

[root@wjq sofrware]# service iptables stop

iptables: Flushing firewall rules:                         [  OK  ]

iptables: Setting chains to policy ACCEPT: filter            [  OK  ]

iptables: Unloading modules:                            [  OK  ]

[root@wjq sofrware]# chkconfig iptables off

7、 解压安装包,设置环境变量

[root@wjq sofrware]#unzip linuxx64_12201_database.zip

[oracle@wjq ~]$ vim .bash_profile

export ORACLE_BASE=/u01/app/oracle

export ORACLE_HOME=$ORACLE_BASE/product/12.2.0/dbhome_1

export ORACLE_SID=seiang

export ORACLE_OWNER=oracle

export ORACLE_TERM=vt100

export PATH=$PATH:$ORACLE_HOME/bin:$HOME/bin

export PATH=$ORACLE_HOME/bin:$ORACLE_HOME/Apache/Apache/bin:$PATH

export BASE_PATH=/usr/sbin:$PATH; export BASE_PATH

export PATH=$ORACLE_HOME/bin:$BASE_PATH

export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib:/usr/local/lib

export ORACLE_HOSTNAME=wjq.comsys.com

export DB_UNIQUE_NAME=prod

export CVUQDISK_GRP=oinstall

umask 022

[oracle@wjq ~]$ source .bash_profile

 

8、 设置内核参数

[root@wjq sofrware]# vim /etc/sysctl.conf

fs.aio-max-nr = 1048576

fs.file-max = 6815744

kernel.shmall = 2097152

kernel.shmmax = 1349242060

kernel.shmmni = 4096

kernel.sem = 250 32000 100 128

net.ipv4.ip_local_port_range = 9000 65500

net.core.rmem_default=262144

net.core.rmem_max=4194304

net.core.wmem_default=262144

net.core.wmem_max=1048586

[root@wjq sofrware]# sysctl –a   //让内核参数文件立即生效

shmmax=物理内存*80%*80%,单位是字节
kernel.shmmax
:表示单个共享内存段的最大值,以字节为单位,此值一般为物理内存的一半,不过大一点也没关系,这里设定的为4GB,即“4294967295/1024/1024/1024=4G”。
kernel.shmmin
:表示单个共享内存段的最小值,默认为1byte
kernel.shmall
:表示整个系统范围内可用共享内存页的总量,单位是页(page),在32位系统上一页等于4kB,也就是4096字节。计算公式是:shmmax/PAGE_SIZE
kernel.shmmni
:表示整个系统范围内内存段的最大数量,一般为4096.
ip_local_port_range  
:表示端口的范围。在监听器帮助客户端进程和服务器进程建立连接时,会用到指定范围内的端口。
kernel.sem  
:表示设置的信号量,这4个参数内容大小固定。
net.core.rmem_default  
:表示接收套接字缓冲区大小的缺省值(以字节为单位)。
net.core.rmem_max  
:表示接收套接字缓冲区大小的最大值(以字节为单位)
net.core.wmem_default  
:表示发送套接字缓冲区大小的缺省值(以字节为单位)。
net.core.wmem_max  
:表示发送套接字缓冲区大小的最大值(以字节为单位)。

9、 修改资源控制文件

[root@wjq sofrware]# vim /etc/security/limits.conf

oracle               soft    nproc   2047
oracle               hard    nproc   16384
oracle               soft    nofile  1024
oracle               hard    nofile  65536

资源限制是针对单个进程的限制,不是针对整个系统总的设置
修改limits.conf以后,将马上生效。但是,如果用户已经登录系统,那么对于该用户的限制将在下一次用户重新登录以后才生效。如果要让对该用户的限制生效,只能让该用户注销然后重新登录就可以了。
/etc/security/limits.conf
    core - 
限制内核文件的大小
  date - 最大数据大小
  fsize - 最大文件大小
  memlock - 最大锁定内存地址空间
  nofile - 打开文件的最大数目
  rss - 最大持久设置大小
  stack - 最大栈大小
  cpu - 以分钟为单位的最多 CPU 时间
  noproc - 进程的最大数目
  as - 地址空间限制
  maxlogins - 此用户允许登录的最大数目

nofile - 打开文件的最大数目,该值不能等于/proc/sys/fs/file-max,如果等于file-max且打开的文件句柄的数量达到file-max,用户将不能登陆操作系统。

二、安装Oracle软件

1、 相应文件模板的存放位置

[root@wjq sofrware]# find / -name *.rsp

/u01/sofrware/database/response/netca.rsp

/u01/sofrware/database/response/db_install.rsp

/u01/sofrware/database/response/dbca.rsp

2、 浏览响应文件内容,并编辑响应文件

[root@wjq response]# ll

total 64

drwxr-xr-x 2 root root  4096 Jul  5 16:32 backup.rsp

-rwxrwxr-x 1 root root 25502 Jan  5 14:00 dbca.rsp

-rw-rw-r-- 1 root root 22924 Jan 26 21:44 db_install.rsp

-rwxrwxr-x 1 root root  6209 Jun 20  2016 netca.rsp

浏览响应文件内容

[oracle@wjq database]$ sed -n '/^[^#]/p' response/db_install.rsp

oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v12.2.0

oracle.install.option=

UNIX_GROUP_NAME=

INVENTORY_LOCATION=

ORACLE_HOME=

ORACLE_BASE=

oracle.install.db.InstallEdition=

oracle.install.db.OSDBA_GROUP=

oracle.install.db.OSOPER_GROUP=

oracle.install.db.OSBACKUPDBA_GROUP=

oracle.install.db.OSDGDBA_GROUP=

oracle.install.db.OSKMDBA_GROUP=

oracle.install.db.OSRACDBA_GROUP=

oracle.install.db.rac.configurationType=

oracle.install.db.CLUSTER_NODES=

oracle.install.db.isRACOneInstall=false

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=

oracle.install.db.config.starterdb.memoryOption=

oracle.install.db.config.starterdb.memoryLimit=

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=

PROXY_HOST=

PROXY_PORT=

PROXY_USER=

PROXY_PWD=

COLLECTOR_SUPPORTHUB_URL=

编辑Oracle数据库软件响应文件db_install.rsp

[root@wjq response]# vim db_install.rsp

oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v12.2.0

oracle.install.option=INSTALL_DB_SWONLY

UNIX_GROUP_NAME=oinstall

INVENTORY_LOCATION=/u01/app/oraInventory

ORACLE_HOME=/u01/app/oracle/product/12.2.0/dbhome_1

ORACLE_BASE=/u01/app/oracle

oracle.install.db.InstallEdition=EE

oracle.install.db.OSDBA_GROUP=dba

oracle.install.db.OSOPER_GROUP=dba

oracle.install.db.OSBACKUPDBA_GROUP=dba

oracle.install.db.OSDGDBA_GROUP=dba

oracle.install.db.OSKMDBA_GROUP=dba

oracle.install.db.OSRACDBA_GROUP=dba

oracle.install.db.rac.configurationType=

oracle.install.db.CLUSTER_NODES=

oracle.install.db.isRACOneInstall=false

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=

oracle.install.db.config.starterdb.memoryOption=

oracle.install.db.config.starterdb.memoryLimit=

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=false

DECLINE_SECURITY_UPDATES=true

PROXY_HOST=

PROXY_PORT=

PROXY_USER=

PROXY_PWD=

COLLECTOR_SUPPORTHUB_URL=

3、 获取帮助,启动静默安装

在静默安装Oracle软件之前,如果没有配置/etc/hosts文件,将会出现如五(1)的错误。

[oracle@wjq database]$ ./runInstaller –help

[oracle@wjq database]$ ./runInstaller -silent -ignoreSysPrereqs -ignorePrereq -responseFile /u01/sofrware/database/response/db_install.rsp

Starting Oracle Universal Installer...

Checking Temp space: must be greater than 500 MB.   Actual 18788 MB    Passed

Checking swap space: must be greater than 150 MB.   Actual 3023 MB    Passed

Preparing to launch Oracle Universal Installer from /tmp/OraInstall2017-07-06_02-07-35PM. Please wait ...[oracle@wjq database]$ You can find the log of this install session at:

/u01/app/oraInventory/logs/installActions2017-07-06_02-07-35PM.log

The installation of Oracle Database 12c was successful.

Please check '/u01/app/oraInventory/logs/silentInstall2017-07-06_02-07-35PM.log' for more details.

As a root user, execute the following script(s):

        1. /u01/app/oraInventory/orainstRoot.sh

        2. /u01/app/oracle/product/12.2.0/dbhome_1/root.sh

Successfully Setup Software.

-silent             表示静默安装
-noconfig          
表示只安装软件
-responseFile     
指定响应文件

4、 监控安装过程所产生的日志

[root@wjq response]# tail -f /u01/app/oraInventory/logs/installActions2017-07-06_02-07-35PM.log

INFO: Using paramFile: /u01/sofrware/database/install/oraparam.ini

INFO:

INFO:

INFO: Checking Temp space: must be greater than 500 MB.   Actual 18788 MB    Passed

INFO: Checking swap space: must be greater than 150 MB.   Actual 3023 MB    Passed

INFO:

INFO: The commandline for unzip:

INFO: /u01/sofrware/database/install/unzip -qqqo ../stage/Components/oracle.jdk/1.8.0.91.0/1/DataFiles/\*.jar -d

/tmp/OraInstall2017-07-06_02-07-35PM

INFO: Using the umask value '022' available from oraparam.ini

INFO: INFO: Oracle Universal Installer Version 12.2.0.1.4

INFO:

INFO: Execvp of the child jre : the cmdline is /tmp/OraInstall2017-07-06_02-07-35PM/jdk/jre/bin/java, and the arg

v is

INFO: /tmp/OraInstall2017-07-06_02-07-35PM/jdk/jre/bin/java

INFO: -Doracle.installer.library_loc=/tmp/OraInstall2017-07-06_02-07-35PM/oui/lib/linux64

INFO: -Doracle.installer.oui_loc=/tmp/OraInstall2017-07-06_02-07-35PM/oui

INFO: -Doracle.installer.bootstrap=TRUE

INFO: -Doracle.installer.startup_location=/u01/sofrware/database/install

INFO: -Doracle.installer.jre_loc=/tmp/OraInstall2017-07-06_02-07-35PM/jdk/jre

INFO: -Doracle.installer.nlsEnabled="TRUE"

INFO: -Doracle.installer.prereqConfigLoc=

INFO: -Doracle.installer.unixVersion=2.6.32-358.el6.x86_64

………

………

INFO: Completed executing action at state

INFO: Waiting for completion of background operations

INFO: Completed background operations

INFO: Waiting for completion of background operations

INFO: Completed background operations

INFO: Moved to state

INFO: Waiting for completion of background operations

INFO: Completed background operations

INFO: Validating state

WARNING: Validation disabled for the state finish

INFO: Completed validating state

INFO: Terminating all background operations

INFO: Terminated all background operations

INFO: Successfully executed the flow in SILENT mode

INFO: Dispose the current Session instance

INFO: Dispose the install area control object

INFO: Update the state machine to STATE_CLEAN

INFO: Finding the most appropriate exit status for the current application

INFO: Exit Status is 0

INFO: Shutdown Oracle Database 12c Release 2 Installer

5、安装过程,以root用户运行相应的脚本

[root@wjq ~]# /u01/app/oraInventory/orainstRoot.sh

Changing permissions of /u01/app/oraInventory.

Adding read,write permissions for group.

Removing read,write,execute permissions for world.

Changing groupname of /u01/app/oraInventory to oinstall.

The execution of the script is complete.

[root@wjq ~]# /u01/app/oracle/product/12.2.0/dbhome_1/root.sh

Check /u01/app/oracle/product/12.2.0/dbhome_1/install/root_wjq.comsys.com_2017-07-06_14-23-00-707842960.log for the output of root script

三、 配置监听器

1、 浏览Oracle监听响应文件netca.rsp

[oracle@wjq database]$ sed -n '/^[^#]/p' response/netca.rsp

[GENERAL]

RESPONSEFILE_VERSION="12.2"

CREATE_TYPE="CUSTOM"

[oracle.net.ca]

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"}

NSN_NUMBER=1

NSN_NAMES={"EXTPROC_CONNECTION_DATA"}

NSN_SERVICE={"PLSExtProc"}

NSN_PROTOCOLS={"TCP;HOSTNAME;1521"}

2、 编辑监听器配置响应文件netca.rsp

[oracle@wjq database]$ vim response/netca.rsp

[GENERAL]

RESPONSEFILE_VERSION="12.2"

CREATE_TYPE="CUSTOM"

[oracle.net.ca]

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"}

NSN_NUMBER=1

NSN_NAMES={"EXTPROC_CONNECTION_DATA"}

NSN_SERVICE={"PLSExtProc"}

NSN_PROTOCOLS={"TCP;HOSTNAME;1521"}

3、静默安装监听器

[oracle@wjq database]$ $ORACLE_HOME/bin/netca -silent -responsefile /u01/sofrware/database/response/netca.rsp

Parsing command line arguments:

Parameter "silent" = true

Parameter "responsefile" = /u01/sofrware/database/response/netca.rsp

Done parsing command line arguments.

Oracle Net Services Configuration:

Profile configuration complete.

Oracle Net Listener Startup:

Running Listener Control:

/u01/app/oracle/product/12.2.0/dbhome_1/bin/lsnrctl start LISTENER

Listener Control complete.

    Listener started successfully.

Listener configuration complete.

Oracle Net Services configuration successful. The exit code is 0

4、查看监听状态,并启动监听器

[oracle@wjq database]$ lsnrctl status

LSNRCTL for Linux: Version 12.2.0.1.0 - Production on 06-JUL-2017 14:46:27

Copyright (c) 1991, 2016, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=wjq.comsys.com)(PORT=1521)))

STATUS of the LISTENER

------------------------

Alias                     LISTENER

Version                   TNSLSNR for Linux: Version 12.2.0.1.0 - Production

Start Date                06-JUL-2017 14:43:52

Uptime                    0 days 0 hr. 2 min. 34 sec

Trace Level               off

Security                  ON: Local OS Authentication

SNMP                      OFF

Listener Parameter File   /u01/app/oracle/product/12.2.0/dbhome_1/network/admin/listener.ora

Listener Log File         /u01/app/oracle/diag/tnslsnr/wjq/listener/alert/log.xml

Listening Endpoints Summary...

(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=wjq.comsys.com)(PORT=1521)))

(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))

The listener supports no services

The command completed successfully

四、创建数据库

1、 浏览Oracle数据库响应文件dbca.rsp

[oracle@wjq database]$ sed -n '/^[^#]/p' response/dbca.rsp

responseFileVersion=/oracle/assistants/rspfmt_dbca_response_schema_v12.2.0

gdbName=

sid=

databaseConfigType=

RACOneNodeServiceName=

policyManaged=

createServerPool=

serverPoolName=

cardinality=

force=

pqPoolName=

pqCardinality=

createAsContainerDatabase=

numberOfPDBs=

pdbName=

useLocalUndoForPDBs=

pdbAdminPassword=

nodelist=

templateName=

sysPassword=

systemPassword=

oracleHomeUserPassword=

emConfiguration=

emExpressPort=5500

runCVUChecks=

dbsnmpPassword=

omsHost=

omsPort=

emUser=

emPassword=

dvConfiguration=

dvUserName=

dvUserPassword=

dvAccountManagerName=

dvAccountManagerPassword=

olsConfiguration=

datafileJarLocation=

datafileDestination=

recoveryAreaDestination=

storageType=

diskGroupName=

asmsnmpPassword=

recoveryGroupName=

characterSet=

nationalCharacterSet=

registerWithDirService=

dirServiceUserName=

dirServicePassword=

walletPassword=

listeners=

variablesFile=

variables=

initParams=

sampleSchema=

memoryPercentage=

databaseType=

automaticMemoryManagement=

totalMemory=

2、 编辑响应文件dbca.rsp

[oracle@wjq database]$ vim response/dbca.rsp                                                             responseFileVersion=/oracle/assistants/rspfmt_dbca_response_schema_v12.2.0

gdbName=prod.comsys.com

sid=seiang

databaseConfigType=

RACOneNodeServiceName=

policyManaged=

createServerPool=

serverPoolName=

cardinality=

force=

pqPoolName=

pqCardinality=

createAsContainerDatabase=

numberOfPDBs=

pdbName=

useLocalUndoForPDBs=

pdbAdminPassword=

nodelist=

templateName=General_Purpose.dbc

sysPassword=oracle

systemPassword=oracle

oracleHomeUserPassword=oracle

emConfiguration=

emExpressPort=5500

runCVUChecks=

dbsnmpPassword=

omsHost=

omsPort=

emUser=

emPassword=

dvConfiguration=

dvUserName=

dvUserPassword=

dvAccountManagerName=

dvAccountManagerPassword=

olsConfiguration=

datafileJarLocation=

datafileDestination=

recoveryAreaDestination=

storageType=

diskGroupName=

asmsnmpPassword=

recoveryGroupName=

characterSet=

nationalCharacterSet=

registerWithDirService=

dirServiceUserName=

dirServicePassword=

walletPassword=

listeners=

variablesFile=

variables=

initParams=

sampleSchema=true

memoryPercentage=

databaseType=

automaticMemoryManagement=

totalMemory=

3、静默创建数据库

[oracle@wjq templates]$ $ORACLE_HOME/bin/dbca -silent -createDatabase -responseFile /u01/sofrware/database/response/dbca.rsp

[WARNING] [DBT-06208] The 'SYS' password entered does not conform to the Oracle recommended standards.

CAUSE:

a. Oracle recommends that the password entered should be at least 8 characters in length, contain at least 1 uppercase character, 1 lower case character and 1 digit [0-9].

b.The password entered is a keyword that Oracle does not recommend to be used as password

ACTION: Specify a strong password. If required refer Oracle documentation for guidelines.

[WARNING] [DBT-06208] The 'SYSTEM' password entered does not conform to the Oracle recommended standards.

CAUSE:

a. Oracle recommends that the password entered should be at least 8 characters in length, contain at least 1 uppercase character, 1 lower case character and 1 digit [0-9].

b.The password entered is a keyword that Oracle does not recommend to be used as password

ACTION: Specify a strong password. If required refer Oracle documentation for guidelines.

Copying database files

1% complete

2% complete

18% complete

33% complete

Creating and starting Oracle instance

35% complete

40% complete

44% complete

49% complete

53% complete

54% complete

55% complete

58% complete

Completing Database Creation

59% complete

60% complete

61% complete

64% complete

68% complete

69% complete

Executing Post Configuration Actions

100% complete

Look at the log file "/u01/app/oracle/cfgtoollogs/dbca/prod/prod.log" for further details.

3、测试实例是否注册成功和能否登录到数据库

[oracle@wjq database]$ lsnrctl status

LSNRCTL for Linux: Version 12.2.0.1.0 - Production on 07-JUL-2017 15:05:17

Copyright (c) 1991, 2016, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=wjq.comsys.com)(PORT=1521)))

STATUS of the LISTENER

------------------------

Alias                     LISTENER

Version                   TNSLSNR for Linux: Version 12.2.0.1.0 - Production

Start Date                06-JUL-2017 14:43:52

Uptime                    1 days 0 hr. 21 min. 25 sec

Trace Level               off

Security                  ON: Local OS Authentication

SNMP                      OFF

Listener Parameter File   /u01/app/oracle/product/12.2.0/dbhome_1/network/admin/listener.ora

Listener Log File         /u01/app/oracle/diag/tnslsnr/wjq/listener/alert/log.xml

Listening Endpoints Summary...

(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=wjq.comsys.com)(PORT=1521)))

(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))

Services Summary...

Service "prod.comsys.com" has 1 instance(s).

Instance "seiang", status READY, has 1 handler(s) for this service...

Service "seiangXDB.comsys.com" has 1 instance(s).

Instance "seiang", status READY, has 1 handler(s) for this service...

The command completed successfully

[oracle@wjq database]$ sqlplus / as sysdba

SQL*Plus: Release 12.2.0.1.0 Production on Fri Jul 7 15:06:40 2017

Copyright (c) 1982, 2016, Oracle.  All rights reserved.

Connected to:

Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production

SQL>

SQL> select status from v$instance;

STATUS

------------

OPEN

至此,静态安装Oracle12.2结束,其他复杂参数的配置请参考Oracle官方文档!

 

 

五、遇到的错误以及解决方法

1、安装Oracle软件时报错:PRVF-0002 : Could not retrieve local nodename.

查看日志信息

[root@wjq ~]# tail -f  /tmp/OraInstall2017-07-06_01-49-38PM/installActions2017-07-06_01-49-38PM.log

INFO: Setting value for the property:configcmds in the bean:configcmdmappings

SEVERE: [FATAL] PRVF-0002 : could not retrieve local node name.

Refer associated stacktrace #oracle.install.commons.util.exception.AbstractErrorAdvisor:37

INFO: Advice is ABORT

SEVERE: Unconditional Exit

INFO: Adding ExitStatus FAILURE to the exit status set

WARNING: A log of this session is currently saved as: /tmp/OraInstall2017-07-06_01-49-38PM/installActions2017-07-06_01-49-38PM.log. Oracle recommends that if you want to keep this log, you should move it from the temporary location.

INFO: Finding the most appropriate exit status for the current application

INFO: Exit Status is -1

INFO: Shutdown Oracle Database 12c Release 2 Installer

猜测是找不到主机名的对应ip

解决办法:

修改了下/etc/hosts

[root@wjq ~]# vim /etc/hosts

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4

::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

10.1.1.45       wjq.comsys.com   wjq

 

 

2、安装Oracle软件时报错:Invalid My Oracle Support credentials. Specify the correct email address and password that you use to log in to My Oracle Support.

查看日志信息

[root@wjq ~]# tail -f /tmp/OraInstall2017-07-06_01-57-21PM/installActions2017-07-06_01-57-21PM.log

INFO: Waiting for completion of background operations

INFO: Completed background operations

INFO: Validating state

SEVERE: Invalid My Oracle Support credentials. Specify the correct email address and password that you use to log in to My Oracle Support.

After 2 more incorrect attempts, the product will be registered anonymously with the specified email address.

INFO: Adding ExitStatus VAR_VALIDATION_FAILURE to the exit status set

WARNING: A log of this session is currently saved as: /tmp/OraInstall2017-07-06_01-57-21PM/installActions2017-07-06_01-57-21PM.log. Oracle recommends that if you want to keep this log, you should move it from the temporary location.

INFO: Finding the most appropriate exit status for the current application

INFO: Exit Status is -2

INFO: Shutdown Oracle Database 12c Release 2 Installer

原因所在:

相应文件db_install.rsp文件中的参数MYORACLESUPPORT_USERNAME和MYORACLESUPPORT_PASSWORD配置的有问题

解决办法:

这两个参数不进行设置

3、 静默创建数据库时报错:[DBT-10503] Invalid template file specified.

出现这个报错信息的原因是:dbcs.rsp响应文件中的参数templateName配置出现错误,下面的这个东西就是咱们在建库的时候选择的模板,general purpose还是Data warehouing还是custom。这个东西在该路径下$ORACLE_HOME/assistants/dbca/templates

[oracle@wjq ~]$ cd $ORACLE_HOME/assistants/dbca/templates

[oracle@wjq templates]$ ll

total 411616

-rw-r----- 1 oracle oinstall      4697 Jan 26 15:38 Data_Warehouse.dbc                   //数据仓库的模板

-rw-r----- 1 oracle oinstall      4577 Jan 26 15:38 General_Purpose.dbc                    //标准的模板

-rw-r----- 1 oracle oinstall     10578 Jun 10  2016 New_Database.dbt                      //自定义的模板

-rw-r----- 1 oracle oinstall 121667584 Jan 26 15:30 pdbseed.dfb

-rw-r----- 1 oracle oinstall      6685 Jan 26 15:30 pdbseed.xml

-rw-r----- 1 oracle oinstall  18726912 Jan 26 15:37 Seed_Database.ctl                    //这个就是恢复的种子数据库的控制文件

-rw-r----- 1 oracle oinstall 281059328 Jan 26 15:37 Seed_Database.dfb                 //这个就是种子数据库的备份片,加上控制文件就能恢复出一个数据库来

解决方法:

将dbca.rsp响应文件中的参数按照如下的方式进行设置:templateName=General_Purpose.dbc

 

 

4、其他错误

特别要注意的是,等号两边不能有空格:
oracle.install.option=INSTALL_DB_SWONLY
 
DECLINE_SECURITY_UPDATES要设置成true
INFO: Adding ExitStatus VAR_VALIDATION_FAILURE to the exit status set

05-04 07:14