Oracle, Oracle Database May 15, 2012 20

Installing Oracle Database 11g R2 on Linux with ASM

In this guide we are going to cover Oracle Database 11g R2 installation on Linux with ASM.

Automatic Storage Management (ASM) is a feature that has be introduced in Oracle 10g to simplify the storage of Oracle datafiles, controlfiles, logfiles and backups.

ASM will be used as the file system and volume manager for Oracle Database files (data, online redo logs, control files, archived redo logs), and the Fast Recovery Area.

NOTE: ASMLib in the Unbreakable Enterprise Kernel.

ASMLib – Linux specific ASM library and its associated driver.

The Oracle ASMLib kernel driver is now included in the Unbreakable Enterprise Kernel. No driver package needs to be installed when using this kernel.

The oracleasm-support and oracleasmlib packages still need to be installed.

The oracleasm-support  can be installed from Oracle Linux ISO image. For other Linux flavors could be found here – (Download section for particular Linux distribution)

The oracleasmlib can be downloaded from ULN (Unbreakable Linux Network), subscription is required. Non-subscribers are free to use the similar package built for RHEL on their Enterprise Linux machines, which we will use in this tutorial.

 Action plan:

1. Installing Oracle Enterprise Linux and creating virtual hard disks in VMware for ASM disks

2. Creating recommended OS groups and user for Grid Infrastructure

3. Creating login scripts for grid and oracle users

4. Installing Oracle ASM packages

5. Creating ASM disk volumes

6. Downloading and installing Oracle Grid Infrastructure software

7. Creating ASM disk groups

8. Installing Oracle database software and create database instance

1. Installing Oracle Enterprise Linux and creating virtual hard disks in VMware for ASM disks

Installation of the Oracle Linux in VMware environment has been described in the following article: Installing Oracle Linux in VMware virtual machine

Once we have Oracle Linux up and running we have to shut it down and create virtual hard disks which will be used for ASM disk groups.

Normally it would be a kind of SAN storage for example, attached to the Linux OS, sometimes several disks visible as multipath devices or raw devices.

However in the end it’s always a set of available disks mounted and accessible for Linux OS like a normal physical disk drives.

We are going to create three virtual hard disks with the following names:

1. CRSDISK1 (100 MB) – 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.

Open virtual machine properties window and use wizard to create new virtual hard disks:

 Once virtual hard disks have been created power on virtual machine and let the Oracle Linux start.

2. Creating recommended OS groups and user for Grid Infrastructure

For ASM instance it is recommended to use separate user from an oracle user.

Create user “grid”, next create ASM_HOME directories for clusterware software.

[root@test-host ~]# 
groupadd -g 1200 asmadmin 
groupadd -g 1201 asmdba 
groupadd -g 1202 asmoper 
useradd -m -u 1100 -g oinstall -G asmadmin,asmdba,asmoper -d /home/grid -s /bin/bash grid 

[root@test-host ~]# id grid 
uid=1100(grid) gid=1000(oinstall) groups=1000(oinstall),1200(asmadmin),1201(asmdba),1202(asmoper) 

#Set the password for new grid account: 

[root@test-host Server]# passwd grid 
Changing password for user grid. 
New UNIX password: 
Retype new UNIX password: 
passwd: all authentication tokens updated successfully.

#Creating directories for grid home
[root@test-host ~]#
mkdir -p /u01/app/grid
mkdir -p /u01/app/11.2.0/grid
chown -R grid:oinstall /u01

 

Also now we can create directories for Oracle database installation.

[root@test-host ~]# 

mkdir -p /u01/app/oracle 

chown oracle:oinstall /u01/app/oracle 

chmod -R 775 /u01

NOTE: We have to assign oracle user also to asmdba group in order to allow oracle user to discover asm disks during the database creation. Oper group will be used by oracle software.

(solution for an issue while dbca doesn’t see ASM disks, this issue might happen when we use separate accounts for managing ASM as a grid and an oracle account to manage database instance)

[root@test-host ~]# groupadd -g 1301 oper  
[root@test-host ~]# usermod -g oinstall -G dba,oper,asmdba oracle

3. Creating login scripts for grid and oracle users

  • Login script for an oracle user:

Switch to an oracle user and edit .bash_profile file

[root@test-host ~]# su – oracle
[oracle@test-host ~]$ echo > .bash_profile 
[oracle@test-host ~]$ vi .bash_profile

 

Paste the following configuration and save the file .bash_profile

# ---------------------------------------------------
# .bash_profile
# ---------------------------------------------------
# OS User: oracle
# Application: Oracle Database Software Owner
# Version: Oracle 11g Release 2
# ---------------------------------------------------
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# ---------------------------------------------------
# ORACLE_SID
# ---------------------------------------------------
# Specifies the Oracle system identifier (SID) for
# the Oracle instance running on this node.
ORACLE_SID=TESTDB1; export ORACLE_SID
# ---------------------------------------------------
# ORACLE_UNQNAME
# ---------------------------------------------------
# In previous releases of Oracle Database, you were
# required to set environment variables for
# ORACLE_HOME and ORACLE_SID to start, stop, and
# check the status of Enterprise Manager. With
# Oracle Database 11g release 2 (11.2) and later, you
# need to set the environment variables ORACLE_HOME
# and ORACLE_UNQNAME to use Enterprise Manager.
# Set ORACLE_UNQNAME equal to the database unique
# name.
# ---------------------------------------------------
ORACLE_UNQNAME=TESTDB1; export ORACLE_UNQNAME
# ---------------------------------------------------
# JAVA_HOME
# ---------------------------------------------------
# Specifies the directory of the Java SDK and Runtime
# Environment.
# ---------------------------------------------------
JAVA_HOME=/usr/local/java; export JAVA_HOME
# ---------------------------------------------------
# ORACLE_BASE
# ---------------------------------------------------
# Specifies the base of the Oracle directory structure
# for Optimal Flexible Architecture (OFA) compliant
# database software installations.
# ---------------------------------------------------
ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE
# ---------------------------------------------------
# ORACLE_HOME
# ---------------------------------------------------
# Specifies the directory containing the Oracle
# Database software.
# ---------------------------------------------------
ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1
export ORACLE_HOME
# ---------------------------------------------------
# ORACLE_TERM
# ---------------------------------------------------
# Defines a terminal definition. If not set, it
# defaults to the value of your TERM environment
# variable. Used by all character mode products.
# ---------------------------------------------------
ORACLE_TERM=xterm; export ORACLE_TERM
# ---------------------------------------------------
# NLS_DATE_FORMAT
# ---------------------------------------------------
# Specifies the default date format to use with the
# TO_CHAR and TO_DATE functions. The default value of
# this parameter is determined by NLS_TERRITORY. The
# value of this parameter can be any valid date
# format mask, and the value must be surrounded by
# double quotation marks. For example:
#
# NLS_DATE_FORMAT = "MM/DD/YYYY"
#
# ---------------------------------------------------
NLS_DATE_FORMAT="DD-MON-YYYY HH24:MI:SS"
export NLS_DATE_FORMAT
# ---------------------------------------------------
# TNS_ADMIN
# ---------------------------------------------------
# Specifies the directory containing the Oracle Net
# Services configuration files like listener.ora,
# tnsnames.ora, and sqlnet.ora.
# ---------------------------------------------------
TNS_ADMIN=$ORACLE_HOME/network/admin; export TNS_ADMIN
# ---------------------------------------------------
# ORA_NLS11
# ---------------------------------------------------
# Specifies the directory where the language,
# territory, character set, and linguistic definition
# files are stored.
# ---------------------------------------------------
ORA_NLS11=$ORACLE_HOME/nls/data; export ORA_NLS11
# ---------------------------------------------------
# PATH
# ---------------------------------------------------
# Used by the shell to locate executable programs;
# must include the $ORACLE_HOME/bin directory.
# ---------------------------------------------------
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
# ---------------------------------------------------
# Specifies the list of directories that the shared
# library loader searches to locate shared object
# libraries at runtime.
# ---------------------------------------------------
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
# ---------------------------------------------------
# Specifies the directory or list of directories that
# contain compiled Java classes.
# ---------------------------------------------------
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
# ---------------------------------------------------
# All the tools in the JDK use green threads as a
# default. To specify that native threads should be
# used, set the THREADS_FLAG environment variable to
# "native". You can revert to the use of green
# threads by setting THREADS_FLAG to the value
# "green".
# ---------------------------------------------------
THREADS_FLAG=native; export THREADS_FLAG
# ---------------------------------------------------
# TEMP, TMP, and TMPDIR
# ---------------------------------------------------
# Specify the default directories for temporary
# files; if set, tools that create temporary files
# create them in one of these directories.
# ---------------------------------------------------
export TEMP=/tmp
export TMPDIR=/tmp
# ---------------------------------------------------
# UMASK
# ---------------------------------------------------
# Set the default file mode creation mask
# (umask) to 022 to ensure that the user performing
# the Oracle software installation creates files
# with 644 permissions.
# ---------------------------------------------------
umask 022
  • Login script for a grid user:

Switch to an oracle user and edit .bash_profile file

[oracle@test-host ~]$ su – grid
Password:   
[grid@test-host ~]$ echo > .bash_profile 
[grid@test-host ~]$ vi .bash_profile

Paste the following configuration and save changes in .bash_profile file

# ---------------------------------------------------
# .bash_profile
# ---------------------------------------------------
# OS User: grid
# Application: Oracle Grid Infrastructure
# Version: Oracle 11g Release 2
# ---------------------------------------------------
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# ---------------------------------------------------
# ORACLE_SID
# ---------------------------------------------------
# Specifies the Oracle system identifier (SID)
# for the Automatic Storage Management (ASM)instance
# running on this node.
# ---------------------------------------------------
ORACLE_SID=+ASM; export ORACLE_SID
# ---------------------------------------------------
# JAVA_HOME
# ---------------------------------------------------
# Specifies the directory of the Java SDK and Runtime
# Environment.
# ---------------------------------------------------
JAVA_HOME=/usr/local/java; export JAVA_HOME
# ---------------------------------------------------
# ORACLE_BASE
# ---------------------------------------------------
# Specifies the base of the Oracle directory structure
# for Optimal Flexible Architecture (OFA) compliant
# installations. The Oracle base directory for the
# grid installation owner is the location where
# diagnostic and administrative logs, and other logs
# associated with Oracle ASM and Oracle Clusterware
# are stored.
# ---------------------------------------------------
ORACLE_BASE=/u01/app/grid; export ORACLE_BASE
# ---------------------------------------------------
# ORACLE_HOME
# ---------------------------------------------------
# Specifies the directory containing the Oracle
# Grid Infrastructure software. For grid
# infrastructure for a cluster installations, the Grid
# home must not be placed under one of the Oracle base
# directories, or under Oracle home directories of
# Oracle Database installation owners, or in the home
# directory of an installation owner. During
# installation, ownership of the path to the Grid
# home is changed to root. This change causes
# permission errors for other installations.
# ---------------------------------------------------
ORACLE_HOME=/u01/app/11.2.0/grid; export ORACLE_HOME
# ---------------------------------------------------
# ORACLE_PATH
# ---------------------------------------------------
# Specifies the search path for files used by Oracle
# applications such as SQL*Plus. If the full path to
# the file is not specified, or if the file is not
# in the current directory, the Oracle application
# uses ORACLE_PATH to locate the file.
# This variable is used by SQL*Plus, Forms and Menu.
# ---------------------------------------------------
# ORACLE_TERM
# ---------------------------------------------------
# Defines a terminal definition. If not set, it
# defaults to the value of your TERM environment
# variable. Used by all character mode products.
# ---------------------------------------------------
ORACLE_TERM=xterm; export ORACLE_TERM
# ---------------------------------------------------
# NLS_DATE_FORMAT
# ---------------------------------------------------
# Specifies the default date format to use with the
# TO_CHAR and TO_DATE functions. The default value of
# this parameter is determined by NLS_TERRITORY. The
# value of this parameter can be any valid date
# format mask, and the value must be surrounded by
# double quotation marks. For example:
#
# NLS_DATE_FORMAT = "MM/DD/YYYY"
#
# ---------------------------------------------------
NLS_DATE_FORMAT="DD-MON-YYYY HH24:MI:SS"; export NLS_DATE_FORMAT
# ---------------------------------------------------
# TNS_ADMIN
# ---------------------------------------------------
# Specifies the directory containing the Oracle Net
# Services configuration files like listener.ora,
# tnsnames.ora, and sqlnet.ora.
# ---------------------------------------------------
TNS_ADMIN=$ORACLE_HOME/network/admin; export TNS_ADMIN
# ---------------------------------------------------
# ORA_NLS11
# ---------------------------------------------------
# Specifies the directory where the language,
# territory, character set, and linguistic definition
# files are stored.
# ---------------------------------------------------
ORA_NLS11=$ORACLE_HOME/nls/data; export ORA_NLS11
# ---------------------------------------------------
# PATH
# ---------------------------------------------------
# Used by the shell to locate executable programs;
# must include the $ORACLE_HOME/bin directory.
# ---------------------------------------------------
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
# ---------------------------------------------------
# Specifies the list of directories that the shared
# library loader searches to locate shared object
# libraries at runtime.
# ---------------------------------------------------
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
# ---------------------------------------------------
# Specifies the directory or list of directories that
# contain compiled Java classes.
# ---------------------------------------------------
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
# ---------------------------------------------------
# All the tools in the JDK use green threads as a
# default. To specify that native threads should be
# used, set the THREADS_FLAG environment variable to
# "native". You can revert to the use of green
# threads by setting THREADS_FLAG to the value
# "green".
# ---------------------------------------------------
THREADS_FLAG=native; export THREADS_FLAG
# ---------------------------------------------------
# TEMP, TMP, and TMPDIR
# ---------------------------------------------------
# Specify the default directories for temporary
# files; if set, tools that create temporary files
# create them in one of these directories.
# ---------------------------------------------------
export TEMP=/tmp
export TMPDIR=/tmp
# ---------------------------------------------------
# UMASK
# ---------------------------------------------------
# Set the default file mode creation mask
# (umask) to 022 to ensure that the user performing
# the Oracle software installation creates files
# with 644 permissions.
# ---------------------------------------------------
umask 022
Set Resource Limits for the Oracle Software Installation Users

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 (the following example shows the software account owner grid ):

[root@test-host ~]# cat >> /etc/security/limits.conf <<EOF 
grid soft nproc 2047
grid hard nproc 16384
grid soft nofile 1024
grid hard nofile 65536
EOF

Add or edit the following line in the /etc/pam.d/login file, if it does not exist:

[root@test-host ~]# cat >> /etc/pam.d/login <<EOF  
session required pam_limits.so  
EOF

 Depending on your shell environment, make the following changes to the default shell startup file, to change ulimit setting for all Oracle installation owners (note that these examples show the users oracle and grid):

  • For the Bourne, Bash, or Korn shell, add the following lines to the /etc/profile file by running the following command:
[root@test-host ~]# 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
  •  For the C shell (csh or tcsh), add the following lines to the /etc/csh.login file by running the following command:
[root@test-host ~]# cat >> /etc/csh.login <<EOF 
if ( \$USER == "oracle" || \$USER == "grid" )
 then
 limit maxproc 16384
 limit descriptors 65536
endif
EOF

 

Adjust /etc/hosts file:

Make sure that hosts file have right entries (remove or comment out line with ipv6), assign proper IP to host:

127.0.0.1 localhost.localdomain localhost
192.168.1.2 test-host.local.com test-host

4. Install Oracle ASM packages and create ASM disk groups

Oracle Linux is up and running, now we can install the oracleasm-support and oracleasm packages.

Login as a root user, mount Linux ISO image as a cd-rom (image also mounted in WMvare virtual cd-rom) device and install packages.

[root@test-host ~]# mount /dev/cdrom /media 
mount: block device /dev/cdrom is write-protected, mounting read-only 
[root@test-host ~]# cd /media/Server/

[root@test-host Server]# ls -1 oracleasm-* 
oracleasm-2.6.18-308.el5-2.0.5-1.el5.x86_64.rpm 
oracleasm-2.6.18-308.el5debug-2.0.5-1.el5.x86_64.rpm 
oracleasm-2.6.18-308.el5xen-2.0.5-1.el5.x86_64.rpm 
oracleasm-support-2.1.7-1.el5.x86_64.rpm

[root@test-host Server]# rpm -Uvh oracleasm-support-2.1.7-1.el5.x86_64.rpm 
Preparing... ########################################### [100%] 
 1:oracleasm-support ########################################### [100%]

[root@test-host Server]# rpm -Uvh oracleasm-2.6.18-308.el5-2.0.5-1.el5.x86_64.rpm 
Preparing... ########################################### [100%] 
 1:oracleasm-2.6.18-308.el########################################### [100%]

 

One more package we have to install is oracleasmlib:

Getting Oracle ASMLib via the Unbreakable Linux Network

We do not have ULN access right now.

Getting ASMLib Without a ULN Subscription

Non-subscribers are free to use the similar package built for RHEL on their Enterprise Linux machines.

Go to Oracle Technology Network and download oracleasmlib package from RHEL 5 section:

copy package to oracle server into /tmp directory and install it:

[root@test-host ~]# rpm -Uvh /tmp/oracleasmlib-2.0.4-1.el5.x86_64.rpm 
warning: /tmp/oracleasmlib-2.0.4-1.el5.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 1e5e0159 
Preparing... ########################################### [100%] 
 1:oracleasmlib ########################################### [100%]

UPDATE:

If missing the unixODBC package (32bit) also has to be installed:

[root@test-host Server]# rpm -Uvh unixODBC-2.2.11-10.el5.i386.rpm 
warning: unixODBC-2.2.11-10.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 1e5e0159 
error: failed to stat /media/OL5.8 x86_64 dvd 20120229: No such file or directory 
Preparing... ########################################### [100%] 
 1:unixODBC ########################################### [100%]

Configuring and load the ASM kernel module (as the “root” user).

[root@test-host Server]# /usr/sbin/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 []: asmadmin 
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 
[root@test-host Server]#

 

The script completes the following tasks:

  • Creates the /etc/sysconfig/oracleasm configuration file
  • Creates the /dev/oracleasm mount point
  • Mounts the ASMLib driver file system

Enter the following command to load the oracleasm kernel module:

[root@test-host Server]# /usr/sbin/oracleasm init 
Creating /dev/oracleasm mount point: /dev/oracleasm 
Loading module "oracleasm": oracleasm 
Mounting ASMlib driver filesystem: /dev/oracleasm

5. Creating ASM disk volumes

Let’s take a look at the available disks in Oracle Linux (remember we have created three additional disks for ASM)

[root@test-host ~]# fdisk -l

Disk /dev/sda: 32.2 GB, 32212254720 bytes 
255 heads, 63 sectors/track, 3916 cylinders 
Units = cylinders of 16065 * 512 = 8225280 bytes

 Device Boot Start End Blocks Id System 
/dev/sda1 * 1 13 104391 83 Linux 
/dev/sda2 14 3916 31350847+ 8e Linux LVM

Disk /dev/sdb: 103 MB, 103809024 bytes 
64 heads, 32 sectors/track, 99 cylinders 
Units = cylinders of 2048 * 512 = 1048576 bytes

Disk /dev/sdb doesn't contain a valid partition table   
Disk /dev/sdc: 10.7 GB, 10737418240 bytes  255 heads, 63 sectors/track, 1305 cylinders  Units = cylinders of 16065 * 512 = 8225280 bytes   
Disk /dev/sdc doesn't contain a valid partition table

Disk /dev/sdd: 10.7 GB, 10737418240 bytes 
255 heads, 63 sectors/track, 1305 cylinders 
Units = cylinders of 16065 * 512 = 8225280 bytes
…
…
[root@test-host ~]#

We’ve got three new disks available for ASM disks:

Disk /dev/sdb: 103 MB

Disk /dev/sdc: 10.7 GB

Disk /dev/sdd: 10.7 GB

 

First we have to create partitions to be able to use those disks as ASM disks;

  • Disk /dev/sdb (100MB)

[root@test-host ~]# fdisk /dev/sdb

Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-99, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-99, default 99):
Using default value 99

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.

  • Disk /dev/sdc

[root@test-host ~]# fdisk /dev/sdc

Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-1305, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-1305, default 1305):
Using default value 1305

Command (m for help): w
The partition table has been altered!

  • Disk /dev/sdd

[root@test-host ~]# fdisk /dev/sdd

Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-1305, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-1305, default 1305):
Using default value 1305

Command (m for help): w
The partition table has been altered!

The new table will be used at the next reboot.
Syncing disks.

System restart is required to apply all changes.

After system restart we have the following disk partitions available:

  • Disk /dev/sdb1: 103 MB –> CRSVOL1
  • Disk /dev/sdc1: 10.7 GB –> DATAVOL1
  • Disk /dev/sdd1: 10.7 GB –> FRAVOL1

 

Creating ASM disks:

[root@test-host ~]# /usr/sbin/oracleasm createdisk CRSVOL1 /dev/sdb1 
Writing disk header: done 
Instantiating disk: done

[root@test-host ~]# /usr/sbin/oracleasm createdisk DATAVOL1 /dev/sdc1 
Writing disk header: done 
Instantiating disk: done

[root@test-host ~]# /usr/sbin/oracleasm createdisk FRAVOL1 /dev/sdd1 
Writing disk header: done 
Instantiating disk: done 

#List ASM disks:

[root@test-host ~]# /usr/sbin/oracleasm listdisks 
CRSVOL1 
DATAVOL1 
FRAVOL1

 

Test disks discovery (oracle-discovery is being used by the oracle database creation assistant (dbca))

[root@test-host ~]# oracleasm-discover 
Using ASMLib from /opt/oracle/extapi/64/asm/orcl/1/libasm.so 
[ASM Library - Generic Linux, version 2.0.4 (KABI_V2)] 
Discovered disk: ORCL:CRSVOL1 [202720 blocks (103792640 bytes), maxio 256] 
Discovered disk: ORCL:DATAVOL1 [20964762 blocks (10733958144 bytes), maxio 256] 
Discovered disk: ORCL:FRAVOL1 [20964762 blocks (10733958144 bytes), maxio 256]

 

6. Downloading and installing Oracle Grid Infrastructure

Download Oracle Database 11g R 2 Grid Infrastructure (11.2.0.1.0) for Linux x86 –

Linux_11gR2_grid.zip

Copy linux.x64_11gR2_grid.zip to oracle server into /tmp directory using, for example WinSCP (here is how, Point 3)

Run Xming server on your localhost to be able to display GUI Oracle Installer (here is how, Point 2.)

  • login as a grid user using putty with Xming configuration enabled (here is how Point 5.)

unzip linux.x64_11gR2_grid.zip package to /home/grid/stage directory and run the Oracle Universal Installer:

[grid@test-host ~]$ unzip /tmp/linux.x64_11gR2_grid.zip -d /home/grid/stage

[grid@test-host ~]$ cd /home/grid/stage/grid

[grid@test-host grid]$ ./runInstaller 
Starting Oracle Universal Installer...

Checking Temp space: must be greater than 120 MB. Actual 15673 MB Passed 
Checking swap space: must be greater than 150 MB. Actual 3999 MB Passed 
Checking monitor: must be configured to display at least 256 colors. Actual 16777216 Passed 
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2022-01-11_10-65-27AM. Please wait ...

 

Oracle Grid Infrastructure installation window will popup…

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

 

[grid@test-host grid]$ ps -ef | grep grid
root      4683  3952  0 10:41 ?        00:00:00 sshd: grid [priv]
grid      4687  4683  1 10:41 ?        00:01:19 sshd: grid@pts/1
grid      4692  4687  0 10:41 pts/1    00:00:00 -bash
grid     11182     1  0 12:17 ?        00:00:05 /u01/app/11.2.0/grid/bin/ohasd.bin reboot
grid     11520     1  0 12:19 ?        00:00:02 /u01/app/11.2.0/grid/bin/oraagent.bin
grid     11539     1  0 12:19 ?        00:00:00 /u01/app/11.2.0/grid/bin/tnslsnr LISTENER -inherit
grid     11731     1  0 12:19 ?        00:00:00 /u01/app/11.2.0/grid/bin/cssdagent
grid     11733     1  0 12:19 ?        00:00:00 /u01/app/11.2.0/grid/bin/orarootagent.bin
grid     11753     1  0 12:19 ?        00:00:01 /u01/app/11.2.0/grid/bin/diskmon.bin -d -f
grid     11768     1  1 12:19 ?        00:00:05 /u01/app/11.2.0/grid/bin/ocssd.bin
grid     12009     1  0 12:20 ?        00:00:00 asm_pmon_+ASM
grid     12013     1  0 12:20 ?        00:00:00 asm_vktm_+ASM
grid     12019     1  0 12:20 ?        00:00:00 asm_gen0_+ASM
grid     12023     1  0 12:20 ?        00:00:00 asm_diag_+ASM
grid     12027     1  0 12:20 ?        00:00:00 asm_psp0_+ASM
grid     12031     1  0 12:20 ?        00:00:00 asm_dia0_+ASM
grid     12035     1  0 12:20 ?        00:00:00 asm_mman_+ASM
grid     12039     1  0 12:20 ?        00:00:00 asm_dbw0_+ASM
grid     12043     1  0 12:20 ?        00:00:00 asm_lgwr_+ASM
grid     12047     1  0 12:20 ?        00:00:00 asm_ckpt_+ASM
grid     12051     1  0 12:20 ?        00:00:00 asm_smon_+ASM
grid     12055     1  0 12:20 ?        00:00:00 asm_rbal_+ASM
grid     12059     1  0 12:20 ?        00:00:00 asm_gmon_+ASM
grid     12063     1  0 12:20 ?        00:00:00 asm_mmon_+ASM
grid     12067     1  0 12:20 ?        00:00:00 asm_mmnl_+ASM
grid     12160  4692  0 12:27 pts/1    00:00:00 ps -ef
grid     12161  4692  0 12:27 pts/1    00:00:00 grep grid

7. Creating ASM disk groups for Oracle database installation

 

Next we are going to configure ASM disk groups for Oracle Database installation (+FRA and +DATA)

Again, as a grid user run asmca (ASM Configuration Assistant)

[grid@test-host grid]$ asmca &

8. Installing Oracle database software and create database instance choosing ASM disks for data storage

First we are going to install Oracle Database software only.

How to get Oracle Database Installation packages has been described in this article: Installing Oracle Database 11g R2 on Linux

  • Assuming that oracle installation software has been downloaded and unzipped into /home/oracle/stage/database directory run the Oracle Universal Installer as an oracle user:
[oracle@test-host ~]$ cd /home/oracle/stage/database/ 
[oracle@test-host database]$ ./runInstaller 
Starting Oracle Universal Installer...

Checking Temp space: must be greater than 120 MB. Actual 12488 MB Passed 
Checking swap space: must be greater than 150 MB. Actual 3978 MB Passed 
Checking monitor: must be configured to display at least 256 colors. Actual 16777216 Passed 
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2042-03-11_12-67-50AM. Please wait ...

Once the Oracle Software has been installed we can run dbca (Database Creation Assistant) to create a database with ASM

NOTE: To avoid “insufficient privileges” errors during the database creation make sure that grid user belongs also to “dba” OS group:

PRCR-1079 : Failed to start resource ora.TESTDB1.db
ORA-01031: insufficient privileges
ORA-01031: insufficient privileges
CRS-2674: Start of 'ora.TESTDB1.db' on 'test-host' failed

checking grid user details:

[oracle@test-host database]$ id grid 
uid=1100(grid) gid=54321(oinstall) groups=54321(oinstall),54322(dba),1200(asmadmin),1201(asmdba),1202(asmoper)

As an oracle user run dbca and follow database creation wizard:

[oracle@test-host ~]$ dbca &

 

Hint: Pay attention to database control file location in initialization parameter configuration step (place control files on ASM disks +DATA and copy on +FRA):

("+DATA/{DB_UNIQUE_NAME}/control01.ctl", "+FRA/{DB_UNIQUE_NAME}/control02.ctl")

Once new database has been created we can use sqlplus to connect to a database or open Enterprise Manager Database Control in our favourite web browser (https://192.168.1.2:1158/em)

That’s all folks!

Cheers!!