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.zipalready copied to/tmpon the VM- SSH access to the VM and a client such as MobaXterm or PuTTY
Agenda
| # | Block | Time | What we cover |
|---|---|---|---|
| 1 | Welcome and goals | 10 min | How the lab works and what everyone takes away |
| 2 | Oracle architecture in a nutshell | 20 min | Instance versus database, SGA, PGA, background processes, datafiles, redo logs, control files, CDB and PDB |
| 3 | Hands-on 1. Preparing Linux | 30 min | Preinstall package, oracle user and groups, directories, kernel parameters and limits |
| 4 | Hands-on 2. Installing Oracle 19c | 45 min | Software install, root scripts, listener, CDB and PDB |
| 5 | Break | 15 min | |
| 6 | Hands-on 3. Configuring the environment | 30 min | Environment variables, oratab, start and stop, connections |
| 7 | Hands-on 4. Running the scripts | 45 min | Run the scripts from this guide and understand what each one checks |
| 8 | Troubleshooting challenge | 20 min | Simulated failures for everyone to fix |
| 9 | Recap and next steps | 15 min | Questions, 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.
| Item | x86 lab | OCI Ampere lab |
|---|---|---|
| Shape | Any x86 VM | VM.Standard.A1.Flex, 2 OCPUs and 16 GB as a starting point |
| Image | Oracle Linux 8 | Oracle Linux 8 aarch64 |
| Boot volume | 60 GB | 100 GB, then grow the file system |
| Binary | LINUX.X64_193000_db_home.zip | LINUX.ARM64_1919000_db_home.zip |
| OS check workaround | CV_ASSUME_DISTID=OEL7.8 | Usually not needed with 19.19 |
| Login user | Local user | opc 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.Flexand 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.zipto/tmp - In Hands-on 2, unzip the ARM file and skip
CV_ASSUME_DISTIDunless 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.zipto/tmpon 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.confand/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_HOMEas oracle - Run
./runInstallerand choose a software-only Enterprise Edition install - As root, run
/u01/app/oraInventory/orainstRoot.shand$ORACLE_HOME/root.sh - Create the default listener on port 1521 with
netca - Create the database with
dbcausing CDBORCLCDB, PDBORCLPDB1and character setAL32UTF8
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.
- On the server, as root, make sure
X11Forwarding yesis set in/etc/ssh/sshd_configand thatxorg-x11-xauthis installed. - Let oracle log in with the same SSH key as opc, so the session opens directly as oracle and X11 keeps working.
- Open a new SSH session as oracle with X11 forwarding. MobaXterm does it by default. With OpenSSH, use
ssh -X. - Check that
echo $DISPLAYreturns 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 immediateandstartup - Practice
lsnrctl status,lsnrctl stopandlsnrctl start - Open the PDB and save its state
- Add
ORCLPDB1totnsnames.oraand test withtnsping ORCLPDB1andsqlplus 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.
- Instance, host and service
- Containers and PDBs
- Tablespace usage
- Who is connected
- Finding blocking locks
- Morning routine, to put everything together
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.
| Scenario | How the instructor sets it up | Error | Reference |
|---|---|---|---|
| Listener down | lsnrctl stop | ORA-12541 | Hands-on 3 |
| Instance down | shutdown abort | ORA-01034 | The database does not start |
| Wrong environment | Wrong ORACLE_SID in the session | ORA-01034 or ORA-12162 | Hands-on 3 |
| Tablespace full | Small tablespace without autoextend, filled with a test table | ORA-01653 | A tablespace is full |
After the lab
- Keep the VM and repeat the daily routine from Daily, weekly and monthly checklists
- Use the Glossary for any term that was not clear
- Next lab topic to be defined