2012年4月30日 星期一

Oracle 10g R2 installtion on CentOS 5.5/RHEL

http://onaxer.com/blog/blog/2010/08/25/oracle-10g-r2-installtion-on-centos-5-5rhel/


August 25th, 2010 by Pawan Kumar Leave a reply »

The main required packages for installing oracle are (installing on 32 bit architecture)

binutils.i386
compat-gcc-7.3-2.96.128.i386
compat-gcc-c++-7.3-2.96.128.i386
compat-libstdc++-7.3-2.96.128.i386
compat-libstdc++-devel-7.3-2.96.128.i386
cpp.i386
gcc.i386
gcc-c++.i386
glibc.i386
glibc-common.i386
glibc-devel.i386
glibc-headers.i386
glibc-kernheaders.i386
libstdc++.i386
libstdc++-devel.i386
libaio
libai-devel.i386
pdksh.i386
setarch.i386
sysstat.i386

Download the Oracle 10gR2 from ,

http://www.oracle.com/technology/software/products/database/oracle10g/index.html

Preinstallation Steps:
1. Edit /etc/hosts file

2. Edit /etc/sysctl.conf
#kernel.shmall = 2097152
#kernel.shmmax = 2147483648
kernel.shmmni = 4096
# semaphores: semmsl, semmns, semopm, semmni
kernel.sem = 250 32000 100 128
#fs.file-max = 65536
net.ipv4.ip_local_port_range = 1024 65000
net.core.rmem_default=262144
net.core.rmem_max=262144
net.core.wmem_default=262144
net.core.wmem_max=262144

3. Run the following command to change the kernel parameters

/sbin/sysctl -p

4. Add the following security parameter
in /etc/security/limits.conf

oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536

5. Edit /etc/pam.d/login and add following line

session required pam_limits.so

6. SElinux and firewall should be turned off

check /etc/selinux/config

SELINUX=disabled

7. Creating following users and Groups

groupadd oinstall
groupadd dba
groupadd oper

useradd -g oinstall -G dba oracle
passwd oracle

8. Oracle will be installed in the following Directories

#mkdir -p /u01/app/oracle/product/10.2.0/db_1
#chown -R oracle.oinstall /u01

9. Login as Root user on the machine in GUI console and execute
#xhost +
This will enable other users to use X console

10. Take backup of the file /etc/redhat-release to /etc/redhat-release.original

and edit /etc/redhat-release
#echo “redhat-4″> /etc/redhat-release

11. Edit the /home/oracle/.bash_profile
add the following lines

# Oracle Settings
TMP=/tmp; export TMP
TMPDIR=$TMP; export TMPDIR

ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1; export ORACLE_HOME
ORACLE_SID=TSH1; export ORACLE_SID
ORACLE_TERM=xterm; export ORACLE_TERM
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:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib; export CLASSPATH

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

12. Log into the oracle user. If you are using X emulation then set the DISPLAY environmental variable:

DISPLAY=:0.0; export DISPLAY

13. Copy the file 10201_database_linux32.zip into oracle user home directory ,i.e, /home/oracle

and unzip the file.

14. Now the time to start installation

when u extact the file it will create a database directory.
$cd database
$./runInstaller
This will start Oracle Universal Installer

15 . In Oracle Universal Installer

a. Select Advanced Installation
b. Here Specify Inventory Directory and Credentials

Values are : /u01/app/oracle/oraInventory
and OS group name will be onistall

c. Select Installation Type
Enterprise Edition
d. Specify Home Details
Name; db_1
Path ; /u01/app/oracle/product/10.2.0/db_1

e. Product Specific Prerequisite checks

This should come passed ,otherwise select user varified

f. Select Configuration Options

Create Database

g. Select Database configuration

General Purpose

h. Specify Database configuration options
Global Database Name: TSH1
SID : TSH1

i. Select Database management options

use database control for database management

j. Specify Database Storage Option
File System
location /u01/app/oracle/oradata

k. Specify Backup and Recovery Options

Do not enable

l. Specify Database Schema Passwords

give a password which you must remember .

m. Summery and install
when the installation finishes it will show
Database Configuration Assistant
click ok
Now it will give you 2 scripts which must be run as root
#/u01/app/oracle/oraInventory/orainstRoot.sh
#/u01/app/oracle/product/10.2.0/db_1/root.sh

This is the end of installation part.

16. Post installation Steps

Just copy back
#cp /etc/redhat-release.original /etc/redhat-release

Edit the file /etc/oratab , In last change to Y

TSH1:/u01/app/oracle/product/10.2.0/db_1:Y

17. Autostart and Stop Script , login as root and create a script

This script is required to automatically start/stop  Oracle database

#vim /etc/init.d/dbora

ORA_HOME=/u01/app/oracle/product/10.2.0/db_1
ORA_OWNER=oracle

if [ ! -f $ORA_HOME/bin/dbstart ]
then
    echo "Oracle startup: cannot start"
    exit
fi

case "$1" in
    'start')
        # Start the Oracle databases:
        # The following command assumes that the oracle login
        # will not prompt the user for any values
        su - $ORA_OWNER -c "$ORA_HOME/bin/dbstart $ORA_HOME"
        ;;
    'stop')
        # Stop the Oracle databases:
        # The following command assumes that the oracle login
        # will not prompt the user for any values
        su - $ORA_OWNER -c "$ORA_HOME/bin/dbshut $ORA_HOME"
        ;;
esac

---------------------------------
#chmod 750 /etc/init.d/dbora

#chkconfig --level 345 dbora on

Now we have created the script which will start/stop with Operating system
#/etc/init.d/dbora stop

#/etc/init.d/dbora start

Note : you may get the listener waring message while starting oracle db

Failed to auto-start Oracle Net Listener using /ade/vikrkuma_new/oracle/bin/tnslsnr
To Resolve the issue ,login as oracle user and  change the file $ORACLE_HOME/bin/dbstart

Nearly 78 line

ORACLE_HOME_LISTNER=/ade/vikrkuma_new/oracle

Change to

ORACLE_HOME_LISTNER=$ORACLE_HOME

18. As oracle user Login in shell

$sqlplus
usename : SYSTEM
password : givenbyyou

Some of the Reference taken from
1. http://dearlinux.wordpress.com/2010/07/01/installing-oracle-database-10g-release-2-on-linux-rhel-5-part-2/
2. http://www.oracle-base.com/articles/10g/OracleDB10gR2InstallationOnRHEL5.php
3. http://ivan.kartik.sk/oracle/install_ora10gR2_redhat.html