Wednesday, March 25, 2015

How to Install Oracle Database 11g on Linux

Oracle Database Software Installer Download

Oracle Database Software can be download either of the below Link
http://www.oracle.com/technetwork/database/enterprise-edition/downloads/index.html?ssSourceSiteId=ocomen
https://edelivery.oracle.com/
Software Update or Patch can be download from below location
https://support.oracle.com
Note : Registered User required to download Oracle software or any update like 11.2.0.3 version.

  1. http://docs.oracle.com/cd/E11882_01/install.112/e24326.pdf
  2. http://oracle-base.com/articles/11g/oracle-db-11gr2-installation-on-oracle-linux-6.php

Environment Details

1. Operating System Version : Oracle Linux 6.4 (64 Bit)
2. Database Version : Oracle Database 11.2.0.3 (64 Bit)
3. RAM : 8 GB
4. HDD : 100 GB.

Configuration Details

1. IP Address : 192.168.0.15
2. Hostname : oracledb2.spectrum-bd.com
3. Oracle SID : orcl
4. Oracle Base : /home/u01/app/oracle
5. Oracle Home : /home/u01/app/oracle/product/11.2.0/db_1
6. Software Installer Location : /home/software 

Required Tools

1. Putty : For connecting to server using remote terminal
2. File Zilla: For transfer any file from local machine to server.
3. VNC viewer: For GUI access from local machine.

Required Tools Installation and Database Software Upload

  1. Install all necessary tools.
  2. Connect to the server as a root user by using putty.
  3. Create a directory which named ‘software’ in home location.
  4. Transfer oracle 11gR2 to software from local machine to server by using filezilla.

Database Installation Prerequisites

Step :01

Perform either the Automatic Setup or the Manual Setup to complete the basic prerequisites. The Additional Setup is required for all installations.
Automatic Setup
If you plan to use the "oracle-rdbms-server-11gR2-preinstall" package to perform all your prerequisite setup, follow the instructions at http://public-yum.oracle.com to setup the yum repository for OL, then perform the following command.
yum install oracle-rdbms-server-11gR2-preinstall
All necessary prerequisites will be performed automatically. It is probably worth doing a full update as well, but this is not strictly speaking necessary.
yum update
Manual Setup
Using any text editor, create or edit the /etc/sysctl.conf file
[root@oracledb2~]# vi  /etc/sysctl.conf
And add or edit lines similar to the following
kernel.shmall = 429496726
fs.suid_dumpable = 1
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 4294967296
kernel.shmmni = 4096
# semaphores: semmsl, semmns, semopm, semmni
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 = 1048586
:x (save and exit)
Note:
  1. Change the value of parameter if less then the above below.
  2. 'kernel.shmmax' Parameter Value should be half size of the RAM.
  3. The current values can be tested using the following command.
    [root@oracledb2 ~]# /sbin/sysctl -a | grep <param-name>
    
Enter the following command to change the current values of the kernel parameters:
[root@oracledb2 ~]#  /sbin/sysctl  -p

Step: 02

Add the following lines to the "/etc/security/limits.conf" file.
[root@oracledb2 ~]#  vi   /etc/security/limits.conf
    oracle                  soft           nproc          16384
    oracle                  hard           nproc          16384
    oracle                  soft           nofile          4096
    oracle                  hard           nofile         65536
    oracle                  soft           stack          10240
:x(save and exit)

Step: 03

Amend the "/etc/security/limits.d/90-nproc.conf" file as described below.
[root@oracledb2~]# vi   /etc/security/limits.d/90-nproc.conf
# Change this
* soft    nproc    1024
# To this
* - nproc 16384
:x(save and exit)

Step: 04

Change the setting SELINUX to disabled by editing the "/etc/selinux/config" file, making sure the SELINUX flag is set as follows.
[root@oracledb2~]# vi   /etc/selinux/config
SELINUX=disabled
:x(save and exit)

Step: 05

If you have the Linux firewall enabled, you will need to disable or configure it. The following is an example of disabling the firewall.
[root@oracledb2~]# etc/init.d/iptables stop
[root@oracledb2~]# chkconfig iptables off

Step: 06

Package Requirements
The following list of packages required for Installed for Oracle Database 11g Release 2. We can do it by two ways.
  1. Install required packages from YUM server (If yum server already configured)
  2. Install required packages manually 
Use below command to install required package from Yum Server,
yum install binutils-2*x86_64*
yum install glibc-2*x86_64* nss-softokn-freebl-3*x86_64*
yum install glibc-2*i686* nss-softokn-freebl-3*i686*
yum install compat-libstdc++-33*x86_64*
yum install glibc-common-2*x86_64*
yum install glibc-devel-2*x86_64*
yum install glibc-devel-2*i686*
yum install glibc-headers-2*x86_64*
yum install elfutils-libelf-0*x86_64*
yum install elfutils-libelf-devel-0*x86_64*
yum install gcc-4*x86_64*
yum install gcc-c++-4*x86_64*
yum install ksh-*x86_64*
yum install libaio-0*x86_64*
yum install libaio-devel-0*x86_64*
yum install libaio-0*i686*
yum install libaio-devel-0*i686*
yum install libgcc-4*x86_64*
yum install libgcc-4*i686*
yum install libstdc++-4*x86_64*
yum install libstdc++-4*i686*
yum install libstdc++-devel-4*x86_64*
yum install make-3.81*x86_64*
yum install numactl-devel-2*x86_64*
yum install sysstat-9*x86_64*
yum install compat-libstdc++-33*i686*
yum install compat-libcap*
yum install unixODBC*
yum install unixODBC-devel*
To determine whether the required packages are installed, enter commands similar to the following:
rpm -q package_name
To install required packages manually, mount the DVD and go to the location where all the package kept, after that enter commands similar to the following:
rpm -ivh package_name
For Mounting Linux Installation DVD use the below command,
mount -t iso9660 /dev/dvd /mnt
In these examples, '/mnt' is the mount point directories for the disc drive.

Step: 07

Enter the following commands to create the oinstall, dba groups and Oracle User
[root@oracledb2~]#
groupadd -g 1000 oinstall
groupadd -g 1200 dba
useradd -u 1100 -g oinstall -G dba oracle
Enter the following command to set the password of the oracle user
passwd oracle
Above Command will prompt you to give password. Enter Password twice to register it
New password: 
Retype new password:

passwd: all authentication tokens updated successfully

Step : 8

Create the directories in which the Oracle software will be installed.
mkdir  -p  /home/u01/app/oracle/product/11.2.0/db_1
set the appropriate owner, group, and permissions
chown -R oracle:oinstall /home/u01
chmod -R 775 /home/u01

Step: 9

Login as the oracle user and add the following lines at the end of the ".bash_profile" file.
[oracle@oracledb2~]# vi  /home/oracle/.bash_profile
# Oracle Settings
TMP=/tmp; export TMP
TMPDIR=$TMP; export TMPDIR
ORACLE_HOSTNAME= oracledb2.spectrum-bd.com; export ORACLE_HOSTNAME
ORACLE_UNQNAME=orcl; export ORACLE_UNQNAME
ORACLE_BASE=/home/u01/app/oracle; export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1; export ORACLE_HOME
ORACLE_SID=orcl; export ORACLE_SID
TNS_ADMIN=$ORACLE_HOME/network/admin; export TNS_ADMIN
PATH=/usr/sbin:$PATH; export PATH
PATH=$ORACLE_HOME/bin:$PATH; export PATH
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib; export LD_LIBRARY_PATH
CLASSPATH=$ORACLE_HOME/JRE
CLASSPATH=${CLASSPATH}:$ORACLE_HOME/jlib
CLASSPATH=${CLASSPATH}:$ORACLE_HOME/rdbms/jlib
CLASSPATH=${CLASSPATH}:$ORACLE_HOME/oc4j/ant/lib/ant.jar
CLASSPATH=${CLASSPATH}:$ORACLE_HOME/oc4j/ant/lib/ant-launcher.jar
CLASSPATH=${CLASSPATH}:$JAVA_HOME/db/lib/derby.jar
CLASSPATH=${CLASSPATH}:$ORACLE_HOME/network/jlib
export CLASSPATH
:x(save and exit)
Note : To execute bash_profile
 . .bash_profile

Step:10

The "/etc/hosts" file must contain a fully qualified name for the server.
Format :<IP-address> <fully-qualified-machine-name> <machine-name>
[root@oracledb2~]# vi   /etc/hosts
For example.
127.0.0.1          localhost.localdomain           localhost
192.168.0.15       oracledb2.spectrum-bd.com       oracledb2

Step: 11

Connect to server by using vnc viewer and open a new terminal
Now to enable X applications, run the following command as root user
[root@oracledb2~]# xhost  +

Step : 12

Unzip Oracle Installer which we uploaded earlier.
[root@oracledb2~]# cd   /home/software/
[root@oracledb2 software]#  unzip p10404530_112030_Linux-x86-64_1of7.zip 
[root@oracledb2 software]#  unzip p10404530_112030_Linux-x86-64_2of7.zip
You should now have a single directory called "database" containing installation file

Step :13

Start the Oracle Universal Installer (OUI) by issuing the following command in the database directory. Start Installation
[root@oracledb2 software]# su - oracle
[oracle@oracledb2 software]$ cd
[oracle@oracledb2 ~]$ cd /home/software/database/
[oracle@oracledb2 database]$ ./runInstaller 

Starting Installation with GUI wizard

After executing runinstaller command, it will show below lines:
Checking Temp space: must be greater than 120 MB.   Actual 40875 MB    Passed
Checking swap space: must be greater than 150 MB.   Actual 7903 MB    Passed
Checking monitor: must be configured to display at least 256 colors  passed   
'''Some requirement checks failed. You must fulfill these requirements before
continuing with the installation.'''
Continue? (y/n) [n]
Write:''' y'''

You can see the screen of each stage of installation

1.Configure Security Updates: We can unchecked if we won't receive security updates via my oracle support.source:Shelf/Wiki/OracleDB/images/01.ConfigureSecurityUpdates.png
2.Warning Message: This warning message show when if you unchecked for receive security updates.Click the 'Yes' button to skip this stage.
source:Shelf/Wiki/OracleDB/images/02.WarningMassageForCriticalSecuityIssu.PNG3.Download Software Updates: Generally we select in this stage Skip software updates.
source:Shelf/Wiki/OracleDB/images/03.DownloadSoftwarUpdates.PNG
4.Select Install Option: We can select Create and configure a database option for full installation with database configuration. Or We can select install database software only, which needed to configuration database later.
source:Shelf/Wiki/OracleDB/images/04.InstallationOption.PNG
5.System Class: In this stage, we generally choose Desktop class for general use, Or Choose Server class for Production purpose.
source:Shelf/Wiki/OracleDB/images/05.SystemClass.PNG
6.Typical Install Configuration: In this stage we have to provide, Proper 'Oracle Base', 'Oracle Home' as 'Software Location' which we configure before in bash_profile. Also need to provide Administrative password.
source:Shelf/Wiki/OracleDB/images/06.TypicalInstallationConfiguaration.PNG
7.Password Confirmation: In this stage, if you use a password that didn't fulfill oracle recommended standard password, then you will see below warning message. But you can click 'Yes' and continue with the installation.
source:Shelf/Wiki/OracleDB/images/07.PasswordConfirmation.PNG8.Summary: In this stage review the information and click on 'install' to start Installation.
source:Shelf/Wiki/OracleDB/images/08.Summary.PNG
9.Install Product: In this stage we can see the installation progress.....
source:Shelf/Wiki/OracleDB/images/09.InstallatonProduct.PNG
10.Database Configuar Assistant: In this stage oracle automatically configure and create the database.
source:Shelf/Wiki/OracleDB/images/10.DatabaseConfiguarAssistant.PNG
11.Password Management: In this stage, we can unlock and provide password for some user by clicking password management button. But this step is optional. We can just keep the record Global Database Name, SID, Database Control URL(EM) and click 'OK' to continue.
source:Shelf/Wiki/OracleDB/images/11.PasswordManagement.PNG
12.Execute Configuration Scripts: In this stage, we need to execute 'root.sh' script as a root user.
source:Shelf/Wiki/OracleDB/images/12.ExecuteConfigurationScripts.PNG
Open a new terminal as root user and follow the steps,
[root@oracledb02 ~]# cd /home/u01/app/oracle/product/11.2.0/db_1/
[root@oracledb02 db_1]# ./root.sh
It will display the below message and prompt for pathname, We need to just press 'Enter' to continue,
Running Oracle 11g root.sh script...

The following environment variables are set as:
    ORACLE_OWNER= oracle
    ORACLE_HOME=  /home/u01/app/oracle/product/11.2.0/dbhome_1

Enter the full pathname of the local bin directory: [/usr/local/bin]:
After successful execution it will display the below message,
Copying dbhome to /usr/local/bin ...
   Copying oraenv to /usr/local/bin ...
   Copying coraenv to /usr/local/bin ...

Creating /etc/oratab file...
Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root.sh script.
Now product-specific root actions will be performed.

Finished product-specific root actions.
13.Finish: In this stage, installer will show Enterprise Manager Login URL, click 'close' to finish the Installation.
source:Shelf/Wiki/OracleDB/images/13.Finish.PNG

Connecting to Oracle Database from SQL*Plus

Login as Oracle user
[root@oracledb02 ~]# su - oracle
Check the Listener Status
[oracle@oracledb02 ~]$ lsnrctl  status
Use the below command to UP the Listener if Listener found Down,
[oracle@oracledb02 ~]$ lsnrctl  start
Use the below command to connect with the database as 'sys' user
[root@oracledb02 ~]# sqlplus sys/sys_password@orcl as sysdba
After successful connection it will display the below message,
SQL*Plus: Release 11.2.0.3.0 Production on Sun Dec 21 21:05:46 2014

Copyright (c) 1982, 2011, Oracle.  All rights reserved.

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL>

Login to Enterprise Manager

Check the Enterprise Manager Status
[oracle@oracledb02 ~]$ emctl status dbconsole
If Enterprise Manager running properly then it will display the below message
Copyright (c) 1996, 2011 Oracle Corporation.  All rights reserved.
https://oracledb02.spectrum-bd.com:1158/em/console/aboutApplication
Oracle Enterprise Manager 11g is running.
------------------------------------------------------------------
Logs are generated in directory /home/u01/app/oracle/product/11.2.0/db_1/oracledb02.spectrum-bd.com_orcl2/sysman/log
Start the Enterprise Manager using below command if its not running,
[oracle@oracledb02 ~]$ emctl start dbconsole
Check the Enterprise Manager Login from Browser
https://oracledb02.spectrum-bd.com:1158/em/console/aboutApplication

At this Point we can Say Oracle Database Installation Completed Successfully.

No comments:

Post a Comment