top of page

Install Oracle 19c with ASM

In this article we would be looking at installing Oracle 19c with ASM on Linux. This will allow us to create 19c databases on ASM disks.


Prerequisites


Start by installing required packages using yum repository

yum -y install oracle-database-preinstall-19c.x86_64
yum -y install wget oracleasm kmod-oracleasm oracleasm-support

It's nice keep your Linux system up-to-date

yum -y update
yum clean all

Create required groups and the grid user

groupadd -g 54327 asmdba
groupadd -g 54328 asmoper
groupadd -g 54329 asmadmin

useradd -u 54322 -g oinstall -G dba,asmdba,asmoper,asmadmin grid

For the oracle user to have access to ASM, it must be part of asm groups

usermod -u 500 -g oinstall -G dba,oper,asmdba,asmoper,asmadmin,kmdba,dgdba,backupdba,racdba oracle

Let's create directories for grid home, oracle home and oracle inventory

mkdir -p /u01/app/grid/19c/grid_home
mkdir -p /u01/app/oracle/19c/db_home 
mkdir -p /u01/app/oraInventory

Give ownership of each directory to respective users

chown -R oracle:oinstall /u01
chown -R grid:oinstall /u01/app/grid
chown -R grid:oinstall /u01/app/oraInventory


Setup ASM Disks


At this stage, we can proceed with ASM disks configuration and initialise it

oracleasm init
oracleasm configure -i

Default user to own the driver interface[]: grid
Default group to own the driver interface[]: oinstall
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
For the demo purpose, I have attached 30gb disk to the server and create three partitions of 10gb each for CRS, DATA and FRA

Find the list of disks attached to the server

fdisk -l

Format the newly attached 30gb disk

fdisk /dev/vdc

n
<enter>
<enter>
<enter?
+10G

n
<enter>
<enter>
<enter>
+10G

n
<enter>
<enter>
<enter>
<enter>

w        --> to save

At this stage you should have three partitions of 10gb each

fdisk -l /dev/vdc

Disk /dev/vdc: 32.2 GB, 32212254720 bytes, 62914560 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x562c57ef

   Device Boot      Start         End      Blocks   Id  System
/dev/vdc1            2048    20973567    10485760   83  Linux
/dev/vdc2        20973568    41945087    10485760   83  Linux
/dev/vdc3        41945088    62914559    10484736   83  Linux

Create three ASM disks with each partition

oracleasm createdisk CRS1 /dev/vdc1
oracleasm createdisk DATA1 /dev/vdc2
oracleasm createdisk FRA1 /dev/vdc3
oracleasm scandisks
oracleasm listdisks

Install Oracle 19c Grid


Switch to grid user and edit the .bash_profile

su - grid
vi .bash_profile

Make sure to add ORACL_BASE, ORACLE_HOME and edit PATH to include ORACLE_HOME. Once done, your .bash_profile should look like below

# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
	. ~/.bashrc
fi

# User specific environment and startup programs

export ORACLE_BASE=/u01/app/grid
export ORACLE_HOME=/u01/app/grid/19c/grid_home

PATH=$PATH:$HOME/.local/bin:$ORACLE_HOME/bin

export PATH

Create a function under .bashrc file so we can use it to quickly set environment variables for ASM instance

vi .bashrc

Put below at the end of the file

ASM()
{
export ORACLE_SID=+ASM
echo "ORACLE_SID="$ORACLE_SID
echo "ORACLE_BASE="$ORACLE_BASE
echo "ORACLE_HOME="$ORACLE_HOME
}
The ASM function will help us quickly set ORACLE_SID=+ASM so we don't have to export it manually

Execute the bash_profile once to make environmental variables changes

. .bash_profile
ASM                --> to setup ASM variables

Download Oracle 19c grid and copy the 19c software file to ORACLE_HOME location and unzip. Start the run installer to perform installation

cd $ORACLE_HOME

unzip LINUX.X64_193000_grid_home.zip

Start the gridSetup.sh to install grid

./gridSetup.sh

Follow the on screen instructions to complete Oracle 19c grid setup.



Install Oracle 19c Database


Before we proceed to install Oracle 19c database, start dbca and create DATA and FRA diskgroups to hold DB files and Fast Recovery Area

Switch to oracle user and edit the .bash_profile

su - oracle
vi .bash_profile

Make sure to add ORACL_BASE, ORACLE_HOME and edit PATH to include ORACLE_HOME. Once done, your .bash_profile should look like below

# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
	. ~/.bashrc
fi

# User specific environment and startup programs

export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=/u01/app/oracle/19c/db_home 

PATH=$PATH:$HOME/.local/bin:$ORACLE_HOME/bin

export PATH

Create a function under .bashrc file so we can use it to quickly set environment variables for ASM instance

vi .bashrc

Put below at the end of the file

orcl()
{
export ORACLE_SID=orcl
echo "ORACLE_SID="$ORACLE_SID
echo "ORACLE_BASE="$ORACLE_BASE
echo "ORACLE_HOME="$ORACLE_HOME
}
The orcl function will help us quickly set ORACLE_SID=orcl so we don't have to export it manually

Execute the bash_profile once to make environmental variables changes

. .bash_profile
orcl                --> to setup orcl variables

Download Oracle 19c and copy the 19c software file to ORACLE_HOME location and unzip. Start the run installer to perform installation

cd $ORACLE_HOME

unzip LINUX.X64_193000_db_home.zip

#for GUI installation
./runInstaller

#for silent installation
./runInstaller -ignorePrereq -waitforcompletion -silent      \
-responseFile ${ORACLE_HOME}/install/response/db_install.rsp \
oracle.install.option=INSTALL_DB_SWONLY                      \
ORACLE_HOSTNAME=${HOSTNAME}                                  \
UNIX_GROUP_NAME=oinstall                                     \
INVENTORY_LOCATION=/u01/app/oraInventory                     \
SELECTED_LANGUAGES=en,en_GB                                  \
ORACLE_HOME=${ORACLE_HOME}                                   \
ORACLE_BASE=${ORACLE_BASE}                                   \
oracle.install.db.InstallEdition=EE                          \
oracle.install.db.OSDBA_GROUP=dba                            \
oracle.install.db.OSBACKUPDBA_GROUP=dba                      \
oracle.install.db.OSDGDBA_GROUP=dba                          \
oracle.install.db.OSKMDBA_GROUP=dba                          \
oracle.install.db.OSRACDBA_GROUP=dba                         \
SECURITY_UPDATES_VIA_MYORACLESUPPORT=false                   \
DECLINE_SECURITY_UPDATES=true

Once the installation is done, run the root scripts and you are now ready to create a database on ASM using dbca



DBCA Create Database Silent Mode


You could choose to invoke dbca in graphical mode or run it in silent mode

dbca -silent -createDatabase                            \
     -templateName General_Purpose.dbc                  \
     -gdbname ${ORACLE_SID} -sid  ${ORACLE_SID}         \
     -characterSet AL32UTF8                             \
     -sysPassword enterDB#123                           \
     -systemPassword enterDB#123                        \
     -createAsContainerDatabase false                   \
     -totalMemory 2000                                  \
     -storageType ASM                                   \
     -datafileDestination +DATA                         \
     -recoveryAreaDestination +FRA                      \
     -emConfiguration NONE                              \
     -ignorePreReqs -sampleSchema true

Related Posts

Heading 2

Add paragraph text. Click “Edit Text” to customize this theme across your site. You can update and reuse text themes.

bottom of page