LLI Wiki — My Digital Knowledge Base

Install and decommission Oracle 12c on Linux and Windows

Prerequisites, GUI install and DBCA creation of Oracle 12c on Linux, then decommissioning steps.

Cheat sheet for installing Oracle Database 12c on Linux (CentOS / Red Hat) with the graphical installer and DBCA, and for cleanly decommissioning an instance on Linux or Windows.

OFA directory layout

/<mount_point>/app/oracle/product/<version>/<software_home>
Level Description
mount point Base directory, file system or drive name.
app Tree holding application software.
oracle Software owner, defined as ORACLE_BASE.
product Holding directory for software trees.
version Directory with the actual installation, defined as ORACLE_HOME.

Example layout: /u1 for binaries, /u2 for datafiles, /u3 for dumps and the Fast Recovery Area.

System prerequisites

Disable the firewall (or open the required ports) and check memory, swap and disk space:

systemctl stop firewalld
systemctl disable firewalld
systemctl status firewalld

grep MemTotal /proc/meminfo
grep SwapTotal /proc/meminfo
df -h /tmp/

uname -a
cat /etc/*-release

Install the required packages:

# Red Hat
yum install oracle-database-server-12cR2-preinstall

# CentOS
yum install -y binutils.x86_64 compat-libcap1.x86_64 gcc.x86_64 gcc-c++.x86_64 glibc.i686 glibc.x86_64 glibc-devel.i686 glibc-devel.x86_64 ksh compat-libstdc++-33 libaio.i686 libaio.x86_64 libaio-devel.i686 libaio-devel.x86_64 libgcc.i686 libgcc.x86_64 libstdc++.i686 libstdc++.x86_64 libstdc++-devel.i686 libstdc++-devel.x86_64 libXi.i686 libXi.x86_64 libXtst.i686 libXtst.x86_64 make.x86_64 sysstat.x86_64 zip unzip

Create the groups and the user:

groupadd dba
groupadd oinstall
useradd -g dba -G oinstall oracle
passwd oracle

Kernel parameters (/etc/sysctl.conf)

kernel.shmmax = 4398046511104
kernel.shmall = 4294967296
kernel.shmmni = 4096
kernel.sem = 1250 256000 100 8192
vm.max_map_count = 1000000
fs.aio-max-nr = 1048576
fs.file-max = 6815744

net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 4194304
net.core.rmem_max = 16777216
net.core.wmem_default = 262144
net.core.wmem_max = 16777216
kernel.panic_on_oops = 1

Limits (/etc/security/limits.conf)

oracle   soft   nofile   65536
oracle   hard   nofile   65536
oracle   soft   nproc    16384
oracle   hard   nproc    16384
oracle   soft   memlock  unlimited
oracle   hard   memlock  unlimited

Directories and permissions

Create the directories for binaries, datafiles and dumps/FRA. If they were created as root, fix the permissions:

chown -R oracle:dba /u1/app/oracle/
chmod -R 775 /u1/app/oracle/

Software installation (GUI)

Log in as oracle, unzip the archive and start the installer:

unzip linuxx64_12201_database.zip
cd ~/database
./runInstaller

Values used in the wizard:

Start the installation, run the requested scripts as root at the end of the wizard, then check that the files are present in the installation directory.

If the installer must display on a remote workstation, set DISPLAY (for example export DISPLAY=192.0.2.10:0.0) and allow the X client.

Creating the database with DBCA

cd $ORACLE_HOME/bin
./dbca

Choices:

Check that the instance is running and connect:

ps -ef | grep pmon
export ORACLE_HOME=/u1/app/oracle/product/12.2.0/dbhome_1
export ORACLE_SID=orcl
export PATH=$PATH:$ORACLE_HOME/bin
sqlplus / as sysdba
SELECT * FROM v$database;

. oraenv can then set the environment from the SID.

Network configuration files

In $ORACLE_HOME/network/admin: tnsnames.ora, listener.ora, sqlnet.ora, ldap.ora. Locate listener logs with:

find $ORACLE_BASE -type f -name listener.log

Decommissioning a database

Items to handle:

First update tnsnames.ora, listener.ora and /etc/oratab.

Linux / UNIX

  1. Shut down the database and archive or back it up.
  2. Remove the .dbf and .ctl files.
  3. Remove the Oracle directories.
  4. Remove external files (/etc/oratab, /var/opt/oracle/oratab).
  5. Remove the user and group (/etc/passwd, /etc/group).

Windows

  1. Shut down the database and archive or back it up.
  2. Remove the .dbf and .ctl files.
  3. Remove the Oracle directories.
  4. Remove the Oracle registry keys.
  5. Remove the oracle user.

Registry keys involved (see My Oracle Support notes 124353.1 and 208256.1 for cleanup):

HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE\ALL_HOMES\IDx
HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE\KEY_ora10g_Home1
HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE\KEY_ora10g_Home2

External files on UNIX/Linux

Path Purpose
/etc/oratab Maps each SID to its ORACLE_HOME.
/var/opt/oracle/oratab Equivalent on Solaris.
/usr/local/bin/oraenv, coraenv, racenv Environment scripts (coraenv for the C shell).
/usr/local/bin/dbhome Used by the scripts above to find a database's home.

Diagnostic directories

Up to Oracle 10g, each instance has bdump, udump, cdump and a pfile directory. From 11g the ADR is located by default under $ORACLE_BASE/diag; the background_dump_dest and user_dump_dest parameters are deprecated. Each instance directory contains alert (text and XML alert log), incident, incpkg, trace (replaces bdump and udump) and cdump.

For RMAN backup cleanup during decommissioning, see this article.

Notes

Mastodon LLIMastodon SocialFosstodon