Fading Coder

One Final Commit for the Last Sprint

Home > Tech > Content

Silent Deployment of Oracle Database 11.2.0.4 on Anolis OS 7.9

Tech May 16 1

System Preparation and Directory Structure

Initialize the required filesystem hierarchy for Oracle binaries, data storage, and recovery archives. Execute the following commands as a privileged user:

mkdir -p /u01/app/oracle/product/11.2.0/dbhome_1 \
         /u01/app/oracle/datafiles \
         /u01/app/oracle/recovery_dest \
         /u01/app/oraInventory
chown -R oracle:oinstall /u01/app/oracle
chmod -R 775 /u01/app/oracle

Operating System User and Group Provisioning

Define the necessary privilege groups and create the dedicated service account with appropriate primary and supplementary group assignments:

groupadd -g 501 oinstall
groupadd -g 502 dba
useradd -u 501 -g oinstall -G dba -s /bin/bash -m oracle
passwd oracle

Environment Profile Configuration

Append runtime variables to the Oracle user's shell initialization script. This establishes base paths, session locale settings, and binary search paths:

cat >> /home/oracle/.bash_profile <<'ENV_SETUP'
export DB_BASE=/u01/app/oracle
export DB_HOME=${DB_BASE}/product/11.2.0/dbhome_1
export DB_SID=prod1
export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
export NLS_DATE_FORMAT='YYYY-MM-DD HH24:MI:SS'
export PATH=${DB_HOME}/bin:${DB_HOME}/OPatch:${PATH}
export LD_LIBRARY_PATH=${DB_HOME}/lib:/usr/lib:/lib
ENV_SETUP
source /home/oracle/.bash_profile

Kernel Tuning and Resource Limit Enforcement

Configure process and file descriptor limits within the PAM limits configuration:

cat >> /etc/security/limits.conf <<'LIM_CFG'
oracle soft nproc 2048
oracle hard nproc 16384
oracle soft nofile 4096
oracle hard nofile 65536
oracle soft stack 10240
oracle hard stack 32768
*    soft memlock 4194304
*    hard memlock 4194304
LIM_CFG

Adjust kernel parameters dynamically. The script below calculates shared memory thresholds and huge page allocations based on available system RAM before applying them:

MEM_PAGES=$(awk '/MemTotal/ {print int($2 * 0.85 / 4)}' /proc/meminfo)
SHMMAX_VAL=$(awk '/MemTotal/ {print int($2 * 0.90 * 1024)}' /proc/meminfo)
HPAGES_VAL=$(awk '/MemTotal/ {print int($2 / 1024 * 0.75 / 2)}' /proc/meminfo)

cat >> /etc/sysctl.conf <<KERN
kernel.shmmni = 4096
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.sem = 250 32000 100 128
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
vm.swappiness = 15
kernel.shmmax = ${SHMMAX_VAL}
kernel.shmall = ${MEM_PAGES}
vm.nr_hugepages = ${HPAGES_VAL}
KERN
sysctl -p

Activate PAM limits integration for login sessions:

echo "session required pam_limits.so" >> /etc/pam.d/login

Dependency Installation and Security Hardening

Install prerequisite libraries. For offline systems, point a local repository manager or execute the batch RPM installation:

cd /opt/install_media/rpms
rpm -Uvh *.rpm --force --nodeps

Disable network filtering services and set SELinux to a permissive state:

systemctl stop firewalld iptables
systemctl disable firewalld iptables
sed -i 's/^SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config
setenforce 0

Database Software Installation

Extract the installation archives and duplicate the default response template:

mkdir -p /opt/oracle_staging
unzip p13390677_112040_Linux-x86-64_1of7.zip -d /opt/oracle_staging
unzip p13390677_112040_Linux-x86-64_2of7.zip -d /opt/oracle_staging
cp /opt/oracle_staging/database/response/db_install.rsp /opt/oracle_staging/db_silent.cfg

Modify the configuration file to reflect silent deployment parameters:

sed -i 's/^oracle\.install\.responseFileVersion=.*/oracle.install.responseFileVersion=\/oracle\/install\/rspfmt_dbinstall_response_schema_v11_2_0/' /opt/oracle_staging/db_silent.cfg
sed -i 's/^oracle\.install\.option=.*/oracle.install.option=INSTALL_DB_SWONLY/' /opt/oracle_staging/db_silent.cfg
sed -i 's/^ORACLE_HOSTNAME=.*/ORACLE_HOSTNAME=db-node-01/' /opt/oracle_staging/db_silent.cfg
sed -i 's/^UNIX_GROUP_NAME=.*/UNIX_GROUP_NAME=oinstall/' /opt/oracle_staging/db_silent.cfg
sed -i 's|^INVENTORY_LOCATION=.*|INVENTORY_LOCATION=/u01/app/oraInventory|' /opt/oracle_staging/db_silent.cfg
sed -i 's/^SELECTED_LANGUAGES=.*/SELECTED_LANGUAGES=en,zh_CN/' /opt/oracle_staging/db_silent.cfg
sed -i 's|^ORACLE_HOME=.*|ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1|' /opt/oracle_staging/db_silent.cfg
sed -i 's|^ORACLE_BASE=.*|ORACLE_BASE=/u01/app/oracle|' /opt/oracle_staging/db_silent.cfg
sed -i 's/^oracle\.install\.db\.InstallEdition=.*/oracle.install.db.InstallEdition=EE/' /opt/oracle_staging/db_silent.cfg
sed -i 's/^oracle\.install\.db\.DBA_GROUP=.*/oracle.install.db.DBA_GROUP=dba/' /opt/oracle_staging/db_silent.cfg
sed -i 's/^oracle\.install\.db\.OPER_GROUP=.*/oracle.install.db.OPER_GROUP=dba/' /opt/oracle_staging/db_silent.cfg
sed -i 's/^DECLINE_SECURITY_UPDATES=.*/DECLINE_SECURITY_UPDATES=true/' /opt/oracle_staging/db_silent.cfg
sed -i 's/^oracle\.installer\.autoupdates\.option=.*/oracle.installer.autoupdates.option=SKIP_UPDATES/' /opt/oracle_staging/db_silent.cfg

Launch the silent installer:

/opt/oracle_staging/database/runInstaller -silent -noconfig -ignorePrereq -responseFile /opt/oracle_staging/db_silent.cfg

Follow the terminal output instructions and execute the generated root configuration scripts in a separate privileged shell session.

Network Listener Initialization

Generate the default listener configuration using the silent network configuration assistant:

netca /silent /responseFile /opt/oracle_staging/database/response/netca.rsp

Silent Instance Provisioning

Define database characteristics and administrative credentials within the DBCA response file:

cat >> /opt/oracle_staging/database/response/dbca.rsp <<DB_PARAMS
GDBNAME=prod1
SID=prod1
SYSPASSWORD=StrongDBPass2024
SYSTEMPASSWORD=StrongDBPass2024
SYSMANPASSWORD=StrongDBPass2024
DBSNMPPASSWORD=StrongDBPass2024
DATAFILEDESTINATION=/u01/app/oracle/datafiles
RECOVERYAREADESTINATION=/u01/app/oracle/recovery_dest
CHARACTERSET=ZHS16GBK
TOTALMEMORY=4096
DB_PARAMS

Execute the database creation utility:

dbca -silent -responseFile /opt/oracle_staging/database/response/dbca.rsp

Post-Deployment Validation

Confirm the network listener is actively bound and accepting connections:

lsnrctl status

Connect to the newly provisioned instance and verify operational state:

sqlplus / as sysdba
SQL> SELECT status, open_mode FROM v$instance;

Force manual service registration to ensure the instence correctly broadcasts to the listener:

sqlplus / as sysdba
SQL> ALTER SYSTEM SET LOCAL_LISTENER='(ADDRESS=(PROTOCOL=TCP)(HOST=0.0.0.0)(PORT=1521))' SCOPE=BOTH;
SQL> ALTER SYSTEM REGISTER;

Related Articles

Understanding Strong and Weak References in Java

Strong References Strong reference are the most prevalent type of object referencing in Java. When an object has a strong reference pointing to it, the garbage collector will not reclaim its memory. F...

Comprehensive Guide to SSTI Explained with Payload Bypass Techniques

Introduction Server-Side Template Injection (SSTI) is a vulnerability in web applications where user input is improper handled within the template engine and executed on the server. This exploit can r...

Implement Image Upload Functionality for Django Integrated TinyMCE Editor

Django’s Admin panel is highly user-friendly, and pairing it with TinyMCE, an effective rich text editor, simplifies content management significantly. Combining the two is particular useful for bloggi...

Leave a Comment

Anonymous

◎Feel free to join the discussion and share your thoughts.