Pages

Oracle 19c Production Deployment on Oracle Linux 8

This guide gets you from zero to a rock-solid Oracle Database 19c (19.3) setup on Oracle Linux 8. Perfect for labs, staging, or production (with security notes). We'll cover OS prep, tuning, install, CDB/PDB creation, and everything to make it production-ready.

Quick Planning: What You'll Need
ComponentMinimumRecommended (Prod)
RAM4 GB8–16 GB
Swap2 GB1.5× RAM (if <16GB)
Disk (Software)10 GB20 GB
Disk (Data)20 GBWorkload-dependent
CPU2 cores4+ cores

Pro tip: For production, aim for SSDs and separate disks for data/FRA.

1. Prep Your OS
First, update everything and grab Oracle's required packages:
$ sudo dnf update -y && sudo reboot
$ sudo dnf install -y bc binutils compat-libstdc++-33 elfutils-libelf elfutils-libelf-devel fontconfig-devel glibc glibc-devel ksh libaio libaio-devel libXrender libXrender-devel libX11 libXau libXi libXtst libgcc librdmacm-devel libstdc++ libstdc++-devel libxcb make net-tools  nfs-utils python3 smartmontools sysstat gcc unixODBC libnsl libnsl2

2. Memory & Swap Setup
Check your RAM:
$ sudo free -h
If needed, create swap (e.g., 8GB):
$ sudo fallocate -l 8G /swapfile
$ sudo chmod 600 /swapfile
$ sudo mkswap /swapfile
$ sudo swapon /swapfile
$ sudo echo '/swapfile swap swap defaults 0 0' | sudo tee -a /etc/fstab

3. Kernel Tuning
Edit /etc/sysctl.conf and add these Oracle 19c parameters:
$ sudo vi /etc/sysctl.conf
# Oracle 19c Kernel Parameters
fs.file-max = 6815744
kernel.sem = 250 32000 100 128
kernel.shmmni = 4096
kernel.shmall = 1073741824     # ~4GB in pages
kernel.shmmax = 4398046511104  # Match your max SGA
fs.aio-max-nr = 1048576
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
wq! --Save file
Apply: $ sudo sysctl -p

4. HugePages for Production
Disable Transparent HugePages (causes latency):
$ sudo grubby --update-kernel=ALL --args="transparent_hugepage=never"
$ sudo reboot
$ sudo cat /sys/kernel/mm/transparent_hugepage/enabled  # Should show "never"

Calculate & set static HugePages:
Estimate SGA (e.g., 6GB = 6144MB)
HugePages = SGA / 2MB = ~3072 pages
Add to $ sudo vi /etc/sysctl.conf: 
vm.nr_hugepages=3072
$ sudo sysctl -p

Why? HugePages eliminate TLB overhead—10-20% perf gain.

5. Oracle User & Directories
$ sudo groupadd -g 54321 oinstall
$ sudo groupadd -g 54322 dba
$ sudo groupadd -g 54323 oper
$ sudo useradd -u 54321 -g oinstall -G dba,oper oracle
$ sudo passwd oracle

$ sudo mkdir -p /u01/app/oracle/product/19.0.0/dbhome_1 /u01/app/oraInventory
$ sudo mkdir -p /u02/oradata /u03/fra
$ sudo chown -R oracle:oinstall /u01 /u02 /u03
$ sudo chmod -R 775 /u01 /u02 /u03

6. Lab Only: Disable Firewall/SELinux
# systemctl stop firewalld && sudo systemctl disable firewalld
# setenforce 0

Production: Open only port 1521: 
# firewall-cmd --permanent --add-port=1521/tcp 
# firewall-cmd --reload

7. Oracle Environment (as oracle user)
$ su - oracle
$ cat > ~/.bash_profile << 'EOF'
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/19.0.0/dbhome_1
export ORACLE_SID=cdb1
export PATH=$ORACLE_HOME/bin:$PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
EOF
source ~/.bash_profile

8. Install Oracle Software (Silent Mode)
$ cd $ORACLE_HOME
$ unzip LINUX.X64_193000_db_home.zip
$ export CV_ASSUME_DISTID=OEL7.6  # OL8 compatibility trick

$ ./runInstaller -silent -waitforcompletion -responseFile $ORACLE_HOME/install/response/db_install.rsp oracle.install.option=INSTALL_DB_SWONLY ORACLE_HOME=$ORACLE_HOME ORACLE_BASE=$ORACLE_BASE oracle.install.db.InstallEdition=EE DECLINE_SECURITY_UPDATES=true

Run root scripts when prompted:
$ sudo /u01/app/oraInventory/orainstRoot.sh
$ sudo /u01/app/oracle/product/19.0.0/dbhome_1/root.sh

9. Apply Latest RU
Download from My Oracle Support. Then:
$ORACLE_HOME/OPatch/opatch version
$ORACLE_HOME/OPatch/opatch apply -silent
$ORACLE_HOME/OPatch/opatch lspatches

10. Create CDB + PDB
$ dbca -silent -createDatabase \
-templateName General_Purpose.dbc \
-gdbname cdb1 -sid cdb1 -createAsContainerDatabase true \
-numberOfPDBs 1 -pdbName pdb1 \
-characterSet AL32UTF8 \
-totalMemory 4096 -storageType FS \
-datafileDestination "/u02/oradata"

11. Production Essentials
Enable Archivelog:
$ sqlplus / as sysdba
SHUTDOWN IMMEDIATE;
STARTUP MOUNT;
ALTER DATABASE ARCHIVELOG;
ALTER DATABASE OPEN;
ARCHIVE LOG LIST;

Fast Recovery Area:
ALTER SYSTEM SET db_recovery_file_dest='/u03/fra' SCOPE=BOTH;
ALTER SYSTEM SET db_recovery_file_dest_size=50G SCOPE=BOTH;

12. Auto-Start with systemd
Create /etc/systemd/system/oracle-rdbms.service:
$ vi /etc/systemd/system/oracle-rdbms.service
[Unit]
Description=Oracle Database Service
After=network.target

[Service]
Type=forking
User=oracle
ExecStart=/u01/app/oracle/product/19.0.0/dbhome_1/bin/dbstart $ORACLE_HOME
ExecStop=/u01/app/oracle/product/19.0.0/dbhome_1/bin/dbshut $ORACLE_HOME
Restart=no

[Install]
WantedBy=multi-user.target

wq! --Save file

Enable:
$ sudo systemctl daemon-reload
$ sudo systemctl enable oracle-rdbms

13. Quick Validation
-- DB status
SELECT name, open_mode, log_mode FROM v$database;
-- PDBs
SHOW PDBS;
-- Memory
SHOW PARAMETER sga; SHOW PARAMETER pga;
-- Invalid objects
SELECT owner, object_name, status FROM dba_objects WHERE status='INVALID';
Listener: lsnrctl status

14. Security Hardening
ALTER USER sys IDENTIFIED BY YourStrongPass123!;
ALTER USER system IDENTIFIED BY YourStrongPass123!;

-- Lock sample schemas
ALTER USER hr ACCOUNT LOCK;
-- etc. for sh, oe, pm, ix, sa

15. RMAN Backup Config
rman target /
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 7 DAYS;
CONFIGURE CONTROLFILE AUTOBACKUP ON;

16. Health Check Commands
WhatCommand
Listenerlsnrctl status
ArchivelogARCHIVE LOG LIST;
FRASELECT * FROM v$recovery_file_dest;
TablespacesSELECT * FROM dba_tablespace_usage_metrics;
Alert Logtail -f $ORACLE_BASE/diag/rdbms/cdb1/cdb1/trace/alert_cdb1.log

17. Common Fixes
ORA-12514 (TNS:listener doesn't know service): ALTER SYSTEM REGISTER;
ORA-00845 (MEMORY_TARGET not supported on this system): Switch to ASMM:
ALTER SYSTEM SET memory_target=0 scope=spfile;
ALTER SYSTEM SET sga_target=4G scope=spfile;
ALTER SYSTEM SET pga_aggregate_target=1G scope=spfile;
SHUTDOWN IMMEDIATE; STARTUP;

No comments:

Post a Comment