Oracle Install standalone noncontainer 19c on Redhat 7 in silent mode

記錄透過 silent mode 安裝 oracle database

1. PreCheck environment and unzip Database Software

a. Install dependencies rpm by root

# yum install bc bind-utils compat-libcap1 glibc-devel ksh libaio-devel libstdc++-devel nfs-utils smartmontools unzip xorg-x11-xauth xorg-x11-utils compat-libstdc++-33 net-tools psmisc sysstat vim -y

Note: compat-libstdc++-33 is not available on RHEL 7 from yum

Download link:

b. Install oracle preinstall by root

-- Install oracle 19c preinstall
# yum install oracle-database-preinstall-19c-1.0-1.el7.x86_64.rpm

-- Or Install from oracle yum server
# curl -o oracle-database-preinstall-19c-1.0-1.el7.x86_64.rpm
# yum -y localinstall oracle-database-preinstall-19c-1.0-1.el7.x86_64.rpm

c. Check hostname is mapping ipaddress

# cat /etc/hosts hostname

d. Check selinux is disable

# vim /etc/selinux/config

# setenforce 0

e. Check firewall is disable

# systemctl status firewalld.service
# systemctl stop firewalld.service
# systemctl disable firewalld.service

f. create oracle account and change password

# useradd -u 54321 -g oinstall -G oper,backupdba,kmdba,dgdba,racdba oracle
# passwd oracle

g. set Oracle Environment by root

# vim /home/oracle/.bash_profile
export ORACLE_SID=orcl1
export ORACLE_UNQNAME=orcl
export ORACLE_HOSTNAME=`hostname`
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/19.0.0/db_1

h. create software directory by root

# mkdir /u01
# chown oracle.oinstall /u01

i. unzip Oracle Database Source by oracle

$ mkdir -p $ORACLE_HOME
$ unzip -d $ORACLE_HOME


2. Install Oracle Software in silent mode

a. copy db_install.rsp to oracle home and edit db_install.rsp config

$ cp $ORACLE_HOME/install/response/db_install.rsp ~/db_install.rsp
$ vim ~/db_install.rsp


b. run Installer using db_install.rsp in silent mode

$ ./runInstaller -silent -responseFile /home/oracle/db_install.rsp

c. execute by root when runInstaller is finish

# sh /u01/app/oraInventory/

Changing permissions of /u01/app/oraInventory.
Adding read,write permissions for group.
Removing read,write,execute permissions for world.

Changing groupname of /u01/app/oraInventory to oinstall.
The execution of the script is complete.

# sh /u01/app/oracle/product/19.0.0/db_1/

Check /u01/app/oracle/product/19.0.0/db_1/install/root_yum-svr1_2021-03-04_15-13-36-597262925.log for the output of root script

d. check log

# tail /u01/app/oracle/product/19.0.0/db_1/install/root_yum-svr1_2021-03-04_15-13-36-597262925.log

   ORACLE_HOME=  /u01/app/oracle/product/19.0.0/db_1
   Copying dbhome to /usr/local/bin ...
   Copying oraenv to /usr/local/bin ...
   Copying coraenv to /usr/local/bin ...

Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root script.
Now product-specific root actions will be performed.
Oracle Trace File Analyzer (TFA) is available at : /u01/app/oracle/product/19.0.0/db_1/bin/tfactl


3. Install Oracle Listener in silent mode

a. find netca.rsp

$ find $ORACLE_HOME -name 'netca.rsp'


b. run netca using netca.rsp in silent mode

$ netca -silent -responseFile /u01/app/oracle/product/19.0.0/db_1/assistants/netca/netca.rsp

c. start listener by oracle and check status

$ lsnrctl start
$ lsnrctl status


4. Install Oracle Database in silent mode

a. create database directory

$ mkdir -p /u01/app/oradata

b. run dbca on silent mode (可以調整 totalMemory 的大小,會自動切割適合的 sga + pga 大小)

$ dbca -silent -createDatabase \
>  -templateName General_Purpose.dbc \
>  -gdbname orcl -sid orcl1 -responseFile NO_VALUE \
>  -characterSet AL32UTF8 \
>  -sysPassword oracle \
>  -systemPassword oracle \
>  -createAsContainerDatabase false \
>  -numberOfPDBs 0 \
>  -databaseType MULTIPURPOSE \
>  -memoryMgmtType auto_sga \
>  -totalMemory 2048 \
>  -storageType FS \
>  -datafileDestination "/u01/app/oradata/" \
>  -useOMF true \
>  -redoLogFileSize 100 \
>  -emConfiguration NONE \
>  -ignorePreReqs

c. Check status

$ ps aux | grep pmon
$ lsnrctl status
$ sqlplus / as sysdba
SQL> select open_mode from v$database;


5. enable archive log mode and add oracle database on systemd service

a. enable archive log mode

--create archivelog destation
$ mkdir -p /u01/app/oradata/archivelog

--edit archivelog parameter destation
$ sqlplus / as sysdba
SQL> show parameter log_archive_dest_1;
SQL> alter system set log_archive_dest_1='LOCATION=/u01/app/oradata/archivelog' scope=both;

--enable archivelog
SQL> shutdown immediate;
SQL> startup mount;
SQL> alter database archivelog;
SQL> alter database open;
SQL> alter system switch logfile;

b. create dbora script by oracle

$ mkdir /home/oracle/scirpt
$ vim /home/oracle/script/dbora
#! /bin/sh
# chkconfig: 2345 80 05
# description: start and stop Oracle Database Enterprise Edition on Oracle Linux 5 and 6

# In /etc/oratab, change the autostart field from N to Y for any
# databases that you want autostarted.
# Note: Change the value of ORACLE_HOME to specify the correct Oracle home
# directory for your installation.

# Note: Change the value of ORACLE to the login name of the oracle owner


case $1 in
        echo -n $"Oracle Process: "
        su $ORACLE -c "ps -ef | grep pmon | grep -v grep; ps -ef | grep -i listener | grep -v grep;" &
        echo -n $"Starting Oracle: "
        $ORACLE_HOME/bin/lsnrctl start
        $ORACLE_HOME/bin/dbstart $ORACLE_HOME &
        echo -n $"Shutting down Oracle: "
        $ORACLE_HOME/bin/dbshut $ORACLE_HOME &
        $ORACLE_HOME/bin/lsnrctl stop
        echo "usage: $0 {start|stop}"
        echo "$1"


c. create systemd service by root

# vim /lib/systemd/system/dbora.service
Description=The Oracle Database Service

# systemd ignores PAM limits, so set any necessary limits in the service.
# Not really a bug, but a feature.

# Type=simple
# idle: similar to simple, the actual execution of the service binary is delayed
#       until all jobs are finished, which avoids mixing the status output with shell output of services.
ExecStart=/home/oracle/script/dbora start
ExecStop=/home/oracle/script/dbora stop


d. system daemon reload by root

# systemctl daemon-reload

e. enable database autostartup by oracle (edit Y from N)

$ vim /etc/oratab


6. Clear Oracle Log in Crontab by root

# vim /root/

SUORA="su - oracle -c "
SUGRI="su - grid -c "

${SUORA} "cd /u01/app/oracle/diag/rdbms/\$ORACLE_UNQNAME/\$ORACLE_SID/alert ; rm -f log_*.xml"
${SUORA} "cd /u01/app/oracle/diag/rdbms/\$ORACLE_UNQNAME/\$ORACLE_SID/trace ; rm -f *.trc *.trm"
${SUORA} "cd /u01/app/oracle/admin/\${ORACLE_UNQNAME}/adump ; rm -f *.aud"
${SUORA} "cd /u01/app/oracle/diag/tnslsnr/`hostname`/listener/alert ; rm -f log_*.xml"
${SUORA} "cd /u01/app/oracle/diag/tnslsnr/`hostname`/listener/trace ; rm -f listener_*.log"

#${SUGRI} "cd /u01/app/grid/diag/crs/`hostname`/crs/trace ; rm -f osysmond_*.trc osysmond_*.trm ologgerd_*.trc ologgerd_*.trm ohasd_orarootagent_root_*.trc ohasd_orarootagent_root_*.trmohasd_cssdmonitor_root_*.trc ohasd_cssdmonitor_root_*.trm ohasd_oraagent_grid_*.trc ohasd_oraagent_grid_*.trm ocrconfig_*.trc ocrconfig_*.trm ohasd_*.trc ohasd_*.trm evmd_*.trc evmd_*.trm gpnpd_*.trc gpnpd_*.trm gipcd_*.trc gipcd_*.trm crsd_jagent_grid_*.trc crsd_jagent_grid_*.trm crsd_scriptagent_grid_*.trc crsd_scriptagent_grid_*.trm crsctl_*.trc crsctl_*.trm ocrcheck_*.trc ocrcheck_*.trm ocssd_*.trc ocssd_*.trm ocssd_*.trm ocssd_*.trc crsd_*.trc crsd_*.trm olsnodes_*.trc olsnodes_*.trm octssd_*.trc octssd_*.trm"
#${SUGRI} "cd /u01/app/grid/diag/crs/`hostname`/crs/alert ; rm -f log_*.xml"
#${SUGRI} "cd /u01/app/grid/diag/tnslsnr/`hostname`/asmnet1lsnr_asm/alert ; rm -f log_*.xml"
#${SUGRI} "cd /u01/app/grid/diag/tnslsnr/`hostname`/asmnet1lsnr_asm/trace ; rm -f asmnet1lsnr_asm_*.log"
#${SUGRI} "cd /u01/app/grid/diag/tnslsnr/`hostname`/listener/trace ; rm -f listener_*.log"
#${SUGRI} "cd /u01/app/grid/diag/tnslsnr/`hostname`/listener_scan1/alert ; rm -f log_*.xml"
#${SUGRI} "cd /u01/app/grid/diag/tnslsnr/`hostname`/listener_scan1/trace ; rm -f listener_scan1_*.log"
#${SUGRI} "cd /u01/app/grid/diag/asm/+asm/+ASM1/trace ; rm -f *.trm *.trc"
# crontab -l
0 0 * * * /root/ > /dev/null 2>&1


X. Delete Oracle Database in silent mode

$ dbca -silent -deleteDatabase -sourceDB ${ORACLE_SID} -sysDBAPassword {syspwd}

Enter SYS user password: {input password again}

[WARNING] [DBT-19202] The Database Configuration Assistant will delete the Oracle instances and datafiles for your database. All information in the database will be destroyed.
Prepare for db operation
32% complete
Connecting to database
35% complete
39% complete
42% complete
45% complete
48% complete
52% complete
65% complete
Updating network configuration files
68% complete
Deleting instance and datafiles
84% complete
100% complete
Database deletion completed.
Look at the log file "/u01/app/oracle/cfgtoollogs/dbca/orcl2/orcl2.log" for further details.