Arun Kumar
Oracle 11g Installation With ASM and Data Guard Setup
In this article we will look at Oracle 11g installation with ASM storage and also setup physical standby on ASM. We will be following below steps for our configuration
We will first setup the primary server and then the standby server
Setup Primary Server
Let us create a virtual machine, install Oracle GRID (which provides us ASM) and then install oracle 11g software. The first step is to Install Oracle Linux 7.7 on Virtualbox.
Oracle Installation Prerequisites
Install below package to perform all oracle installation pre-requisites
yum -y install oracle-rdbms*
Change password for oracle user
passwd oracle
Add grid user and update password
useradd -u 54323 -g oinstall -G dba grid
passwd grid
Create necessary directories
mkdir -p /u01/app/oracle
mkdir -p /u01/app/grid
mkdir -p /u01/app/11.2.0/grid
chown -R grid:oinstall /u01
chownoracle:oinstall /u01/app/oracle
chmod -R 775 /u01
mkdir -p /u02
chown -R oracle:oinstall /u02
chmod -R 775 /u02
Download Oracle 11.2.0.4 gird and database binaries. Copy it to /u02 location

Switch to Oracle user and edit the bash profile
su - oracle
vi .bash_profile
Put below under the bash profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
export ORACLE_SID=proddb
export ORACLE_UNQNAME=proddb
export JAVA_HOME=/usr/bin/java
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1
export ORACLE_TERM=xterm
export NLS_DATE_FORMAT="DD-MON-YYYY HH24:MI:SS"
export TNS_ADMIN=$ORACLE_HOME/network/admin
PATH=.:${JAVA_HOME}/bin:${PATH}:$HOME/bin:$ORACLE_HOME/bin
PATH=${PATH}:/usr/bin:/bin:/usr/local/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
Switch to grid user and edit the bash profile
su - grid
vi .bash_profile
Put below under the bash profile
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
export ORACLE_SID=+ASM
export JAVA_HOME=/usr/bin/java
export ORACLE_BASE=/u01/app/grid
export ORACLE_HOME=/u01/app/11.2.0/grid
export ORACLE_TERM=xterm
export TNS_ADMIN=$ORACLE_HOME/network/admin
PATH=.:${JAVA_HOME}/bin:${PATH}:$HOME/bin:$ORACLE_HOME/bin
PATH=${PATH}:/usr/bin:/bin:/usr/local/bin
export PATH
export TEMP=/tmp
export TMPDIR=/tmp
umask 022
Configure ASM Disks
Our goal is to setup primary database on ASM disks. Let us proceed and configure ASM disks. Install ASM packages
yum -y install oracleasm*
yum -y install kmod-oracleasm
Configure ASM
[root@prod ~]# oracleasm configure -i
Configuring the Oracle ASM library driver.
This will configure the on-boot properties of the Oracle ASM library
driver. The following questions will determine whether the driver is
loaded on boot and what permissions it will have. The current values
will be shown in brackets ('[]'). Hitting <ENTER> without typing an
answer will keep that current value. Ctrl-C will abort.
Default user to own the driver interface []: grid
Default group to own the driver interface []: dba
Start Oracle ASM library driver on boot (y/n) [n]: y
Scan for Oracle ASM disks on boot (y/n) [y]: y
Writing Oracle ASM library driver configuration: done
Load kernel module
[root@prod ~]# oracleasm init
Creating /dev/oracleasm mount point: /dev/oracleasm
Loading module "oracleasm": oracleasm
Configuring "oracleasm" to use device physical block size
Mounting ASMlib driver filesystem: /dev/oracleasm
Shutdown the virtual machine and Add asm disk to virtual machine of 110 GB size. Go to virtual machine settings > storage > Controller SATA > Add new disk

Select create new disk

Select VDI and click next

Select Fixed size and click next

Give 110 GB size and click on create

It will take some time to create the disk. Once created, start the virtual machine. Check the new added disk is listed via fdisk -l command

Create three partitions on /dev/sdb disk to be used as ASM disks
fdisk /dev/sdb
n --> create new partition
p
1
<enter>
+50G
n
P
2
<enter>
+50G
n
p
3
<enter>
<enter>
w --> save partitions
Create asm disks. Each partition will be used as one disk inside a disk group
oracleasm createdisk DATA1 /dev/sdb1
oracleasm createdisk FRA1 /dev/sdb2
oracleasm createdisk CRS1 /dev/sdb3
Install Grid Software
Switch to grid user, unzip the grid software under /u02
su - grid
cd /u02
unzip p13390677_112040_Linux-x86-64_3of7.zip
Start the runInstaller
cd grid
./runInstaller
Follow the screens to install oracle grid software













Check the resources status
ps -ef|grep pmon
crsctl status resource -t
Create ASM Diskgroups
As grid user, start asmca utility

Click on Create. Give a name to your DATA disk group. This disk group will hold database files. Then click on OK


Similarly create FRA diskgroup

Close!
Install Oracle Database Software
Switch to oracle user, unzip oracle software under /u02
su - oracle
cd /u02
unzip p13390677_112040_Linux-x86-64_1of7_DB1.zip
unzip p13390677_112040_Linux-x86-64_2of7_DB2.zip
cd database
./runInstaller
Follow the screens to install oracle database software










DBCA Create Primary Database
Initiate dbca and follow below screens














Under Sizing Tab, click on All Initialization Parameters
Change the control files parameter to
("+DATA/{DB_UNIQUE_NAME}/control1.ctl","+FRA/{DB_UNIQUE_NAME}/control2.ctl")







Check the database pmon status at OS level

Our primary database is ready!
Setup Standby Server
Now that we have successfully installed Oracle 11g on ASM, we will proceed with setting up standby server. We will create another virtual machine and install OEL 7.
Oracle Installation Prerequisites
Update /etc/hosts file

Install below package to perform all oracle installation pre-requisites
yum -y install oracle-rdbms*
Change password for oracle user
passwd oracle
Add grid user and update password
useradd -u 54323 -g oinstall -G dba grid
passwd grid
Create necessary directories
mkdir -p /u01/app/oracle
mkdir -p /u01/app/grid
mkdir -p /u01/app/11.2.0/grid
chown -R grid:oinstall /u01
chown oracle:oinstall /u01/app/oracle
chmod -R 775 /u01
mkdir -p /u02
chown -R oracle:oinstall /u02
chmod -R 775 /u02
Download Oracle 11.2.0.4 gird and database binaries. Copy it to /u02 location

Switch to Oracle user and edit the bash profile
su - oracle
mv .bash_profile .bash_profile_orig
vi .bash_profile
Put below under the bash profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
export ORACLE_SID=proddb_st
export ORACLE_UNQNAME=proddb_st
export JAVA_HOME=/usr/bin/java
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1
export ORACLE_TERM=xterm
export NLS_DATE_FORMAT="DD-MON-YYYY HH24:MI:SS"
export TNS_ADMIN=$ORACLE_HOME/network/admin
PATH=.:${JAVA_HOME}/bin:${PATH}:$HOME/bin:$ORACLE_HOME/bin
PATH=${PATH}:/usr/bin:/bin:/usr/local/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
Switch to grid user and edit the bash profile
su - grid
mv .bash_profile .bash_profile_orig
vi .bash_profile
Put below under the bash profile
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
export ORACLE_SID=+ASM
export JAVA_HOME=/usr/bin/java
export ORACLE_BASE=/u01/app/grid
export ORACLE_HOME=/u01/app/11.2.0/grid
export ORACLE_TERM=xterm
export TNS_ADMIN=$ORACLE_HOME/network/admin
PATH=.:${JAVA_HOME}/bin:${PATH}:$HOME/bin:$ORACLE_HOME/bin
PATH=${PATH}:/usr/bin:/bin:/usr/local/bin
export PATH
export TEMP=/tmp
export TMPDIR=/tmp
umask 022
Configure ASM Disks
In this lab exercise, we will be adding ASM disks to standby server. Our goal is to setup both primary and standby database on ASM disks. Let us proceed and configure ASM disks. Install ASM packages
yum -y install oracleasm*kmod-oracleasm
Configure ASM
[root@prod ~]# oracleasm configure -i
Configuring the Oracle ASM library driver.
This will configure the on-boot properties of the Oracle ASM library
driver. The following questions will determine whether the driver is
loaded on boot and what permissions it will have. The current values
will be shown in brackets ('[]'). Hitting <ENTER> without typing an
answer will keep that current value. Ctrl-C will abort.
Default user to own the driver interface []: grid
Default group to own the driver interface []: dba
Start Oracle ASM library driver on boot (y/n) [n]: y
Scan for Oracle ASM disks on boot (y/n) [y]: y
Writing Oracle ASM library driver configuration: done
Load kernel module
[root@prod ~]# oracleasm init
Creating /dev/oracleasm mount point: /dev/oracleasm
Loading module "oracleasm": oracleasm
Configuring "oracleasm" to use device physical block size
Mounting ASMlib driver filesystem: /dev/oracleasm
Shutdown the virtual machine and Add asm disk to virtual machine of 110 GB size. Go to virtual machine settings > storage > Controller SATA > Add new disk

Select create new disk

Select VDI and click next

Select Fixed size and click next

Give 110 GB size and click on create

It will take some time to create the disk. Once created, start the virtual machine.
Check the new added disk is listed via fdisk -l command (These commands are same as prod server but run on DR server)

Create three partitions on /dev/sdb disk to be used as ASM disks
fdisk /dev/sdb
n --> create new partition
p
1
<enter>
+50G
n
P
2
<enter>
+50G
n
p
3
<enter>
<enter>
w --> save partitions
Check the partitions under /dev/sdb

Create asm disks. Each partition will be used as one disk inside a disk group
oracleasm createdisk DATA1 /dev/sdb1
oracleasm createdisk FRA1 /dev/sdb2
oracleasm createdisk CRS1 /dev/sdb3
Install Oracle Grid Software
Switch to grid user, unzip the grid software under /u02
su - grid
cd /u02
unzip p13390677_112040_Linux-x86-64_3of7.zip
cd grid directory and run the installer
cd grid
./runInstaller
Follow the screens to install oracle grid software









