Installing Oracle Database 19c on Oracle Linux 8


In one of my previous posts, I showed how to install Oracle Database 21c on Linux 7. In this post, I will show the step-by-step process of how to install and set up an Oracle Database 19c on Oracle Linux 8. For most of my installs, I use Linux 7. This is the first time I used Oracle Linux 8. So, thought of sharing this. I have used Tim Hall’s post – “Oracle Database 19c Installation On Oracle Linux 8 (OL8)”, as a reference . So let us begin with the software downloads. You can download Oracle Database from either MOS or Oracle edelivery:

I have configured Linux 8 on Oracle Virtual Box. I won’t go through the steps to setup OL8 in this post. The software I used are:

Prerequisites

Once you have downloaded and setup OL8, there are some prerequisite setups that needs to be performed before kicking of the installation. These steps are shown below.

Get the IP Address using ‘ifconfig’ or ‘ip addr’ command. For example:

[root@oracledb19col8 ~]# ifconfig

Get the hostname.

[root@oracledb19col8 ~]# hostname
oracledb19col8.rishoradev.com

Amend the IP address and hostname to “/etc/hosts” file to resolve the hostname. You can use the vi editor for this.

[ Note: This can also be done with DNS ].

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.XX.X oracledb19col8.rishoradev.com

Next, download “oracle-database-preinstall-19c” package. This package will perform all the setups that are necessary to install 19c.

[root@oracledb19col8 ~]# dnf install -y oracle-database-preinstall-19c

....
....

Installed:
  ksh-20120801-254.0.1.el8.x86_64                       libaio-devel-0.3.112-1.el8.x86_64
  libnsl-2.28-151.0.1.el8.x86_64                        lm_sensors-libs-3.4.0-23.20180522git70f7e08.el8.x86_64
  oracle-database-preinstall-19c-1.0-2.el8.x86_64       sysstat-11.7.3-6.0.1.el8.x86_64

Complete!

The next step is not mandatory. But I ran the ‘yum update’ because I wanted to make sure I had also the latest OS packages. It might take a while for all the packages to be installed.

[root@oracledb19col8 ~]# yum update -y --skip-broken

Edit “/etc/selinux/config” file and set “SELINUX=permissive“. It is recommended that you restart the server after this step.

[root@oracledb19col8 ~]# vi /etc/selinux/config

Disable firewall.

[root@oracledb19col8 ~]# systemctl stop firewalld
[root@oracledb19col8 ~]# systemctl disable firewalld

Create the directory structure for Oracle 19c to be installed and grant privileges.

Change the password of “oracle” user.

[root@oracledb19col8 ~]# passwd oracle

Login using “oracle” user.

[root@oracledb19col8 ~]# su - oracle

Unzip the Oracle software in ‘/u01/app/oracle/product/19c/dbhome_1’ directory, using the ‘unzip’ command as shown below. We’ll set this path as the ORACLE_HOME later on during the installation.

[oracle@oracledb19col8 ~]# mkdir -p /u01/app/oracle/product/19c/dbhome_1
[oracle@oracledb19col8 ~]# mkdir -p /u02/oradata
[oracle@oracledb19col8 ~]# chown -R oracle:oinstall /u01 /u02
[oracle@oracledb19col8 ~]# chmod -R 777 /u01 /u02

Create a directory for hosting the scripts and navigate to the directory.

[oracle@oracledb19col8 ~]# mkdir /home/oracle/scripts

Create an environment file called “setEnv.sh” using the script below.

[oracle@oracledb19col8 ~]# cat > /home/oracle/scripts/setEnv.sh <<EOF
> # Oracle Settings
> export TMP=/tmp
> export TMPDIR=\$TMP
>
> export ORACLE_HOSTNAME=oracledb19col8.rishoradev.com
> export ORACLE_UNQNAME=cdb1
> export ORACLE_BASE=/u01/app/oracle
> export ORACLE_HOME=\$ORACLE_BASE/product/19c/dbhome_1
> export ORA_INVENTORY=/u01/app/oraInventory
> export ORACLE_SID=cdb1
> export PDB_NAME=pdb1
> export DATA_DIR=/u02/oradata
>
> export PATH=/usr/sbin:/usr/local/bin:\$PATH
> export PATH=\$ORACLE_HOME/bin:\$PATH
>
> export LD_LIBRARY_PATH=\$ORACLE_HOME/lib:/lib:/usr/lib
> export CLASSPATH=\$ORACLE_HOME/jlib:\$ORACLE_HOME/rdbms/jlib
> EOF

Issue the following command to add the reference of the environment file created above in the “/home/oracle/.bash_profile”.

[oracle@oracledb19col8 ~]# echo ". /home/oracle/scripts/setEnv.sh" >> /home/oracle/.bash_profile

Copy the Oracle software that you have downloaded to a directory. I have copied it under dbhome1.

[oracle@oracledb19col8 dbhome_1]$ ls -lrt
total 2987996
-rw-r--r--. 1 oracle oinstall 3059705302 Nov 17 02:06 LINUX.X64_193000_db_home.zip

Unzip the Oracle software in ‘/u01/app/oracle/product/19c/dbhome_1’ directory, using the ‘unzip’ command as shown below. We’ll set this path as the ORACLE_HOME later on during the installation.

[oracle@oracledb19col8 dbhome_1]$ unzip -q LINUX.X64_193000_db_home.zip
[oracle@oracledb19col8 dbhome_1]$ ls
addnode     clone  cv      deinstall    drdaas   hs             javavm  ldap                          mgw      olap     ord   owm      QOpatch  relnotes       runInstaller   sqldeveloper  srvm      utl
apex        crs    data    demo         dv       install        jdbc    lib                           network  OPatch   ords  perl     R        root.sh        schagent.conf  sqlj          suptools  wwg
assistants  css    dbjava  diagnostics  env.ora  instantclient  jdk     LINUX.X64_193000_db_home.zip  nls      opmn     oss   plsql    racg     root.sh.old    sdk            sqlpatch      ucp       xdk
bin         ctx    dbs     dmu          has      inventory      jlib    md                            odbc     oracore  oui   precomp  rdbms    root.sh.old.1  slax           sqlplus       usm

This completes all the prerequite steps and now we are all set to kick off the installation.

Installation

For installing Oracle, you can either chose to use the Interactive mode or the Silent mode. The interactive mode would open up the GUI screens and user input would be required at every step, whereas, for the silent mode, all the required parameters are passed using the command line, and hence, it does not display any screens.

For interactive mode, I generally launch the installer through MobaXterm. Download MobaXterm on the Host machine, open a console and connect to your Linux machine using ‘ssh’ and IP address of the Linux machine with oracle user, as shown in the screenshot below.

Navigate to the folder where you have unzipped the Oracle using MobaXterm console and execute ‘runInstaller’.

[oracle@oracledb19col8 ~]$ cd /u01/app/oracle/product/19c/dbhome_1
[oracle@oracledb19col8 dbhome_1]$ ./runInstaller

Note: If you are installing the software on Linux 8, you will get the following error when the installer is launched.

Execute the following command before you launch the installer, to get around the above error.

[oracle@oracledb19col8 dbhome_1]$ export CV_ASSUME_DISTID=OEL7.6

Now, if you execute the runInstaller, if will work just fine, and the installer would open without any issues.

You can go through the subsequent steps in the interactive mode to complete the installation. However, for this post, we are going use the silent mode to install the software. You can find more details on the silent more here.

To install Oracle using the silent installation, login as oracle user, navigate to the folder where you have unzipped the software, and run the following command.

[oracle@oracledb19col8 dbhome_1]$ export CV_ASSUME_DISTID=OEL7.6

Now launch the installer using command line as follows:

[oracle@oracledb19col8 dbhome_1]$ ./runInstaller -ignorePrereq -waitforcompletion -silent     \
>     -responseFile ${ORACLE_HOME}/install/response/db_install.rsp               \
>     oracle.install.option=INSTALL_DB_SWONLY                                    \
>     ORACLE_HOSTNAME=${ORACLE_HOSTNAME}                                         \
>     UNIX_GROUP_NAME=oinstall                                                   \
>     INVENTORY_LOCATION=${ORA_INVENTORY}                                        \
>     SELECTED_LANGUAGES=en,en_GB                                                \
>     ORACLE_HOME=${ORACLE_HOME}                                                 \
>     ORACLE_BASE=${ORACLE_BASE}                                                 \
>     oracle.install.db.InstallEdition=EE                                        \
>     oracle.install.db.OSDBA_GROUP=dba                                          \
>     oracle.install.db.OSBACKUPDBA_GROUP=dba                                    \
>     oracle.install.db.OSDGDBA_GROUP=dba                                        \
>     oracle.install.db.OSKMDBA_GROUP=dba                                        \
>     oracle.install.db.OSRACDBA_GROUP=dba                                       \
>     SECURITY_UPDATES_VIA_MYORACLESUPPORT=false                                 \
>     DECLINE_SECURITY_UPDATES=true
Launching Oracle Database Setup Wizard...

On successful completion, the installer will prompt to run the root scripts.

As a root user, execute the following script(s):
        1. /u01/app/oraInventory/orainstRoot.sh
        2. /u01/app/oracle/product/19c/dbhome_1/root.sh

Execute /u01/app/oraInventory/orainstRoot.sh on the following nodes:
[oracledb19col8]
Execute /u01/app/oracle/product/19c/dbhome_1/root.sh on the following nodes:
[oracledb19col8]


Successfully Setup Software.

Login as a root user and execute the scripts as shown below.

[root@oracledb19col8 oraInventory]# sh orainstRoot.sh
[root@oracledb19col8 dbhome_1]# sh root.sh

Database Creation

This should complete the installation process. The next stage will be to create the database.

Before we create the database, the first thing we need to do is to start the listener services, using “lsnrctl start”.

[oracle@oracledb19col8 ~]$ lsnrctl start

LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 10-JAN-2022 21:40:12

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

Starting /u01/app/oracle/product/19c/dbhome_1/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 19.0.0.0.0 - Production
Log messages written to /u01/app/oracle/diag/tnslsnr/oracledb19col8/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oracledb19col8.rishoradev.com)(PORT=1521)))

Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 19.0.0.0.0 - Production
Start Date                10-JAN-2022 21:40:12
Uptime                    0 days 0 hr. 0 min. 0 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Log File         /u01/app/oracle/diag/tnslsnr/oracledb19col8/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oracledb19col8.rishoradev.com)(PORT=1521)))
The listener supports no services
The command completed successfully

Once the listener is up and running, you need to create the database using the Database Configuration Assistant (DBCA). This can be done using the interactive mode by issuing the dbca command, through MobaXterm. Once you execute the dbca command, the GUI should pop up .

OR, you can opt the Silent mode, as I have done below.

dbca -silent -createDatabase                                                   \
     -templateName General_Purpose.dbc                                         \
     -gdbname ${ORACLE_SID} -sid  ${ORACLE_SID} -responseFile NO_VALUE         \
     -characterSet AL32UTF8                                                    \
     -sysPassword Welcome1                                                 \
     -systemPassword Welcome1                                              \
     -createAsContainerDatabase true                                           \
     -numberOfPDBs 1                                                           \
     -pdbName ${PDB_NAME}                                                      \
     -pdbAdminPassword Welcome1                                            \
     -databaseType MULTIPURPOSE                                                \
     -memoryMgmtType auto_sga                                                  \
     -totalMemory 2000                                                         \
     -storageType FS                                                           \
     -datafileDestination "${DATA_DIR}"                                        \
     -redoLogFileSize 50                                                       \
     -emConfiguration NONE                                                     \
     -ignorePreReqs

This would create the database for you. Now you have successfully installed Oracle Database 19c.

[oracle@oracledb19col8 ~]$ sqlplus / as sysdba
....
....
SQL> Select BANNER_FULL from v$version;

BANNER_FULL
-----------------------------------------------------------------------------------------------------Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0

Post-Installation Steps

Create a start_all.sh script.

cat > /home/oracle/scripts/start_all.sh <<EOF
#!/bin/bash
. /home/oracle/scripts/setEnv.sh
export ORAENV_ASK=NO
. oraenv
export ORAENV_ASK=YES
dbstart \$ORACLE_HOME
EOF

Create the stop_all.sh script.

cat > /home/oracle/scripts/stop_all.sh <<EOF
#!/bin/bash
. /home/oracle/scripts/setEnv.sh
export ORAENV_ASK=NO
. oraenv
export ORAENV_ASK=YES
dbshut \$ORACLE_HOME
EOF

Change the ownership of the scripts using the following commands.

chown -R oracle:oinstall /home/oracle/scripts
chmod u+x /home/oracle/scripts/*.sh

Set the restart flag for the instance(and for every instance) to ‘Y’ in the ‘/etc/oratab’ file. You can use the ‘vi’ editor.

[oracle@oracledb19col8 ~]$ vi /etc/oratab

Here, we have created only one contaner database, so I have edited the line as highlighted below:

Once you have edited the ‘/etc/oratab’ file, you can now start and stop the database by calling the scripts, start_all.sh and stop_all.sh respectively, from the “oracle” user.

Enable Oracle Managed Files (OMF) and set the pluggable databse to start automatically when the instance is started.

[oracle@oracledb19col8 ~]$ sqlplus / as sysdba <<EOF
> alter system set db_create_file_dest='${DATA_DIR}';
> alter pluggable database ${PDB_NAME} save state;
> exit;
> EOF

Now, Oracle Database 19c is installed and ready to be used. Hope this helps. A big thanks , again, to Tim Hall for his tutorials and blog posts.

References

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s