Install Oracle Database 10g in Redhat Enterprise Linux 5

Install Oracle Database 10g in Redhat Linux.

Red Hat Linux is extremely useful for installing Oracle. If you Install Oracle Database 10g in Redhat Linux. You do not have to worry from virus affect. Linux is robust and unbreakable. That's why I prefer to Install Oracle Database in Linux. 

To install Oracle in Linux:

When installation create partition named /data

;copy the Server folder from media to /data/Server
;copy the database folder to /data/database


Network Installation:

setup
-- enter ip.
service NetworkManager start
chkconfig NetworkManager on

vi /etc/sysconfig/network-scripts/ifcfg-eth0
vi /etc/sysconfig/network
vi /etc/hosts

service NetworkManager stop
service NetworkManager off

vi /etc/resolv.conf
service network restart
chkconfig network on

hostname
ping 

Repository Installation:

# cd /etc/yum.repos.d/

; change the location of files.
 name=padma
 baseurl=files:///data/Server
 enabled=1
 gpgcheck=1
 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

yum install all

  yum install binutils-2.17.50.0.6*
  yum install compat-libstdc++-33-3.2.3*
  yum install elfutils-libelf-0.125*
  yum install elfutils-libelf-devel-0.125*
  yum install elfutils-libelf-devel-static-0.125*
  yum install gcc-4.1.2*
  yum install gcc-c++-4.1.2*
  yum install glibc-2.5-24*
  yum install glibc-common-2.5*
  yum install glibc-devel-2.5*
  yum install glibc-headers-2.5*
  yum install kernel-headers-2.6.18*
  yum install ksh-20060214*
  yum install libaio-0.3.106*
  yum install libaio-devel-0.3.106*
  yum install libgcc-4.1.2*
  yum install libgomp-4.1.2*
  yum install libstdc++-4.1.2*
  yum install libstdc++-devel-4.1.2*
  yum install make-3.81*
  yum install numactl-devel-0.9.8.i386*
  yum install sysstat-7.0.2*
  yum install unixODBC-2.2.11*
  yum install unixODBC-devel-2.2.11*
  yum install libXp-1.0.0-8.i386.rpm*
  yum install java*

Add the following Lines :

Add the following the lines in the file /etc/sysctl.conf

# vi /etc/sysctl.conf

#kernel.semopm=100
kernel.shmmni = 4096 
kernel.sem = 256 32000 150 142
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

# sysctl -p

;Create two group is oinstall and dba, user is oracle 

# groupadd oinstall
# groupadd dba
# useradd -g oinstall -G dba oracle
# passwd oracle

Create directories for Oracle Base and change the ownership

# mkdir -p /u01/app/oracle
# chown -R oracle:dba /u01/app/oracle 
# chmod -R 777 /u01/app/oracle

# chown -R oracle:dba /data
# chmod -R 777 /data

Add the following lines to the limits.conf

# vi /etc/security/limits.conf 

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

;Add the following line in /etc/pam.d/login
 vi /etc/pam.d/login

session required pam_limits.so

# vi /home/oracle/.bash_profile

export ORACLE_BASE=/u01/app/oracle;
export ORACLE_HOME=$ORACLE_BASE/product/10.2.0.1.0/db_1;
export ORACLE_SID=padma
export PATH=$ORACLE_HOME/bin:$PATH;
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib;


# vi /etc/redhat-release
  change 5.3 to 4

; Now logout from the root user and login as oracle user and do the following step---------

yum install libXp compat-libstdc++*

cpio -idmv <10201_database_linux_x86_64.cpio

Install Database :

$ cd /data/database/
$ ./runInstaller 

Post-Installation


; after installation configure the net manager listener.ora

Starting the services

Now, the Oracle instance should be installed and working. Let's check it:

su - oracle
sqlplus / as sysdba
If it says Connected to an idle instance, it means that the instance is not started. Do the following:

lsnrct start
emctl start dbconsole
sqlplus / as sysdba
startup (in sqlplus session)


Starting Oracle Instance up on System Startup

Creating the startup bash script in root

# cd /etc/init.d 

# touch dbora

# chmod 750 dbora

# vi dbora

# edit the dbora file and make the contents of it like below:

#!/bin/bash
#
# chkconfig: 35 99 10
# description: Starts and stops Oracle processes
#
ORA_HOME=/u01/app/oracle/product/10.2.0.1.0/db_1
ORA_OWNER=oracle

case "$1" in
'start')

# Start the TNS Listener
su - $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl start"
# Start the Oracle databases:
su - $ORA_OWNER -c $ORA_HOME/bin/dbstart
# Start the Intelligent Agent
if [ -f $ORA_HOME/bin/emctl ];
then
su - $ORA_OWNER -c "$ORA_HOME/bin/emctl start agent"
elif [ -f $ORA_HOME/bin/agentctl ]; then

su - $ORA_OWNER -c "$ORA_HOME/bin/agentctl start"
else
su - $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl dbsnmp_start"
fi
# Start Management Server
if [ -f $ORA_HOME/bin/emctl ]; then
su - $ORA_OWNER -c "$ORA_HOME/bin/emctl start dbconsole"
elif [ -f $ORA_HOME/bin/oemctl ]; then
su - $ORA_OWNER -c "$ORA_HOME/bin/oemctl start oms"
fi
# Start HTTP Server
if [ -f $ORA_HOME/Apache/Apache/bin/apachectl]; then
su - $ORA_OWNER -c "$ORA_HOME/Apache/Apache/bin/apachectl start"
fi
touch /var/lock/subsys/dbora
;;
'stop')
# Stop HTTP Server
if [ -f $ORA_HOME/Apache/Apache/bin/apachectl ]; then

su - $ORA_OWNER -c "$ORA_HOME/Apache/Apache/bin/apachectl stop"
fi
# Stop the TNS Listener

su - $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl stop"
# Stop the Oracle databases:
su - $ORA_OWNER -c $ORA_HOME/bin/dbshut
rm -f /var/lock/subsys/dbora
;;
esac
# End of script dbora

As root perform the following to create symbolic links:


# ln -s /etc/init.d/dbora /etc/rc3.d/S99oracle
# ln -s /etc/init.d/dbora /etc/rc0.d/K01oracle

Alternatively you can register the Service using
/sbin/chkconfig --add dbora

This action registers the service to the Linux service mechanism.

Test the script to see if it works.

The real test is to reboot unix box and then see whether oracle is started up automatically or not.

However to test the script created in step 2, without rebooting, do the following:

Login as root and then,
# /etc/init.d/dbora start (for startup)
# /etc/init.d/dbora stop (for shutdown)

If you restart start and stop oracle database is successful then you are almost done.

[root@lnxdb init.d]# /etc/init.d/dbora start

-bash: /var/opt/oracle/product/10.2.0/db_1/bin/lsnrctl: No such file or directory

-bash: /var/opt/oracle/product/10.2.0/db_1/bin/dbstart: No such file or directory

-bash: /var/opt/oracle/product/10.2.0/db_1/bin/lsnrctl: No such file or directory

/etc/init.d/dbora: line 66: [: missing `]'

[Updated on: Sun, 02 September 2012 08:24] by Moderator

Report message to a moderator
 Send a private message to this user      
- Re: Auto start database listner with machine on [message #565266 is a reply to message #565263] Sun, 02 September 2012 08:28 Go to previous message
Mahesh Rajendran
Messages: 10552
Registered: March 2002
Location: oracleDocoVille 
Senior Member
Account Moderator
First check if dbshut and dbstart scripts are working. Call them manually logged in as Oracle.
If it does not work, edit the file and fix the location of oratab.
Inside dbora, i would also export the PATH.
Something like
Code: [Select all] [Show/ hide]

export PATH=$PATH:$ORACLE_HOME/bin


Obviously,
Code: [Select all] [Show/ hide]

 /etc/init.d/dbora: line 66: [: missing `]' 

fix that.

The following commands will ensure that the databases will come up in runlevels 2,3 and 4:

    $ ln -s ../init.d/oracle /etc/rc.d/rc2.d/S99oracle
    $ ln -s ../init.d/oracle /etc/rc.d/rc3.d/S99oracle
    $ ln -s ../init.d/oracle /etc/rc.d/rc4.d/S99oracle

To stop the databases on reboot or restart we need the following links:

    $ ln -s ../init.d/oracle /etc/rc.d/rc0.d/K01oracle          # Halting
    $ ln -s ../init.d/oracle /etc/rc.d/rc6.d/K01oracle          # Rebooting

Fixing the dbstart script

The dbstart script, which is called inside the dbora script, has some errors. Open the file:

/u01/app/oracle/product/10.2.0.1.0/db_1/bin/dbstart as oracle user and change
ORACLE_HOME_LISTNER=/ade/vikrkuma_new/oracle to ORACLE_HOME_LISTNER=$ORACLE_HOME

Otherwise, your listener might not get started.

Flagging the padma instance to be started

We open the /etc/oratab file and change the last letter from N to Y:

padma:/u01/app/oracle/product/10.2.0/db_1:N
to
padma:/u01/app/oracle/product/10.2.0/db_1:Y

Setting the IP Address
----------------------

If the instance is running, shut it down with (as oracle user):

sqlplus / as sysdba

shutdown immediate
Then, open the /u01/app/oracle/product/10.2.0/db_1/network/admin/tnsnames.ora
file and set your hostname/static IP Address:
HOST = padma
Start the instance in sqlplus session:
startup

chgrp dba /etc/init.d/dbora
chmod 750 /etc/init.d/dbora

vi /etc/inittab

Useful Resources:

• libXp package: http://rpm2html.osmirror.nl/fedora/core/5/i386/os/Fedora/RPMS/libXp-1.0.0-2.2.i386.html
• libstc++ package: http://rpm2html.osmirror.nl/fedora/core/3/i386/os/Fedora/RPMS/compat-libstdc++-8-3.3.4.2.i386.html
• Startup script: http://listweb.bilkent.edu.tr/Linux/linux-sunucu/2005/Nov/0095.html
• Linking startup script: http://www.idevelopment.info/data/Oracle/DBA_tips/Linux/LINUX_8.shtml
• Fixing dbstart: http://forums.oracle.com/forums/thread.jspa?threadID=336184
• Flagging Instance to start up: http://download-uk.oracle.com/docs/html/B10812_01/chapter2.htm#sthref21011

--import the data

Create tablespace

CREATE tablespace MDATA
datafile '/u01/app/oracle/oradata/orcl\MDATA.dbf' SIZE 25000M
AUTOEXTEND ON
ONLINE
EXTENT MANAGEMENT LOCAL UNIFORM SIZE 2M;

alter tablespace mdata
add datafile '/u01/app/oracle/oradata/orcl\MDATA2.dbf' SIZE 25000M;

alter tablespace mdata
add datafile '/u01/app/oracle/oradata/orcl\MDATA3.dbf' SIZE 25000M;

alter tablespace mdata
add datafile '/u01/app/oracle/oradata/orcl\MDATA4.dbf' SIZE 25000M;

Index Tablespace :

CREATE tablespace MINDEX
datafile '/index/mindex.dbf' SIZE 25000M
AUTOEXTEND ON
ONLINE
EXTENT MANAGEMENT LOCAL UNIFORM SIZE 2M;

alter tablespace mindex
add datafile '/index/mindex2.dbf' SIZE 25000M;

alter tablespace MINDEX
add datafile '/index/mindex3.dbf' SIZE 25000M;

alter tablespace MINDEX
add datafile '/index/mindex4.dbf' SIZE 25000M;

--drop user MICROSYS;

CREATE USER MICROSYS IDENTIFIED BY M;
GRANT DBA TO MICROSYS;

ALTER USER MICROSYS DEFAULT TABLESPACE MDATA;

SELECT 'ALTER TABLE '||TABLE_NAME||' MOVE TABLESPACE MDATA;' FROM TABS;
SELECT 'ALTER INDEX '||INDEX_NAME||' REBUILD NOLOGGING ONLINE TABLESPACE MINDEX;' FROM USER_INDEXES;

Thank You.




Muhammad Abdullah Al Noor

Muhammad Abdullah Al Noor, An Oracle Apex Consultants and founder of Noors Technology (www.noorstech.com). Core Expertise : Database Administration, Oracle Forms and Reports Development, Oracle Apex Application Designer and Development, Linux Professional etc. Also the owner of TrainerBD Training and OraDemy E-Learning. WhatsApp +8801790721177

Post a Comment

Previous Post Next Post