Sunday, 30 November 2014

Oracle Database 12 Installation on Redhat 6.6/CentOS 6.6

Oracle database (Oracle DB) is a relational database management system (RDBMS) from the Oracle Corporation.The system is built around a relational database framework in which data objects may be directly accessed by users (or an application front end) through structured query language (SQL). Oracle is a fully scalable relational database architecture and is often used by global enterprises, which manage and process data across wide and local area networks. The Oracle database has its own network component to allow communications across networks. Oracle DB is also known as Oracle RDBMS and, sometimes, just Oracle.

Minimum requirements:

- Recommended minimum RAM needed for Oracle is 2GB or more.
- Swap must be enabled double the size of RAM
- Disk space must be more than 8GB and its edition
- /tmp directory must have free space more than 1GB

    Below, was my system requirements on which Oracle 12 will be installed:

    Environment: CentOS 6.6/Redhat 6.6 (x86_64)
    Kernel version : 2.6.32-504.el6
    Hostname: oracle12c
    Memory: 3.5GB
    HDD: 40GB
    Firewall: Disabled.
    SELinux: Disabled

    Make an entry in /etc/hosts file.

    [root@oracle12c ~]# tail -1 /etc/hosts
    <IP address> oracle12c
    [root@oracle12c ~]# 

    Make sure that your system is upto date and download the below packages.

    #yum clean all
    #yum install -y binutils.x86_64 compat-libcap1.x86_64 compat-libstdc++-33.x86_64 compat-libstdc++-33.i686 compat-gcc-44 compat-gcc-44-c++ gcc.x86_64 gcc-c++.x86_64 glibc.i686 glibc.x86_64 glibc-devel.i686 glibc-devel.x86_64 ksh.x86_64 libgcc.i686 libgcc.x86_64 libstdc++.i686 libstdc++.x86_64 libstdc++-devel.i686 libstdc++-devel.x86_64 libaio.i686 libaio.x86_64 libaio-devel.i686 libaio-devel.x86_64 libXext.i686 libXext.x86_64 libXtst.i686 libXtst.x86_64 libX11.x86_64 libX11.i686 libXau.x86_64 libXau.i686 libxcb.i686 libxcb.x86_64 libXi.i686 libXi.x86_64 make.x86_64 unixODBC unixODBC-devel sysstat.x86_64

    Change your kernel parameters as per below snap provided and edit in /etc/sysctl.conf

    [root@oracle12c ~]# tail -12 /etc/sysctl.conf
    #oracle installations kernel parameters settings

    kernel.shmmax = 3698180096
    kernel.shmall = 1805752
    fs.aio-max-nr = 1048576
    fs.file-max = 6815744
    kernel.shmmni = 4096
    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
    [root@oracle12c ~]# 

    Once you have added above values, issue below command to take effect.

    [root@oracle12c ~]# sysctl -p
    net.ipv4.ip_forward = 0
    net.ipv4.conf.default.rp_filter = 1
    net.ipv4.conf.default.accept_source_route = 0
    kernel.sysrq = 0
    kernel.core_uses_pid = 1
    net.ipv4.tcp_syncookies = 1
    error: "net.bridge.bridge-nf-call-ip6tables" is an unknown key
    error: "net.bridge.bridge-nf-call-iptables" is an unknown key
    error: "net.bridge.bridge-nf-call-arptables" is an unknown key
    kernel.msgmnb = 65536
    kernel.msgmax = 65536
    kernel.shmmax = 3698180096
    kernel.shmall = 1805752
    fs.aio-max-nr = 1048576
    fs.file-max = 6815744
    kernel.shmmni = 4096
    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
    [root@oracle12c ~]# 

    Create user and groups for Oracle installations

    Create the new groups Oracle inventory, OSDBA and OSOPER for Oracle installation.
    [root@oracle12c ~]# groupadd -g 5000 oracle
    [root@oracle12c ~]# groupadd -g 5001 dba
    [root@oracle12c ~]# groupadd -g 5002 opr

    Create the new users and add them to the above group.
    [root@oracle12c ~]# useradd -u 5000 -g oracle -G dba,opr oracle
    [root@oracle12c ~]# usermod -a -G wheel oracle
    [root@oracle12c ~]# passwd oracle
    Changing password for user oracle.
    New password: 
    Retype new password: 
    passwd: all authentication tokens updated successfully.
    [root@oracle12c ~]# 

    Create directory for installing Oracle and change the ownership and grand permission.
    [root@oracle12c ~]#mkdir -p /u01/app/oracle/product/12.1/db_1
    [root@oracle12c ~]#chmod -R 775 /u01
    [root@oracle12c ~]#chown -R /u01
    [root@oracle12c ~]# ls -ld /u01/
    drwxrwxr-x 4 oracle oracle 4096 Nov 29 12:02 /u01/
    [root@oracle12c ~]# 

    Add the environment variable for oracle user by editing the profile file of oracle user and append the oracle environment entries.

    [root@oracle12c ~]#vim /home/oracle/.bash_profile
    ## Oracle Env Settings 
    export TMP=/tmp
    export TMPDIR=$TMP
    export ORACLE_UNQNAME=orcl
    export ORACLE_BASE=/u01/app/oracle
    export ORACLE_HOME=$ORACLE_BASE/product/12.1/db_1
    export ORACLE_SID=orcl
    export PATH=/usr/sbin:$PATH
    export PATH=$ORACLE_HOME/bin:$PATH
    export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
    export CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
    [root@oracle12c ~]# 

    Setting shell limits of an oracle user.

    To improve the performance of the software, you must increase the shell limits for the oracle user. Add the following lines to the /etc/security/limits.conf file:

    [root@oracle12c ~]# tail -6 /etc/security/limits.conf
    oracle              soft    nproc   2047
    oracle              hard    nproc   16384
    oracle              soft    nofile  4096
    oracle              hard    nofile  65536
    oracle              soft    stack   10240
    oracle              hard    stack   10240
    [root@oracle12c ~]#

    try to download the oracle packages from the official repository, Click here to download
    I had downloaded the two below files, extracted to database directory, install oracle by running runInstaller script.

    [oracle@oracle12c ~]$ unzip
    [oracle@oracle12c ~]$ unzip

    Note: Make sure X11 forwading is enabled, I would leave to reader to configure if isn't set.
    Reboot the box once to come clean before starting oracle installations.

    [oracle@oracle12c database]$ ./runInstaller
    Starting Oracle Universal Installer...

    Checking Temp space: must be greater than 500 MB.   Actual 1367 MB    Passed
    Checking swap space: must be greater than 150 MB.   Actual 2999 MB    Passed
    Checking monitor: must be configured to display at least 256 colors.    Actual 16777216    Passed
    Preparing to launch Oracle Universal Installer from /tmp/OraInstall2014-11-29_04-29-06PM. Please wait ...

    Step 1:
    Configure security update window would be popped up, where in it would require your email, I would be skipping it by pressing next, thereby providing another window for confirmation press YES

    Step 2: Create and configure a database, press by clicking Next

    Step 3: Installing server class

    Step 4: Single instance database installation, Press Next to continue

    Step 5: Choose advance installation

    Step 6: Default English chosen, press Next to continue.

    Step 7: Choose for DB edition.
    We need more than 6.5 GB space for Enterprise installation because database may grow soon/increase, make sure you have enough space to install.

    Step 8: Installation location

    Step 9: Inventory creation

    every Inventory files will be created under '/u01/app/oralnventory' directory. We have created the group oracle for installation. So now the oracle group has permission to access Inventory Directory

    Step 10: Configuration type 
    select 'General purpose/Transaction processing' and proceed with Next

    Step 11: Database identifiers
    Specify the Global Database name for uniquely identified and un-check the Create as Container database, as here we are not going to create multiple databases.

    Step 12: Configuration options
    I have assigned 3.5GB of memory but this is not enough for Oracle. Here we need to Enable allocate memory automatically for the use of system global Area.

    Step 13: Database storage

    Step 14: Management options
    As, I don't have Cloud control manager credentials from oracle, so I have to skip this step by clicking Next

    Step 15: Recovery options
    This must be enabled in production environment also this would be in a separate file system, hence I choose to un-check(skip) the option and proceed by clicking Next.

    Step 16: Schema password
    We need to define the password for starter database which is all pre-loaded while the installations, as well as weblogin as well.

    Step 17: Operation System groups
    We need to provide system privileges to create database for that we need to choose the oracle group. Choose oracle for every options.

    Step 18: Preform Pre-requisites check.
    this would check for the minimum requirements, and take necessary actions.
    Increase your swap/tmp if not met the required space. Once your pre-requisite check is successful below would be the pic.

    Step 19: Install product
    Installation started to Preparation and copying files. This will take long time to complete according to our Hardware Resource.

    During setup process, it will ask to run two scripts as a root user as shown in the below picture. execute as root user and once done, press OK

    Once above tasks completed successfully, we will receive the Database Configuration Assistant window with the all the details and it will show you the EM Database Express URL. Click OK to move forward.

    Finally Oracle Database installation was successfully completed. Click on Close to quit the Oracle Installer.

    Reboot the system to take necessary effect

    Post verification:

    Start listener:

    [oracle@oracle12c ~]$ lsnrctl start
    LSNRCTL for Linux: Version - Production on 30-NOV-2014 07:26:13
    Copyright (c) 1991, 2014, Oracle.  All rights reserved.
    Starting /u01/app/oracle/product/12.1/db_1/bin/tnslsnr: please wait...

    TNSLSNR for Linux: Version - Production
    System parameter file is /u01/app/oracle/product/12.1/db_1/network/admin/listener.ora
    Log messages written to /u01/app/oracle/diag/tnslsnr/oracle12c/listener/alert/log.xml
    Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(

    Alias                     LISTENER
    Version                   TNSLSNR for Linux: Version - Production
    Start Date                30-NOV-2014 07:26:15
    Uptime                    0 days 0 hr. 0 min. 0 sec
    Trace Level               off
    Security                  ON: Local OS Authentication
    SNMP                      OFF
    Listener Parameter File   /u01/app/oracle/product/12.1/db_1/network/admin/listener.ora
    Listener Log File         /u01/app/oracle/diag/tnslsnr/oracle12c/listener/alert/log.xml
    Listening Endpoints Summary...
    The listener supports no services
    The command completed successfully
    [oracle@oracle12c ~]$ 

    [oracle@oracle12c ~]$ sqlplus / as sysdba
    SQL*Plus: Release Production on Sun Nov 30 07:58:51 2014
    Copyright (c) 1982, 2014, Oracle.  All rights reserved.
    Connected to an idle instance.

    SQL> startup
    ORACLE instance started.

    Total System Global Area 1493172224 bytes
    Fixed Size    2924592 bytes
    Variable Size  973082576 bytes
    Database Buffers  503316480 bytes
    Redo Buffers   13848576 bytes
    Database mounted.
    Database opened.

    you can also connect via web interface which was prompted earlier by Database configuration Assistant, in which you have EM Database Express URL

    If you need to reset the password for the account, below explained.

    SQL> passw system
    Changing password for system
    New password: 
    Retype new password: 
    Password changed

    Finally, Oracle 12c installation has been completed successfully on CentOS 6.6.