Installing Oracle Database 12c

In this article, I will show you how to install Oracle Database 12c in a sandbox !

Preparing your sandbox

First of all, make sure that your CentOS 7 / Red Hat system is up to date.

yum update -y

You will need some dependencies to install Oracle, as zip or unzip.

yum install -y binutils.x86_64 compat-libcap1.x86_64 gcc.x86_64 gcc-c++.x86_64 glibc.i686 glibc.x86_64 glibc-devel.i686 glibc-devel.x86_64 ksh compat-libstdc++-33 libaio.i686 libaio.x86_64 libaio-devel.i686 libaio-devel.x86_64 libgcc.i686 libgcc.x86_64 libstdc++.i686 libstdc++.x86_64 libstdc++-devel.i686 libstdc++-devel.x86_64 libXi.i686 libXi.x86_64 libXtst.i686 libXtst.x86_64 make.x86_64 sysstat.x86_64 zip unzip

Let’s create Oracle groups and user on your sandbox

groupadd oinstall
groupadd dba
useradd -g oinstall -G dba oracle
passwd oracle

Next, edit your /etc/sysctl.conf system file to add / check the following parameters

fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 8329226240
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

When it’s done, apply them

sysctl -p
sysctl -a

Unzip your Oracle Database 12c installation package to a specific directerory (as /tmp/Oracle), then create some directories which will be used while installing Oracle.

mkdir /u01
mkdir /u02
chown -R oracle:oinstall /u01
chown -R oracle:oinstall /u02
chown -R oracle:oinstall /tmp/Oracle
chmod -R 775 /u01
chmod -R 775 /u02
chmod g+s /u01
chmod g+s /u02

You are now ready to run the installer ! Be careful, I will use the GUI installer. Make sure that you have installed a X server, or use some tools as mobaXterm with exported DISPLAY environment value.

/tmp/Oracle/runInstaller

Installing Oracle Database 12c

If you already own an Oracle account, you can provide your email address in this step. This is optional.

Oracle account

Select the “Create and configure a database” and click “Next”

Creating and configuring a database

Select “desktop class” and click “Next”, cause we are just setting up a sandbox

Using a desktop class system

Configure your Oracle instance, and click “Next”.

Using previously created directories, and setting up DataBase name and password

Click “Next” to validate the inventory directory

Tune your system, if needed, to remove all warnings (the Swap Size warning isn’t very important for me), then click “Next”

Check the sumary, then click “Install” to start the installation

Wait until the Oracle installation completes (can take a couple of minutes, coffee time !)

Installing…

You will be asked, during installation, to execute some scripts as “root”. Let’s execute them using the following commands (as root, of course)

cd /u01/app/oraInventory
./orainstRoot.sh
cd /u01/app/oracle/product/12.2.0/dbhome_1
./root.sh

The installation will complete. Just have to tune it to finish the sandbox.

Tuning Oracle server

If you are enabling the server firewall, you have to open the following ports :
– 1521/TCP
– 5500/TCP
– 5520/TCP
– 3938/TCP

firewall-cmd --zone=public --add-port=1521/tcp --add-port=5500/tcp --add-port=5520/tcp --add-port=3938/tcp --permanent
firewall-cmd --reload

Connect to your server as oracle, then edit your .bash_profile file to add the following lines (make sure to change the ORACLE_SID value to match your global DataBase name configured when installing Oracle 12c)

TMPDIR=$TMP; export TMPDIR
ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/12.1.0/dbhome_1; export ORACLE_HOME
ORACLE_SID=oracle; export ORACLE_SID
PATH=$ORACLE_HOME/bin:$PATH; export PATH
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib:/usr/lib64; export LD_LIBRARY_PATH
CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib; export CLASSPATH

Source your file to reload the configuration

source ~/.bash_profile

Starting the instance

Finally, you will be able to start your newly created instance and use it. To do it, just execute the following command lines, logged as oracle. The first command will start the listener, and the second line will start this Oracle instance

/u01/app/oracle/product/12.1.0/dbhome_1/bin/lsnrctl start
/u01/app/oracle/product/12.1.0/dbhome_1/bin/dbstart /u01/app/oracle/product/12.1.0/dbhome_1

Using SQL Developper (or sqlplus command), you will be able to connect to your new instance (you will may have to create a new user, who will be granted to connect to your new DataBase instance)

SQL Developper connection configuration

You now have a fully configured Oracle 12c instance in your sandbox !

Please follow and like us:

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.