How to Install Oracle Database 12C in Centos 7 Linux

1 - Step 1 :

Install Centos 7 :

Give ISO location in CD-Rom Location and Boot.

RAM 4 GB

Partition : 60 GB.

01 - Boot Partition    :  1,000 MB.

02 - /  Root Partition : 35,000 MB.

03 - Swap              :  8,000 MB.

04 - Data              :  The Rest of the space remaining.(around 16 GB.)


Give Required Packages including Virtual Box.


Give IP Address : 192.168.1.50  Subnet 255.255.255.0


2 - Step 2 :

Virtual Machine Networking :

Go to Settings > Network > Host Only Adaptor

                 Promiscuous Settings > Allow All


In the Host :

Control Panel\Network and Internet\Network Connections > Host Only Adaptor Give IP : 192.168.1.5

Now Ping from and to Guest and Host.

----------- If not connect with Putty (SSH) configure as below :

vi /etc/ssh/sshd_config

change the ip address to 192.168.1.50 lik this example below :

#

Port 22

AddressFamily any

ListenAddress 192.168.1.30


==== see the status :

systemctl status sshd.service

===== restart the service :

systemctl restart sshd.service


3 - Step 3 :

Mount Share Folder :

a - mount share folder in Virtual Box.

b - Run Guest Addition from Virtual Box Menu.

c - Mounting Folder location:

d - Create a share folder 1st named iso

e - Create a Directory named /media/shared

mkdir /media/shared

mount -t vboxsf iso /media/shared

f - Now go to /media/shared and get the folder shared from windows through centos7.

g - Copy the files :

  i) centos7.iso

 ii) linuxx64_12201_database.zip

iii) Get some txt file.

 to /data


4 - Confiture Repo setup of YUM :

--- centos yum setup

Remove all repos

remove yum cache :

rm -rf /var/cache/yum

cd /etc/yum.repos.d

cp Centos-Media.repo localrepo.repo

mkdir /media/localrepo

mount -o loop,ro /data/centos7.iso /media/localrepo

yum clean all

yum repolist


Install packages required by Oracle database with yum.


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

yum install -y binutils* 

yum install -y compat* 

yum install -y gcc* 

yum install -y glibc*

yum install -y ksh* 

yum install -y compat*

yum install -y libaio* 

yum install -y libgcc* 

yum install -y libstdc*

yum install -y libXi*

yum install -y libXtst*

yum install -y make*

yum install -y sysstat*

Step 2 - Configure User and System

New user and group are created, now we need to configure our system for the Oracle installation. 

There are some kernel parameters that we must configure for the Oracle installation.


Edit 'sysctl.conf' file with vim.

vi /etc/sysctl.conf

Paste configuration below.

fs.aio-max-nr = 1048576

fs.file-max = 6815744

kernel.shmall = 2097152

kernel.shmmax = 2147483648

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


Save the file and exit the editor.

Now run the commands below to display all kernel parameter and apply the new values.

sysctl -p

sysctl -a


Next, we need to configure some limits for the oracle user. Specify the max number process and max number of open files descriptors.


Edit 'limits.conf' file with vi.

vi /etc/security/limits.conf

Paste the configuration below.


oracle soft nproc 2047

oracle hard nproc 16384

oracle soft nofile 1024

oracle hard nofile 65536

Save the file and exit vim.


New user and system configuration is finished.


Step 3 - Configure Desktop

The Oracle installation requires GUI access, so the fastest way for this is by installing a X Window System on the server, and then access the GUI app with ssh -X option.


Install X Window System with yum command below.


yum groupinstall -y "X Window System"

When the installation is done, open a new terminal and connect to the server as oracle user with the ssh command option below. 

Try to run the GUI application and you will get the application screen.


ssh -X oracle@192.168.33.15


Step 4 - Download Oracle Database :

---------------- copied from 11g :

Disable secure linux by editing the /etc/selinux/config file, making sure the SELINUX flag is set as follows: -

SELINUX=disabled 

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

--- User Accounts and Groups:  --

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

#  groupadd -g 1001 oinstall 

#  groupadd -g 1002 dba 

#  groupadd -g 1003 oper 

#  useradd -u 1002 -g oinstall -G dba,oper,asmadmin,asmdba,asmoper oracle 

#  passwd oracle 


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

--- File System Layout         --

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


# mkdir -p /u01/app/oracle 

# chown -R oracle:oinstall /u01 

# chmod -R 775 /u01 


chown -R oracle:dba /data

chmod -R 777 /data


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

--- Login as Oracle user and add below lines at the end of /home/oracle/.bash_profile file ---

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

ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE 

ORACLE_HOME=$ORACLE_BASE/product/12.2.0/dbhome_1; 

export ORACLE_HOME ORACLE_SID=srvr; export ORACLE_SID 

ORACLE_TERM=xterm; export ORACLE_TERM PATH=/user/sbin:$PATH; 

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

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

CLASSPATH=$ORACLE_HOME/lib:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib; 

export CLASSPATH 


if [ $USER = "oracle" ]; then 

if [ $SHEL ="/bin/ksh"  ]; then 

ulimit -p 16384 

ulimit -p 65536

else

ulimit -u 16384 -n 65536

fi

fi 


Restart OS to get effect of changed parameters 


Step 5 - Install Oracle Database 12c

cd /data/database/

./runInstaller


'Typical Installation' info.

Oracle base: '/u01/app/oracle'

Software location: /u01/app/oracle/product/12.1.0/dbhome_1

Database file location: /u02

Database edition: Default

Character set: Default

OSDBA group: dba

Global database name: Type your own name

Administrative password: Type your own password

Confirm password: Type again

Uncheck the 'Create as Container database'


At 'Create Inventory', enter the path below:

Inventory Directory: /u01/app/oraInventory

oraInventory Group Name: use 'oinstall' group.

Click 'Next'.

Open a new terminal and execute the files.

ssh root@192.168.33.15

/u01/app/oraInventory/orainstRoot.sh

/u01/app/oracle/product/12.1.0/dbhome_1/root.sh


Click 'Ok' and the Oracle database installation is done.

Click 'Close'.


Oracle Database Installation is done


Step 6 - Testing

The Oracle installation is finished and ready for testing. I will try to access Oracle from the command line first.

Log in to the server and access the oracle user.

ssh root@192.168.33.15

TYPE YOUR PASSWORD

Login to the oracle user.


su - oracle

Execute the commands below to set the oracle environment.


export ORACLE_SID=srvr

export ORACLE_HOME=/u01/app/oracle/product/12.1.0/dbhome_1/

export PATH=$PATH:$ORACLE_HOME/bin

Access the oracle database utility 'sqlplus', log in as 'sysdba' privileges.


sqlplus / as sysdba

Oracle comes with some default users. Run the query below if you want to change the default user named 'sys'.


alter user sys identified by yourpassword;

SQLPlus Oracle Database


Sqlplus is working fine.


Next, try to access the web-based 'Oracle Enterprise Manager'. Open your web browser and type the https URL below on port 5500. Use the IP of your server!


https://192.168.33.55:5500/em/


Login with user 'system', and the password you have setup as 'Administrative Password' in step 5. Or you can use the 'sys' user and your password.


Oracle Enterprise management Database

After login, you will see the 'Oracle Enterprise Manager' dashboard below.

Oracle Enterprise Manager Database

The Oracle Database 12c installation and configuration is done.

Oracle database utility and Oracle Enterprise manager are working.

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

Post Installation Tasks:  --

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

Oracle provides the means to do this using scripts called dbshut and dbstart that are located in your $ORACLE_HOME/bin directory. 

The above two scripts actually read the /etc/oratab file to find out which databases to stop and start.

$ORACLE_HOME/bin

CD /etc

touch oratab

/etc/oratab


So the first thing we need to do is edit the /etc/oratab file and make sure that the databases are set to stop and start when the dbshut and dbstart commands are passed. You do this by making sure the last letter is set to ‘Y’. If you have a specific database you don’t want the scripts to affect you put a ‘N’. See below for examples.


srvr:/u01/app/oracle/product/12.2.0/dbhome_1:Y 


Next we will need to create a script to take advantage of the dbshut and dbstart commands when you are shutting down or rebooting the server. Create a file: 

/etc/init.d/dbora


In the file paste the following:


#!/bin/sh

# chkconfig: 345 99 10

# description: Service to start and stop Oracle Database and Listener

#

# processname: oracle

# config: /etc/oratab

# pidfile: /var/run/oracle.pid


# Source function library.


. /etc/init.d/functions


RETVAL=0

ORA_OWNER="oracle"

ORA_HOME="/u01/app/oracle/product/12.2.0/dbhome_1"


# See how we were called.


prog="oracle"


start() {

echo -n $"Starting $prog: "

su - $ORA_OWNER -c "$ORA_HOME/bin/dbstart $ORA_HOME"

RETVAL=$?

echo

[ $RETVAL -eq 0 ] && touch /var/lock/subsys/dbora


return $RETVAL

}


stop() {

echo -n $"Stopping $prog: "

su - $ORA_OWNER -c "$ORA_HOME/bin/dbshut $ORA_HOME"

RETVAL=$?

echo

[ $RETVAL -eq 0 ] && rm -r /var/lock/subsys/dbora


return $RETVAL

}


restart() {

stop

start

}


case "$1" in

start)

start

;;

stop)

stop

;;

restart)

restart

;;

*)

echo $"Usage: $0 {start|stop|restart}"

exit 1

esac


exit $?


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


You need to make sure to change the script so that the ORA-OWNER and ORA_HOME match your configuration.


Next you need to run the following commands to change permissions and make the service active.


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


# chgrp  dba /etc/init.d/dbora

# chmod 750 /etc/init.d/dbora

# chkconfig --level 345 dbora on


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


With that you should be able to now reboot your server and have the databases and 

listener(s) stop and start automatically.

https://192.168.1.50:5500/em

Connection hangs :

exec dbms_xdb_config.SetGlobalPortEnabled(TRUE);

SQLNET.ALLOWED_LOGON_VERSION_CLIENT=8

SQLNET.ALLOWED_LOGON_VERSION_SERVER=8

======= LISTENER :

SID_LIST_LISTENER =

  (SID_LIST =

    (SID_DESC =

      (GLOBAL_DBNAME = SRVR)

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

      (SID_NAME = SRVR)

    )

  )


LISTENER =

  (DESCRIPTION_LIST =

    (DESCRIPTION =

      (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))

    )

    (DESCRIPTION =

      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))

    )

  )


ADR_BASE_LISTENER = /u01/app/oracle

=========== sqlnet.ora

NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)

SQLNET.OUTBOUND_CONNECT_TIMEOUT=99999

SQLNET.ALLOWED_LOGON_VERSION_CLIENT=8

SQLNET.ALLOWED_LOGON_VERSION_SERVER=8


NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)


SQLNET.ALLOWED_LOGON_VERSION_CLIENT=8

SQLNET.ALLOWED_LOGON_VERSION_SERVER=8


SQLNET.AUTHENTICATION_SERVICES= (ALL)


SQLNET.INBOUND_CONNECT_TIMEOUT=360

SQLNET.RECV_TIMEOUT=10

SQLNET.SEND_TIMEOUT=10


SQLNET.OUTBOUND_CONNECT_TIMEOUT=99999


Click for Script : Install Oracle12c in centos7



Muhammad Abdullah Al Noor

Muhammad Abdullah Al Noor, An Oracle Apex Consultants and founder of Noors Technology (www.noorstech.com). Core Expertise : Database Administration, Oracle Forms and Reports Development, Oracle Apex Application Designer and Development, Linux Professional etc. Also the owner of TrainerBD Training and OraDemy E-Learning. WhatsApp +8801790721177

Post a Comment

Previous Post Next Post