Thursday, August 12, 2010

How To Install Oracle On RHEL5

The most popular database(DB) software known to man is Oracle. There are some other commercial and open source Databases such as1. MS-Sql(from Microsoft)
2. DB2(from IBM)
3. PostgreSQL(its a open source SW) 
4. Mysql(my favorate one and good for small/medium organisations)
5. Sybase
Etc.. 



Do you want to know more about other DB names? Have look at below link, i create a squered link for you.Ans : http://www.google.com/squared/search?q=mssql&items=mysql&items=oracle&items=PostgreSQL&items=db2&items=njsql
In this post we will come to know that how to install Oracle on RHEL5?
Step1 : Before installing Oracle it require following packages to be installed on the machine.
1. compat-gcc
2. compat-libstdc++
3. compat-db
4. make-3.79
5. binutils-2.11.90.0.8-12
6. gcc-3.2
7. openmotif-2.2
8. setarch-1.3

All these packages are there in RHEL5 DVD so you just implement YUM server for easy installation of the above packages, other wise you have to install one by one with rpm command which will create a lot of dependencies.

Step2 : Set kernel parameters by editing /etc/sysctl.conf or using sysctl -w command. As follows.

Note : When ever you edit any files take backup of that files before editing those files.
kernel.shmall = 268435456
kernel.sem = 250 32000 100 128
kernel.shmmax = 2147483647

kernel.shmmni = 4096
kernel.shmall = 2097152
fs.file-max = 65536

net.ipv4.ip_local_port_range = 1024 65000
kernel.sem=250 32000 100 128
net.core.rmem_default = 4194304

net.core.rmem_max= 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 262144
#cp /etc/sysctl.conf /etc/sysctl.conf.org
#vi /etc/sysctl.conf

After entering the above values save and exit the file
or use sysctl -w to edit kernel paramaters.
Here I will just give one example how to edit sysctl.conf using sysctl -w command.

Suppose I want to edit kernel.sem value just execute below command.
#/sbin/sysctl -w kernel.sem=”250 32000 100 128”

Step3 :
 After editing the file check if any issue is there or not by printing the sysctl content.
#sysctl -p
Note1 : Most part of the installation is done by oracle user. Untill and unless specified. Only at the end of installation we require to run two scripts which will 
set path variables.

Note2 : If you are installing Oracle on remote machine we have to export the display to local machine or we have to take vnc to the remote machine.

Step4 : Create Group name
#groupadd dba
Step5 : Creat oracle user with group equal to dba and home directory equal to 
/oracle
#useradd -d /oracle -g dba oracle



Installation :Step1 : Copy Oracle software to some folder. Change the directory to bin directory as showen below.cd /test/database
Here you will find run Installer script which you should execute in oracle user and this should be done in GUIit self(so in order to execute this command you have to export display or take vnc to remote machine). Here in this document I have taken vnc connection to remote machine where I am installing OS. For those who don't have vnc export display as follows.

Step2 : Exporting display, you have to execute this command as oracle user on remote machine where you are going to install oracle. And one more thing. Display should be exported to local machine where you are going to preform your installation.
DISPLAY = system name/ip: 0.0
Export DISPLAY

Note : System name/ip in the above display command is the ip/system name of your local machine.
Image.

















































































































































































The above screen shot shows that you have to run the script. And this should be run only by root.
Step3 : Script to be run by root user.
[root@test oracle]# /oracle/oracle/product/10.2.0/db_1/root.shRunning Oracle10 root.sh script...
The following environment variables are set as :ORACLE_OWNER= oracle

ORACLE_HOME= /oracle/oracle/product/10.2.0/db_1

Enter the full pathname of the local bin directory : [/usr/local/bin]:
Copying dbhome to /usr/local/bin ...

Copying oraenv to /usr/local/bin ...

Copying coraenv to /usr/local/bin ...

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.

Once run this as root go to oracle user gui login and say ok.. to exit..











































Step4 : Now we have to check whether oracle is installed perfectly or not. We have to set ORACLE_HOME variable for oracle user .bash_profile file to export oracle bin directory as follows. So that we can start/stop oracle service with lsnrctl edit .bashrc file for the oracle user.$vi ~/.bash_profile

PATH=$PATH:$HOME/bin

export PATH
ORACLE_HOME=/oracle/oracle/product/10.2.0/db_1

PATH=$PATH:$ORACLE_HOME/bin

ORACLE_SID=orcl

export PATH ORACLE_HOME ORACLE_SID
Save and exit the file. Once done we have to source the .bash_profile file. Then start the oracle service by using below command.
[oracle@v-itig42 ~]$ lsnrctl start
LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 05-MAR-2010 07:12:13

Copyright (c) 1991, 2005, Oracle. All rights reserved.

TNS-01106: Listener using listener name LISTENER has already been started
For checking status.[oracle@v-itig42 ~]$ lsnrctl status

LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 05-MAR-2010 07:12:01

Copyright (c) 1991, 2005, Oracle. All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC3)))

STATUS of the LISTENER

------------------------

Alias LISTENER

Version TNSLSNR for Linux: Version 10.2.0.1.0 - Production

Start Date 05-MAR-2010 06:10:20

Uptime 0 days 1 hr. 1 min. 41 sec

Trace Level off

Security ON: Local OS Authentication

SNMP OFF

Listener Parameter File /oracle/oracle/product/10.2.0/db_1/network/admin/listener.ora

Listener Log
File /oracle/oracle/product/10.2.0/db_1/network/log/listener.log

Listening Endpoints Summary...

(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC3)))

(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=v-itig42.persistent.co.in)(PORT=1523)))

Services Summary :
Service "PLSExtProc" has 1 instance(s).

Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
Service "orcl" has 1 instance(s).

Instance "orcl", status READY, has 1 handler(s) for this service...

Service "orclXDB" has 1 instance(s).

Instance "orcl", status READY, has 1 handler(s) for this service...

Service "orcl_XPT" has 1 instance(s).

Instance "orcl", status READY, has 1 handler(s) for this service...

The command completed successfully

Step5 : Connect to Oracle sql database(and this should be done only as oracle user).
[oracle@v-itig42 ~]$ sqlplus /nolog
SQL*Plus: Release 10.2.0.1.0 - Production on Fri Mar 5 07:22:56 2010

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

SQL>

This sql> prompt indicates you have sucessfully connected..

SQL> conn sys@iasdb as sysdba
Enter password :Connected to an idle instance.SQL>If the database is not started it will show the messages as connected to idle instance.
4. To start the database executeSQL> startup
ORACLE instance started.
Total System Global Area 289406976 bytes
Fixed Size 1301536 bytes
Variable Size 262677472 bytes
Database Buffers 25165824 bytes
Redo Buffers 262144 bytes
Database mounted.
Database opened.
SQL>
5. To check the name of the databaseSQL> select name from v_$database;

NAME
---------
IASDB