Tuesday, 11 November 2014

Oracle database requirements and install

Oracle Database 11g R2 Preinstallation Requirements on Linux and Install

a) The first thing we need to verify is, if the hardware we have is okay for an Oracle 11g Installation
======================================================

There are a number of parameters to be set on Linux. In this article we will prepare Oracle Enterprise Linux to the installation of Oracle Database 11gR2.Unless otherwise specified all of the following process steps must be made with user “root” .

The first thing we need to verify is, if the hardware we have is okay for an Oracle 11g Installation.
===========================================================
run script:-

[oracle@localhost ~]$ ./check_mem_cpu.sh 

-- Check Physical RAM.
=======================
# grep MemTotal /proc/meminfo
MemTotal:      2075424 kB


 We need at least 1GB of physical RAM.
 In my case I have 2GB.

-- Check Swap Space.
===========================
# grep SwapTotal /proc/meminfo
SwapTotal:     3148732 kB


 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.

Check disk
=============
# df -h /dev/shm/
Filesystem            Size  Used Avail Use% Mounted on
tmpfs                1014M     0 1014M   0% /dev/shm


 What ever you are going to use your Automatic Memory Management
 Targets later on this database, you need to have shared memory
 file system size at lease equal to those settings. In my case I
 have plans to use memory management targets lower then 1000M
 so 1014 M of shared memory file system is sufficient for me.
 But if you would like to have a bigger shared memory (/dev/shm)
 size then do the following:

Alter/change the size of /dev/shm mount if necessary
=====================================
# mount -t tmpfs tmpfs -o size=1500m /dev/shm

# df -h /dev/shm/
Filesystem            Size  Used Avail Use% Mounted on
tmpfs                 1.5G     0  1.5G   0% /dev/shm

Check space available in /tmp
=============================================
# df -h /tmp
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda5             1.5G   35M  1.4G   3% /tmp


  You need to have at least 1GB of space in the /tmp directory.
  Make sure you have 1GB in the column "Avail" in the above output.
  In my case I have 1.4G space available in /tmp.

-- Check space for Oracle Software and pre configured database.
-- I have created a separate partition "/u01" for Oracle Software
-- and database files
=========================================
# df -h /u01
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda2              15G  166M   14G   2% /u01

            Important factors to consider
***********************************************
I have 14G available space on the partition /u01.

  Space requirement for Oracle 11g Release 2 Software:
     Enterprise Edition      3.95G
     Standard Edition          3.88G
 
  Space requirement for Oracle Database Files:
     1.7 G
    
  creating a database is always optional with oracle installation.Can be done later.
   
***********************************************************************************

To install Oracle 11g Release 2 your system should be running on at least 1024x768 screen resolution.

Check the Resolution
==================
# xdpyinfo | grep 'dimensions:'
 
dimensions:    1280x720 pixels (433x244 millimeters)

To install Oracle 11g Release 2 on RHEL 5 you should be running a kernel version 2.6.18 or later.
==================================================
# uname -r
2.6.18-194.el5

Make sure that there is an entry in /etc/hosts file for your machine like this:
=================================================
1. Edit hosts file and add specifications as per your machine.eg if as root user do not sudo

$ sudo vim /etc/hosts
# vim /etc/hosts

<IP-address>     <fully-qualified-machine-name>     <machine-name>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
192.168.1.74      ora11gr2.localdomain          ora11gr2
192.168.1.121     localhost.localdomain          localhost

2. Set kernel parameters in sysctl.conf file. These values are suggested by Oracle. According to your server, you can change some values.Save after editing :wq

$ sudo vim /etc/sysctl.conf
# vim /etc/sysctl.conf

I added the following Oracle settings
~~~~~~~~~~~~~~~~~~~~~~~~~
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 536870912
kernel.shmmni = 4096
semaphores: semmsl, semmns, semopm, semmni
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

Make the kernel parameters changes effective immediately:
==============================================================
#sudo /sbin/sysctl -p

Verify the parameters are changed or not?
================================================================
As root or oracle USER

# /sbin/sysctl -a | grep name_of_kernel_parameter 

e.g.  # /sbin/sysctl -a | grep shmall

$ /sbin/sysctl –p

kernel.shmall  paramter must be equal to page size.
====================================
pagesize
$ getconf PAGESIZE

Run the script check_limits.sh script to set limit values in limits.conf file.
=============================================
Now set the shell limits for the user Oracle.Open /etc/security/limits.conf copy and paste
to add the lines below (oracle/root user).

$ sudo vim /etc/security/limits.conf or # vim /etc/security/limits.conf

oracle     soft     nproc     2047   can go upto****65536
oracle     hard     nproc     16384  can go upto****65536
oracle     soft     nofile    1024   can go upto****65536
oracle    hard     nofile    65536
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
NB:The shell limits can be more than the above settings but not less
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Open /etc/pam.d/login file and add following line.
==================================
$ sudo vim /etc/pam.d/login

add:  session required  pam_limits.so

You must disable SELINUX. Edit /etc/selinux/config file to disable it.
===========================================
Set secure Linux to permissive by editing the "/etc/selinux/config" file, making sure the SELINUX flag is set as follows.
$vim /etc/selinux/config

$ SELINUX=disable

Alternatively, this alteration can be done using the GUI tool (Applications > System Settings > Security Level). Click on the SELinux tab and disable the feature. If SELinux is disabled after installation, the server will need a reboot for the change to take effect.

*****If you have the Linux firewall enabled, you will need to disable or configure it

Run the scripts for checking packages:- check_packages.py
==========================================
$ ./check_packages.py

RPM packages which are required by Oracle must be installed .  You can check needed rpm packages with following command;

$rpm -q binutils compat-db compat-libstdc++-33 libgcc glibc glibc-devel glibc-headers gcc gcc-c++ libgcc libstdc++ cpp make libaio ksh elfutils-libelf make sysstat libaio libaio-devel setarch libXp –qf “%{NAME}-%{VERSION}-%{RELEASE} (%{ARCH})\n”|sort

If a rpm is not installed then you can install it from Oracle DVD/ISO and if connected to the internet u can YUM
===========================================================
$cd /media/cdrom/Server
$rpm -ivh binutils-2.*

******If connected to the internet

$ yum install package name

******NB:Packages that are not installed will indicate:eg, package compat-libstdc++ is not installed.SO

$ yum install compat-libstdc++ 

Allow the user oracle to use X server, which it will need to run Oracle Universal Installer.
======================================================

# xhost +SI:localuser:oracle

Switching to the oracle user to see which shell is being used by user Oracle
================================================
# su - oracle   password:

$ echo $SHELL
/bin/bash

Create oracle operating system user and groups.
==================================

First create groups
~~~~~~~~~~~~~~~~
$ groups
$ id
$ /usr/sbin/groupadd -g 500 oracle
$ /usr/sbin/groupadd -g 501 dba

**Create directory which will be used for oracle software installation. I create default directory. You can change it.
    $ mkdir -p /u01/app/oracle/product/11.2.0/db_1

**Create oracle operating system user.
    $ /usr/sbin/useradd -m -u 501 -g oracle -G dba -d /u01/app/oracle/product/11.2.0/db_1 oracle

**Set owner of oracle base directory as oracle user .
    $ chown -R oracle:dba /u01

**Give permissions to this directory.
    $ chmod -R 775 /u01

**Specify password of oracle user.
    $ passwd oracle

As oracle user,edit .bash_profile file and add following lines
======================================
$ vim .bash_profile

# User specific environment and startup programs

TMP=/tmp; export TMP
TMPDIR=$TMP; export TMPDIR
PATH=$PATH:$HOME/bin
export PATH
umask 022
set SYSTEM_PASS=SYSTEM/root
set -o vi
EDITOR=vim
export EDITOR
ORAENV_ASK=NO
ORACLE_SID=orcl
. oraenv
ORAENV_ASK=YES

After that save the bash profile file and run it to set operating system envimronment variables.

$ source ~/.bash_profile

Add oracle to /etc/sudoers. This will give oracle super user privilege.
===========================================
oracle    ALL=(ALL) ALL

To avoid MAKE Error problems during installation
===========================================

Ensure that gcc is installed on your system by executing:

$ which gcc
/usr/bin/gcc

Here is the command to find the RPM package name for /usr/bin/gcc:
======================================================================
$ rpm -qf /usr/bin/gcc
gcc-2.96-98

To avoid MAKE Error problems invoking target install of makefile /u01/app/oracle/product/11.2.0/ctx/lib/ins_ctx.mk
===================================================================================================================
[root@localhost 11.2.0]# mkdir -p /ctx/lib/

#vim ins_ctx.mk

Edit the file $ORACLE_HOME/ctx/lib/env_ctx.mk, add "$(LDLIBFLAG)dl" to the "INSO_LINK =" line. The updated line should with the added "$(LDLIBFLAG)dl" flag,

 should look like this:
~~~~~~~~~~~~~~~~~~~~~~~~~~~
INSO_LINK = -L$(CTXLIB) $(LDLIBFLAG)m $(LDLIBFLAG)dl $(LDLIBFLAG)sc_ca $(LDLIBFLAG)sc_fa $(LDLIBFLAG)sc_ex $(LDLIBFLAG)sc_da $(LDLIBFLAG)sc_ut $(LDLIBFLAG)sc_ch $(LDLIBFLAG)sc_fi $(LLIBCTXHX) $(LDLIBFLAG)c -Wl,-rpath,$(CTXHOME)lib $(CORELIBS) $(COMPEOBJS)

If this did not fix the problem, try the following solution:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Edit the file $ORACLE_HOME/ctx/lib/env_ctx.mk again, go to "INSO_LINK =", remove the above entry you made and add "`cat $(LIBHOME)/sysliblist`" to the line and save it. This is what the updated line, with the added "`cat $(LIBHOME)/sysliblist`" string,

should look like this:
~~~~~~~~~~~~~~~~~~~~~~~~~~~

INSO_LINK = -L$(CTXLIB) $(LDLIBFLAG)m `cat $(LIBHOME)/sysliblist` $(LDLIBFLAG)sc_ca $(LDLIBFLAG)sc_fa $(LDLIBFLAG)sc_ex $(LDLIBFLAG)sc_da $(LDLIBFLAG)sc_ut $(LDLIBFLAG)sc_ch $(LDLIBFLAG)sc_fi $(LLIBCTXHX) $(LDLIBFLAG)c -Wl,-rpath,$(CTXHOME)lib $(CORELIBS) $(COMPEOBJS)

You may see the following errors in $ORACLE_HOME/install/make.log:

*****Oracle Enterprise Linux server is ready to install Oracle database*****


Install Oracle 11g Release 2 on RHEL 5:

The environment is ready for oracle installation. Its time to prepare the oracle installation media now.
Download or Copy the oracle media to the oracle user home directory i.e. /home/oracle.
Once Download/Copy is done unzip the media as follows:

====================================================
 b) INSTALL ORACLE 11g Release 2 on RHEL 5/Centos:
====================================================

Download linux_11gR2_database_1of2.zip & linux_11gR2_database_2of2.zip and copy them to home directoty

Then:
$ cd /home/oracle
$ ls -rtl
linux_11gR2_database_1of2.zip  linux_11gR2_database_2of2.zip

Unzip the files
=================
$ unzip linux_11gR2_database_1of2.zip
$ unzip linux_11gR2_database_2of2.zip

Once the unzip is finished go to the "database" directory unzipped in the previous step and start the Oracle Universal Installer.

$ cd /home/oracle/database/
$ ./runInstaller

NB:
*****Incase you encounter the missing packages,open a terminal as root and yum install listed packages
*****Incase of the MAKE problem,check on; To avoid MAKE Error problems above
*****If the missing packges are not found by yum,click ignore all and continue with the installation

postinstallation settings
------------------------------------------
As a last step you will be asked to execute some configuration scripts as root.

Execute Configuration Scripts

Open another terminal as root and copy/paste on the terminal

# /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.

# /u01/app/oracle/product/11.2.0/db_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/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.
    Finished product-specific root actions.

SQLPLUS NOT STARTING AFTER INSTALL?do the following;
==========================================
[oracle@localhost ~]$ export PATH=$ORACLE_HOME/bin:$PATH
[oracle@localhost ~]$ . oraenv
ORACLE_SID = [orcl] ? orcl  (your SID)
[oracle@localhost ~]$ sqlplus / as sysdba

OR
======

[oracle@localhost ~]$ su - oracle
Password:
[oracle@localhost ~]$ sqlplus / as sysdba

setting database to ARCHIVELOG MODE
=====================================================
SQL> startup mount
SQL> alter database archivelog;
SQL> select log_mode,open_mode from v$database;

LOG_MODE     OPEN_MODE
------------ --------------------
ARCHIVELOG   MOUNTED
SQL> alter database open;
SQL> select log_mode,open_mode from v$database;

LOG_MODE     OPEN_MODE
------------ --------------------
ARCHIVELOG   READ WRITE

TO run DBCA,NETMRG and RMAN you need to set the path to ~$ORACLE_HOME/bin as below
========================================================== 
[oracle@localhost ~]$ cd /u01/app/oracle/product/11.2.0/dbhome_2/bin

DBCA
======
[oracle@localhost bin]$ ./dbca

NETMRG
=======
[oracle@localhost bin]$ ./netmrg

RMAN
======
[oracle@localhost bin]$ rman target /

Recovery Manager: Release 11.2.0.1.0 - Production on Sun Jan 26 02:43:50 2014

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

connected to target database: ORCL (DBID=1365549684)

Starting the Database
===========================
$ sqlplus / as sysdba

SQL>startup

Invalid username and/or password when trying to login to the EM console
==============================================

SQL> alter user sys identified by oracle;
 
User altered.

SQL> alter user system identified by oracle;

User altered.

Then on the login form enter the username and password for user sys or system as above(example)
============================================================
        Username:sys
        Password:oracle
        As    :SYSDBA

Some SQLPlus Querries to test
=============================================

SQL>show parameter v$database
SQL>show parameter v$option
SQL>show parameter db_name
SQL>show parameter service
SQL>show parameter db_unique_name

SQL> alter system register;

sorting library set issues
==============================

[oracle@localhost bin]$ set | fgrep ORA----  check if you have errors



YOU NOW HAVE A DATABASE SET !!!

No comments:

Post a Comment