How to Install Oracle Database 19c in Oracle Linux 7.9
vi /etc/hosts
192.168.100.9 ol7-19.localdomain ol7-19
192.168.100.9 ol7-19.localdomain ol7-19
vi /etc/hostname
ol7-19.localdomain
yum install -y oracle-database-preinstall-19c
yum update -y
passwd oracle
vi /etc/selinux/config
SELINUX=permissive
setenforce Permissive
systemctl stop firewalld
systemctl disable firewalld
mkdir -p /u01/app/oracle/product/19.0.0/dbhome_1
mkdir -p /u02/oradata
chown -R oracle:oinstall /u01 /u02
chmod -R 775 /u01 /u02
mkdir /home/oracle/scripts
SELINUX=permissive
setenforce Permissive
systemctl stop firewalld
systemctl disable firewalld
mkdir -p /u01/app/oracle/product/19.0.0/dbhome_1
mkdir -p /u02/oradata
chown -R oracle:oinstall /u01 /u02
chmod -R 775 /u01 /u02
mkdir /home/oracle/scripts
cat > /home/oracle/scripts/setEnv.sh <<EOF
# Oracle Settings
export TMP=/tmp
export TMPDIR=\$TMP
export ORACLE_HOSTNAME=ol7-19.localdomain
export ORACLE_UNQNAME=policypdb
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=\$ORACLE_BASE/product/19.0.0/dbhome_1
export ORA_INVENTORY=/u01/app/oraInventory
export ORACLE_SID=policypdb
export PDB_NAME=policypdb1
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
export TMPDIR=\$TMP
export ORACLE_HOSTNAME=ol7-19.localdomain
export ORACLE_UNQNAME=policypdb
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=\$ORACLE_BASE/product/19.0.0/dbhome_1
export ORA_INVENTORY=/u01/app/oraInventory
export ORACLE_SID=policypdb
export PDB_NAME=policypdb1
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
Add a reference to the "setEnv.sh" file at the end of the "/home/oracle/.bash_profile" file.
echo ". /home/oracle/scripts/setEnv.sh" >> /home/oracle/.bash_profile
Create a "start_all.sh" and "stop_all.sh" script that can be called from a startup/shutdown service. Make sure the ownership and permissions are correct.
Create a "start_all.sh" and "stop_all.sh" script that can be called from a startup/shutdown service. Make sure the ownership and permissions are correct.
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
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
#!/bin/bash
. /home/oracle/scripts/setEnv.sh
export ORAENV_ASK=NO
. oraenv
export ORAENV_ASK=YES
dbstart \$ORACLE_HOME
EOF
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
chown -R oracle:oinstall /home/oracle/scripts
chmod u+x /home/oracle/scripts/*.sh
chmod u+x /home/oracle/scripts/*.sh
Switch to the ORACLE_HOME directory, unzip the software directly into this path and start the Oracle Universal Installer (OUI) by issuing one of the following commands in the ORACLE_HOME directory. The interactive mode will display GUI installer screens to allow user input, while the silent mode will install the software without displaying any screens, as all required options are already specified on the command line.
copy LINUX.X64_193000_db_home.zip /tmp/LINUX.X64_193000_db_home.zip by WinSCP Software.
# Unzip software at root user
cd $ORACLE_HOME
unzip -oq /tmp/LINUX.X64_193000_db_home.zip
sudo yum groupinstall "Server with GUI" -y
sudo systemctl set-default graphical.target
sudo reboot
# Interactive mode. login to ORACLE user in GUI MODE:
# Interactive mode. login to ORACLE user in GUI MODE:
./runInstaller
Run the root scripts when prompted. Auto if root password given when installation.
As a root user, execute the following script(s):
1. /u01/app/oraInventory/orainstRoot.sh
2. /u01/app/oracle/product/19.0.0/dbhome_1/root.sh
Correct Way to Auto-Start Oracle 19c on systemd (Non-CDB DB) :
--------------------------------------------------------------
1. /u01/app/oraInventory/orainstRoot.sh
2. /u01/app/oracle/product/19.0.0/dbhome_1/root.sh
Correct Way to Auto-Start Oracle 19c on systemd (Non-CDB DB) :
--------------------------------------------------------------
Step 1: Enable in /etc/oratab
-------
-------
Edit as root:
sudo vi /etc/oratab
Make sure your DB line looks like this (last field = Y):
ORCL:/u01/app/oracle/product/19.0.0/dbhome_1:Y
Step 2: Create a systemd service unit
-------
sudo vi /etc/oratab
Make sure your DB line looks like this (last field = Y):
ORCL:/u01/app/oracle/product/19.0.0/dbhome_1:Y
Step 2: Create a systemd service unit
-------
Create a new service file:
sudo vi /etc/systemd/system/oracle.service
Paste this (adjust ORACLE_HOME and SID):
[Unit]
Description=Oracle Database Service
After=network.target
[Service]
User=oracle
Group=oinstall
Type=forking
ExecStart=/u01/app/oracle/product/19.0.0/dbhome_1/bin/dbstart /u01/app/oracle/product/19.0.0/dbhome_1
ExecStop=/u01/app/oracle/product/19.0.0/dbhome_1/bin/dbshut /u01/app/oracle/product/19.0.0/dbhome_1
RemainAfterExit=yes
[Install]
WantedBy=multi-user.target
sudo vi /etc/systemd/system/oracle.service
Paste this (adjust ORACLE_HOME and SID):
[Unit]
Description=Oracle Database Service
After=network.target
[Service]
User=oracle
Group=oinstall
Type=forking
ExecStart=/u01/app/oracle/product/19.0.0/dbhome_1/bin/dbstart /u01/app/oracle/product/19.0.0/dbhome_1
ExecStop=/u01/app/oracle/product/19.0.0/dbhome_1/bin/dbshut /u01/app/oracle/product/19.0.0/dbhome_1
RemainAfterExit=yes
[Install]
WantedBy=multi-user.target
Step 3: Reload systemd and enable :
-----------------------------------
sudo systemctl daemon-reload
sudo systemctl enable oracle
sudo systemctl start oracle
-----------------------------------
sudo systemctl daemon-reload
sudo systemctl enable oracle
sudo systemctl start oracle
Step 4: Test :
--------------
Reboot and check:
ps -ef | grep pmon
lsnrctl status
You should see:
ora_pmon_ORCL (your DB instance)
tnslsnr LISTENER
--------------
Reboot and check:
ps -ef | grep pmon
lsnrctl status
You should see:
ora_pmon_ORCL (your DB instance)
tnslsnr LISTENER
-------------------------------------------------
Step 1: Set your Oracle environment correctly
Step 1: Set your Oracle environment correctly
As oracle user, edit your environment file:
vi ~/.bash_profile
Add (or fix) these lines:
# Oracle Environment
export ORACLE_HOME=/u01/app/oracle/product/19.0.0/dbhome_1
export ORACLE_SID=policypdb
export PATH=$ORACLE_HOME/bin:$PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export NLS_LANG=AMERICAN_AMERICA.AL32UTF8
Save and reload:
Add (or fix) these lines:
# Oracle Environment
export ORACLE_HOME=/u01/app/oracle/product/19.0.0/dbhome_1
export ORACLE_SID=policypdb
export PATH=$ORACLE_HOME/bin:$PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export NLS_LANG=AMERICAN_AMERICA.AL32UTF8
Save and reload:
source ~/.bash_profile
Step 2: Test the environment
Run:
echo $ORACLE_HOME
echo $ORACLE_SID
which sqlplus
which lsnrctl
You should see:-
----------------
/u01/app/oracle/product/19.0.0/dbhome_1
echo $ORACLE_HOME
echo $ORACLE_SID
which sqlplus
which lsnrctl
You should see:-
----------------
/u01/app/oracle/product/19.0.0/dbhome_1
policypdb
/u01/app/oracle/product/19.0.0/dbhome_1/bin/sqlplus
/u01/app/oracle/product/19.0.0/dbhome_1/bin/lsnrctl
Step 3: Start listener & sqlplus normally :-
/u01/app/oracle/product/19.0.0/dbhome_1/bin/lsnrctl
Step 3: Start listener & sqlplus normally :-
lsnrctl start
sqlplus / as sysdba
POLICYPDB_NEW =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.100.9)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = POLICYPDB)
)
)
POLICYPDB_NEW =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.100.9)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = POLICYPDB)
)
)