Oracle 12c Installation on Linux
with ASM
This guide provides a detailed walkthrough for installing Oracle Database 12c
Release 2 on Oracle Linux 7.6, using Automatic Storage Management (ASM) for
storage management.
1. System Requirements
Operating System: Oracle Linux 7.6
Memory: Minimum 2GB RAM (Recommended: 4GB or more)
Storage: Minimum 20GB free space
2. Software Downloads
Oracle Database 12c Release 2 installation files (Linux x86_64)
Oracle Grid Infrastructure software
Prerequisites
Configure Oracle ASM
Install Grid Software
Configure ASM Diskgroups
Install Oracle Software
DBCA Create Database on ASM
Prerequisites
Connect to OEL 7.6 server via putty or mobaxtrem and install
the below packages
yum -y install oracle-database-server-12cR2-preinstall
yum -y install oracleasm*
yum -y install kmod-oracleasm*
Add below OS groups
groupadd -g 54327 asmdba
groupadd -g 54328 asmoper
Add asmdba as secondary group to Oracle user
usermod -a -G asmdba oracle
Create Grid User
useradd -u 54331 -g oinstall -G dba,asmdba,asmoper,asmadmin,racdba grid
Change the password for Oracle and Grid user
passwd oracle
passwd grid
Create the Directories for Oracle Database installation
mkdir -p /u01/app/oracle
mkdir -p /u01/app/oracle/product/12.2.0/db_home
chown -R oracle:oinstall /u01
Create the Directories for Oracle Grid installation
mkdir -p /u01/app/grid
mkdir -p /u01/app/grid/product/12.2.0/grid_home
chown -R grid:oinstall /u01/app/grid
chmod -R 775 /u01
Configure Oracle ASM
Let us configure Oracle ASM
oracleasm configure -i
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
Writing Oracle ASM library driver configuration: done
Load / initiate Oracle ASM
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
Add 1GB ,5GB,5GB,5GB,5GB, 30GB HDD to virtual machine which we
will use to create 6 partitions for our ASM disks. Open Virtual machine
>> Settings >> Storage >> Controller: SATA >> Create new disk
Click Next >> Next >> Give size 30 GB >> Click on Create
Start virtual machine and login as root user to format the newly added
disk
lsblk
fdisk -1
In the above output the /dev/sdb is not yet formatted. Let's create partitions on sdb
fdisk /dev/sdb
n --> to create new partition
<enter>
<enter>
<enter>
+1G
w --> to save partition table
fdisk /dev/sdc
n --> to create new partition
<enter>
<enter>
<enter>
<enter>
+5G
w --> to save partition table
fdisk /dev/sdd
n --> to create new partition <enter>
<enter>
<enter>
<enter>
+5G
w --> to save partition table
fdisk /dev/sde
n --> to create new partition <enter>
<enter>
<enter>
<enter>
+5G
w --> to save partition table
fdisk /dev/sdf
n --> to create new partition <enter>
<enter>
<enter>
<enter>
+5G
w --> to save partition table
fdisk /dev/sdg
n --> to create new partition
<enter>
<enter>
<enter>
<enter>
+30G
w --> to save partition table
Create separate ASM Disk for each partition
oracleasm createdisk CRS1 /dev/sdb1
oracleasm createdisk DATA1 /dev/sdc1
oracleasm createdisk DATA2 /dev/sdd1
oracleasm createdisk DATA3 /dev/sde1
oracleasm createdisk DATA4 /dev/sdf1
oracleasm createdisk FRA1 /dev/sdg1
To check asm disks
oracleasm listdisks
ls -lrt /dev/oracleasm/disks
Install Grid Software
Edit Grid user Bash_Profile but take .bash_profile backup before
editing it
su – grid
cp .bash_profile .bash_profile.orig
vi .bash_profile
Paste below contents
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
ORACLE_SID=+ASM; export ORACLE_SID
ORACLE_BASE=/u01/app/grid; export ORACLE_BASE
ORACLE_HOME=/u01/app/grid/product/12.2.0/grid_home; export ORACLE_HOME
ORACLE_TERM=xterm; export ORACLE_TERM
JAVA_HOME=/usr/bin/java; export JAVA_HOME
TNS_ADMIN=$ORACLE_HOME/network/admin; export TNS_ADMIN
PATH=.:${JAVA_HOME}/bin:${PATH}:$HOME/bin:$ORACLE_HOME/bin
PATH=${PATH}:/usr/bin:/bin:/usr/local/bin
export PATH
umask 022
Save and close vi editor. Execute the bash profile and check the
environment variables
. .bash_profile
env|grep ORA
Copy the 12cR2 grid software under grid home and unzip it
cd $ORACLE_HOME
unzip linuxx64_12201_grid_home.zip
Start the gridSetup.sh which will install grid software
./gridSetup.sh
Follow below screens to perform the grid software installation
Change Disk group name as CRS
Select External
Click on Change Discovery Path
Give Disk Discovery Path as /dev/oracleasm/disks
Click on OK
Select /dev/oracleasm/disks/CRS1 >> Next
Select Use Same Password for these Accounts >> Specify password >> confirm
password >> Next. Click on Yes
Click Next >> Next
Click Next >> Next >> Next
Click on fix and check again
Copy script and paste into the Root User
Click on OK >> Check Ignore All >> Click Yes
Click on Install and wait for installer to prompt root scripts
Click on Close
Configure ASM Diskgroups
The grid installer allows you to only create one
diskgroup (CRS). We need to start the asmca utility in
order to create DATA and FRA diskgroup which are
required for database installation. Click on Create
Create 3 diskgroups
Configured 3 Disk Groups: using asmca utility
CRS: Dedicated to storing grid files for managing high availability and
.failover operations
DATA: Designed for storing database data, configured with 2 failure
.groups to ensure redundancy and data protection
FRA (Fast Recovery Area): Created to streamline backup and recovery
processes, improving disaster recovery efficiency.
Give Disk Group Name as DATA
Select normal
Select /dev/oracleasm/disks/DATA1
Select /dev/oracleasm/disks/DATA2
Select /dev/oracleasm/disks/DATA3
Select /dev/oracleasm/disks/DATA4
Make failuregroup FG1 /dev/oracleasm/disks/DATA1
/dev/oracleasm/disks/DATA2
Make failuregroup FG2 /dev/oracleasm/disks/DATA3
/dev/oracleasm/disks/DATA4
Click on OK
Click on Create
Give Disk Group Name as FRA
Select External(None)
Select /dev/oracleasm/disks/FRA1
Click on OK
Exit >> Yes
Install Oracle Software
Edit Oracle user bash profile and put below
vi .bash_profile
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
ORACLE_HOSTNAME=asm.dbagenesis.com; export ORACLE_HOSTNAME
ORACLE_SID=prod; export ORACLE_SID
ORACLE_UNQNAME=prod; export ORACLE_UNQNAME
ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE
ORACLE_HOME=/u01/app/oracle/product/12.2.0/db_home; export ORACLE_HOME
ORACLE_TERM=xterm; export ORACLE_TERM
JAVA_HOME=/usr/bin/java; export JAVA_HOME
NLS_DATE_FORMAT="DD-MON-YYYY HH24:MI:SS"; export NLS_DATE_FORMAT
TNS_ADMIN=$ORACLE_HOME/network/admin; export TNS_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:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib:$ORACL
E_HOME/network/jlib
export CLASSPATH
TEMP=/tmp ;export TMP
TMPDIR=$tmp ; export TMPDIR
umask 022
Execute the Bash_Profile
. .bash_profile
Unzip the Oracle software
cd /u01
unzip linuxx64_12201_database.zip
Start the runinstaller
cd database
./runinstaller
Uncheck the i wish to receive security updates via my oracle support
Select install database software only >> Next >> Next >> Next >> Next >> Next
Click on Install
Run the Root scripts as root user
Close the installer.
DBCA Create Database on ASM
We can now go ahead and create database on ASM with DBCA. Start DBCA >>
Create a Database >> Advance Configuration
Give Global Database name as prod
Uncheck Create as container database
Click on Next
Select Use following for the database storage attributes >> Browse
Select DATA >> Click on OK
Click on Next
Select specific fast recovery area >> Browse
Select FRA >> Click on OK
Change Fast Recovery Area Size >> Next
Click Next >> Next >> Next
Uncheck Register with Enterprise Manager(EM) database express
Select Use the same administrative password for all accounts >> Password >>
Confirm Password
Select Create the database >> Next >> Finish
Done! For confirmation purpose, connect to database as Oracle user and issue below
queries
SQL> select name, open_mode from v$database;
SQL> select name from v$datafile;
SQL> select name from v$controlfile;
We have successfully create Oracle Database on ASM!
The process remains pretty much the same when compared to 12cR1 and also with the
11gR2 release.
Reference:
https://docs.dbagenesis.com/post/oracle-12c-installation-on-
linux-with-asm