top of page
  • Writer's pictureArun 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

oracle 11g installation with asm- download oracle 11.2.0.4 gird and database binaries

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

configure asm disks - add asm disk

Select create new disk

configure asm disks - create new disk

Select VDI and click next

configure asm disks - select vdi

Select Fixed size and click next

configure asm disks - storage on physical hard disk - select fixed size

Give 110 GB size and click on create

configure asm disks - file location and size

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

configure asm disks - disk fdisk - 1

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

oracle grid infrastructure - skip software updates
oracle grid infrastructure - configure oracle grid infrastructure for a standalone server
oracle grid infrastructure - product language
oracle grid infrastructure - create asm disk group
oracle grid infrastructure - candidate disks
oracle grid infrastructure - asm password
oracle grid infrastructure - osasm group
oracle grid infrastructure - installation location
oracle grid infrastructure - oracle home and oracle base
oracle grid infrastructure - inventory directory
oracle grid infrastructure summary
oracle grid infrastructure - execute configuration scripts
oracle grid infrastructure for a standalone server

Check the resources status

ps -ef|grep pmon
crsctl status resource -t

Create ASM Diskgroups


As grid user, start asmca utility

asm configuration assistant - disk groups

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

asm configuration assistant - name to data disk group
asm configuration assistant - configure asm disk group

Similarly create FRA diskgroup

asm configuration assistant - asm instance

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

oracle database 11g release 2 installer - configure security updates
oracle database 11g release 2 installer - download software updates
oracle database 11g release 2 installer - install database software
oracle database 11g release 2 installer - single instance database installation
oracle database 11g release 2 installer - enterprise edition
oracle database 11g release 2 installer - oracle base
oracle database 11g release 2 installer - operating system groups
oracle database 11g release 2 installer  summary
oracle database 11g release 2 installer - execute configuration scripts
oracle database 11g release 2 installer - oracle database installation

DBCA Create Primary Database


Initiate dbca and follow below screens

database configuration assistant - oracle database
database configuration assistant - create database
database configuration assistant - general purpose or transaction processing
database configuration assistant - global database name and SID
database configuration assistant - configure database control for local management
database configuration assistant - automatic maintenance tasks
database configuration assistant - password
database configuration assistant - use oracle managed files
database configuration assistant - select disk group
database configuration assistant - asm credentials
database configuration assistant - specify fast recovery area
database configuration assistant - available disk groups
database configuration assistant - fast recovery area
database configuration assistant - sample schemas

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")
all initialization parameters
database configuration assistant- sizing
database configuration assistant - database storage
database configuration assistant - genrate database creation scripts
database configuration assistant - database configuration summary
database configuration assistant - copying database files
database configuration assistant - password management

Check the database pmon status at OS level

oracle 11g installation with asm - check pmon

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

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

oracle 11g installation with asm - oracle oinstall

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

oracle 11g installation with asm - storage

Select create new disk

configure asm disks - create new disk

Select VDI and click next

configure asm disks - select vdi

Select Fixed size and click next

configure asm disks - select fixed size

Give 110 GB size and click on create

configure asm disks - file location and size

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)

configure asm disks - fdisk -1

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

oracle 11g installation with asm - check 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

oracle grid infrastructure - skip software updates
oracle grid infrastructure - configure oracle grid infrastructure for a standalone server
oracle grid infrastructure - product language
oracle grid infrastructure - create asm disk group
oracle grid infrastructure - candidate disk
oracle grid infrastructure - asm password
oracle grid infrastructure - operating system groups
oracle grid infrastructure
oracle grid infrastructure - software installation location
oracle grid infrastructure oracle base