Oracle 11gR2 DB Installation on RHEL using ASM !!!

Home »  11g »  Oracle 11gR2 DB Installation on RHEL using ASM !!!

In past releases, Oracle ASM was installed as part of the Oracle Database installation. With Oracle Database 11g Release 2 (11.2), Oracle ASM is installed when you install the Oracle Grid Infrastructure components and shares an Oracle home with Oracle Clusterware when installed in a cluster such as with Oracle Real Application Cluster (Oracle RAC).

In this article, we will see Oracle 11gR2 database installation on Linux using ASM.

======================================================================================================

 

• Hardware Requirements

– Memory Requirements
Minimum: 1 GB of RAM
Recommended: 2 GB of RAM or more

To determine the RAM size, enter the following command,
# grep MemTotal /proc/meminfo

To determine the size of the configured swap space, enter the following command,
# grep SwapTotal /proc/meminfo

To determine the available RAM and swap space, enter the following command,
# free

Starting with Oracle Database 11g, the Automatic Memory Management feature requires more shared memory (/dev/shm)and file descriptors.
To determine the amount of shared memory available, enter the following command:
# df -h /dev/shm/

If the size of shared memory is too less, than it results in an ORA-00845 error at startup. To increase the /dev/shm mountpoint size you can do the below steps,
# mount -t tmpfs shmfs -o size=7g /dev/shm

To make this change persistent across system restarts, add an entry in /etc/fstab similar to the following:
shmfs /dev/shm tmpfs size=7g 0

 

– Disk Space Requirements
2 GB of disk space in the /tmp directory.

To determine the amount of disk space available in the /tmp directory, enter the following command,
# df -h /tmp

 

– System Architecture
To determine if the system architecture can run the software, enter the following command:
# uname -m

Verify that the processor architecture matches the Oracle software release to install.

======================================================================================================

 

• Software Requirements

– The following packages are required for our installation.

binutils-2.17.50.0.6
compat-libstdc++-33-3.2.3
elfutils-libelf-0.125
elfutils-libelf-devel-0.125
elfutils-libelf-devel-static-0.125
gcc-4.1.2
gcc-c++-4.1.2
glibc-2.5-24
glibc-common-2.5
glibc-devel-2.5
glibc-headers-2.5
kernel-headers-2.6.18
ksh-20060214
libaio-0.3.106
libaio-devel-0.3.106
libgcc-4.1.2
libgomp-4.1.2
libstdc++-4.1.2
libstdc++-devel-4.1.2
make-3.81
sysstat-7.0.2

– To determine whether the required packages are installed or not,
# rpm -qa | grep pkg_name

======================================================================================================

 

• Creating Required Operating System Groups and Users

– Creating the Oracle Inventory Group
# /usr/sbin/groupadd oinstall

– Creating the OSDBA Group for Database Installations
# /usr/sbin/groupadd dba

– Creating an OSOPER Group for Database Installations
# /usr/sbin/groupadd oper

– Creating the OSASM Group for Oracle Automatic Storage Management
# /usr/sbin/groupadd asmadmin

– Creating the OSDBA Group for Oracle Automatic Storage Management
# /usr/sbin/groupadd asmdba

– Creating the OSOPER Group for Oracle Automatic Storage Management
# /usr/sbin/groupadd asmoper

 

– Creating the Oracle Software Owner User
# /usr/sbin/useradd -g oinstall -G asmdba,dba,oper -c “Oracle Software Owner” oracle

Set the password of the oracle user:
# passwd oracle

 

– Creating the Oracle Grid Infrastructure Owner User
# /usr/sbin/useradd -g oinstall -G asmadmin,asmdba,dba,asmoper -c “Grid Infrastructure Owner” grid

Set the password of the grid user:
# passwd grid

======================================================================================================

 

• Configure Resource Limits for Oracle User

For each installation software owner, check the resource limits for installation. To check resource limits, log in as oracle.

– Check the soft and hard limits for the file descriptor setting. Ensure that the result is in the recommended range, for example:
$ ulimit -Sn
$ ulimit -Hn

– Check the soft and hard limits for the number of processes available to a user. Ensure that the result is in the recommended range, for example:
$ ulimit -Su
$ ulimit -Hu

– Check the soft limit for the stack setting. Ensure that the result is in the recommended range, for example:
$ ulimit -Ss
$ ulimit -Hs

 

– Update the resource limits in the “/etc/security/limits.conf” configuration file for the installation owner by adding the following lines to the “/etc/security/limits.conf” file.

======================================================================================================

 

• Configure Kernel Parameters for Linux

– Make sure that the kernel parameters are set to values greater than or recommended values as shown below,

fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 4294967295
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 = 1048576

– Enter the below commands to view the current values of the kernel parameters,
# /sbin/sysctl -a | grep sem
This will display the values of semaphore parameters.

# /sbin/sysctl -a | grep shm
This will display the shared memory segment sizes.

# /sbin/sysctl -a | grep file-max
It will display the maximum number of file handles.

# /sbin/sysctl -a | grep ip_local_port_range
It will display a range of port numbers.

# /sbin/sysctl -a | grep rmem
# /sbin/sysctl -a | grep wmem
# /sbin/sysctl -a | grep aio-max-nr

 

– If the value of any kernel parameter is different from the minimum value, then using any text editor, edit the /etc/sysctl.conf file, and add or edit lines similar to the following,

# vi /etc/sysctl.conf
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 4294967295
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 = 1048576

– By specifying the values in the /etc/sysctl.conf file they persist when you restart the system. For immediate effect of the changed parameters, restart the system or run below commad.

# sysctl -p

======================================================================================================

 

• Creating Required Software directories

– Oracle Base Directory
The Oracle base directory is a top-level directory for Oracle software installation.
# mkdir -p /u01/app/oracle
# chown -R oracle.oinstall /u01/app

 

– Grid Base Directory
The Grid base directory is a top-level directory for Grid Infrastructure software installation.
# mkdir -p /u01/crs/grid
# chown -R grid.oinstall /u01/crs
# chmod -R 775 /u01/

======================================================================================================

 

• Configuring Oracle and Grid Users Environment

– Login as the oracle user and add the following lines in the “.bash_profile” file.

$ vi .bash_profile
export TMP=/tmp;
export TMPDIR=$TMP;

export ORACLE_BASE=/u01/app/oracle;
export ORACLE_HOME=$ORACLE_BASE/products/11.2.0/db;
export ORACLE_SID=asmdb;
export ORACLE_TERM=xterm;
export PATH=$ORACLE_HOME/bin:$PATH:/usr/sbin;

export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib;
export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib;

 

– Add the below entry in “/etc/profile” file as root user.

 

– Login as the grid user and add the following lines in the “.bash_profile”.

$ vi .bash_profile
export TMP=/tmp;
export TMPDIR=$TMP;

export GRID_BASE=/u01/crs/grid;
export ORACLE_BASE=$GRID_BASE;
export GRID_HOME=$ORACLE_BASE/products/11.2.0/crs;
export ORACLE_HOME=$GRID_HOME;
export PATH=$GRID_HOME/bin:$PATH:/usr/sbin;
export LD_LIBRARY_PATH=$GRID_HOME/lib;

======================================================================================================

 

• Installing Oracle Grid Infrastructure

– Login as grid user in GUI mode and perform the below steps.
$ cd /u01/software
$ unzip p10404530_112030_Linux-x86-64_3of7.zip

$ cd grid
$ ./runInstaller

– DOWNLOAD SOFTWARE UPDATES Screen

11gR2 Grid Download Software Updates Screen

Starting with Oracle Database 11g Release 2 (11.2.0.2), you can download updates before starting the installation by starting Oracle Universal Installer. You will need to provide the My Oracle Support user name and password.
For this installation we will skip the software updates.

 

– SELECT INSTALLATION OPTION Screen

11gR2 Grid Select Installation Option Screen

Select “Install Oracle Grid Infrastructure Software Only”.
Click on Next to continue.

 

– SELECT PRODUCT LANGUAGES Screen

11gR2 Grid Languages Screen

Click on Next to continue.

 

– PRIVILEGED OPERATING SYSTEM GROUPS Screen

11gR2 Grid OS Groups Screen

Here, you can see the default groups selected.
Click on Next to continue.

 

– SPECIFY INSTALLATION LOCATION Screen

11gR2 Grid Specify Installation Location Screen

By default the Oracle Base and Software Location path will already be assigned to the one that we have earlier defined.
Click on Next to continue.

 

– CREATE INVENTORY Screen

11gR2 Grid Create Inventory Screen

Verify the Inventory path and the oraInventory group name.
Click on Next to continue.

 

– SUMMARY Screen

11gR2 Grid Summary Screen

Click on Install to continue.

 

– INSTALL PRODUCT Screen

11gR2 Grid Install Product Screen

You can observe the Oracle Grid Infrastructure installation. When the installation is finished, you will get a window to execute configuration scripts as shown below.

 

11gR2 Grid Execute Configuration Scripts Screen

When the execution of root.sh script is finished, you will be asked to run the command to configure Grid Infrastructure for a Stand-Alone Server or for a Cluster. Since we are installing Grid Infrastructure for a Stand-Alone Server, execute the command shown to configure Grid Infrastructure for a Stand-Alone Server.

Now click OK on the Execute Configuration Scripts window to continue.

 

– FINISH Screen

11gR2 Grid Finish Screen

The installation of Oracle Grid Infrastructure Software is done.

======================================================================================================

 

• Installing Oracle Database Software

– Login as oracle user in GUI mode and perform the below steps.
$ cd /u01/software
$ unzip p10404530_112030_Linux-x86-64_1of7.zip
$ unzip p10404530_112030_Linux-x86-64_2of7.zip

$ cd database
$ ./runInstaller

– CONFIGURE SECURITY UPDATES Screen

11gR2 DB Configure Security Updates Screen

Uncheck the option “I wish to receive security updates” and click on Next to continue.

 

– DOWNLOAD SOFTWARE UPDATES Screen

11gR2 DB Download Software Updates Screen

Select the “Skip software updates” option and click on Next to continue.

 

– SELECT INSTALLATION OPTION Screen

11gR2 DB Select Installation Option Screen

Select “Install database software only” and click on Next to continue.

 

– GRID INSTALLATION OPTIONS Screen

11gR2 DB Grid Installation Options Screen

Select “Single Instance database installation” option and click on Next to continue.

 

– SELECT PRODUCT LANGUAGES Screen

11gR2 DB Select Product Languages Screen

Click on Next to continue.

 

– SELECT DATABASE EDITION Screen

11gR2 DB Select Database Edition Screen

Select “Enterprise Edition” and click on Next to continue.

 

– SPECIFY INSTALLATION LOCATION Screen

11gR2 DB Specify Installation Location Screen

You can see the ORACLE_BASE and ORACLE_HOME path that we had set earlier. Verify whether the path is proper and click on Next to continue.

 

– PRIVILEGED OPERATING SYSTEM GROUPS Screen

11gR2 DB Privileged OS Groups Screen

Verify the groups and click on Next to continue.

 

– SUMMARY Screen

11gR2 DB Summary Screen

Click on Install to start the installation.

 

– INSTALL PRODUCT Screen

11gR2 DB Install Product Screen

You can observe the Oracle Database Software installation. When the installation is finished, you will get a window to execute configuration scripts as shown below.

 

11gR2 DB Execute Configuration Scripts Screen

Once the scripts are executed, click on OK to end the installation.

 

– FINISH Screen

11gR2 DB Finish Screen

The installation of Oracle Database Software is complete.

======================================================================================================

 

• Preparing Disks for an Oracle ASM installation

We have 3 raw devices available for ASM configuration (sdb, sdc, sdd). The following procedure creates partitions for Oracle Database files on block devices.

– Login as root and execute below commands
# fdisk -l

# fdisk /dev/sdb

 

Always create the raw devices as primary partition and allocate the whole disk. Don’t make multiple primary partitions on a single disk for ASM installation. It might not work properly.
Do the above steps for “/dev/sdc” and “/dev/sdd” device also.

To update the kernel about new partitions, run the below command,
# partprobe

Now check whether you are able to see the newly created raw devices.
# fdisk -l

======================================================================================================

 

• ASMLib Configuration

– Determine your kernel version and accordingly download the ASMLib software from OTN.
# uname -r

– The below packages were downloaded which were suitable for my kernel.
oracleasm-2.6.18-164.el5-2.0.5-1.el5.i686.rpm
oracleasmlib-2.0.4-1.el5.i386.rpm
oracleasm-support-2.1.7-1.el5.i386.rpm

– Install the packages
# rpm -ivh oracleasm-2.6.18-164.el5-2.0.5-1.el5.i686.rpm oracleasmlib-2.0.4-1.el5.i386.rpm oracleasm-support-2.1.7-1.el5.i386.rpm

 

– Configure the ASM kernel module

The script completes the following tasks:
o Creates the /etc/sysconfig/oracleasm configuration file
o Creates the /dev/oracleasm mount point
o Mounts the ASMLib driver file system

 

– Create ASM disks for Oracle

# /etc/init.d/oracleasm listdisks
ARCHGRP
DATAGRP
LOGGRP

The ASM disks are now ready for use.

======================================================================================================

 

• RAW Device Setup

– Edit the file “/etc/sysconfig/rawdevices”, and add the below lines.

 

– Now restart the service.

 

– Change the ownership and permissions of raw devices

 

– Configure udev rules

Most of the times after rebooting the system, the above permissions and ownership gets changed to “root” user. To make these changes persistent, we need to configure udev rules.
udev rules are used to map block devices (/dev/sdb1) to raw devices (/dev/raw/raw1).

The ASM raw disks are configured. You can start your database creation now.

======================================================================================================

 

• Create ASM Instance

Since Oracle 11gr2, ASM instance creation is a part of grid infrastructure. “ASMCA” a new utility added for creating ASM instance.

– Login as grid user in GUI and execute below command
$ asmca

– CREATE ASM Screen

11gR2 ASMCA Create ASM Screen

First screen of this utility asks for ASM SYS, ASMSNAP passwords. Apart from that we have to create a disk group for storing the SPFILE.

Click on “Specify Disk Group” and you will get a window as below,

11gR2 ASMCA Create Disk Group Screen

Enter Disk Group Name: DATAGRP
Select redundancy as “External”.
Select “/dev/raw/raw1” from disks list.
Now click on OK and you will be taken back to the previous screen.

Here you can see, the Disk Group for Server Parameter file is DISKGRP.

11gR2 ASMCA Create ASM DG Screen

Now click on “Create ASM” and the diskgroup creation will get start.
Once the disk group creation is completed you will get a confirmation window as shown below.

 

11gR2 ASMCA Create ASM DG Complete Screen

Similarly create ARCHGRP and LOGGRP disk groups. Now you should see all the 3 disk groups as shown below.

11gR2 ASMCA Disk Groups Final

Click on Exit to finish the installation.

– ASM instance and disk groups have been configured. You can check the ASM instance running as below.
$ ps -ef | grep pmon

======================================================================================================

 

• Listener Configuration

– Before starting with the database creation, configure the listener and register ASM instance with it. Login as grid user.
$ netca

– If you don’t see the ASM instance register with the listener service, then do the below steps
$ export ORACLE_SID=+ASM
$ sqlplus / as sysdba
SQL> alter system register;
SQL> exit

$ lsnrctl status LISTENER
Now you will see that the ASM instance has been registered with the listener service

======================================================================================================

 

• Database Creation

– Login as oracle user in GUI and run DBCA to create the database.
$ dbca

– WELCOME Screen

11gR2 DBCA Welcome Screen

Click on Next to continue.

 

– OPERATIONS Screen

11gR2 DBCA Operations Screen

By default, the option “Create a database” will be selected.
Click on Next to continue.

 

– DATABASE TEMPLATES Screen

11gR2 DBCA Database Templates Screen

Click on Next to continue.

 

– DATABASE IDENTIFICATION Screen

11gR2 DBCA Database Identification Screen

Enter the database name and Click on Next to continue.

 

– MANAGEMENT OPTIONS Screen

11gR2 DBCA Management Options Screen

Uncheck the option “Configure Enterprise Manager”. Click on Next to continue.

 

– DATABASE CREDENTIALS Screen

11gR2 DBCA Database Credentials Screen

Enter the password and Click on Next to continue.

 

– DATABASE FILE LOCATIONS Screen

11gR2 DBCA Database File Locations Screen

Select Storage Type as Automatic Storage Management (ASM).
Select the option “Use Common Location for All Database Files”. Click on “Browse” and select the +DATAGRP disk group as common location.
Click on Next to continue.

 

– RECOVERY CONFIGURATION Screen

11gR2 DBCA Recovery Configuration Screen

Check the option “Specify Fast Recovery Area”. Click on “Browse” and select the +ARCHGRP disk group as the location for Fast Recovery Area.
Enter the size of Fast Recovery Area in Mb.
For now, we are not enabling the Archivelog mode. We will do it after the database creation is completed.
Click on Next to continue.

 

– DATABASE CONTENT Screen

11gR2 DBCA Database Content Screen

Click on Next to continue.

 

– INITIALIZATION PARAMETERS Screen

11gR2 DBCA Initialization Parameters Screen

Click on “Character Sets” tab and select the option “Use Unicode”.
Click on Next to continue.

 

– DATABASE STORAGE Screen

11gR2 DBCA Database Storage CF Screen

Click on Controlfile in the left pane. You will see the location of controlfile. Change the location for controlfile to +LOGGRP diskgroup.

 

Click on Datafiles and you will see the location where the datafiles will get generated.

 

11gR2 DBCA Database Storage LF Screen

Expand the Redo Log Groups in the left pane and click on “1”. You will see the location for Redo Log Group 1. Make sure the +LOGGRP diskgroup is selected. Similarly change the diskgroup to +LOGGRP for Redo Log Group 2 and 3.
Click on Next to continue.

 

– CREATION OPTIONS Screen

11gR2 DBCA Creation Options Screen

By default, “Create Database” option is checked. Here we have also checked the option “Generate Database Creation Scripts”.
Click on Finish to continue.

 

– CONFIRMATION Screen

11gR2 DBCA Confirmation Screen

Click on OK to start the installation.

 

– DBCA Screen

Since we had selected the option to generate database creation scripts, the DBCA will first create the scripts.

11gR2 DBCA Database Creation Scripts Screen

Click on OK to continue. The database creation will get start.

 

11gR2 DBCA Database Creation Progress Screen

You can observe the database creation process. When the database creation is complete you will get a window similar to the below.

 

11gR2 DBCA DB Creation Complete Screen

 

– The Database has been created using ASM as storage type. You can verify the same by executing the below commands.
$ ps -ef | grep pmon

$ sqlplus / as sysdba
SQL> select name, open_mode from v$database;

======================================================================================================

 

• Put database in Archivelog Mode

– Login as oracle user
$ sqlplus / as sysdba
SQL> show parameter log_archive_dest_1
[The value for this parameter will be null]

SQL> alter system set log_archive_dest_1=’LOCATION=+ARCHGRP’;

SQL> show parameter log_archive_dest_1
[Now you will see the above path as value of this parameter]

 

– Now to put database in archivelog mode, the database should be in mount mode
SQL> shutdown immediate
SQL> startup mount
SQL> alter database archivelog;

SQL> archive log list;
[You can see now the database is in archive log mode and the archive destination is the path that we had defined above.]

SQL> alter database open;

SQL> select name, open_mode, log_mode from v$database;

This completes our 11gR2 database creation using ASM.

======================================================================================================

Tags : ,, ,

13 Comments so far:

  1. michael says:

    Thank you very much for the detailed installation steps provided. It was very helpful. I followed all the steps except for the ASM disk creation – step 11 and 12, as ASMLib is optional. Keep up the good work!

  2. khalid says:

    Dear , Great work. I followed all the steps mentioned by you and successfully installed Single node ASM base Oracle 11g Installations on virtualbox. I recommend to follow this stuff …

  3. khalid amin says:

    As I have mentioned already I have installed Oracle 11gR2 ASM based on linux 5.8 via the help of your steps but when I rebooted my system, CRS services are working fine but ASM is not starting.. Kindly explain me the step by step procedure what to do when the system reboots. I hope your comments will also help those who follows your steps.
    Thanks in advance.

    • TJ says:

      Hi Khalid,

      For configuring the ASMLib, you run the command “/etc/init.d/oracleasm configure”.
      In this it asks us whether the ASM driver should be started at boot or not. If you have passed the value “y” then it should get started at boot. If you had passed the value “n” then the ASM drivers will not start at boot.

      You can again run this command and enter value “y” and then restart your system and check whether the ASM gets started or not.

      Thanks,
      TJ

  4. Ramachandran says:

    Hi ,

    First Thanks very much.
    I have done many time this configuration and currently doing production through this document. I have some doubt here. Why do you uncheck configure enterprise manager and archivelog?If we leave uncheck both this, any problem after installation and i have mapped osdba group on oinstall replace dba group.Is it problem come for future?

    • TJ says:

      Hi Ramachandran,

      If you want to configure Enterprise Manager and Archivelog during installation, you can select both the options while creation of database.
      It totally depends upon you, whether you want to use these options or not. I never configure EM and archivelog since it is a test environment.

      For the second question I think you are using dba group instead of oinstall. If that is the case, it won’t cause any problem.
      You can use the primary group as dba.

      Thanks,
      TJ

  5. khalid says:

    Hi TJ,
    I reconfigured “/etc/init.d/oracleasm configure” and reboot the system.But I received the same error as before.
    I connected with Oracle user and used the following command.
    $sys as sysdba
    Its connected to idle instance then I used the following command
    $startup
    so the following error occurred, I have followed 100% exact steps as you have recommended. I am stuck over here and Its is very critical for me. Please help me what should I do.
    Can you reach to me via email: khalid_631@yahoo.com

    ORA-01078: failure in processing system parameters
    ORA-01565: error in identifying file ‘+DATAGRP/asmdb/spfileasmdb.ora’
    ORA-17503: ksfdopn:2 Failed to open file +DATAGRP/asmdb/spfileasmdb.ora
    ORA-15077: could not locate ASM instance serving a required diskgroup
    SQL>

  6. Guhan says:

    Thank you verymuch for the step by step process for ASM database creation . Please also let me know if you have any similar kind of link for RAC installation also .

  7. Guhan says:

    Hi TJ,

    I would like to share an issue which i had faced while installing the database

    I had to edit the below file and the add the permissions manually ,so that the permissions remained static . Before this addition the permission changed back to default root after a server reboot (which in-turn did not mount the raw-devices )

    /etc/rc.d/rc.local
    chown grid.oinstall /dev/raw/raw1
    chown grid.oinstall /dev/raw/raw2
    chown grid.oinstall /dev/raw/raw3
    chmod 660 /dev/raw/raw1
    chmod 660 /dev/raw/raw2
    chmod 660 /dev/raw/raw3

    Thanks,
    M Guhan

    • TJ says:

      Hi Guhan,

      I have added configuration of “udev rules” in the “RAW Device Setup” part. This should resolve your issue.
      I had forgot to update this part in my post.

      Thanks,
      TJ

  8. khalid amin says:

    Dear All,

    As you know, I have installed Oracle 11gR2 single instance ASM base installation following the above steps recommened by TJ. But after successful installation, whenever I used to reboot my system, ASM disks were not getting mounted because the permissions of the raw devices were getting automatically changed from grid user to root user.

    So TJ advised me to configure the udev rules and my issue got resolved. Once again thank you very much TJ.

    Regards
    Khalid

Leave a Reply

Your email address will not be published. Required fields are marked *