Installing Oracle Database 12.1 in Command Line and "Silent Mode"

Installing and configuring Oracle databases is probably the first task you will want to automate when you are a DBA. Well, it is not the most expensive, neither the most difficult and probably not even the worthiest. Be also careful, it might come at a very bad time if you are not in charge or did not already have automated your Operating Systems installation and configuration. Anyway, we can assume this operation has to be done frequently enough to start with it as an automation.

Every Oracle release and, sometimes Patch Set, come with a few changes. Oracle Database 12.1 is no exception to that rule! Before you get your installation fully automated and rely on your preferred tool to deploy them, this blog post will present the command lines you can use to perform a silent mode installation of Oracle on most operating systems

Checking for Pre-requisites

Before you install the Oracle software, make sure all the pre-requisites are met. If you rely on Oracle Linux 6, this step is as simple as installing the oracle-rdbms-server-12cR1-preinstall RPM:
# yum -y install oracle-rdbms-server-12cR1-preinstall.x86_64

Setting up Install Process
Resolving Dependencies
  oracle-rdbms-server-12cR1-preinstall.x86_64 0:1.0-11.el6
Dependency Installed:
 bc.x86_64 0:1.06.95-1.el6                   bind-libs.x86_64 32:9.8.2-0.23.rc1.el6_5.1
 bind-utils.x86_64 32:9.8.2-0.23.rc1.el6_5.1 compat-libcap1.x86_64 0:1.10-1
 compat-libstdc++-33.x86_64 0:3.2.3-69.el6   gcc-c++.x86_64 0:4.4.7-4.el6
 keyutils.x86_64 0:1.4-4.el6                 ksh.x86_64 0:20120801-10.el6_5.7
 libICE.x86_64 0:1.0.6-1.el6                 libSM.x86_64 0:1.2.1-2.el6
 libX11.x86_64 0:1.5.0-4.el6                 libX11-common.noarch 0:1.5.0-4.el6
 libXau.x86_64 0:1.0.6-4.el6                 libXext.x86_64 0:1.3.1-2.el6
 libXi.x86_64 0:1.6.1-3.el6                  libXinerama.x86_64 0:1.1.2-2.el6
 libXmu.x86_64 0:1.1.1-2.el6                 libXrender.x86_64 0:0.9.7-2.el6
 libXt.x86_64 0:1.1.3-1.el6                  libXtst.x86_64 0:1.2.1-2.el6
 libXv.x86_64 0:1.0.7-2.el6                  libXxf86dga.x86_64 0:1.1.3-2.el6
 libXxf86misc.x86_64 0:1.0.3-4.el6           libXxf86vm.x86_64 0:1.1.2-2.el6
 libaio.x86_64 0:0.3.107-10.el6              libaio-devel.x86_64 0:0.3.107-10.el6
 libdmx.x86_64 0:1.1.2-2.el6                 libedit.x86_64 0:2.11-4.20080712cvs.1.el6
 libevent.x86_64 0:1.4.13-4.el6              libgssglue.x86_64 0:0.1-11.el6
 libstdc++-devel.x86_64 0:4.4.7-4.el6        libtirpc.x86_64 0:0.2.1-6.el6_5.2
 libxcb.x86_64 0:1.8.1-1.el6                 mailx.x86_64 0:12.4-7.el6
 nfs-utils.x86_64 1:1.2.3-39.el6_5.3         nfs-utils-lib.x86_64 0:1.1.5-6.el6
 openssh-clients.x86_64 0:5.3p1-94.el6       rpcbind.x86_64 0:0.2.0-11.el6
 smartmontools.x86_64 1:5.43-1.el6           sysstat.x86_64 0:9.0.4-22.el6
 xorg-x11-utils.x86_64 0:7.5-6.el6           xorg-x11-xauth.x86_64 1:1.0.2-7.1.el6

It's very important server host name can be resolve to perform the Install. If you don't rely on a DCHP and/or DNS, you might want to check the /etc/hosts file and add the host name in it

Creating ORACLE_BASE and Inventory

To install the Oracle Software, you will need to create a root directory, an ORACLE_BASE directory and an Inventory directory as root. This procedure slightly differs between operating systems. With Unix and Linux, you can simply create the 3 directories with the commands below; the location of these directories can be changed to meet your needs:
if [ ! -d /u01 ]; then
   mkdir -p /u01/app/oracle/distribs
   mkdir -p /u01/app/oraInventory
   chown -R oracle:dba /u01
Once the directories created, add the oraInst.loc to the correct location like below on Linux:
if [ ! -f /etc/oraInst.loc ]; then
   cat >/etc/oraInst.loc <<EOF
  chown root:oinstall /etc/oraInst.loc
  chown 640 /etc/oraInst.loc

Installing the Oracle Software

Assuming you've downloaded and unzipped the 12.1 software in the /u01/app/oracle/distribs directory, the installation should look like below:
cd /u01/app/oracle/distribs/database
export DISTRIB=`pwd`
./runInstaller -silent -responseFile $DISTRIB/response/db_install.rsp \
   oracle.install.option=INSTALL_DB_SWONLY \
   ORACLE_HOME=/u01/app/oracle/product/12.1.0/db_1 \
   ORACLE_BASE=/u01/app/oracle \
   oracle.install.db.InstallEdition=EE \
   oracle.install.db.DBA_GROUP=dba \
   oracle.install.db.BACKUPDBA_GROUP=dba \
   oracle.install.db.DGDBA_GROUP=dba \
   oracle.install.db.KMDBA_GROUP=dba \

Starting Oracle Universal Installer...

Checking Temp space: must be greater than 500 MB.   Actual 35722 MB    Passed
Checking swap space: must be greater than 150 MB.   Actual 3967 MB    Passed
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2014-07-14_07-03-22AM. Please wait ...
[WARNING] - My Oracle Support Username/Email Address Not Specified

You can find the log of this install session at:
The installation of Oracle Database 12c was successful.
Please check '/u01/app/oraInventory/logs/silentInstall2014-07-14_07-03-22AM.log' for more details.

As a root user, execute the following script(s):
 1. /u01/app/oracle/product/12.1.0/db_1/

Successfully Setup Software.
As you can check for yourself, the Installer now require you specify OS groups for the SYSDBA, SYSBACKUP, SYSDG and SYSKM administrative privileges. Once done, you can finish by executing the script:
sudo  /u01/app/oracle/product/12.1.0/db_1/
[sudo] password for oracle: 
Check /u01/app/oracle/product/12.1.0/db_1/install/root_black.resetlogs.com_2014-07-14_07-07-45.log for the output of root script

Configuring and Starting a Listener

Before you proceed with the database creation, you might want to configure a listener with the netca command:
. oraenv
ORACLE_SID = [oracle] ? 
ORACLE_HOME = [/home/oracle] ? /u01/app/oracle/product/12.1.0/db_1
The Oracle base has been set to /u01/app/oracle

netca -silent \
 -responsefile /u01/app/oracle/product/12.1.0/db_1/network/install/netca_typ.rsp 

Parsing command line arguments:
    Parameter "silent" = true
    Parameter "responsefile" = /u01/app/oracle/product/12.1.0/db_1/network/install/netca_typ.rsp
Done parsing command line arguments.
Oracle Net Services Configuration:
Profile configuration complete.
Oracle Net Listener Startup:
    Running Listener Control: 
      /u01/app/oracle/product/12.1.0/db_1/bin/lsnrctl start LISTENER
    Listener Control complete.
    Listener started successfully.
Listener configuration complete.

Creating a database

You can now create a database. The fastest way again is probably to use dbca. Check the syntax in
Oracle Database Administrator's Guide
12c Release 1 (12.1)
2 Creating and Configuring an Oracle Database
Creating a Database with DBCA
Below is an example of database creation. Here again, 12.1 comes with its new parameters like createAsContainerDatabase:
 dbca -silent -createDatabase     \
  -templateName New_Database.dbt  \
  -gdbName BLACK                  \
  -createAsContainerDatabase true \
  -sysPassword change_on_install  \
  -systemPassword manager         \
  -emConfiguration NONE           \
  -storageType FS                 \
  -characterSet AL32UTF8          \
  -totalMemory 1024
Before you jump start to install and configure your Oracle database automatically with the set of commands above, be careful a better solution is, by far, to use the cloning features of the Oracle products. That will be the subject of the next post...


Popular posts from this blog

Querying an Oracle VM Server Xenstore from a Linux Guest

Introduction to Oracle Linux 7 Network