Skip to main content

Lab 1: Install Oracle 19c on Linux

A hands-on lab to train a junior DBA. Each participant installs and configures an Oracle 19c database on Linux from scratch, then uses the scripts from this guide to understand what is running. By the end, everyone has a working environment of their own to keep practicing.

LAB About 4 hours. Run it on lab VMs only, never on a client or production server.

Prerequisites

  • VM running Oracle Linux 8 with at least 8 GB of RAM and 60 GB of disk
  • LINUX.X64_193000_db_home.zip already copied to /tmp on the VM
  • SSH access to the VM and a client such as MobaXterm or PuTTY

Agenda

#BlockTimeWhat we cover
1Welcome and goals10 minHow the lab works and what everyone takes away
2Oracle architecture in a nutshell20 minInstance versus database, SGA, PGA, background processes, datafiles, redo logs, control files, CDB and PDB
3Hands-on 1. Preparing Linux30 minPreinstall package, oracle user and groups, directories, kernel parameters and limits
4Hands-on 2. Installing Oracle 19c45 minSoftware install, root scripts, listener, CDB and PDB
5Break15 min
6Hands-on 3. Configuring the environment30 minEnvironment variables, oratab, start and stop, connections
7Hands-on 4. Running the scripts45 minRun the scripts from this guide and understand what each one checks
8Troubleshooting challenge20 minSimulated failures for everyone to fix
9Recap and next steps15 minQuestions, study materials and the next lab

Variant: OCI Ampere (ARM)

Use this variant when the lab VMs run on OCI Ampere A1 instead of x86. The lab is the same, only the instance, the binary and a few setup steps change.

ARM Oracle Database 19c for ARM is the 19.19 release on Oracle Linux 8 or 9. Oracle Linux 7 on ARM is only for the Instant Client, so do not use it for this lab.

Itemx86 labOCI Ampere lab
ShapeAny x86 VMVM.Standard.A1.Flex, 2 OCPUs and 16 GB as a starting point
ImageOracle Linux 8Oracle Linux 8 aarch64
Boot volume60 GB100 GB, then grow the file system
BinaryLINUX.X64_193000_db_home.zipLINUX.ARM64_1919000_db_home.zip
OS check workaroundCV_ASSUME_DISTID=OEL7.8Usually not needed with 19.19
Login userLocal useropc with sudo, using the SSH key from instance creation

FREE TIER Always Free accounts include Ampere A1 capacity equivalent to 4 OCPUs and 24 GB of memory in total, so plan how many participant VMs fit before the lab.

Extra steps on Ampere, before Hands-on 1

# confirm the architecture
uname -m                      # must show aarch64
cat /etc/oracle-release

# grow the root file system after enlarging the boot volume
sudo /usr/libexec/oci-growfs -y

# OCI images come without swap; create 8 GB for the installer checks
sudo fallocate -l 8G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab

# copy the binary from your PC (download it from oracle.com first)
scp -i ~/.ssh/lab_key LINUX.ARM64_1919000_db_home.zip opc@<public_ip>:/tmp/
  • Create the instance with shape VM.Standard.A1.Flex and the Oracle Linux 8 image
  • Set the boot volume to 100 GB and run oci-growfs
  • Create the swap file
  • Copy LINUX.ARM64_1919000_db_home.zip to /tmp
  • In Hands-on 2, unzip the ARM file and skip CV_ASSUME_DISTID unless the OS check fails
  • Keep port 1521 closed in the OCI Security List and connect through SSH

Execution plan

Before the lab, instructor tasks

  • Create the Oracle Linux 8 VMs and test SSH access for every participant
  • Copy LINUX.X64_193000_db_home.zip to /tmp on all VMs
  • Share the link to this guide with the participants
  • Take a VM snapshot after Hands-on 1 so anyone who gets stuck can recover

Hands-on 1. Preparing Linux

ROOT Run these steps as root.

dnf install -y oracle-database-preinstall-19c
passwd oracle
mkdir -p /u01/app/oracle/product/19.0.0/dbhome_1 /u02/oradata
chown -R oracle:oinstall /u01 /u02
chmod -R 775 /u01 /u02
firewall-cmd --permanent --add-port=1521/tcp
firewall-cmd --reload
  • Install the preinstall package
  • Set the oracle user password
  • Create the directories owned by oracle:oinstall
  • Check the hostname in /etc/hosts
  • Open port 1521 for the listener
  • Review /etc/sysctl.conf and /etc/security/limits.d/ to see what the package changed

Hands-on 2. Installing Oracle 19c

su - oracle
cd /u01/app/oracle/product/19.0.0/dbhome_1
unzip -q /tmp/LINUX.X64_193000_db_home.zip
export CV_ASSUME_DISTID=OEL7.8
./runInstaller

TIP On Oracle Linux 8 the 19.3 base installer usually fails the OS check. CV_ASSUME_DISTID=OEL7.8 avoids it. Applying a Release Update during the install also works.

  • Unzip the software inside ORACLE_HOME as oracle
  • Run ./runInstaller and choose a software-only Enterprise Edition install
  • As root, run /u01/app/oraInventory/orainstRoot.sh and $ORACLE_HOME/root.sh
  • Create the default listener on port 1521 with netca
  • Create the database with dbca using CDB ORCLCDB, PDB ORCLPDB1 and character set AL32UTF8

Option A. Graphical install (recommended for the lab)

The installer opens on your PC through X11 forwarding. Participants see every screen, which is the point of the lab.

  1. On the server, as root, make sure X11Forwarding yes is set in /etc/ssh/sshd_config and that xorg-x11-xauth is installed.
  2. Let oracle log in with the same SSH key as opc, so the session opens directly as oracle and X11 keeps working.
  3. Open a new SSH session as oracle with X11 forwarding. MobaXterm does it by default. With OpenSSH, use ssh -X.
  4. Check that echo $DISPLAY returns a value, then run ./runInstaller.
# as opc, once
sudo mkdir -p /home/oracle/.ssh
sudo cp ~/.ssh/authorized_keys /home/oracle/.ssh/
sudo chown -R oracle:oinstall /home/oracle/.ssh
sudo chmod 700 /home/oracle/.ssh && sudo chmod 600 /home/oracle/.ssh/authorized_keys

# from your PC
ssh -X -i ~/.ssh/lab_key oracle@<server>
echo $DISPLAY
cd $ORACLE_HOME && ./runInstaller

TIP Do not use sudo su - oracle from an opc session for the graphical installer. The X11 credentials stay with opc and the installer fails with "Can't connect to X11 window server". If the screens open with empty boxes instead of text, install dejavu-sans-fonts and xorg-x11-fonts-Type1.

Option B. Silent install

Same result without a graphical session. Useful when X11 is not available or to repeat the install quickly.

cd $ORACLE_HOME
./runInstaller -silent -waitforcompletion \
  oracle.install.option=INSTALL_DB_SWONLY \
  UNIX_GROUP_NAME=oinstall INVENTORY_LOCATION=/u01/app/oraInventory \
  ORACLE_HOME=$ORACLE_HOME ORACLE_BASE=$ORACLE_BASE \
  oracle.install.db.InstallEdition=EE \
  oracle.install.db.OSDBA_GROUP=dba oracle.install.db.OSOPER_GROUP=oper \
  oracle.install.db.OSBACKUPDBA_GROUP=backupdba oracle.install.db.OSDGDBA_GROUP=dgdba \
  oracle.install.db.OSKMDBA_GROUP=kmdba oracle.install.db.OSRACDBA_GROUP=racdba \
  DECLINE_SECURITY_UPDATES=true

In both options, run orainstRoot.sh and root.sh as root when the installer asks.

Hands-on 3. Configuring the environment

# ~/.bash_profile
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/19.0.0/dbhome_1
export ORACLE_SID=ORCLCDB
export PATH=$ORACLE_HOME/bin:$PATH
sqlplus / as sysdba
shutdown immediate
startup
alter pluggable database all open;
alter pluggable database all save state;
  • Set the environment variables in .bash_profile
  • Check the database entry in /etc/oratab
  • Practice shutdown immediate and startup
  • Practice lsnrctl status, lsnrctl stop and lsnrctl start
  • Open the PDB and save its state
  • Add ORCLPDB1 to tnsnames.ora and test with tnsping ORCLPDB1 and sqlplus system@ORCLPDB1

Hands-on 4. Running the scripts

For each script, run it, read the output and find out which view it queries. Every page below follows the same structure, so participants also learn how to use this guide.

READ ONLY All the scripts in this block only query the data dictionary.

Troubleshooting challenge

The instructor breaks something on each VM. Participants find the error, explain the cause and fix it.

ScenarioHow the instructor sets it upErrorReference
Listener downlsnrctl stopORA-12541Hands-on 3
Instance downshutdown abortORA-01034The database does not start
Wrong environmentWrong ORACLE_SID in the sessionORA-01034 or ORA-12162Hands-on 3
Tablespace fullSmall tablespace without autoextend, filled with a test tableORA-01653A tablespace is full

After the lab