You are on page 1of 22

How to Install Oracle Database 11g R2 on Oracle Linux 7 with

ASM
In this demo we are going to install oracle database 11gR2 with ASM (Automatic Storage Management)
on Oracle Linux 7 virtual machine which we have created in previous post.
First we have shutdown the Oracle Linux 7 VM to create virtual disks for ASM disk groups. we are going
to create three virtual hard disks with following names.

CRSDISK1 ( 2GB) for CRSVOL1 disk where Cluster Ready Services (CRS) files will
be stored. CRS provides many system management services and interacts with the
vendor clusterware to coordinate cluster membership information.
2.
DATADISK1 (10 GB) disk for DATAVOL1 disk. Here database will keep all
datafiles, control files, log files
3.
FRADISK1 (10 GB) disk for FRAVOL1 disk for database Fast Recovery Area
(FRA) files. For example: database backup files, copy of database control files.
1.

Open Virtual machine Settings and create new virtual hard disks.

After
creating
new
virtual
hard
disks
lets
power
on
the
virtual
machine,
Now we have to create recommended groups and user for Grid infrastructure. It is recommended to use a
separate
user
from
an
oracle
user.
[root@OEL7
[root@OEL7
[root@OEL7

~]#
~]#
~]#

groupadd
groupadd
groupadd

-g
-g
-g

1200
1201
1202

asmdba
asmadmin
asmoper

[root@OEL7~]# useradd -m -u 1100 -g oinstall -G asmdba,asmadmin,asmoper,dba -d /home/grid -s


/bin/bash
grid
[root@OEL7
~]#
id
grid
To
set
the
[root@OEL7 ~]# passwd grid

password

To Create directories for grid home


[root@OEL7 ~]# mkdir -p /u01/app/grid
[root@OEL7 ~]# mkdir -p/u01/app/11.2.0/grid
[root@OEL7 ~]# chown -R grid:oinstall /u01

Create directories for oracle database installation.

for

user

grid.

We have to assign oracle user to asmdba group in order to all oracle user to discover ASM disks during
database creation. oper group will be used by oracle software.

Now create login script for oracle and grid user


Login Script for oracle user:
[root@OEL7 ~]# su - oracle
[oracle@OEL7 ~]$ echo > .bash_profile
[oracle@OEL7 ~]$ vi .bash_profile
Copy and paste following and save the .bash_profile. You may skip lines in red color
#--------------------------------------------------------------------------------------------------------# .bash_profile
# --------------------------------------------------# OS User: oracle
# Application: Oracle Database Software Owner

# Version: Oracle 11g Release 2.4


# --------------------------------------------------# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
ORACLE_SID=DB11G; export ORACLE_SID
ORACLE_UNQNAME=DB11G; export ORACLE_UNQNAME
JAVA_HOME=/usr/local/java; export JAVA_HOME
ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1
export ORACLE_HOME
ORACLE_TERM=xterm; export ORACLE_TERM
NLS_DATE_FORMAT="DD-MON-YYYY HH24:MI:SS"
export NLS_DATE_FORMAT
TNS_ADMIN=$ORACLE_HOME/network/admin; export TNS_ADMIN
ORA_NLS11=$ORACLE_HOME/nls/data; export ORA_NLS11
PATH=.:${JAVA_HOME}/bin:${PATH}:$HOME/bin:$ORACLE_HOME/bin
PATH=${PATH}:/usr/bin:/bin:/usr/bin/X11:/usr/local/bin
PATH=${PATH}:/u01/app/common/oracle/bin
export PATH
LD_LIBRARY_PATH=$ORACLE_HOME/lib
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$ORACLE_HOME/oracm/lib
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/lib:/usr/lib:/usr/local/lib
export LD_LIBRARY_PATH
CLASSPATH=$ORACLE_HOME/JRE
CLASSPATH=${CLASSPATH}:$ORACLE_HOME/jlib
CLASSPATH=${CLASSPATH}:$ORACLE_HOME/rdbms/jlib
CLASSPATH=${CLASSPATH}:$ORACLE_HOME/network/jlib
export CLASSPATH
THREADS_FLAG=native; export THREADS_FLAG
export TEMP=/tmp
export TMPDIR=/tmp
umask 022
#----------------------------------------------------------------------------------------------------------------Login Script for grid user: # --------------------------------------------------[oracle@OEL7 ~]$ su - grid
Password:
[grid@OEL7 ~]$ echo > .bash_profile

[grid@OEL7 ~]$ vi .bash_profile


Copy and paste following and save the .bash_profile. You may skip lines in red color
#.bash_profile
# --------------------------------------------------# OS User: grid
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
ORACLE_SID=+ASM; export ORACLE_SID
JAVA_HOME=/usr/local/java; export JAVA_HOME
ORACLE_BASE=/u01/app/grid; export ORACLE_BASE
ORACLE_HOME=/u01/app/11.2.0/grid; export ORACLE_HOME
ORACLE_TERM=xterm; export ORACLE_TERM
NLS_DATE_FORMAT="DD-MON-YYYY HH24:MI:SS"; export NLS_DATE_FORMAT
TNS_ADMIN=$ORACLE_HOME/network/admin; export TNS_ADMIN
ORA_NLS11=$ORACLE_HOME/nls/data; export ORA_NLS11
PATH=.:${JAVA_HOME}/bin:${PATH}:$HOME/bin:$ORACLE_HOME/bin
PATH=${PATH}:/usr/bin:/bin:/usr/bin/X11:/usr/local/bin
PATH=${PATH}:/u01/app/common/oracle/bin
export PATH
LD_LIBRARY_PATH=$ORACLE_HOME/lib
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$ORACLE_HOME/oracm/lib
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/lib:/usr/lib:/usr/local/lib
export LD_LIBRARY_PATH
CLASSPATH=$ORACLE_HOME/JRE
CLASSPATH=${CLASSPATH}:$ORACLE_HOME/jlib
CLASSPATH=${CLASSPATH}:$ORACLE_HOME/rdbms/jlib
CLASSPATH=${CLASSPATH}:$ORACLE_HOME/network/jlib
export CLASSPATH
THREADS_FLAG=native; export THREADS_FLAG
export TEMP=/tmp
export TMPDIR=/tmp
umask 022
#---------------------------------------------------------------------------------------------------------Set resource limits for Oracle software installation

To improve the performance of the software on Linux systems, you must increase the
following resource limits for the Oracle software owner users ( grid).
For oracle user it has been automatically setup by the oracle-validated tool.
To make these changes, run the following as root:
Add the following lines to the /etc/security/limits.conf file
[root@OEL7 ~]# vi /etc/security/limits.conf

Enter following line at the end of file.


grid soft nproc 2047
16384

grid hard nproc


grid soft nofile 1024
grid hard nofile 65536

Add or edit the following line in the /etc/pam.d/login file, if it does not exist:
[root@OEL7 ~]# cat >> /etc/pam.d/login <<EOF
> session required pam_limits.so
> EOF

Add the following lines to the /etc/profile file by running the following command:
[root@OEL7 ~]# cat >> /etc/profile <<EOF
> if [ \$USER = "oracle" ] || [ \$USER = "grid"] ; then
> if [ \$SHELL = "/bin/ksh" ]; then
> ulimit -p 16384
> ulimit -n 65536
> else
> ulimit -u 16384 -n 65536
> fi
> umask 022
> fi
> EOF
Install oracle ASM package and create ASM disk groups:
Check if oracleasm-support package is installed or not by running following command
rpm -qa | grep oracleasm
If installed then go with Next step to install oracleasmlib, otherwise install it

One more package we need to install is oracleasmlib-2.0.12-1.el7.x86_64.rpm. Download it from


this link and install

Configure and load ASM kernel module as root user

The script completes the following:


Creates the /etc/sysconfig/oracleasm configuration file
Creates the /dev/oracleasm mount point
Enter Following lines to load the Oracle ASM kernel module
[root@oel7 ~]# /usr/sbin/oracleasm init
This will load the oracleasm module

Now Create Oracle ASM Disk Volumes, Check the available disks

We have three disks available for ASM. Now we have to create partitions to be able to use those
partitions as ASM disks.

Reboot the system to apply the changes. To List ASM disk run following.

Test disk discovery

Now we have to install Oracle Grid Infrastructure, login as grid user browse the path up-to grid extracted
folder and run the installer.

Before Running Root scripts we need to install Opath 18370031. If you have support account download
the patch and install as grid_home Owner which is grid user.

ORACLE_HOME is grid users ORACLE_HOME and /home/Downloads is the directory where we


extracted the patch 18370031

Open a new terminal window change the user to root and run the scripts.

Click OK after running Root Scripts and you will see.

At this moment we have Oracle ASM instance and related services up and
running:

To verify the installation execute the following as user grid

Check sqlplus

Create ASM disk group for Oracle Database Installation (+FRA and +DATA)
As a grid user run asmca (ASM Configuration Assistant)

Now we have to install the Oracle database 11gR2. Logout and login with user root and change
the password for user oracle as we didn't set the password for user oracle:
To set the password run following command
[root@oel7 ~] passwd oracle
Login with user oracle and extract the database archives. and you will see a folder database

You may face error like following.

Error in invoking target 'agent nmhs' of makefile


'/u01/app/oracle/product/11.2.0.4/sysman/lib/ins_emagent.mk'.

Following is the work around for above error.


In /u01/app/oracle/product/11.2.0/db_1/sysman/lib/ins_emagent.mk
Look for the line $(MK_EMAGENT_NMECTL)
Change it to $(MK_EMAGENT_NMECTL) -lnnz11
Click Retry and Setup will continue.

Oracle Database 11gR2 software has been installed successfully. Now we have to create the database
using dbca with user oracle.
[oracle@oel7 ~]$ dbca &

Database has been created successfully. Now we can use sqlplus to connect to database or Enterprise
Manager Database Control from a browser.
Lets Check sqlplus and unlock Sample Schema.

Open Browser to check Enterprise Manager Database control.

That's all. We have successfully installed oracle database 11gR2 11.2.0.4 with ASM on a Stand alone
Oracle Linux 7.1
Cheers:-)

You might also like