INSTALL ORACLE DATABASE 12C RELEASE 2 ON CENTOS 7.6 (64BIT)
Configure firewall
Use this command to find your active zone(s)
# firewall-cmd --get-active-zones
It will say either public, dmz, or something else. You should only apply to the zones required.
In the case of public try:
# firewall-cmd --zone=public --add-port=1521/tcp --permanent
# firewall-cmd --zone=public --add-port=5500/tcp --permanent
Then remember to reload the firewall for changes to take
effect.
# firewall-cmd --reload
I.
Setup Environment for Oracle Database (login as nhantt)
# sudo yum install -y binutils compat-libstdc++-33 compat-libstdc++-33.i686 gcc gcc-c++ glibc glibc.i686 glibc-devel glibc-devel.i686 ksh libgcc libgcc.i686 libstdc++ libstdc++.i686 libstdc++-devel libstdc++-devel.i686 libaio libaio.i686 libaio-devel libaio-devel.i686 libXext libXext.i686 libXtst libXtst.i686 libX11 libX11.i686 libXau libXau.i686 libxcb libxcb.i686 libXi libXi.i686 make sysstat unixODBC unixODBC-devel zlib-devel xclock
2)
Create Oracle user and group
# useradd -g oinstall oracle && echo oracle:'oraPassword'
| chpasswd
# chown -R oracle:oinstall /oracle
# chmod -R 775 /oracle
# chmod g+s /oracle
5)
Create folder and upload installation file
# mkdir /home/oracle/installation_src
[ Upload installation folders and files from local machine
to this folder. ]
6)
Grant permission to source folder
# chmod -R 775 /home/oracle/installation_src
# chmod g+s /home/oracle/installation_src
7)
Go to installation source directory
# ls -lh
9)
Extract the Oracle files to a new
directory named 'stage'.
# unzip linuxamd64_12102_database_1of2.zip -d /stage/
# unzip linuxamd64_12102_database_2of2.zip -d /stage/
10) Change
owner and group of the '/stage/' directory
Change to the oracle user and oinstall group.
# chown -R oracle:oinstall /stage/
11) Next,
create new directories for the Oracle installation and database files.
Directory 'u01' is for the Oracle installation files and
'u02' for the Oracle database files.
# mkdir -p /u01 /u02
12) Change
owner and permission of the new directories.
# chown -R oracle:oinstall /u01 /u02
# chmod -R 775 /u01 /u02
# chmod g+s /u01 /u02
13) Set
the limits for Oracle user in /etc/security/limits.conf file
# sudo vi /etc/security/limits.conf
###################################
##### ORACLE
DATABASE #####
###################################
#<domain>
<type>
<item>
<value>
oracle
soft nproc 131072
oracle
hard nproc 131072
oracle
soft nofile 131072
oracle
hard nofile 131072
oracle
soft core unlimited
oracle
hard core unlimited
oracle
soft memlock 50000000
oracle
hard memlock 50000000
# sudo /sbin/sysctl -w kernel.sem="250 32000 100
128"
kernel.sem = 250 32000 100 128
# sudo /sbin/sysctl -w fs.aio-max-nr=1048576
fs.aio-max-nr = 1048576
# sudo /sbin/sysctl -w kernel.shmmax=4398046511104
kernel.shmmax = 4398046511104
# sudo /sbin/sysctl -w kernel.shmall=1073741824
kernel.shmall = 1073741824
# sudo /sbin/sysctl -w net.core.wmem_max=1048586
net.core.wmem_max = 1048586
# sudo /sbin/sysctl -w net.core.wmem_default=262144
net.core.wmem_default = 262144
# sudo /sbin/sysctl -w net.core.rmem_max=4194304
net.core.rmem_max = 4194304
# sudo /sbin/sysctl -w net.core.rmem_default=262144
net.core.rmem_default = 262144
# sudo /sbin/sysctl -w net.ipv4.ip_local_port_range=
"9000
65500"
net.ipv4.ip_local_port_range = 9000 65500
# sudo /sbin/sysctl -w kernel.shmmni=4096
kernel.shmmni = 4096
# sudo /sbin/sysctl -w kernel.shmmax=8329226240
kernel.shmmax = 8329226240
Edit ‘/etc/sysctl.conf ' file with vim. Paste configuration
below.
# sudo /etc/sysctl.conf
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 file and exit.
# sudo sysctl –p
# sudo sysctl –a > /tmp/sysctl-a.txt
15) Reboot
server to apply changes
# sudo reboot
16) Set
the DISPLAY Environment (login as root)
a. Make
sure you have “Tick” the Enable X11 forwarding in Putty or MobaXterm.
b. Create
file /root/.Xauthority
# touch /root/.Xauthority
c. Uncomment
the X11Forwarding and set to “yes” in /etc/ssh/sshd_config file.
# vi /etc/ssh/sshd_config
d. Restart
server sshd
# service sshd restart
# xauth list $DISPLAY
mmvnvuoradbho01/unix:10
MIT-MAGIC-COOKIE-1
9ffdd3db87e435362b50d18084766285
# echo $DISPLAY
localhost:10.0
[ IF the output shows nothing, set the display env first… ]
# export DISPLAY=localhost:10.0
# echo $DISPLAY
e. Switch
to user oracle
# su - oracle
f. Go to
home directory
# cd $HOME
g. Check
current folder
# pwd
/home/oracle
# touch .Xauthority
# xauth list $DISPLAY
# echo $DISPLAY
[ Both the xauth list and DISPLAY shows NO output, Whereas,
we need to add it now. ]
# xauth add mmvnvuoradbho01/unix:10 MIT-MAGIC-COOKIE-1 9ffdd3db87e435362b50d18084766285
[Add the root MIT-MAGIC-COOKIE in oracle user ]
# export DISPLAY=localhost:10.0
export DISPLAY=localhost:10.0
# echo $DISPLAY
localhost:10.0
h. Now,
try to issue the command “xclock” and wait for it launch.
# xclock
1) Open a
new terminal and connect to the CentOS 7 server with the ssh command below.
# ssh -X oracle@localhost
2) Go to
the stage database directory and run the installer file.
# cd /stage/database/
# ./runInstaller
3) The
script will check the server, make sure all tests are passed.
4) And
you will see the GUI installation screen below, there click 'Next'.
Click ‘Yes’ if see pop up message like this.
5) At
'Installation Options', choose 'Create and configure a database' and click
'Next'.
7) In
‘Grid Installation Options’, select ‘Single Instance database installation’,
click ‘Next’.
8) In
‘Install Type’, select ‘Typical install’, click ‘Next’.
9) In 'Typical
Installation'.
·
Oracle base: '/u01/app/oracle'
·
Software location:
/u01/app/oracle/product/12.1.0/dbhome_1
·
Database file location: /u02
·
Database edition: Default [Enterprise Edition
(6.4GB)]
·
Character set: Default (WE8MSWIN1252)
·
OSDBA group: oinstall
·
Global database name: orcl
·
Administrative password: Type your own password,
must has number and no special char.
·
Confirm password: Type again
·
Uncheck the 'Create as Container database'
Click Next.
10) At
'Create Inventory', enter the path below:
·
Inventory Directory: /u01/app/oraInventory
·
oraInventory Group Name: use 'oinstall' group.
Click 'Next'.
11) Make
sure all checks completed without an error, then you will see a summary of the
Oracle configuration. Click 'Install'.
12) Installation
process.
13) During
installation process, you will be asked to execute some scripts as root.
14) Open a
new terminal and execute the files.
# ssh root@localhost
# /u01/app/oraInventory/orainstRoot.sh
# /u01/app/oracle/product/12.1.0/dbhome_1/root.sh
You will get the results below.
15) Next,
you will be shown a new pop-up from the database configuration assistant,
please wait, it takes a time.
16) When
the 'Database Configuration Assistant' is finished, you will see the info
below:
17) Click
'Ok' and the Oracle database installation is done. Click 'Close'.
18) Switch
to user ‘root’, now, change the /etc/oratab entry from “N” to
“Y”
# vi /etc/oratab
orcl:/oracle/app/oracle/product/12.2.0/dbhome_1:Y
19) Switch
to user ‘oracle’, add the below entries in .bash_profile file
# cd $HOME
# vi ./bash_profile
export ORACLE_HOSTNAME=mmvnvuoraho01
export ORACLE_UNQNAME=orcl
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/12.1.0/dbhome_1
export ORACLE_SID=orcl
export PATH=$PATH:$ORACLE_HOME/bin
20) Execute
bash profile
# source .bash_profile
21) Edit
file /u01/app/oracle/product/12.1.0/dbhome_1/network/admin/listener.ora
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME
= ORCL)
(SID_NAME =
ORCL)
(ORACLE_HOME =
/u01/app/oracle/product/12.1.0/dbhome_1)
)
)
USE_SID_AS_SERVICE_LISTENER = ON
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS =
(PROTOCOL = TCP)(HOST = 172.26.24.221)(PORT = 1521))
(ADDRESS =
(PROTOCOL = IPC)(KEY = EXTPROC1521))
)
)
22) Edit
file /u01/app/oracle/product/12.1.0/dbhome_1/network/admin/tnsnames.ora
LISTENER_ORCL =
(ADDRESS =
(PROTOCOL = TCP)(HOST = 172.26.24.221)(PORT = 1521))
ORCL =
(DESCRIPTION =
(ADDRESS =
(PROTOCOL = TCP)(HOST = 172.26.24.221)(PORT = 1521))
(CONNECT_DATA =
(SERVER =
DEDICATED)
(SERVICE_NAME =
orcl)
)
)
23) Stop
Listener
$ORACLE_HOME/bin/lsnrctl stop LISTENER
24) Start
Listener
$ORACLE_HOME/bin/lsnrctl start LISTENER
The Oracle installation is finished and ready for testing.
1) I will
try to access Oracle from the command line first. Log in to the server and
access the oracle user.
# su - oracle
2) Access
the oracle database utility 'sqlplus'. Log in as 'sysdba' privileges.
# sqlplus / as sysdba
3) (Optional)
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;
4) 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://172.26.24.221:5500/em/
5) Login
with user 'system', and the password you have setup as 'Administrative
Password' in step 6. Or you can use the 'sys' user and your password.
6) After
login, you will see the 'Oracle Enterprise Manager' dashboard below.
The Oracle Database 12c installation and configuration is
done.
Oracle database utility and Oracle Enterprise manager are working.