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:
- Oracle Base:
/u1/app/oracle - Software location:
/u1/app/oracle/product/12.2.0/dbhome_1 - Inventory:
/u1/app/oracle/orainventory - Administrative group:
dba
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:
- Advanced mode, Oracle Single Instance database, general purpose or transaction processing.
- Do not create a container database (uncheck "create as container").
- Global database name and SID:
orcl. - Storage: do not use Oracle-Managed Files; enable the Fast Recovery Area.
- Listener:
LISTENER, port 1521. - Memory: Automatic Memory Management if possible, otherwise Shared Memory Management; processes: 300.
- Character set: Unicode (AL32UTF8); national character set: UTF-16.
- Connection mode: dedicated server; Enterprise Manager disabled.
- A template and creation scripts can be generated.
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:
- database files (
*.dbf,*.ctl, redo logs, tempfiles); - database directories (
admin/<SID>: bdump, cdump, arch, pfile); - operating system structures (registry on Windows;
/etcand/var/opt/oracleon UNIX/Linux); - the
oracleoperating system user; - the software (
$ORACLE_HOME).
First update tnsnames.ora, listener.ora and /etc/oratab.
Linux / UNIX
- Shut down the database and archive or back it up.
- Remove the
.dbfand.ctlfiles. - Remove the Oracle directories.
- Remove external files (
/etc/oratab,/var/opt/oracle/oratab). - Remove the user and group (
/etc/passwd,/etc/group).
Windows
- Shut down the database and archive or back it up.
- Remove the
.dbfand.ctlfiles. - Remove the Oracle directories.
- Remove the Oracle registry keys.
- 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
- Versions and paths above are examples (12.1 and 12.2); adapt them to the installed version.
- Reference: Oracle-Base, automating startup and shutdown on Linux.