Tuesday, April 23, 2013

How to Install Oracle 11 g on Linux

In order to use Oracle Database, first of all we need to setup Oracle Software. Installation of Oracle Database on Windows is very easy. By running setup.exe from installation CD of Oracle for Windows, we can invoke a setup and by clicking NEXT buttons we can install Oracle Software and Database without any problem. We don’t need any prerequisite actions before installation. But in Linux it’s different. If we want to install Oracle Database on Linux OS, we should follow some prerequisite actions.
Today, we’re going to install Oracle Database on CentOS and mostly used release of Oracle Database – “Oracle Database 11g Release 2”.

Checking minimum hardware requirements 


At least, your system should meet the following requirements:
-           1GB RAM
-           Requirement for swap space in Oracle installation is as follows:
                Available RAM                                      Swap Space Required
                Between 1 GB and 2 GB        1.5 times the size of RAM
                Between 2 GB and 8 GB       Equal to the size of RAM
                More than 8 GB                     .75 times the size of RAM
-           400MB free space in /tmp directory
-           Depending on type of the installation, 1.5-3.5 GB free space for Oracle Software
-           1.5GB free space if new Oracle Database is created

Getting familiar with requirements mentioned above, we need to get hardware information of our system. To check the size of RAM, Swap space and tmp directory, we run these commands:

-           To check the size of physical memory, execute      
                    grep MemTotal     /proc/meminfo
-           To check the size of swap space, execute  
                    grep SwapTotal     /proc/meminfo
-           To check the space in  /tmp directory, execute
                    df –h /tmp






Changes to be made to Kernel parameters 


 If you have not used the "oracle-validated" package to perform all prerequisites. You will need to manually perform the following setup tasks :
 
Oracle recommend the following minimum parameter settings :

shmmax
2147483648
shmmni
4096
shmall
2097152
shmmin
1
semmsl
250
semmns
32000
semopm
100
semmni
128
file-max
65536
ip_local_port_range
1024   65000
rmem_default
1048576
rmem_max
1048576
wmem_default
262144
wmem_max
262144

We do all these changes in the /etc/sysctl.conf file by adding these lines to that file:
kernel.shmmax = 2147483648
kernel.shmall = 2097152
kernel.shmmni=4096
kernel.sem=250 32000 100 128
fs.file-max=65536
net.ipv4.ip_local_port_range=1024 65000
net.core.rmem_default=1048576
net.core.rmem_max=1048576
net.core.wmem_default=262144
net.core.wmem_max=262144

After appending those lines we save that file and run the following command to 
make these changes effective immediately in the running system

/sbin/sysctl –p

Setting Shell limits for the Oracle User 


To improve the performance of the software on Linux systems, you must increase the 
following shell limits for the oracle user:

1. Add the following lines to /etc/security/limits.conf file
oracle              soft    nproc   2047
oracle              hard    nproc   16384
oracle              soft    nofile  1024
oracle              hard    nofile  65536

2. Add the following lines to /etc/pam.d/login file
session    required     /lib/security/pam_limits.so
session    required     pam_limits.so

3. In order to use Oracle Software, we need to make a change in “oracle” user’s 
 buffer size and number of opened file descriptors. In order to do it, we add below lines 
to /etc/profile file

if [ $USER = "oracle" ]; then
        if [ $SHELL = "/bin/ksh" ]; then
              ulimit -p 16384
              ulimit -n 65536
        else
              ulimit -u 16384 -n 65536
        fi
fi

Installing Oracle Database 11g Release 2 

 Download Oracle Software

OTN : Oracle Database 11g Release 2 (11.2.0.1) Software (64 -bit) 
 # 11.2.0.1
unzip linux.x64_11gR2_database_1of2.zip
unzip linux.x64_11gR2_database_2of2.zip

You should now have a single directory called "database" containing installation files.
 
Hosts File
The "/etc/hosts" file must contain a fully qualified name for the server.
<IP-address>  <fully-qualified-machine-name>  <machine-name>
For example.
127.0.0.1       localhost.localdomain  localhost
10.10.9.3       pankaj-oraserver    ol5-11gr2
$uname –n  -- > to check machine name
$dnsdomainname -- > to check the localdomain

Install the following packages if they are not already present.
binutils-2.*
compat-libstdc++-33*
compat-libstdc++-33*.i386.rpm
elfutils-libelf*
gcc-4.*
gcc-c++-4.*
glibc-2.*
glibc-common-2.*
glibc-devel-2.*
glibc-headers-2.*
ksh*
libaio-0.*
libaio-devel-0.*
libgomp-4.*
libgcc-4.*
libstdc++-4.*
libstdc++-devel-4.*
make-3.*
sysstat-7.*
unixODBC-2.*
unixODBC-devel-2.*
numactl-devel-*

Install all the packages required for oracle. We need to install the mentioned rpm manually.

To check whether the package is installed or not

rpm -qa | grep -i compact*

If the package is not installed, install it with command

rpm -ivh compat-db-4.2.52-5.1.i386.rpm

Create groups and user for Oracle Installation

In this step, we create “oinstall” and “dba” groups and “oracle” user to install Oracle Software, and

groupadd  oinstall

groupadd  dba

groupadd oper

groupadd admadmin

Add oracle user and assign oinstall as primary group and others as secondary

useradd -m -g oinstall -G dba,oper,asmadmin,oracle
passwd oracle

 AdditionalSetup
The following setup tasks must be performed regardless of which setup method you used previously.
Disable secure linux by editing the "/etc/selinux/config" file, making sure the SELINUX flag  is set as follows.
SELINUX=disabled
Alternatively, this alteration can be done using the GUI tool (Applications > System Settings  > Security Level). Click on the SELinux tab and disable the feature. If SELinux is disabled after installation, the server will need a reboot for the change to take effect.
Create the directories in which the Oracle software will be installed.
mkdir -p /opt/oracle/product/11.2.0/db_1
chown -R oracle:oinstall opt/
chmod -R 775 opt/
Note:
/opt = ORACLE_BASE
opt/oracle/product/11.2.0/db_1 =  ORACLE_HOME
Login as root and issue the following command.
xhost +<machine-name>
$uname –n -- > to check the machnine name
Login as the oracle user and add the following lines at the end of the ".bash_profile" file,
remembering to adjust them for your specific installation.
# Oracle Settings

PATH=$PATH:$HOME/bin

export PATH

TMP=/tmp; export TMP
TMPDIR=$TMP; export TMPDIR

ORACLE_HOSTNAME=pankaj_oraserver; export ORACLE_HOSTNAME
ORACLE_UNQNAME_DB11G; export ORACLE_UNQNAME
ORACLE_BASE=/oracle; export ORACLE_BASE
#ORACLE_HOME=@ORACLE_BASE/product/11.2.0/db_1;
 export ORACLE_HOME
ORACLE_HOME=/oracle/product/11.2.0/db_1/; export ORACLE_HOME
ORACLE_SID=calypsotest; export ORACLE_SID
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/jlib:@ORACLE_HOME/rdbms/jlib;
 export CLASSPATH

./bash_profile -- To restart  bash Installation

Log into the oracle user. If you are using X emulation then set the DISPLAY environmental
 variable.
DISPLAY=<machine-name>:0.0; export DISPLAY


Start the Oracle Universal Installer (OUI) by issuing the following command in the database
 directory.
[oracle@pankaj-oraserver database]$ cd /home/oracle/database/
[oracle@pankaj-oraserver database]$ ls -lh
total 40K
drwxr-xr-x 12 root root 4.0K Apr 11 20:12 doc
drwxr-xr-x  4 root root 4.0K Apr 11 20:12 install
drwxr-xr-x  2 root root 4.0K Apr 11 20:12 response
drwxr-xr-x  2 root root 4.0K Apr 11 20:12 rpm
-rwxr-xr-x  1 root root 4.3K Apr 11 20:12 runInstaller
drwxr-xr-x  2 root root 4.0K Apr 11 20:12 sshsetup
drwxr-xr-x 14 root root 4.0K Apr 11 20:14 stage
-rw-r--r--  1 root root 5.3K Apr 11 20:14 welcome.html


sh -x runInstaller

Note : If it prompted for any package installtion, please install those packages first.



Installation of Oracle Database 10g completed successfully! Congratulations!

Now reboot your server and login as oracle user and start newly created database. 

[oracle@pankaj-oraserver ~]$ cd /oracle/product/11.2.0/db_1/
[oracle@pankaj-oraserver db_1]$ cd bin
[oracle@pankaj-oraserver bin]$ sh -x dbca
 





 Database is created successfully now.

Post Installation

Edit the "/etc/oratab" file setting the restart flag for each instance to "Y"

calypsotest:/oracle/product/11.2.0/db_1:Y (To make your database up when your system boots)


Issues I face after Installation and configuration of database



[oracle@pankaj-oraserver bin]$ sqlplus

SQL*Plus: Release 11.2.0.1.0 Production on Tue Apr 23 15:24:19 2013

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

Enter user-name: system
Enter password:
ERROR:
ORA-01034: ORACLE not available
ORA-27101: shared memory realm does not exist
Linux Error: 2: No such file or directory
Process ID: 0
Session ID: 0 Serial number: 0

Fix :


1-export ORACLE_SID=Your database SID My Sid is calypsotest
2-export ORACLE_HOME=YOUR ORACLE HOME for example 
/oracle/product/11.2.0/db_1/
3-export PATH=PATH:$ORACLE_HOME/bin
4-connect to sqlplus like the following:
sqlplus / as sysdba
5-after connecting to sqlplus type:
startup
 







 











 



2 comments:

  1. نقدم لكم افضل خدمة تنظيف بجدة لاننا متواجدون ايضا في جدة فنحن افضل شركة تنظيف بجدة افضل شركة تنظيف بجده شركة نظافه في جدة افضل شركة نقل اثاث خارج الرياض
    افضل شركة نقل عفش خارج الرياض
    شاهد تلك الصورة
    شركة تنظيف منازل ان خدمة التنظيف خدمة تقدمها شركة الطيب لانها تعلم بانها قادرة علي تسجيل افضل النتائج فيها افضل شركة رش مبيدات شمال الرياض نقوم برش المبيدات الحشرية التي تقوم بالقضاء علي الحشرات المنزلية بجدارة
    شركة رش مبيدات حشرية شمال الرياض
    شركة الطيب تقوم بتنظيف المسابح جيدا بالاضافة الي عملية الصيانة التي تجريها علي المسابح بافضل الاجهزة التي تقوم بمعالجة اي خراب في المسابحصيانة مسابح بالرياض ان صيانة المسابح مهمة للغاية حيث ان شركة الطيب تقوم بعمل فحص كامل للمسابح و تقوم بكشف تسربات المياه الذي من الممكن ان نجده بجانب المسابحشركة صيانة مسابح بالرياض قم بزيارة الرابط السابقشركة الطيب للخدمات المنزلية
    <a href="http://kenanaonline

    ReplyDelete
  2. شركة الطيب
    شكرا لكم
    كما اننا نقدم لكم كافة خدمات العزل حيث اننا افضل شركة عزل اسطح بالرياض نقوم بعزل الاسطح بافضل مواد العزل فنحن نقوم بعزل اسطح المنازل في الاعلي كما اننا نقوم بعزل الحمامات و المطابخ فنحن افضل شركة عزل خزانات بالرياض نقوم بعزل ارضيات الخزانات للمحافظة عليها لكي لا يتم تسريب اي مياه فنحن نمتلك افضل ادوات عزل الاسطح عزيزي العميل لا تقلق بشأن خدمات العزل فنحن نوفر لكم شركة عزل حراري بالرياض نقوم بعزل الاسطح بعزل مضاد للحرارة للحفاظ علي درجة حرارة المنزل من الداخل فاذا كنت تحتاج الي العزل الحراري فيجب ان تتصل علي شركة الطيب نحن شركة الطيب افضل شركة عزل صوتي بالرياض نقوم بعمل مادة للعزل لكي نقوم بكتم الصوت و لمنعة للتسريب كما اننا شركة الطيب افضل شركة عزل مسابح بالرياض اتصل الان علي شركة الطيب افضل شركة عزل بالرياض يمكنك زيارة

    ReplyDelete