[Oracle] - Oracle Database 21

November 24, 2021 |

 

I. Install Oracle DB 21c In CentOS 8

Ref:
1. Oracle 21c : https://www.oracle.com/database/technologies/oracle21c-windows-downloads.html
2. CentOS v8 : https://www.centos.org/download/

Step 1: Set hostname
$hostnamectl set-hostname oracle.unixcop.local
Step 2: Install Oracle Database preinstall packages.
$dnf install oracle-database-preinstall-21c -y

# If above is cannot install, download rpm in url: 
# https://yum.oracle.com/repo/OracleLinux/OL8/appstream/x86_64/index.html
$dnf localinstall oracle-database-preinstall-21c-1.0-1.el8.x86_64.rpm

Step 3: Update packages.
$ dnf update -y

Step 4: Create the user
$ useradd oracle
$ passwd oracle


Step 5: Disabled SELinux
$ cat /etc/selinux/config
$ vi /etc/selinux/config

Step 6: Disable Firewall
$ systemctl status firewalld
$ systemctl disable firewalld
Step 7: Make environments
$ mkdir -p /u01/app/oracle
$ mkdir -p /u01/app/oracle/product/21.0.0/dbhome_1
$ mkdir -p /u01/app/oraInventory
$ mkdir -p /u02/oradata
$ chown -R oracle:oinstall /u01 /u02
$ chown -R oracle:oinstall /u01/app/oraInventory
$ 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=oracle.unixcop.local
> export ORACLE_UNQNAME=cdb1
> export ORACLE_BASE=/u01/app/oracle
> export ORACLE_HOME=\$ORACLE_BASE/product/21.0.0/dbhome_1
> export ORA_INVENTORY=/u01/app/oraInventory
> export ORACLE_SID=cdb1
> export PBD_NAME=pdb1
> export DATA_DIR=/u02/oradata
>
> export PATH=/usr/sbin:/usr/local/bin:\$PATH
> export PATH=\$ORACLE_HOME/bin:\$PATH
>
> export LB_LIBRRARY_PATH=\$ORACLE_HOME/lib:/lib:/usr/lib
> export CLASSPATH=\$ORACLE_HOME/jlib:\$ORACLE_HOME/rdbms/jlib
> EOF

$ echo ". /home/oracle/scripts/setEnv.sh" >> /home/oracle/.bash_profile

Step 8: Create start/stop oracle db:
$ 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
$ chown -R oracle:oinstall /home/oracle/scripts
$ chmod u+x /home/oracle/scripts/*.sh
Step 9: Upload unzip Oracle DB installter to server follow the path:
/u01/app/oracle/product/21.0.0/dbhome_1

$ ./runInstaller

Note: Switch to user "oracle" in GUI and run this scripts.


* Running RPM packages to Install Oracle Database:
























Read more…