Install Oracle in silent mode 12C Release 2 (12.2) on OEL7

This article presents how to install Oracle 12C(12.2) Release 2 on Oracle Enterprise Linux 7 (OEL7) in silent mode.

Read following article how to install Oracle Enterprise Linux 7: Install Oracle Linux 7 (OEL7) (for comfort set 4G memory for your virtual machine before proceeding with Oracle software installation).

Software

Software for 12CR2 is available on OTN or edelivery

Database software

linuxamd64_12201_database.zip

OS configuration and preparation

OS configuration is executed as root. To login as root just execute following command in terminal.

su - root

The “/etc/hosts” file must contain a fully qualified name for the server.

<IP-address>  <fully-qualified-machine-name>  <machine-name>

For example.

127.0.0.1 oel7 oel7.dbaora.com localhost.localdomain localhost

Set hostname

hostnamectl set-hostname oel7.dbaora.com --static

Add groups

#groups for database management
groupadd -g 54321 oinstall
groupadd -g 54322 dba
groupadd -g 54323 oper
groupadd -g 54324 backupdba
groupadd -g 54325 dgdba
groupadd -g 54326 kmdba
groupadd -g 54327 asmdba
groupadd -g 54328 asmoper
groupadd -g 54329 asmadmin
groupadd -g 54330 racdba

Add user Oracle for database software

useradd -u 54321 -g oinstall \
-G dba,oper,backupdba,dgdba,kmdba,racdba oracle

Change password for user Oracle

passwd oracle

Packages

Check which packages are installed and which are missing

rpm -q --qf '%{NAME}-%{VERSION}-%{RELEASE}(%{ARCH})\n' binutils \
compat-libcap1 \
compat-libstdc++-33 \
glibc \
glibc-devel \
ksh \
libaio \
libaio-devel \
libX11 \
libXau \
libXi \
libXtst \
libgcc \
libstdc++ \
libstdc++-devel \
libxcb \
make \
nfs-utils \
smartmontools \
net-tools \
sysstat

You can install missing packages from dvd. Just mount it and install missing packages using rpm -Uvh command from directory <mount dvd>/Packages or by using yum install command.

NOTE – I’m using x86_64 version of packages

First option from dvd

rpm -Uvh libaio-devel*.x86_64.rpm
rpm -Uvh ksh*.x86_64.rpm

Second option using yum install command. It requires access to internet.

yum install libaio-devel*.x86_64
yum install ksh*.x86_64

Add kernel parameters to /etc/sysctl.conf

# kernel parameters for 12gR2 installation

fs.file-max = 6815744
kernel.sem = 250 32000 100 128
kernel.shmmni = 4096
kernel.shmall = 1073741824
kernel.shmmax = 4398046511104
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576
fs.aio-max-nr = 1048576
net.ipv4.ip_local_port_range = 9000 65500
kernel.panic_on_oops=1

Apply kernel parameters

/sbin/sysctl -p

Add following lines to set shell limits for user oracle in file /etc/security/limits.conf

# shell limits for users oracle 12gR2

oracle   soft   nofile   1024
oracle   hard   nofile   65536
oracle   soft   nproc    2047
oracle   hard   nproc    16384
oracle   soft   stack    10240
oracle   hard   stack    32768
oracle   soft   memlock  3145728
oracle   hard   memlock  3145728

Disable firewall

service iptables stop
chkconfig iptables off

Additional steps

Add following lines in .bash_profile for user oracle

# Oracle Settings
export TMP=/tmp

export ORACLE_HOSTNAME=oel7.dbaora.com
export ORACLE_UNQNAME=ORA12C
export ORACLE_BASE=/ora01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/12.2.0/db_1
export ORACLE_SID=ORA12C

PATH=/usr/sbin:$PATH:$ORACLE_HOME/bin

export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib;
export CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib;

alias cdob='cd $ORACLE_BASE'
alias cdoh='cd $ORACLE_HOME'
alias tns='cd $ORACLE_HOME/network/admin'
alias envo='env | grep ORACLE'

umask 022

if [ $USER = "oracle" ]; then
    if [ $SHELL = "/bin/ksh" ]; then
       ulimit -u 16384 
       ulimit -n 65536
    else
       ulimit -u 16384 -n 65536
    fi
fi

envo

Directory structure

Create directory structure as user root

ORACLE_BASE – /ora01/app/oracle

ORACLE_HOME – /ora01/app/oracle/product/12.2.0/db_1

mkdir -p /ora01/app/oracle/product/12.2.0/db_1
chown oracle:oinstall -R /ora01

“OPTIONAL” – In Oracle Enterprise Linux 7 /tmp data is stored on tmpfs which consumes memory and is too small. To revert it back to storage just run following command and REBOOT machine to be effective.

systemctl mask tmp.mount

Prepare database software for installation

su - oracle

--unizp software it will create directory "database" 
--where you can find installation software
unzip linuxamd64_12201_database.zip

--I defined 4 aliases in .bash_profile of user oracle to make 
--administration easier :)

[oracle@oel7 ~]$ alias envo cdob cdoh tns
alias envo='env | grep ORACLE'
alias cdob='cd $ORACLE_BASE'
alias cdoh='cd $ORACLE_HOME'
alias tns='cd $ORACLE_HOME/network/admin'

--run alias command envo to display environment settings
envo
ORACLE_UNQNAME=ORA12C
ORACLE_SID=ORA12C
ORACLE_BASE=/ora01/app/oracle
ORACLE_HOSTNAME=oel7.dbaora.com
ORACLE_HOME=/ora01/app/oracle/product/12.2.0/db_1

--run alias command cdob and cdoh 
--to check ORACLE_BASE, ORACLE_HOME 
[oracle@oel7 ~]$ cdob
[oracle@oel7 oracle]$ pwd
/ora01/app/oracle

[oracle@oel7 db_1]$ cdoh
[oracle@oel7 db_1]$ pwd
/ora01/app/oracle/product/12.2.0/db_1

Response files

Once Oracle 12CR2 binaries are unzipped you can find in directory /home/oracle/database/response dedicated files called “response files” used for silent mode installations.

The response files store parameters necessary to install Oracle components:

  • db_install.rsp – used to install oracle binaries, install/upgrade a database in silent mode
  • dbca.rsp – used to install/configure/delete a database in silent mode
  • netca.rsp – used to configure simple network for oracle database in silent mode
cd /home/oracle/database/response

[oracle@oel7 response]$ ls
dbca.rsp  db_install.rsp  netca.rsp

Install Oracle binaries

It’s the best to preserve original response file db_install.rsp before editing it

[oracle@oel7 response]$ cp db_install.rsp db_install.rsp.bck

Edit file db_install.rsp to set parameters required to install binaries. This is just example and in next releases parameters can be different. Each of presented parameter is very well described in db_install.rsp. I just give here brief explanations.

--------------------------------------------
-- force to install only database software
--------------------------------------------
oracle.install.option=INSTALL_DB_SWONLY

--------------------------------------------
-- set unix group for oracle inventory
--------------------------------------------
UNIX_GROUP_NAME=oinstall

--------------------------------------------
-- set directory for oracle inventory
--------------------------------------------
INVENTORY_LOCATION=/ora01/app/oraInventory

--------------------------------------------
-- set oracle home for binaries
--------------------------------------------
ORACLE_HOME=/ora01/app/oracle/product/12.2.0/db_1

--------------------------------------------
-- set oracle home for binaries
--------------------------------------------
ORACLE_BASE=/ora01/app/oracle

--------------------------------------------
-- set version of binaries to install
-- EE - enterprise edition
--------------------------------------------
oracle.install.db.InstallEdition=EE

--------------------------------------------
-- specify extra groups for database management
--------------------------------------------
oracle.install.db.OSDBA_GROUP=dba
oracle.install.db.OSOPER_GROUP=oper
oracle.install.db.OSBACKUPDBA_GROUP=backupdba
oracle.install.db.OSDGDBA_GROUP=dgdba
oracle.install.db.OSKMDBA_GROUP=kmdba
oracle.install.db.OSRACDBA_GROUP=racdba

once edition is completed. Start binaries installation.

cd /home/oracle/database
./runInstaller -silent \
-responseFile /home/oracle/database/response/db_install.rsp

output is following

[oracle@oel7 database]$ ./runInstaller -silent \
> -responseFile /home/oracle/database/response/db_install.rsp

Starting Oracle Universal Installer...

Checking Temp space: must be greater than 500MB.Actual 48021 MB Passed
Checking swap space: must be greater than 150MB. Actual 4095 MB Passed
Preparing to launch Oracle Universal Installer 
from /tmp/OraInstall2017-05-16_01-06-34PM. 
Please wait ...
[oracle@oel7 database]$ You can find the log 
of this install session at:
 /ora01/app/oraInventory/logs/installActions2017-05-16_01-06-34PM.log
The installation of Oracle Database 12c was successful.
Please check 
'/ora01/app/oraInventory/logs/silentInstall2017-05-16_01-06-34PM.log' 
for more details.

As a root user, execute the following script(s):
    1. /ora01/app/oraInventory/orainstRoot.sh
    2. /ora01/app/oracle/product/12.2.0/db_1/root.sh

Successfully Setup Software.

you are asked to run two scripts as user root. Once it’s done binaries are installed

[root@oel7 /]# 

/ora01/app/oraInventory/orainstRoot.sh
/ora01/app/oracle/product/12.2.0/db_1/root.sh

quick binary verification

[oracle@oel7 database]$ sqlplus / as sysdba
SQL*Plus: Release 12.2.0.1.0 Production on Tue May 16 13:16:14 2017
Copyright (c) 1982, 2016, Oracle.  All rights reserved.
Connected to an idle instance.
SQL>

Configure Oracle Net

Again based on response file Oracle Net will be configured

cd /home/oracle/database/response
cp netca.rsp netca.rsp.bck

You can edit netca.rsp to set own parameters. I didn’t changed anything here. So just start standard configuration. It will configure LISTENER with standard settings.

netca -silent -responseFile /home/oracle/database/response/netca.rsp

To my surprise I got error so I had to start manually LISTENER and port was changed from default 1521 to 1539.

[oracle@oel7 response]$ netca -silent \
-responseFile /home/oracle/database/response/netca.rsp

Parsing command line arguments:
  Parameter "silent" = true
  Parameter "responsefile" = /home/oracle/database/response/netca.rsp
Done parsing command line arguments.
Oracle Net Services Configuration:
Profile configuration complete.
Oracle Net Listener Startup:
The information provided for this listener is 
currently in use by other software on this computer. 
    Listener start failed.
Check the trace file for details: 
/ora01/app/oracle/cfgtoollogs/netca/
trace_OraDB12Home1-1705312PM4854.log
Oracle Net Services configuration failed.  
The exit code is 1

[oracle@oel7 admin]$ lsnrctl start

Check LISTENER status

[oracle@oel7 admin]$ lsnrctl status

LSNRCTL for Linux: Version 12.2.0.1.0 - Production 
on 16-MAY-2017 13:45:13

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

Connecting to 
(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=oel7.dbaora.com)(PORT=1539)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: 
Version 12.2.0.1.0 - Production
Start Date                16-MAY-2017 13:19:26
Uptime                    0 days 0 hr. 25 min. 47 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   
/ora01/app/oracle/product/12.2.0/db_1/network/admin/listener.ora
Listener Log File         
/ora01/app/oracle/diag/tnslsnr/oel7/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oel7)(PORT=1539)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
The listener supports no services
The command completed successfully

Configure database

The last setup is to create new container database ORA12C.dbaora.com with one pluggable database PORA12C1 and configure and enable oracle db express

Prepare directories for database datafiles and flash recovery area

mkdir /ora01/app/oracle/oradata
mkdir /ora01/app/oracle/flash_recovery_area

backup original response file for dbca

cd /home/oracle/database/response

cp dbca.rsp dbca.rsp.bck
vi dbca.rsp

set own parameters

--------------------------------------------
-- global database name
--------------------------------------------
gdbName=ORA12C.dbaora.com

--------------------------------------------
-- instance database name
--------------------------------------------
sid=ORA12C

--------------------------------------------
--create container database
--------------------------------------------
createAsContainerDatabase=true

--------------------------------------------
-- number of pluggable databases
--------------------------------------------
numberOfPDBs=1

--------------------------------------------
-- list of pluggable databases
--------------------------------------------
pdbName=PORA12C1

--------------------------------------------
-- pluggable administrator password
--------------------------------------------
pdbAdminPassword=Oracle12c

--------------------------------------------
-- template name used to create database
--------------------------------------------
templateName=General_Purpose.dbc

--------------------------------------------
-- password for user sys
--------------------------------------------
sysPassword=Oracle12c

--------------------------------------------
-- password for user system
--------------------------------------------
systemPassword=Oracle12c

--------------------------------------------
-- configure dbexpress with port 5500
--------------------------------------------
emConfiguration=DBEXPRESS
emExpressPort=5500

--------------------------------------------
-- password for dbsnmp user
--------------------------------------------
dbsnmpPassword=Oracle12c

--------------------------------------------
-- default directory for oracle database datafiles
--------------------------------------------
datafileDestination=/ora01/app/oracle/oradata

--------------------------------------------
-- default directory for flashback data
--------------------------------------------
recoveryAreaDestination=/ora01/app/oracle/flash_recovery_area

--------------------------------------------
-- storage used for database installation
-- FS - OS filesystem
--------------------------------------------
storageType=FS

--------------------------------------------
-- database character set
--------------------------------------------
characterSet=AL32UTF8

--------------------------------------------
-- national database character set
--------------------------------------------
nationalCharacterSet=AL16UTF16

--------------------------------------------
-- listener name to register database to
--------------------------------------------
listeners=LISTENER

--------------------------------------------
-- force to install sample schemas on the database
--------------------------------------------
sampleSchema=true

--------------------------------------------
--specify database type
--has influence on some instance parameters
--------------------------------------------
databaseType=OLTP

--------------------------------------------
-- force to use autmatic mamory management
--------------------------------------------
automaticMemoryManagement=TRUE

--------------------------------------------
-- defines size of memory used by the database
--------------------------------------------
totalMemory=1024

run database installation

dbca -silent -createDatabase \
-responseFile /home/oracle/database/response/dbca.rsp

Example output

[oracle@oel7 ~]$ dbca -silent -createDatabase \
-responseFile /home/oracle/database/response/dbca.rsp
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
47% complete
50% complete
Creating Pluggable Databases
55% complete
75% complete
Executing Post Configuration Actions
100% complete
Look at the log file 
"/ora01/app/oracle/cfgtoollogs/dbca/ORA12C/ORA12C0.log" 
for further details.

Verify connection

[oracle@oel7 ~]$ sqlplus / as sysdba

SQL*Plus: Release 12.2.0.1.0 Production on Wed May 31 16:45:22 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> show parameter db_name

NAME               TYPE     VALUE
----------- ----------- -------------
db_name          string     ORA12C
SQL> alter session set container=PORA12C1;

Session altered.

SQL> show con_id

CON_ID
------------------------------
3
SQL> show con_name

CON_NAME
------------------------------
PORA12C1
SQL>

Check port status of db expressin root database

SQL> select DBMS_XDB_CONFIG.GETHTTPSPORT 
from dual;

GETHTTPSPORT
------------
    5500

Edit the “/etc/oratab” file to set restart flag for ORA12C to ‘Y’.

ORA12C:/ora01/app/oracle/product/12..0/db_1:Y

Have a fun 🙂

Tomasz

3 thoughts on “Install Oracle in silent mode 12C Release 2 (12.2) on OEL7

  1. Pingback: Cài đặt Oracle Database 12c trên CentOS 7 – vnsys

  2. Muchas gracias por la guia todo fue excelente, tuve algunos detalles pero fueron mas por las capacidades del equipo pero todo perfecto, muchas gracias.

    Thank you very much for the guide everything was excellent, I had some details but they were more for the capabilities of the team but everything perfect, thank you very much.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.