Monday 28 September 2015

Installation Of Oracle 11g

1.Installation  Of Oracle 11g On Linux Host.
1. check host  details and download the Oracle 11g software that support your  operating system.
[root@localhost ~]# uname -a
Linux amer.localhost 2.6.18-308.el5 #1 SMP Fri Jan 27 17:21:15 EST 2012 i686 i686 i386 GNU/Linux


2. Checking Memory And /Tmp Space
2.1. Physical Memory ( for Oracle 11g memory should be at least 1 GB, Here we have 2 GB)
[root@localhost etc]# grep MemTotal /proc/meminfo
MemTotal:      2075036 kB


2.2.Swap Memory
RAM between 1GB and 2GB then Swap = 1.5 times the size of RAM
RAM between 2GB and 16GB then Swap = equal to the size of RAM
RAM more than 16GB then Swap Size = 16GB
Since my RAM is 2GB, so I have 3GB of Swap Size.
[root@localhost etc]# grep SwapTotal /proc/meminfo
SwapTotal:     314412 kB


2.3 check tmp and other space in file system.( You need to have at least 1GB of space in the /tmp directory.)
[root@localhost etc]# df -kh
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda1              21G  2.5G   17G  13% /
/dev/sda2             3.9G   73M  3.7G   2% /tmp
tmpfs                1014M     0 1014M   0% /dev/shm


2.4> To install Oracle 11g Release 2 your system should be running on at least 1024x768 screen resolution.
[root@localhost etc]# xdpyinfo | grep 'dimensions:'
 dimensions:    1162x590 pixels (394x200 millimeters)


2.5>To install Oracle 11g Release 2 on RHEL 5 you should be running a kernel version 2.6.18 or later.
[root@localhost etc]# uname -r
2.6.18-308.el5


3. Create User
[root@localhost ~]# groupadd oinstall
[root@localhost ~]# groupadd dba
[root@localhost ~]# useradd -m -g oinstall -G dba -d /home/oracle -s /bin/bash -c "Oracle Software Owner" oracle
[root@localhost ~]# 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.


4> Check The Hosts Entry  And Make The Host Entry In This If Not Exists.
[root@localhost etc]# cat /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1             localhost.localdomain localhost
::1             localhost6.localdomain6 localhost
192.168.1.111 amer.localhost amer
5.> Set Oracle Kernel Parameter For Oracle 11g R2.
vi /etc/sysctl.conf 
# Oracle settings
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 536870912
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048586
net.ipv4.tcp_wmem = 262144 262144 262144
net.ipv4.tcp_rmem = 4194304 4194304 4194304


6.> Make The Above Kernel  Parameter Changes In  Effective Immediately


[root@localhost etc]# sysctl -p
net.ipv4.ip_forward = 0
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.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 536870912
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048586
net.ipv4.tcp_wmem = 262144 262144 262144
net.ipv4.tcp_rmem = 4194304 4194304 4194304


7> Create Oracle Directories To Save Oracle Binaries.


mkdir -p /u01/app/oracle/product/11.2.0/db_1-- For oracle binaries
chown -R oracle:oinstall /u01
chmod -R 0775 /u01


8> Make Other Directories.


mkdir -p /u02/amer/redologcontrol---- For Redo log file and Control file
mkdir -p /u03/amer/archivelog-- for archive log file
mkdir -p /u04/amer/backup-- for Backup
mkdir -p /u05/amer/oradata/-- for database file
chown -R oracle:oinstall /u02 /u03 /u04 /u05
chmod -R 0775 /u01 /u02 /u03 /u04 /u05


9> Now Set The Shell Limits For The User Oracle. Open /etc/security/limits.Conf And Add These Lines.
oracle           soft    nproc   2047
oracle           hard    nproc   16384
oracle           soft    nofile  1024
oracle           hard    nofile  65536


10> Open /etc/pam.d/login And Add The Following Line If It Is Already Not There.
[root@localhost /]# cat /etc/pam.d/login
session    required     pam_limits.so
11> Disable Secure Linux By Editing The /etc/selinux/config File, Making Sure The SELINUX Flag Is Set As Follows:
[root@localhost /]# cat /etc/selinux/config
SELINUX=disabled


12>Check Shell
[root@localhost /]# echo $SHELL
/bin/bash


13> Setting The Profile


[root@localhost /]# cat ~/.bash_profile
# Oracle settings
TMP=/tmp; export TMP
TMPDIR=$TMP; export TMPDIR
ORACLE_HOSTNAME= amer.localhost; export ORACLE_HOSTNAME
ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1; export ORACLE_HOME
ORACLE_SID=amer; export ORACLE_SID
ORACLE_TERM=xterm; export ORACLE_TERM
PATH=$ORACLE_HOME/bin:/usr/sbin:$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


umask 022






14> Apply Patch Is Recommended By Oracle For 11gr2


15> Start Oracle 11g Software Installation.


Create a directory on /u01/ with name software and paste oracle setup in /u01/software directory. Unzip both the .zipped setup file


[oracle@amer software]$ ls -lrth
total 2.2G
-rwxrw-rw- 1 oracle oinstall 1.2G Aug 18  2009 linux_11gR2_database_1of2.zip
-rwxrw-rw- 1 oracle oinstall 950M Aug 18  2009 linux_11gR2_database_2of2.zip
[oracle@amer software]$ pwd
/u01/software
[oracle@amer software]$ unzip linux_11gR2_database_1of2.zip
[oracle@amer software]$ unzip linux_11gR2_database_2of2.zip


16> We Will Installation Oracle In Three Phase
1. binay installation using OUI
2.Network and other setup using netmgr /netca
3. Database Creation using DBCA


17> Phase 1( Installation Of Oracle Binaries).


[oracle@amer ~]$ cd /u01/software/database/
[oracle@amer database]$ ls -lrth
total 40K
-rwxr-xr-x  1 oracle oinstall 4.3K Aug 14  2009 runInstaller
drwxr-xr-x  4 oracle oinstall 4.0K Aug 14  2009 install
drwxr-xr-x  2 oracle oinstall 4.0K Aug 14  2009 rpm
drwxr-xr-x 14 oracle oinstall 4.0K Aug 14  2009 stage
drwxrwxr-x  2 oracle oinstall 4.0K Aug 14  2009 sshsetup
drwxrwxr-x  2 oracle oinstall 4.0K Aug 14  2009 response
drwxr-xr-x 12 oracle oinstall 4.0K Aug 17  2009 doc
-rw-r--r--  1 oracle oinstall 5.3K Aug 18  2009 welcome.html
[oracle@amer database]$ ./runInstaller
Starting Oracle Universal Installer...


Checking Temp space: must be greater than 80 MB.   Actual 1511 MB    Passed
.........................................................................................................


Preparing to launch Oracle Universal Installer from /tmp/OraInstall2015-09-27_01-58-14PM. Please wait ...[oracle@amer database]$








-bash-3.2# /u01/app/oraInventory/orainstRoot.sh
Changing permissions of /u01/app/oraInventory.
Adding read,write permissions for group.
Removing read,write,execute permissions for world.


Changing groupname of /u01/app/oraInventory to oinstall.
The execution of the script is complete.
-bash-3.2# /u01/app/oracle/product/11.2.0/dbhome_1/root.sh
Running Oracle 11g root.sh script...


The following environment variables are set as:
   ORACLE_OWNER= oracle
   ORACLE_HOME=  /u01/app/oracle/product/11.2.0/dbhome_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.
Finished product-specific root actions.


-bash-3.2#







18> Phase 2 Listener Configuration


cd /u01/app/oracle/product/11.2.0/db_home/bin






19. Databse Installation Phase-3


$cd /u01/app/oracle/product/11.2.0/db_home/bin
./dbca























20.> Database Installation Has Been Completed. Checking datafile, control file, archive log file  and redo log file location


[oracle@amer ~]$ . oraenv
ORACLE_SID = [amer] ? amer
The Oracle base for ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1 is /u01/app/oracle
[oracle@amer ~]$ sqlplus


SQL*Plus: Release 11.2.0.1.0 Production on Mon Sep 28 23:53:44 2015


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


Enter user-name: /as sysdba


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options


SQL> select name,open_mode from V$database;


NAME      OPEN_MODE
--------- --------------------
AMER      READ WRITE


SQL>
SQL>
SQL> select name from V$datafile;


NAME
--------------------------------------------------------------------------------
/u05/amer/oradata/amer/system01.dbf
/u05/amer/oradata/amer/sysaux01.dbf
/u05/amer/oradata/amer/undotbs01.dbf
/u05/amer/oradata/amer/users01.dbf


SQL> select name from V$controlfile;


NAME
--------------------------------------------------------------------------------
/u02/amer/redologcontrol/control01.ctl
/u02/amer/redologcontrol/control02.ctl


SQL> select member from V$logfile;


MEMBER
--------------------------------------------------------------------------------
/u02/amer/redologcontrol/redo01.log
/u02/amer/redologcontrol/redo02.log
/u02/amer/redologcontrol/redo03.log

SQL> select name from V$archived_log;


NAME
--------------------------------------------------------------------------------
/u03/amer/archivelog/1_66_891561393.dbf