top of page
DBA Genesis Logo

Oracle 21c Installation on Linux

Simplify Oracle 21c installation on Linux with this comprehensive guide.

With Oracle 12c, 18c and 19c, you are allowed to create single instance and multitenant databases. Starting from Oracle 21c, Multitenant database is the only supported architecture. Let's install and create Oracle 21c database on Oracle Linux 7.




Oracle 21c Pre-requisites


Install the Oracle 21c pre-install package from YUM repository

yum install -y oracle-database-preinstall-21c

Set password for Oracle user

passwd oracle

Create 21c home directory and give ownership to Oracle user

mkdir -p /u01/app/oracle/product/21.0/db_home
chown -R oracle:oinstall /u01
chmod -R 775 /u01

Setup Oracle user bash_profile

su - oracle
vi .bash_profile

Add the ORACLE_SID, ORACLE_BASE, ORACLE_HOME and update PATH variable. Your .bash_profile must look like below

# .bash_profile

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

# User specific environment and startup programs

export ORACLE_SID=CDB
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=/u01/app/oracle/product/21.0/db_home

PATH=$PATH:$HOME/.local/bin:$ORACLE_HOME/bin

export PATH

Export bash profile

. .bash_profile

Download and Install Oracle 21c


Download the Oracle Database 21c (21.3) for Linux x86-64 software and place the download zip file under $ORACLE_HOME location

cd $ORACLE_HOME

unzip LINUX.X64_213000_db_home.zip

Start the runInstaller in silent mode to install 21c

./runInstaller -ignorePrereq -waitforcompletion -silent      \
-responseFile ${ORACLE_HOME}/install/response/db_install.rsp \
oracle.install.option=INSTALL_DB_SWONLY                      \
ORACLE_HOSTNAME=${HOSTNAME}                                  \
UNIX_GROUP_NAME=oinstall                                     \
INVENTORY_LOCATION=/u01/app/oraInventory                     \
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

Run the root scripts post installation

/u01/app/oraInventory/orainstRoot.sh
/u01/app/oracle/product/21.0/db_home/root.sh

Create 21c Multi-tenant Database


Let's create a multi-tenant database with two PDBs by running DBCA in silent mode

dbca -silent -createDatabase                            \
     -templateName General_Purpose.dbc                  \
     -gdbname ${ORACLE_SID} -sid  ${ORACLE_SID}         \
     -characterSet AL32UTF8                             \
     -sysPassword enterCDB#123                          \
     -systemPassword enterCDB#123                       \
     -createAsContainerDatabase true                    \
     -totalMemory 2000                                  \
     -storageType FS                                    \
     -datafileDestination /u01/${ORACLE_SID}            \
     -emConfiguration NONE                              \
     -numberOfPDBs 2                                    \
     -pdbName PDB                                       \
     -pdbAdminPassword enterPDB#123                     \
     -ignorePreReqs

Once the database is created, check the status of all the containers

sqlplus / as sysdba

SELECT  NAME, OPEN_MODE, CDB FROM V$DATABASE;
SELECT CON_ID, NAME, OPEN_MODE FROM V$CONTAINERS;

Become a top notch dba with DBA Genesis
Start your DBA career today
bottom of page