Saturday, February 8, 2020

Installation of ORACLE 19c at CentOS 8

After installing CentOS 8 , I have decided to install oracle db. With CentOS 7 i used oracle 12c for my work. But when I try to install Oracle 12c at CentOS 8 it show warning INS-13001


By Ignoring this warning message i can install Oracle12c, but i have decided to install Oracle 19c
So I download it from Oracle website. For Linux, Oracle19c have two variant one is rpm and other .zip file. I have decided to download zip file.

Prerequisite of ORACLE 19c For CentOS/ RedHat 8

Server Configuration
Oracle Server Configuration
Machine NameIP AddressProcessorOSMemory
devbase.lambda.asia192.168.0.11 x AMD Athlon™ 64 X2 Dual Core Processor 3800+CentOS 8 (64-bit)8GB


Disk Partition for Oracle Software As per oracle Recommendation
Mount Point UsagesSize
/u01Oracle Database Softwareat least 8 GB
/u02Data fileat least 6 GB but it should be according to your db size
/u03Recovery AreaSame as data file

Server Hardware and Memory Check List
ComponentRecomendationHow To Check
Physical RAMat least 1 GB
#grep MemTotal /proc/meminfo
Swapif 1GB < RAM < 2GB then 1.5 times of RAM
if 2GB < RAM < 16GB then equal to SIZE of RAM
if RAM >16GB then SWAP SIZE is 16 GB
#grep SwapTotal /proc/meminfo
tmp dirat least 1 GB
#df -h /tmp

Oracle Configuration

This section provides instruction how to create the operating system user and groups that will used to manage and install oracle database release 19c.


Create Oracle Software Owner
Description OS Group NameOS User Assigned to  this GroupOracle PrivilegeOracle Group NameHome Directory
Oracle Inventory and Software Owneroinstalloracle/home/oracle
Database Administratordbaoracle,yogeshSYSDBAOSDBA
Database Operatoroperoracle,yogeshSYSOPEROSOPER

# groupadd oinstall
#groupadd dba
#groupadd oper
#useradd -g oinstall -G dba,oper -c "oracle software owner" oracle

Now create password for user oracle
#passwd oracle
Changing password for user oracle.

New password: xxxxxxxxxxx 

Retype new password: xxxxxxxxxxx 

passwd: all authentication tokens updated successfully.
Create Environment variable for user Oracle
# su - oracle
Login to machine using user Oracle and set enviornment variable.
$vim ~/.bash_profile 

# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
 . ~/.bashrc
fi

# User specific environment and startup programs
export TMP=/tmp
export TMPDIR=$TMP
export ORACLE_HOSTNAME=devbase.lambda.asia
export ORACLE_UNQNAME=devdb
##########ORACLE BASE #############

ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE

export ORACLE_HOME=$ORACLE_BASE/product/19.3.0/dbhome_1
export ORA_INVENTORY=/u01/app/oraInventory
export ORACLE_SID=devdb
export PDB_NAME=devdbpdb
export DATA_DIR=/u02/app/oracle/oradata
export GLOBAL_NAME=devdb.lambda.asia
# ---------------------------------------------------
# TNS NAME SETTING
# ---------------------------------------------------
export TNS_ADMIN=$ORACLE_HOME/network/admin
# ---------------------------------------------------
# PATH
# ---------------------------------------------------
# Used by the shell to locate executable programs;
# must include the $ORACLE_HOME/bin directory.
# ---------------------------------------------------
PATH=.:${PATH}:$ORACLE_HOME/bin:/u01/app/oracle/dba_scripts/bin
export PATH

# ---------------------------------------------------
# LD_LIBRARY_PATH
# ---------------------------------------------------
# Specifies the list of directories that the shared
# library loader searches to locate shared object
# libraries at runtime.
# ---------------------------------------------------

LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib:/usr/local/lib
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$ORACLE_HOME/oracm/lib
export LD_LIBRARY_PATH
# ---------------------------------------------------
# CLASSPATH
# ---------------------------------------------------
# The class path is the path that the Java runtime
# environment searches for classes and other resource
# files. The class search path (more commonly known
# by the shorter name, "class path") can be set using
# either the -classpath option when calling a JDK
# tool (the preferred method) or by setting the
# CLASSPATH environment variable. The -classpath
# option is preferred because you can set it
# individually for each application without affecting
# other applications and without other applications
# modifying its value.
# --------------------------------------------------

CLASSPATH=.:$ORACLE_HOME/jdbc/lib/ojdbc6.jar
CLASSPATH=${CLASSPATH}:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
CLASSPATH=${CLASSPATH}:$ORACLE_HOME/network/jlib
export CLASSPATH


Oracle Software Component
Software ComponentVersion
Oracle DatabaseOracle Database Release 19c Zip file

Oracle Database Name
Software ComponentOracle SIDGlobal Database Name
oracle container database(cdb)devdbdevdb.lambda.asia
oracle pluggable databasedevpdbdevpdb.lambda.asia

Oracle Software Component
DiscriptionDirectory
Oracle Base /u01/app/oracle
Oracle Home /u01/app/oracle/product/19.3.0/dbhome_1
Oracle data /u02/app/oracle/oradata
Oracle Recovery Files /u03/app/oracle/flash_recovery_area

Create Oracle Base
# mkdir -p /u01/app/oracle
# chown -R oracle.oinstall /u01/app 
# chmod -R 775 /u01/app 
Create Oracle Home
$ mkdir -p /u01/app/oracle/product/19.3.0/dbhome_1
Create Oracle Data Directory
# mkdir -p /u02/app/oracle/oradata
# chown -R oracle.oinstall /u02/app 
# chmod -R 775 /u02/app 
Create Recovery Directory
# mkdir -p /u03/app/oracle/flash_recovery_area 
# chown -R oracle.oinstall /u03/app 
# chmod -R 775 /u03/app 
 

Configuring  Kernel Parameters for Linux

This section focuses on preparing the CentOS/RedHat 8 machine for Oracle 19c installation. This section include verfying memory and swap space , setting shared memory and semaphores, setting the maximum number of file handles, setting IP local port range.


Following table show the minimum kernel parameter settings
If the current value for any parameter is greater than the value listed in this table, then the Fixup scripts do not change the value of that parameter.
Parameter Value File
semmsl
semmns
semopm
semmni
250
32000
100
128
/proc/sys/kernel/sem
shmall Greater than or equal to the value of shmmax, in pages. /proc/sys/kernel/shmall
shmmax Half the size of physical memory in bytes /proc/sys/kernel/shmmax
shmmni 4096 /proc/sys/kernel/shmmni
panic_on_oops 1 /proc/sys/kernel/panic_on_oops
file-max 6815744 /proc/sys/fs/file-max
aio-max-nr 1048576
Note: This value limits concurrent outstanding requests and should be set to avoclass="tblrow" I/O subsystem failures.
/proc/sys/fs/aio-max-nr
ip_local_port_range Minimum: 9000
Maximum: 65500
/proc/sys/net/ipv4/ip_local_port_range
rmem_default 262144 /proc/sys/net/core/rmem_default
rmem_max 4194304 /proc/sys/net/core/rmem_max
wmem_default 262144 /proc/sys/net/core/wmem_default
wmem_max 1048576 /proc/sys/net/core/wmem_max

1. The kernel parameter need to persist after reboot. there are serveral method to set kernel parameter. In CentOS 8 or RedHat 8  i used /etc/sysctl.d/ and create a file 97-oracle-database-sysctl.conf  file and add kernel parameter in it.
# vim /etc/sysctl.d/97-oracle-database-sysctl.conf 

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


2. To Change current value of kernel parameter
# /sbin/sysctl --system 

Review the output of above command, if the value is incorrect, edit 97-oracle-database-sysctl.conf file, then enter this command again.
3. Confirm that value are set correctly.
# /sbin/sysctl -a 

4. Restart the system or enter sysctl --system command to make the changes in 97-oracle-database-sysctl.conf file avilable in active memory of kernel.

 Download Oracle19c and extract it

 After above mentioned steps now we need Oracle Software 19c Zip file. Download it from Oracle Website. 
Unzip downloaded file into Oracle Home directory i.e. /u01/app/oracle/product/19.3.0./dbhome_1/

I have downloded Oracle Software under /home/oracle/oracle19c/ . Enter following command to extract zip file to ORACLE Home. Note -> Starting from Oracle 18c, zip file should be extracted into ORACLE Home location.
$ unzip ~/oracle19c/LINUX.X64_193000_db_home.zip -d /u01/app/oracle/product/19.3.0/dbhome_1/ 

Install Prerequisite packages

Nowadays all the required packages are available for Oracle database installation but i Got few errors. So I mentioned thoses and steps i used to solved.

Error-1: /u01/app/oracle/product/19.3.0/dbhome_1/perl/bin/perl: error while loading shared libraries: libnsl.so.1: cannot open shared object file: No such file or directory

For this check the following perl script
$ ldd /u01/app/oracle/product/19.3.0/dbhome_1/perl/bin/perl
        linux-vdso.so.1 (0x00007ffd0e9b1000)
        libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f31d8706000)
        libnsl.so.1 => not found
        libdl.so.2 => /lib64/libdl.so.2 (0x00007f31d82e9000)
        libm.so.6 => /lib64/libm.so.6 (0x00007f31d7f67000)
        libcrypt.so.1 => /lib64/libcrypt.so.1 (0x00007f31d7d3e000)
        libutil.so.1 => /lib64/libutil.so.1 (0x00007f31d7b3a000)
        libc.so.6 => /lib64/libc.so.6 (0x00007f31d7776000)
        libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007f31d755e000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f31d8926000)

To solved this install following packages
dnf install -y libnsl
dnf install -y libnsl.i686
dnf install -y libnsl2
dnf install -y libnsl2.i686
dnf install -y xorg-x11-xauth

Error-2: [WARNING] [INS-08101] Unexpected error while executing the action at state: 'supportedOSCheck' CAUSE: No additional information available. ACTION: Contact Oracle Support Services or refer to the software manual. SUMMARY: - java.lang.NullPointerException
To solve this i enter the following command.
$ export CV_ASSUME_DISTID=RHEL7.6

Now I again start installer.
 $ cd $ORACLE_HOME
$ ./runInstaller
 

POST Installation work

1. Oracle Network Configuration 

After successful installtion of Oracle, we need to configure Listener. and If we want to use tnsname to connect database then we need to configure tnsnames.ora file.

   a. Configuring Listener


Steps Involved in Configuring Listner.

1. Start Listener

$ switch to Oracle user if not 
$ su - oracle
$ -- use lsnrctl command to check listener
$ lsnrctl
LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 08-FEB-2020 08:48:51

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

Welcome to LSNRCTL, type "help" for information.

LSNRCTL> status
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=devbase.lambda.asia)(PORT=1539)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 19.0.0.0.0 - Production
Start Date                05-FEB-2020 07:48:08
Uptime                    3 days 1 hr. 1 min. 9 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/oracle/product/19.3.0/dbhome_1/network/admin/listener.ora
Listener Log File         /u01/app/oracle/diag/tnslsnr/devBase/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1539)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=localhost)(PORT=5500))(Security=(my_wallet_directory=/u01/app/oracle/admin/devdb/xdb_wallet))(Presentation=HTTP)(Session=RAW))
Services Summary...
Service "86b637b62fdf7a65e053f706e80a27ca.lambda.asia" has 1 instance(s).
  Instance "devdb", status READY, has 1 handler(s) for this service...
Service "9dcb836d9b005d05e055000000000001.lambda.asia" has 1 instance(s).
  Instance "devdb", status READY, has 1 handler(s) for this service...
Service "9df280b47456442ee055000000000001.lambda.asia" has 1 instance(s).
  Instance "devdb", status READY, has 1 handler(s) for this service...
Service "devdb.lambda.asia" has 1 instance(s).
  Instance "devdb", status READY, has 1 handler(s) for this service...
Service "devdbXDB.lambda.asia" has 1 instance(s).
  Instance "devdb", status READY, has 1 handler(s) for this service...
Service "devpdb.lambda.asia" has 1 instance(s).
  Instance "devdb", status READY, has 1 handler(s) for this service...
Service "studentpdb.lambda.asia" has 1 instance(s).
  Instance "devdb", status READY, has 1 handler(s) for this service...
The command completed successfully

2. Configure Listener
  •   connect oracle database server using sqlplus / as sysdba
  •   Now check available services use  -  select name from v$services;
  •   Now check listener parameter  use - show parameter listener
  •   Now alter local_listener parameter value if it is not set. two ways 
    • Either use - alter sysetm set local_listener='(ADDRESS = (PROTOCOL=TCP)(HOST=devbase.lambda.asia)(PORT=1539))' scope=both;
    • or use listener alias, Listener alias we can get from lisenter.ora file 
      [oracle@devBase admin]$ cat listener.ora 
      # listener.ora Network Configuration File: /u01/app/oracle/product/19.3.0/dbhome_1/network/admin/listener.ora
      # Generated by Oracle configuration tools.
      
      LISTENER =
        (DESCRIPTION_LIST =
          (DESCRIPTION =
            (ADDRESS = (PROTOCOL = TCP)(HOST = devbase.lambda.asia)(PORT = 1539))
            (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
          )
        )
      
      SQL>alter sysetm set local_listener='LISTENER' scope =both;

b . Configure tnsnames.ora

Luckliy Oracle provide us a very handy tools for doing this. it is net manager.  To open net manager in CentOS 8 or RedHat 8 we  enter following command


 $ netmgr & 
Now we configure tnsnames for our servers.



 Connect with PDB

From oracle 12c onwards oracle introduce concept of pluggable database. we can connect pluggable database by following steps

Method using SQLPLUS alter session

1. sqlplus / as sysdba
2. select name,open_mode from v$pdbs;
or 
2. show pdbs;
if open_mount is not in read write then enter following query
3. alter pluggable database all open;
4. now alter session - alter session set container=devpdb;
5. show con_name -> it will present you pluggable database name.

using TNSNAMES.ora configuration

1. conn system/password@devpdb
2. verify that you are connected with pdbs or not show con_name;

Installing Example database

Here I am going to explain how to install example database manually.

Download Script From Github

Starting from Oracle 12.2 , the sample schemas are avialable on github. 


Extract the Downloaded File

Extract downloaded file  directly into the $ORACLE_HOME/demo/schema
$ unzip db-sample-schemas-19.2.zip -d $ORACLE_HOME/demo/schema 

Adjust working directory

Enter the following perl command to replace "_SUB_CWD" tag in the scripts with current working directory

$ cd $ORACLE_HOME/demo/schema
$ perl -p -i.bak -e ‘s#SUB__CWD#’$(pwd)’#g’ *.sql */*.sql */*.dat
 

Install Sample Schema

1. Connect with pdb where you want to create these schema

$ sqlplus / as sysdba
SQL> conn system/password@devpdb
Connected.

2. Create dedicated tablespace

SQL> -- verify tablespace
SQL> select tablespace_name, b.file_name from dba_tablespaces a join dba_data_files b using (tablespace_name); 
TABLESPACE_NAME                FILE_NAME                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        
------------------------------ ----------------------------------------------------------------
SYSTEM                         /u02/app/oracle/oradata/DEVDB/devpdb/system01.dbf                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
SYSAUX                         /u02/app/oracle/oradata/DEVDB/devpdb/sysaux01.dbf                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
UNDOTBS1                       /u02/app/oracle/oradata/DEVDB/devpdb/undotbs01.dbf                                                                                                                                                                                                                                                                                                                                                                                                                                                                               
USERS                          /u02/app/oracle/oradata/DEVDB/devpdb/users01.dbf 
 
SQL> create tablespace example datafile '/u02/app/oracle/oradata/DEVDB/devpdb/example.dbf'
size 100M AUTOEXTEND ON next 10M 
extent management local;
Tablespace EXAMPLE created.

3. Install sample schemas


SQL> -- Now we run mksample.sql sql script
@mksample systempw syspw hrpw oepw pmpw ixpw shpw bipw example temp /your/path/to/log/ connect_stri
where mksample is located inside $ORACLE_HOME/demo/schema/ 
systempw - System User password
syspw - Sys user password
hrpw - Hr User Password
oepw - OE(Order Entry) user password
pmpw - pm(Print media) user password
ixpw - ix(Information exchange) user password
shpw - sh( Sale history) user password
bipw - bi (business information) user password
example - tablespace
temp - tablespace
/log - log location
connect_string - system/password@devpdb

$ cd $ORACLE_HOME/demo/schema
$ sqlplus / as sysdba
SQL> @?/demo/schema/mksample password password hr oe pm ix sh bi example temp $ORACLE_HOME/demo/schema/log devbase.lambda.asia:1539/devpdb.lambda.asia


No comments:

Post a Comment