oracle 12.2.0.1.0 install on centos 7.5
1、安装操作系统(过程略)
[root@oracle ~]# cat /etc/redhat-release
CentOS Linux release 7.5.1804 (Core)
2、修改主机名
[root@oracle ~]# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.99.150 oracle
[root@oracle ~]# hostname oracle
3、挂在镜像文件以及安装依赖软件
[root@oracle ~]# mount /dev/cdrom /iso -o loop
mount: /dev/sr0 is already mounted
[root@oracle ~]# cat rpm.txt
binutils
compat-libcap1
compat-libstdc++-33
compat-libstdc++-33.i686
glibc
glibc.i686
glibc-devel
glibc-devel.i686
ksh
libaio
libaio.i686
libaio-devel
libaio-devel.i686
libX11
libX11.i686
libXau
libXau.i686
libXi
libXi.i686
libXtst
libXtst.i686
libgcc
libgcc.i686
libstdc++
libstdc++.i686
libstdc++-devel
libstdc++-devel.i686
libxcb
libxcb.i686
make
nfs-utils
net-tools
smartmontools
sysstat
unixODBC
unixODBC-devel
gcc
gcc-c++
libXext
libXext.i686
zlib-devel
zlib-devel.i686
[root@oracle ~]# yum install -y `cat rpm.txt`
4、修改系统参数
[root@oracle ~]# cat /etc/sysctl.conf
# sysctl settings are defined through files in
# /usr/lib/sysctl.d/, /run/sysctl.d/, and /etc/sysctl.d/.
#
# Vendors settings live in /usr/lib/sysctl.d/.
# To override a whole file, create a new file with the same in
# /etc/sysctl.d/ and put new settings there. To override
# only specific settings, add a file with a lexically later
# name in /etc/sysctl.d/ and put new settings there.
#
# For more information, see sysctl.conf(5) and sysctl.d(5).
fs.file-max = 6815744
kernel.sem = 250 32000 100 128
kernel.shmmni = 4096
kernel.shmall = 1073741824
kernel.shmmax = 4398046511104
kernel.panic_on_oops = 1
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576
net.ipv4.conf.all.rp_filter = 2
net.ipv4.conf.default.rp_filter = 2
fs.aio-max-nr = 1048576
net.ipv4.ip_local_port_range = 9000 65500
[root@oracle ~]# sysctl -p
fs.file-max = 6815744
kernel.sem = 250 32000 100 128
kernel.shmmni = 4096
kernel.shmall = 1073741824
kernel.shmmax = 4398046511104
kernel.panic_on_oops = 1
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576
net.ipv4.conf.all.rp_filter = 2
net.ipv4.conf.default.rp_filter = 2
fs.aio-max-nr = 1048576
net.ipv4.ip_local_port_range = 9000 65500
[root@oracle ~]# cat /etc/security/limits.d/20-nproc.conf
# Default limit for number of user's processes to prevent
# accidental fork bombs.
# See rhbz #432903 for reasoning.
* soft nproc 4096
root soft nproc unlimited
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft nproc 16384
oracle hard nproc 16384
oracle soft stack 10240
oracle hard stack 32768
oracle hard memlock 134217728
oracle soft memlock 134217728
5、创建用户和组
groupadd oinstall
groupadd dba
groupadd oper
useradd -g oinstall -G dba,oper oracle
6、暂时关闭防火墙和selinux
vim /etc/selinux/config
SELINUX=disabled
systemctl stop firewalld
systemctl disable firewalld
7、创建目录
mkdir -p /u01
chown oralce:oinstall /u01
8、环境变量
[root@oracle ~]# cat /home/oracle/.bash_profile
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
PATH=$PATH:$HOME/.local/bin:$HOME/bin
export PATH
export TMP=/tmp
export TMPDIR=$TMP
export ORACLE_UNQNAME=pu
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/12.2.0.1/db_1
export ORACLE_SID=pu
export PATH=/usr/sbin:$PATH
export PATH=$ORACLE_HOME/bin:$PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
9、安装软件
编辑应答文件
[root@oracle ~]# vi /opt/database/response/db_install.rsp
30 oracle.install.option=INSTALL_DB_SWONLY
35 UNIX_GROUP_NAME=oinstall
42 INVENTORY_LOCATION=/u01/app/oracle/oraInventory
46 ORACLE_HOME=/u01/app/oracle/product/12.2.0.1/db_1
51 ORACLE_BASE=/u01/app/oracle
63 oracle.install.db.InstallEdition=EE
80 oracle.install.db.OSDBA_GROUP=dba
86 oracle.install.db.OSOPER_GROUP=oper
91 oracle.install.db.OSBACKUPDBA_GROUP=dba
96 oracle.install.db.OSDGDBA_GROUP=dba
101 oracle.install.db.OSKMDBA_GROUP=dba
106 oracle.install.db.OSRACDBA_GROUP=dba
180 oracle.install.db.config.starterdb.type=GENERAL_PURPOSE
185 oracle.install.db.config.starterdb.globalDBName=pu
190 oracle.install.db.config.starterdb.SID=pu
216 oracle.install.db.config.starterdb.characterSet=AL32UTF8
386 SECURITY_UPDATES_VIA_MYORACLESUPPORT=false
398 DECLINE_SECURITY_UPDATES=true
执行
[oracle@oracle ~]$ /opt/database/runInstaller -force -silent -noconfig -responseFile /opt/database/response/db_install.rsp
Starting Oracle Universal Installer...
Checking Temp space: must be greater than 500 MB. Actual 11715 MB Passed
Checking swap space: must be greater than 150 MB. Actual 2047 MB Passed
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2017-04-15_08-36-48PM. P[oracle@centos7 database]$ [WARNING] [INS-32055] The Central Inventory is located in the Oracle base.
ACTION: Oracle recommends placing this Central Inventory in a location outside the Oracle base directory.
You can find the log of this install session at:
/u01/app/oracle/oraInventory/logs/installActions2018-8-15_08-36-48PM.log
The installation of Oracle Database 12c was successful.
Please check '/u01/app/oracle/oraInventory/logs/silentInstall2018-08-15_08-36-48PM.log' for more details.
As a root user, execute the following script(s):
1. /u01/app/oracle/oraInventory/orainstRoot.sh
2. /u01/app/oracle/product/12.2.0.1/db_1/root.sh
Successfully Setup Software.
切换到root用户执行两个脚本
[root@oracle ~]# /u01/app/oracle/oraInventory/orainstRoot.sh
[root@centos7 ~]# /u01/app/oracle/product/12.2.0.1/db_1/root.sh
10、安装监听
不需要修改响应文件
执行
[oracle@oracle response]$ netca -silent -responsefile /opt/database/response/netca.rsp
查看监听状态
[oracle@oracle ~]$ lsnrctl status
LSNRCTL for Linux: Version 12.2.0.1.0 - Production on 17-AUG-2018 10:20:17
Copyright (c) 1991, 2016, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=oracle)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 12.2.0.1.0 - Production
Start Date 15-AUG-2018 14:14:23
Uptime 1 days 20 hr. 5 min. 54 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/12.2.0.1/db_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/diag/tnslsnr/oracle/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oracle)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Services Summary...
Service "73748bf2a3945447e0539663a8c0f785" has 1 instance(s).
Instance "pu", status READY, has 1 handler(s) for this service...
Service "pu" has 1 instance(s).
Instance "pu", status READY, has 1 handler(s) for this service...
Service "puXDB" has 1 instance(s).
Instance "pu", status READY, has 1 handler(s) for this service...
Service "pupdb1" has 1 instance(s).
Instance "pu", status READY, has 1 handler(s) for this service...
The command completed successfully
----这个是建库之后的状态
11、PDB模式建库
修改响应文件[oracle@oracle ~]$ cat /opt/database/response/dbca.rsp |grep -Ev '^#|^$'
responseFileVersion=/oracle/assistants/rspfmt_dbca_response_schema_v12.2.0
gdbName=pu
sid=pu
databaseConfigType=SI
RACOneNodeServiceName=
policyManaged=false
createServerPool=false
serverPoolName=
cardinality=
force=false
pqPoolName=
pqCardinality=
createAsContainerDatabase=true #选择创建12C新模式,cdb、pdb
numberOfPDBs=1
pdbName=pupdb1
useLocalUndoForPDBs=true
pdbAdminPassword=
nodelist=
templateName=/u01/app/oracle/product/12.2.0.1/db_1/assistants/dbca/templates/General_Purpose.dbc
sysPassword=
systemPassword=
oracleHomeUserPassword=
emConfiguration=
emExpressPort=5500
runCVUChecks=false
dbsnmpPassword=
omsHost=
omsPort=0
emUser=
emPassword=
dvConfiguration=false
dvUserName=
dvUserPassword=
dvAccountManagerName=
dvAccountManagerPassword=
olsConfiguration=false
datafileJarLocation={ORACLE_HOME}/assistants/dbca/templates/
datafileDestination={ORACLE_BASE}/oradata/{DB_UNIQUE_NAME}/
recoveryAreaDestination={ORACLE_BASE}/fast_recovery_area/{DB_UNIQUE_NAME}
storageType=FS
diskGroupName=
asmsnmpPassword=
recoveryGroupName=
characterSet=AL32UTF8
nationalCharacterSet=AL16UTF16
registerWithDirService=false
dirServiceUserName=
dirServicePassword=
walletPassword=
listeners=LISTENER
variablesFile=
variables=DB_UNIQUE_NAME=pu,ORACLE_BASE=/u01/app/oracle,PDB_NAME=,DB_NAME=pu,ORACLE_HOME=/u01/app/oracle/product/12.2.0.1/db_1,SID=pu
initParams=undo_tablespace=UNDOTBS1,memory_target=450MB,processes=300,db_recovery_file_dest_size=2780MB,nls_language=AMERICAN,dispatchers=(PROTOCOL=TCP) (SERVICE=puXDB),db_recovery_file_dest={ORACLE_BASE}/fast_recovery_area/{DB_UNIQUE_NAME},db_block_size=8192BYTES,diagnostic_dest={ORACLE_BASE},audit_file_dest={ORACLE_BASE}/admin/{DB_UNIQUE_NAME}/adump,nls_territory=AMERICA,local_listener=LISTENER_pu,compatible=12.2.0,control_files=("{ORACLE_BASE}/oradata/{DB_UNIQUE_NAME}/control01.ctl", "{ORACLE_BASE}/fast_recovery_area/{DB_UNIQUE_NAME}/control02.ctl"),db_name=pu,audit_trail=db,remote_login_passwordfile=EXCLUSIVE,open_cursors=300
sampleSchema=false
memoryPercentage=40
databaseType=MULTIPURPOSE
automaticMemoryManagement=true
totalMemory=0
执行建库
[oracle@oracle ~]$ dbca -silent -createDatabase -responseFile /opt/database/response/dbca.rsp
[WARNING] [DBT-06801] Specified Fast Recovery Area size (2,780 MB) is less than the recommended value.
CAUSE: Fast Recovery Area size should at least be three times the database size (2,730 MB).
ACTION: Specify Fast Recovery Area Size to be at least three times the database size.
Enter SYS user password:
Enter SYSTEM user password:
Enter PDBADMIN User Password:
[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.
[WARNING] [DBT-06208] The 'PDBADMIN' 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-06801] Specified Fast Recovery Area size (2,780 MB) is less than the recommended value.
CAUSE: Fast Recovery Area size should at least be three times the database size (3,571 MB).
ACTION: Specify Fast Recovery Area Size to be at least three times the database size.
Copying database files
1% complete
13% complete
25% complete
Creating and starting Oracle instance
26% complete
30% complete
31% complete
35% complete
38% complete
39% complete
41% complete
Completing Database Creation
42% complete
43% complete
44% complete
46% complete
49% complete
50% complete
Creating Pluggable Databases
55% complete
75% complete
Executing Post Configuration Actions
100% complete
Look at the log file "/u01/app/oracle/cfgtoollogs/dbca/pu/pu0.log" for further details.
12、非PDB模式建库
修改响应文件[oracle@oracle ~]$ cat /tmp/dbca.rsp |grep -Ev '^#|^$'
responseFileVersion=/oracle/assistants/rspfmt_dbca_response_schema_v12.2.0
gdbName=pu
sid=pu
databaseConfigType=SI
RACOneNodeServiceName=
policyManaged=false
createServerPool=false
serverPoolName=
cardinality=
force=false
pqPoolName=
pqCardinality=
createAsContainerDatabase= #默认为false
numberOfPDBs=
pdbName=
useLocalUndoForPDBs=
pdbAdminPassword=
nodelist=
templateName=/u01/app/oracle/product/12.2.0.1/db_1/assistants/dbca/templates/General_Purpose.dbc
sysPassword=
systemPassword=
oracleHomeUserPassword=
emConfiguration=
emExpressPort=5500
runCVUChecks=false
dbsnmpPassword=
omsHost=
omsPort=0
emUser=
emPassword=
dvConfiguration=false
dvUserName=
dvUserPassword=
dvAccountManagerName=
dvAccountManagerPassword=
olsConfiguration=false
datafileJarLocation={ORACLE_HOME}/assistants/dbca/templates/
datafileDestination={ORACLE_BASE}/oradata/{DB_UNIQUE_NAME}/
recoveryAreaDestination={ORACLE_BASE}/fast_recovery_area/{DB_UNIQUE_NAME}
storageType=FS
diskGroupName=
asmsnmpPassword=
recoveryGroupName=
characterSet=AL32UTF8
nationalCharacterSet=AL16UTF16
registerWithDirService=false
dirServiceUserName=
dirServicePassword=
walletPassword=
listeners=LISTENER
variablesFile=
variables=DB_UNIQUE_NAME=pu,ORACLE_BASE=/u01/app/oracle,DB_NAME=pu,ORACLE_HOME=/u01/app/oracle/product/12.2.0.1/db_1,SID=pu
initParams=undo_tablespace=UNDOTBS1,memory_target=450MB,processes=300,db_recovery_file_dest_size=2780MB,nls_language=AMERICAN,dispatchers=(PROTOCOL=TCP) (SERVICE=puXDB),db_recovery_file_dest={ORACLE_BASE}/fast_recovery_area/{DB_UNIQUE_NAME},db_block_size=8192BYTES,diagnostic_dest={ORACLE_BASE},audit_file_dest={ORACLE_BASE}/admin/{DB_UNIQUE_NAME}/adump,nls_territory=AMERICA,local_listener=LISTENER_pu,compatible=12.2.0,control_files=("{ORACLE_BASE}/oradata/{DB_UNIQUE_NAME}/control01.ctl", "{ORACLE_BASE}/fast_recovery_area/{DB_UNIQUE_NAME}/control02.ctl"),db_name=pu,audit_trail=db,remote_login_passwordfile=EXCLUSIVE,open_cursors=300
sampleSchema=false
memoryPercentage=40
databaseType=MULTIPURPOSE
automaticMemoryManagement=true
totalMemory=0
建库;
[oracle@oracle ~]$ dbca -silent -createDatabase -responseFile /tmp/dbca.rsp
[WARNING] [DBT-06801] Specified Fast Recovery Area size (2,780 MB) is less than the recommended value.
CAUSE: Fast Recovery Area size should at least be three times the database size (1,142 MB).
ACTION: Specify Fast Recovery Area Size to be at least three times the database size.
Enter SYS user password:
Enter SYSTEM user password:
[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.
[WARNING] [DBT-06801] Specified Fast Recovery Area size (2,780 MB) is less than the recommended value.
CAUSE: Fast Recovery Area size should at least be three times the database size (2,672 MB).
ACTION: Specify Fast Recovery Area Size to be at least three times the database size.
Copying database files
1% complete
2% complete
18% complete
33% complete
Creating and starting Oracle instance
35% complete
40% complete
44% complete
49% complete
50% complete
53% complete
55% complete
Completing Database Creation
56% complete
57% complete
58% complete
62% complete
65% complete
66% complete
Executing Post Configuration Actions
100% complete
Look at the log file "/u01/app/oracle/cfgtoollogs/dbca/pu/pu.log" for further details.
[oracle@oracle ~]$ sqlplus / as sysdba
SQL*Plus: Release 12.2.0.1.0 Production on Mon Sep 3 15:22:32 2018
Copyright (c) 1982, 2016, Oracle. All rights reserved.
Connected to:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production
SQL> select cdb from v$database;
CDB
---
NO
致此整个静默安装完成