Wednesday, November 24, 2010

How to install Oracle 10g from rpm in redhat enterprise linux rhel5

Advertisements


This document explains how to install the Oracle 10g database server on a redhat rhel5 linux
machine using rpm package. This steps will work in other redhat distros like Centos, Fedora etc.

System:
VMware VM
OS Redhat enterprise Linux 5.4
32 bit
IP: 192.168.0.56
RAM = 1700Mb
Host machine Dell inspiron 1545

Oracle software:
Oracle 10g
Version 10.2.0.1.0

Other Requirements:
Yum server

Installation:
Login as root user
login as: root
root@192.168.0.35's password:
Last login: Sat Nov 20 15:17:28 2010

Download the rpm from oracle.com:
[root@oracle /]# ls
bin dev home lost+found misc net oracle-xe-univ-10.2.0.1-1.0.i386.rpm root selinux sys tmp var boot etc lib media mnt opt proc sbin srv tftpboot usr

#Changing the version 5.4 to rhel4:
[root@oracle /]# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 4 (Tikanga)installed #10g doesnt support rhel 5.4
[root@oracle /]#

Checking whether the dependencies are installed or not:
[root@oracle /]# rpm -r prm -q glibc libaio
libaio-0.3.106-3.2

Checking the swap space:
[root@oracle /]# swapon -s
FilenameTypeSizeUsedPriority
/dev/sda3 partition 23535120 -1

Checking the memory status:
[root@oracle /]# free -m
total used free shared buffers cached
Mem: 1685 654 1030 0 27 544
-/+ buffers/cache: 82 1602
Swap: 2298 0 2298

#Adding the kernel parameters to the sysctl.conf file:
[root@oracle /]# cat /etc/sysctl.conf

# Kernel sysctl configuration file for Red Hat Linux
#
# For binary values, 0 is disabled, 1 is enabled. See sysctl(8) and
# sysctl.conf(5) for more details.
# Controls IP packet forwarding
net.ipv4.ip_forward = 0
# Controls source route verification
net.ipv4.conf.default.rp_filter = 1
# Do not accept source routing
net.ipv4.conf.default.accept_source_route = 0
# Controls the System Request debugging functionality of the kernel
kernel.sysrq = 0
# Controls whether core dumps will append the PID to the core filename
# Useful for debugging multi-threaded applications
kernel.core_uses_pid = 1
# Controls the use of TCP syncookies
net.ipv4.tcp_syncookies = 1
# Controls the maximum size of a message, in bytes
kernel.msgmnb = 65536
# Controls the default maxmimum size of a mesage queue
kernel.msgmax = 65536
# Controls the maximum shared segment size, in bytes
kernel.shmmax = 4294967295
# Controls the maximum number of shared memory segments, in pages
kernel.shmall = 268435456

#Parameters for Oracle installation
kernel.sem = 250 32000 100 128
kernel.shmmax =536870912
kernel.shmmni =4096
kernel.shmall =2097152
fs.file-max = 65536
net.ipv4.ip_local_port_range = 1024 65000
[root@oracle /]#

Reloading and checking for errors:
[root@oracle /]#
[root@oracle /]# sysctl -p > /dev/null
[root@oracle /]#

Installing the oracle rpm:
[root@oracle /]# rpm -ivh oracle-xe-univ-10.2.0.1-1.0.i386.rpm
Preparing... [100%]
1:oracle-xe-univ [100%]
Executing Post-install steps...
You must run '/etc/init.d/oracle-xe configure' as the root user to
configure the database.


You will be prompted to run the following command for configuring oracle:
[root@oracle /]# /etc/init.d/oracle-xe configure

Oracle Database 10g Express Edition Configuration
-------------------------------------------------
This will configure on-boot properties of Oracle Database 10g Express
Edition. The following questions will determine whether the database should
be starting upon system boot, the ports it will use, and the passwords that
will be used for database accounts. Press to accept the defaults.
Ctrl-C will abort.

Specify the HTTP port that will be used for Oracle Application Express [8080]: #Hit enter

Specify a port that will be used for the database listener [1521]: #Hit enter

Specify a password to be used for database accounts. Note that the same
password will be used for SYS and SYSTEM. Oracle recommends the use of
different passwords for each database account. This can be done after
initial configuration: #Give a password
Confirm the password: #Retype it

Do you want Oracle Database 10g Express Edition to be started on boot (y/n) [y]:y or #Hit enter

Starting Oracle Net Listener...Done
Configuring Database...Done
Starting Oracle Database 10g Express Edition Instance...Done
Installation Completed Successfully.
To access the Database Home Page go to "http://127.0.0.1:8080/apex"
[root@oracle /]#

[root@oracle /]# cd /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin/

Run the following script for setting environment variables:
[root@oracle bin]# . oracle_env.sh
[root@oracle bin]# echo $?
0

Add the script in profile file for environment variables for oracle [To survive reboots]:
[root@oracle bin]# cat >> /etc/profile
. /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin/oracle_env.sh

And source it to make effect:
[root@oracle bin]# . source /etc/profile
[root@oracle bin]# cat /etc/profile
# /etc/profile
# System wide environment and startup programs, for login setup
# Functions and aliases go in /etc/bashrc
pathmunge () {
if ! echo $PATH | /bin/egrep -q "(^|:)$1($|:)" ; then
if [ "$2" = "after" ] ; then
PATH=$PATH:$1

else
PATH=$1:$PATH
fi
fi
}
# ksh workaround
if [ -z "$EUID" -a -x /usr/bin/id ]; then
EUID=`id -u`
UID=`id -ru`
fi
# Path manipulation
if [ "$EUID" = "0" ]; then
pathmunge /sbin
pathmunge /usr/sbin
pathmunge /usr/local/sbin
fi
# No core files by default
ulimit -S -c 0 > /dev/null 2>&1
if [ -x /usr/bin/id ]; then
USER="`id -un`"
LOGNAME=$USER
MAIL="/var/spool/mail/$USER"
fi
HOSTNAME=`/bin/hostname`
HISTSIZE=1000
if [ -z "$INPUTRC" -a ! -f "$HOME/.inputrc" ]; then
INPUTRC=/etc/inputrc
fi
export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE INPUTRC
for i in /etc/profile.d/*.sh ; do
if [ -r "$i" ]; then
if [ "$PS1" ]; then
. $i
else
. $i >/dev/null 2>&1
fi
fi
done
unset i
unset pathmunge
. /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin/oracle_env.sh
[root@oracle bin]#

Checking oracle from Command line:
[root@oracle bin]# sqlplus system

SQL*Plus: Release 10.2.0.1.0 - Production on Sat Nov 20 16:58:56 2010
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Enter password:
Connected to:
Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production

SQL> exit
Disconnected from Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production
[root@oracle bin]# cd

Checking the user list:
SQL> select * from all_users;

USERNAME USER_ID CREATED
------------------------------ ---------- ------------------
FLOWS_020100 35 31-JAN-06
FLOWS_FILES 34 31-JAN-06
HR 33 31-JAN-06
MDSYS 32 31-JAN-06
ANONYMOUS 28 31-JAN-06
XDB 27 31-JAN-06
CTXSYS 25 31-JAN-06
DBSNMP 23 31-JAN-06
TSMSYS 20 31-JAN-06
DIP 18 31-JAN-06
OUTLN 11 31-JAN-06

USERNAME USER_ID CREATED
------------------------------ ---------- ------------------
SYSTEM5 31-JAN-06
SYS0 31-JAN-06

13 rows selected.

Listing the DBA users:
SQL> select username from dba_users;

USERNAME
------------------------------
TSMSYS
XDB
HR
FLOWS_020100
DBSNMP
DIP
OUTLN
CTXSYS
MDSYS
FLOWS_FILES
SYSTEM

USERNAME
------------------------------
SYS
ANONYMOUS
13 rows selected

Licence:
.

Login:
Databse:


Http Access:


Tuesday, November 16, 2010

Process states in linux systems

Advertisements

There are many states for processes in linux environment. You can see the process states using the following commands.

#ps
#ps -ax       -From all users and terminals.
#ps -aux     -Shows Process owner also.

For the dynamic details:

#top
#top -c      -Sorts according to CPU usage.
#top   and pressing M(shift+m)  - sorts according to memory usage.

Main process states are as follows:


             D       Marks a process in disk (or other short term, uninterruptible) wait.
             I       Marks a process that is idle (sleeping for longer than about 20 seconds).
             R       Marks a runnable process.
             S       Marks a process that is sleeping for less than about 20 seconds.

             T       Marks a stopped process.
             Z       Marks a dead process (a ``zombie'').

Additional characters after these, indicates additional state information:

             +       The process is in the foreground process group of its control terminal.
             <       The process has raised CPU scheduling priority.
             >       The process has specified a soft limit on memory requirements and is currently exceeding that limit; such a process is (necessarily) not swapped.
             E       The process is trying to exit.
             L       The process has pages locked in core (for example, for raw I/O).
             N       The process has reduced CPU scheduling priority (see setpriority(2)).
             s       The process is a session leader.
             V       The process is suspended during a vfork(2).
             W       The process is swapped out.
             X       The process is being traced or debugged.

How to install and configure oracle 10g standalone database server in redhat rhel5 linux

Advertisements

Oracle 10g installation on RHEL5 ( Standalone Server)

This document explains how to install and configure the Oracle 10g database server on a redhat rhel5 linux machine. This steps will work in other redhat distros like Centos, Fedora etc.

System:
VMware VM
OS Redhat enterprise Linux 5.4
32 bit
IP: 192.168.0.56
RAM = 1700Mb
Host machine Dell inspiron 1545

Oracle software:
Oracle 10g
Version 10.2.0.1.0

Other Requirements:
Yum server

Pre - Installation steps:

Setting the hostname:
[root@oracle ~]# hostname
oracle.lap.work

Resolving the hostname:
[root@oracle ~]# cat /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1oracle.lap.work oracle localhost.localdomain localhost
::1localhost6.localdomain6 localhost6
192.168.0.35 oracle.lap.work oracle

Making the hostname permenant:
[root@oracle ~]# cat s/etc/sysconfig/network
NETWORKING=yes
NETWORKING_IPV6=no
HOSTNAME=oracle.lap.work

Changing the OS Name:
Oracle 10g does not support the rhel 5.4. So we've tochange it to rhel4

[root@oracle ~]# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 4 (Tikanga)

Installation:
Installing dependancies:

[root@oracle ~]# yum install compat-db compat-gcc* compat-libstdc++* openmotif* sysstat telnet-server libaio* gcc*

Now creating groups and users for oracle installation:
[root@oracle ~]# [root@oracle ~]# groupadd -g 200 oinstall
[root@oracle ~]# groupadd -g 200 oinstall1 dba
[root@oracle ~]# useradd -g oinstall -G dba oracle-u 200
[root@oracle ~]# passwd oracle
Changing password for user oracle.
New UNIX password:
BAD PASSWORD: it is based on a dictionary word
Retype new UNIX password:
passwd: all authentication tokens updated successfully.

Creating home directories for oracle:
Crs home:
[root@oracle ~]# mkdir -p /u01/app/oracle/product/10.2.0/crs
Oracle home:
[root@oracle ~]# mkdir -p /u01/app/oracle/product/10.2.0/db_1

Setting Kernel & other parameters for Oracle installation in /etc/sysctl.conf file
[root@oracle ~]# cat >> /etc/sysctl.conf
#Oracle installation parameters
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.default.accept_source_route = 0
kernel.sysrq = 0
kernel.core_uses_pid = 1
net.ipv4.tcp_syncookies = 1
kernel.msgmnb = 65536
kernel.msgmax = 65536
kernel.shmmax = 4294967295
kernel.shmall = 268435456
fs.file-max = 65536
net.ipv4.ip_local_port_range = 1024 65000
net.ipv4.tcp_fin_timeout = 5
net.ipv4.tcp_keepalive_intvl = 5
net.ipv4.tcp_keepalive_time = 3
net.ipv4.tcp_keepalive_probes = 9
net.ipv4.tcp_orphan_retries = 2
kernel.sem = 250 32000 100 128
net.core.rmem_default = 262144
net.core.rmem_max = 262144
net.core.wmem_default = 262144
net.core.wmem_max = 262144^[[A 4
kernel.domainname = lap.work #change the domain name as you wish
[root@oracle ~]#

Reloading the sysctl.conf to make effect the above parameters:
[root@oracle ~]# sysctl -p

You can check the errors using
[root@oracle ~]# sysctl -p > /dev/null

Settings for limiting the resource usage of oracle user:
[root@oracle ~]# cat >> /etc/security/limits.conf << EOF
> oracle soft nproc 4096
> oracle hard nproc 16384
> oracle soft nofile 2048
> oracle hard nofile 65536
> EOF

[root@oracle ~]# cat >> /etc/pam.d/login << EOF
> session required /lib/security/pam_limits.so
> EOF

[root@oracle ~]# [root@oracle ~]# cat >> /etc/pam.d/su << EOF
> session required /lib/security/pam_limits.so
> EOF

[root@oracle ~]# cat >> /etc/pam.d/sshd << EOF
> session required /lib/security/pam_limits.so
> EOF

Adding the variables and functions needed for oracle installation into /etc/profile file:

[root@oracle ~]# cat >> /etc/profile
#oracle installation variavl bles and functions
TMP=/tmp; export TMP
TMPDIR=$TMP; export TMPDIR
ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE
CRS_HOME=$ORACLE_BASE/product/10.2.0/crs
ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1; export ORACLE_HOME
ORACLE_SID=orcl; 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
if [ $USER = .oracle. ]; then
ulimit .u 16384 .n 65536
fi

Sourcing it to make effect:
[root@oracle ~]# source /etc/profile

Adding the variables and functions needed for oracle installation into user oracle's profile file:

cat >> ~oracle/.bash_profile
TMP=/tmp; export TMP
TMPDIR=$TMP; export TMPDIR
ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE
CRS_HOME=$ORACLE_BASE/product/10.2.0/crs
ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1; export ORACLE_HOME
ORACLE_SID=orcl; 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


Sourcing it to make effect. Or you can logout and log in.

[oracle@oracle ~]$ sourse .bash_profile

Hang Checker Timer:

[root@oracle ~]# cat >> /etc/modprobe.conf
options hangcheck-timer hangcheck_tick=30 hangcheck_margin=180

Starting the hangcheck driver using the following command

[root@oracle ~]# modprobe hangcheck-timer

Now mount the cd to /media and copy the oracle database directory to /u01/app/oracle:

Now we have :
[root@oracle ~]# cd /u01/app/oracle/
[root@oracle oracle]# ls
database product

Changing the ownership and permissions of oracle files and directories:

[root@oracle oracle]# chown -R oracle:dba /u01/app/oracle/
[root@oracle oracle]# chmod -R 775 /u01/app/oracle/

Now we can start the installation:

You have to do this in runlevel 5, ie graphical mode:
You have to run the command xhost + as root user. As shown below.



Then only you will get access to oracle's graphical installation tool.

Starting the installation:

First we have to switch as user oracle and goto the directory /u01/app/oracle/database.
There you can see a script runInstaller. Execute it. See the pic below.


And you will get the following window.


Set the database password in that. And click next.
Note: It will be the password for the users SYS,SYSTEM,SYSMAN and DBSNMP

Now you will get the next window as follows:


Check the oracle group name is oinstall and click next.

Here you will get the prerequisite check results. There may be some errors. We are lacking enough swap memory here. And network script is not executed. [Its because we have static ip not dhcp]


Creating swap memory:

Sometimes there wont be enough swap memory in your system. So you have to create swap area either by partition or file.

Here we create swap using file.

[root@oracle oracle]# touch /swapfile

Using dd command and dumping zeros to the file:

[root@oracle oracle]# dd if=/dev/zero of=/swapfile bs=1024 count=500000
500000+0 records in
500000+0 records out
512000000 bytes (512 MB) copied, 71.4932 seconds, 7.2 MB/s

Making swap filesystem:

[root@oracle oracle]# mswkswap -v1 /swapfile
Setting up swapspace version 1, size = 511995 kB

Creating entry in fstab:

[root@oracle oracle]# cat /etc/fstab
LABEL=/ / ext3 defaults 1 1
LABEL=/boot /boot ext3 defaults 1 2
tmpfs /dev/shm tmpfs defaults 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
sysfs /sys sysfs defaults 0 0
proc /proc proc defaults 0 0
LABEL=SWAP-sda3 swap swap defaults 0 0
/swapfile swap swap defaults 0 0

Mounting and enabling it:

[root@oracle oracle]# mount -a
[root@oracle oracle]# swapon -a

Checking the swap status:

[root@oracle oracle]# swapon -s
FilenameTypeSizeUsedPriority
/dev/sda3 partition23535120-1
/swapfile file4999920-2

Now rechecking and continuing installation:



Now Pre-checks are over:


If there was errors, it'll be listed in red color so check for errors.

Now Click on install.


It may take some time.

Some configuration scripts will run during installation:




At the end of installation we have to run two scripts manually as root user:


1st script:

[root@oracle db_1]# ./root.sh

Running Oracle10 root.sh script...

The following environment variables are set as:
ORACLE_OWNER= oracle
ORACLE_HOME= /u01/app/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 ...

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.
[root@oracle db_1]# cd ../../../oraior

2nd script:

[root@oracle oraInventory]# ./orainstRoot.sh
Changing permissions of /u01/app/oracle/oraInventory to 770.
Changing groupname of /u01/app/oracle/oraInventory to oinstall.
The execution of the script is complete
[root@oracle oraInventory]#


For using the EM you have to run this command as user oracle:
Switching user as oracle:
[root@oracle oraInventory]# su - oracle

Running the command:
[oracle@oracle ~]$ emctl start dbconsole
TZ set to Asia/Calcutta
Oracle Enterprise Manager 10g Database Control Release 10.2.0.1.0
Copyright (c) 1996, 2005 Oracle Corporation. All rights reserved.
http://oracle.lap.work:1158/em/console/aboutApplication
  • An instance of Oracle Enterprise Manager 10g Database Control is already running.
Now installation is over:

Now login using web access:
http://192.168.0.35/em



user :sys
password: same you've given during oracle installation

Accepting the license:


Thats it



Using the command prompt:

Login as user oracle:
[oracle@oracle ~]$ sqlplus / as stysdba

SQL*Plus: Release 10.2.0.1.0 - Production on Tue Nov 16 12:48:40 2010

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


Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options

SQL> select * from all_users;

USERNAME USER_ID CREATED
------------------------------ ---------- ---------
BI 60 16-NOV-10
PM 59 16-NOV-10
SH 58 16-NOV-10
IX 57 16-NOV-10
OE 56 16-NOV-10
HR 55 16-NOV-10
SCOTT 54 30-JUN-05
****** Output truncated *********


SQL> shutdown
SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
Thats it. Leave a comment if you like. Enjoy.