Installing Oracle RAC 10g Release 2 on Linux x86
by John Smiley
Learn the basics of installing Oracle RAC 10g Release 2 on Red Hat Enterprise Linux or Novell
SUSE Enterprise Linux, from the bare metal up (for evaluation purposes only)
Contents
Overview
Background
Part I: Install Linux
Part II: Configure Linux for Oracle
Part III: Prepare the Shared Disks
Part IV: Install Oracle RAC Software
Conclusion
Overview
This guide provides a walkthrough of installing an Oracle Database 10g Release 2 RAC
database on commodity hardware for the purpose of evaluation. If you are new to Linux and/or
Oracle, this guide is for you. It starts with the basics and walks you through an installation of
Oracle Database 10g Release 2 RAC from the bare metal up.
This guide will take the approach of offering the easiest paths, with the fewest number of steps,
for accomplishing a task. This approach often means making configuration choices that would be
inappropriate for anything other than an evaluation. For that reason, this guide is not appropriate
for building production-quality environments, nor does it reflect best practices.
The three Linux distributions certified for Oracle 10g Release 2 RAC are:
Red Hat Enterprise Linux 4 (RHEL4)
Red Hat Enterprise Linux 3 (RHEL3)
Novell SUSE Linux Enterprise Server 9
We will cover both of the Linux 2.6 kernel-based distributions: RHEL4 and SLES9. RHEL3 is
not covered here.
This guide is divided into four parts: Part I covers the installation of the Linux operating system,
Part II covers configuring Linux for Oracle, Part III discusses the essentials of partitioning
shared disk, and Part IV covers installation of the Oracle software.
A Release 1 version of this guide is also available.
Background
The illustration below shows the major components of an Oracle RAC 10g Release 2
configuration. Nodes in the cluster are typically separate servers (hosts).
Hardware
At the hardware level, each node in a RAC cluster shares three things:
1. Access to shared disk storage
2. Connection to a private network
3. Access to a public network.
Shared Disk Storage
Oracle RAC relies on a shared disk architecture. The database files, online redo logs, and control
files for the database must be accessible to each node in the cluster. The shared disks also store
the Oracle Cluster Registry and Voting Disk (discussed later). There are a variety of ways to
configure shared storage including direct attached disks (typically SCSI over copper or fiber),
Storage Area Networks (SAN), and Network Attached Storage (NAS).
Private Network
Each cluster node is connected to all other nodes via a private high-speed network, also known
as the cluster interconnect or high-speed interconnect (HSI). This network is used by Oracle's
Cache Fusion technology to effectively combine the physical memory (RAM) in each host into a
single cache. Oracle Cache Fusion allows data stored in the cache of one Oracle instance to be
accessed by any other instance by transferring it across the private network. It also preserves data
integrity and cache coherency by transmitting locking and other synchronization information
across cluster nodes.
The private network is typically built with Gigabit Ethernet, but for high-volume environments,
many vendors offer proprietary low-latency, high-bandwidth solutions specifically designed for
Oracle RAC. Linux also offers a means of bonding multiple physical NICs into a single virtual
NIC (not covered here) to provide increased bandwidth and availability.
Public Network
To maintain high availability, each cluster node is assigned a virtual IP address (VIP). In the
event of node failure, the failed node's IP address can be reassigned to a surviving node to allow
applications to continue accessing the database through the same IP address.
Configuring the Cluster Hardware
There are many different ways to configure the hardware for an Oracle RAC cluster. Our
configuration here uses two servers with two CPUs, 1GB RAM, two Gigabit Ethernet NICs, a
dual channel SCSI host bus adapter (HBA), and eight SCSI disks connected via copper to each
host (four disks per channel). The disks were configured as Just a Bunch Of Disks (JBOD)—that
is, with no hardware RAID controller.
Software
At the software level, each node in a RAC cluster needs:
1. An operating system
2. Oracle Clusterware
3. Oracle RAC software
4. An Oracle Automatic Storage Management (ASM) instance (optional).
Operating System
Oracle RAC is supported on many different operating systems. This guide focuses on Linux. The
operating system must be properly configured for the OS--including installing the necessary
software packages, setting kernel parameters, configuring the network, establishing an account
with the proper security, configuring disk devices, and creating directory structures. All these
tasks are described in this guide.
Oracle Cluster Ready Services becomes Oracle Clusterware
Oracle RAC 10g Release 1 introduced Oracle Cluster Ready Services (CRS), a platform-
independent set of system services for cluster environments. In Release 2, Oracle has renamed
this product to Oracle Clusterware.
Clusterware maintains two files: the Oracle Cluster Registry (OCR) and the Voting Disk. The
OCR and the Voting Disk must reside on shared disks as either raw partitions or files in a cluster
filesystem. This guide describes creating the OCR and Voting Disks using a cluster filesystem
(OCFS2) and walks through the CRS installation.
Oracle RAC Software
Oracle RAC 10g Release 2 software is the heart of the RAC database and must be installed on
each cluster node. Fortunately, the Oracle Universal Installer (OUI) does most of the work of
installing the RAC software on each node. You only have to install RAC on one node—OUI
does the rest.
Oracle Automatic Storage Management (ASM)
ASM is a new feature in Oracle Database 10g that provides the services of a filesystem, logical
volume manager, and software RAID in a platform-independent manner. Oracle ASM can stripe
and mirror your disks, allow disks to be added or removed while the database is under load, and
automatically balance I/O to remove "hot spots." It also supports direct and asynchronous I/O
and implements the Oracle Data Manager API (simplified I/O system call interface) introduced
in Oracle9i.
Oracle ASM is not a general-purpose filesystem and can be used only for Oracle data files, redo
logs, control files, and the RMAN Flash Recovery Area. Files in ASM can be created and named
automatically by the database (by use of the Oracle Managed Files feature) or manually by the
DBA. Because the files stored in ASM are not accessible to the operating system, the only way
to perform backup and recovery operations on databases that use ASM files is through Recovery
Manager (RMAN).
ASM is implemented as a separate Oracle instance that must be up if other databases are to be
able to access it. Memory requirements for ASM are light: only 64MB for most systems. In
Oracle RAC environments, an ASM instance must be running on each cluster node.
Part I: Installing Linux
Install and Configure Linux as described in the first guide in this series. You will need three IP
addresses for each server: one for the private network, one for the public network, and one for
the virtual IP address. Use the operating system's network configuration tools to assign the
private and public network addresses. Do not assign the virtual IP address using the operating
system's network configuration tools; this will be done by the Oracle Virtual IP Configuration
Assistant (VIPCA) during Oracle RAC software installation.
Red Hat Enterprise Linux 4 (RHEL4)
Required Kernel:
2.6.9-11.EL or higher
Verify kernel version:
# uname -r
2.6.9-22.ELsmp
Other required package versions (or higher):
binutils-2.15.92.0.2-10.EL4
compat-db-4.1.25-9
control-center-2.8.0-12
gcc-3.4.3-9.EL4
gcc-c++-3.4.3-9.EL4
glibc-2.3.4-2
glibc-common-2.3.4-2
gnome-libs-1.4.1.2.90-44.1
libstdc++-3.4.3-9.EL4
libstdc++-devel-3.4.3-9.EL4
make-3.80-5
pdksh-5.2.14-30
sysstat-5.0.5-1
xscreensaver-4.18-5.rhel4.2
Verify installed packages:
# rpm -q binutils compat-db control-center gcc gcc-c++ glibc glibc-common \
gnome-libs libstdc++ libstdc++-devel make pdksh sysstat xscreensaver
binutils-2.15.92.0.2-15
compat-db-4.1.25-9
control-center-2.8.0-12.rhel4.2
gcc-3.4.4-2
gcc-c++-3.4.4-2
glibc-2.3.4-2.13
glibc-common-2.3.4-2.13
gnome-libs-1.4.1.2.90-44.1
libstdc++-3.4.4-2
libstdc++-devel-3.4.4-2
make-3.80-5
pdksh-5.2.14-30.3
sysstat-5.0.5-1
xscreensaver-4.18-5.rhel4.9
SUSE Linux Enterprise Server 9 (SLES9)
Required Package Sets:
Basis Runtime System
YaST
Graphical Base System
Linux Tools
KDE Desktop Environment
C/C++ Compiler and Tools (not selected by default)
Do not install:
Authentication Server (NIS, LDAP, Kerberos)
Required Kernel:
2.6.5-7.97 or higher
Verify kernel version:
# uname -r
2.6.5-7.97-smp
Other required package versions (or higher):
gcc-3.3
gcc-c++-3.3.3-43
glibc-2.3.3-98.28
libaio-0.3.98-18
libaio-devel-0.3.98-18
make-3.80
openmotif-libs-2.2.2-519.1
Verify installed packages:
# rpm -q gcc gcc-c++ glibc libaio libaio-devel make openmotif-libs
gcc-3.3.3-43.24
gcc-c++-3.3.3-43.24
libaio-0.3.98-18.3
libaio-devel-0.3.98-18.3
make-3.80-184.1
openmotif-libs-2.2.2-519.1
Part II: Configure Linux for Oracle
Create the Oracle Groups and User Account
Next we'll create the Linux groups and user account that will be used to install and maintain the
Oracle 10g Release 2 software. The user account will be called 'oracle' and the groups will be
'oinstall' and 'dba.' Execute the following commands as root on one cluster node only:
/usr/sbin/groupadd oinstall
/usr/sbin/groupadd dba
/usr/sbin/useradd -m -g oinstall -G dba oracle
id oracle
Ex:
# /usr/sbin/groupadd oinstall
# /usr/sbin/groupadd dba
# /usr/sbin/useradd -m -g oinstall -G dba oracle
# id oracle
uid=501(oracle) gid=501(oinstall) groups=501(oinstall),502(dba)
The User ID and Group IDs must be the same on all cluster nodes. Using the information from
the id oracle command, create the Oracle Groups and User Account on the remaining cluster
nodes:
/usr/sbin/groupadd -g 501 oinstall
/usr/sbin/groupadd -g 502 dba
/usr/sbin/useradd -m -u 501 -g oinstall -G dba oracle
Ex:
# /usr/sbin/groupadd -g 501 oinstall
# /usr/sbin/groupadd -g 502 dba
# /usr/sbin/useradd -m -u 501 -g oinstall -G dba oracle
# id oracle
uid=501(oracle) gid=501(oinstall) groups=501(oinstall),502(dba)
Set the password on the oracle account:
# passwd oracle
Changing password for user oracle.
New password:
Retype new password:
passwd: all authentication tokens updated successfully.
Create Mount Points
Now create mount points to store the Oracle 10g Release 2 software. This guide will adhere to
the Optimal Flexible Architecture (OFA) for the naming conventions used in creating the
directory structure. For more information on OFA standards, see Appendix D of the Oracle
Database 10g Release 2 Installation Guide.
Issue the following commands as root:
mkdir -p /u01/app/oracle
chown -R oracle:oinstall /u01/app/oracle
chmod -R 775 /u01/app/oracle
Ex:
# mkdir -p /u01/app/oracle
# chown -R oracle:oinstall /u01/app/oracle
# chmod -R 775 /u01/app/oracle
Configure Kernel Parameters
Login as root and configure the Linux kernel parameters on each node.
cat >> /etc/sysctl.conf > /etc/security/limits.conf > /etc/pam.d/login > /etc/profile > /etc/csh.login > /etc/profile.local > /etc/csh.login.local > /etc/rc.d/rc.local > /etc/init.d/boot.local > ~/.ssh/authorized_keys
cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys
Now copy the keys to the other node so that we can ssh to the remote node without being
prompted for a password.
ssh oracle@ds2 cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
(If you are cut and pasting these commands, run each of them separately. SSH will prompt for
the oracle password each time and if the commands are pasted at the same time, the other
commands will be lost when the first one flushes the input buffer prior to prompting for the
password.)
ssh oracle@ds2 cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys
chmod 644 ~/.ssh/authorized_keys
Ex:
$ cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
$ cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys
$ ssh oracle@ds2 cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
The authenticity of host 'ds2 (192.168.200.52)' can't be established.
RSA key fingerprint is d1:23:a7:df:c5:fc:4e:10:d2:83:60:49:25:e8:eb:11.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'ds2,192.168.200.52' (RSA) to the list of known
hosts.
oracle@ds2's password:
$ ssh oracle@ds2 cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys
oracle@ds2's password:
$ chmod 644 ~/.ssh/authorized_keys
Now do the same for the second node. Notice that this time SSH will prompt for the passphrase
you used when creating the keys rather than the oracle password. This is because the first node
(ds1) now knows the public keys for the second node and SSH is now using a different
authentication protocol. Note, if you didn't enter a passphrase when creating the keys with ssh-
keygen, you will not be prompted for one here.
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys
ssh oracle@ds1 cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
ssh oracle@ds1 cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys
chmod 644 ~/.ssh/authorized_keys
Ex:
$ cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
$ cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys
$ ssh oracle@ds1 cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
The authenticity of host 'ds1 (192.168.200.51)' can't be established.
RSA key fingerprint is bd:0e:39:2a:23:2d:ca:f9:ea:71:f5:3d:d3:dd:3b:65.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'ds1,192.168.200.51' (RSA) to the list of known
hosts.
Enter passphrase for key '/home/oracle/.ssh/id_rsa':
$ ssh oracle@ds1 cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys
Enter passphrase for key '/home/oracle/.ssh/id_rsa':
$ chmod 644 ~/.ssh/authorized_keys
Establish User Equivalence
Finally, after all of the generating of keys, copying of files, and repeatedly entering passwords
and passphrases (isn't security fun?), you're ready to establish user equivalence. When user
equivalence is established, you won't be prompted for a password again.
As oracle on the node where the Oracle 10g Release 2 software will be installed (ds1):
exec /usr/bin/ssh-agent $SHELL
/usr/bin/ssh-add
Ex:
$ exec /usr/bin/ssh-agent $SHELL
$ /usr/bin/ssh-add
Enter passphrase for /home/oracle/.ssh/id_rsa:
Identity added: /home/oracle/.ssh/id_rsa (/home/oracle/.ssh/id_rsa)
Identity added: /home/oracle/.ssh/id_dsa (/home/oracle/.ssh/id_dsa)
(Note that user equivalence is established for the current session only. If you switch to a different
session or log out and back in, you will have to run ssh-agent and ssh-add again to re-establish
user equivalence.)
Test Connectivity
If everything is set up correctly, you can now use ssh to log in, execute programs, and copy files
on the other cluster nodes without having to enter a password. Verify user equivalence by
running a simple command like date on a remote cluster node:
$ ssh ds2 date
Sat Jan 21 13:31:07 PST 2006
It is crucial that you test connectivity in each direction from all servers. That will ensure that
messages like the one below do not occur when the OUI attempts to copy files during CRS and
database software installation. This message will only occur the first time an operation on a
remote node is performed, so by testing the connectivity, you not only ensure that remote
operations work properly, you also complete the initial security key exchange.
The authenticity of host 'ds2 (192.168.200.52)' can't be established.
RSA key fingerprint is 8f:a3:19:76:ca:4f:71:85:42:c2:7a:da:eb:53:76:85.
Are you sure you want to continue connecting (yes/no)? yes
Part III: Prepare the Shared Disks
Both Oracle Clusterware and Oracle RAC require access to disks that are shared by each node in
the cluster. The shared disks must be configured using one of the following methods. Note that
you cannot use a "standard" filesystem such as ext3 for shared disk volumes since such file
systems are not cluster aware.
For Clusterware:
1. OCFS (Release 1 or 2)
2. raw devices
3. third party cluster filesystem such as GPFS or Veritas
For RAC database storage:
1. OCFS (Release 1 or 2)
2. ASM
3. raw devices
4. third party cluster filesystem such as GPFS or Veritas
This guide covers installations using OCFS2 and ASM. If you have a small number of shared
disks, you may wish to use OCFS2 for both Oracle Clusterware and the Oracle RAC database
files. If you have more than a few shared disks, consider using ASM for Oracle RAC database
files for the performance benefits ASM provides. Note that ASM cannot be used to store Oracle
Clusterware files since Clusterware must be installed before ASM (ASM depends upon the
services of Oracle Clusterware). This guide uses OCFS2 for Oracle Clusterware files.
Partition the Disks
In order to use either OCFS2 or ASM, you must have unused disk partitions available. This
section describes how to create the partitions that will be used for OCFS2 and for ASM.
WARNING: Improperly partitioning a disk is one of the surest and fastest ways to wipe out
everything on your hard disk. If you are unsure how to proceed, stop and get help, or you will
risk losing data.
This example uses /dev/sdb (an empty SCSI disk with no existing partitions) to create a single
partition for the entire disk (36 GB).
Ex:
# fdisk /dev/sdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF
disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.
The number of cylinders for this disk is set to 4427.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)
Command (m for help): p
Disk /dev/sdb: 255 heads, 63 sectors, 4427 cylinders
Units = cylinders of 16065 * 512 bytes
Device Boot Start End Blocks Id System
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-4427, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-4427, default 4427):
Using default value 4427
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
WARNING: If you have created or modified any DOS 6.x
partitions, please see the fdisk manual page for additional
information.
Syncing disks.
Now verify the new partition:
Ex:
# fdisk -l /dev/sdb
Disk /dev/sdb: 36.4 GB, 36420075008 bytes
255 heads, 63 sectors/track, 4427 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 * 1 4427 35559846 83 Linux
Repeat the above steps for each disk to be partitioned. Disk partitioning should be done from
one node only. When finished partitioning, run the 'partprobe' command as root on each of the
remaining cluster nodes in order to assure that the new partitions are configured.
Ex:
# partprobe
Oracle Cluster File System (OCFS) Release 2
OCFS2 is a general-purpose cluster file system that can be used to store Oracle Clusterware files,
Oracle RAC database files, Oracle software, or any other types of files normally stored on a
standard filesystem such as ext3. This is a significant change from OCFS Release 1, which only
supported Oracle Clusterware files and Oracle RAC database files.
Obtain OCFS2
OCFS2 is available free of charge from Oracle as a set of three RPMs: a kernel module, support
tools, and a console. There are different kernel module RPMs for each supported Linux kernel
so be sure to get the OCFS2 kernel module for your Linux kernel. OCFS2 kernel modules may
be downloaded from http://oss.oracle.com/projects/ocfs2/files/ and the tools and console may be
downloaded from http://oss.oracle.com/projects/ocfs2-tools/files/.
To determine the kernel-specific module that you need, use uname -r.
# uname -r
2.6.9-22.ELsmp
For this example I downloaded:
ocfs2console-1.0.3-1.i386.rpm
ocfs2-tools-1.0.3-1.i386.rpm
ocfs2-2.6.9-22.ELsmp-1.0.7-1.i686.rpm
Install OCFS2 as root on each cluster node
# rpm -ivh ocfs2console-1.0.3-1.i386.rpm \
ocfs2-tools-1.0.3-1.i386.rpm \
ocfs2-2.6.9-22.ELsmp-1.0.7-1.i686.rpm
Preparing... ###########################################
[100%]
1:ocfs2-tools ########################################### [
33%]
2:ocfs2console ########################################### [
67%]
3:ocfs2-2.6.9-22.ELsmp ###########################################
[100%]
Configure OCFS2
Run ocfs2console as root:
# ocfs2console
Select Cluster → Configure Nodes
Click on Add and enter the Name and IP Address of each node in the cluster
Once all of the nodes have been added, click on Cluster --> Propagate Configuration. This will
copy the OCFS2 configuration file to each node in the cluster. You may be prompted for root
passwords as ocfs2console uses ssh to propagate the configuration file. Leave the OCFS2
console by clicking on File --> Quit. It is possible to format and mount the OCFS2 partitions
using the ocfs2console GUI; however, this guide will use the command line utilities.
Enable OCFS2 to start at system boot:
As root, execute the following command on each cluster node to allow the OCFS2 cluster stack
to load at boot time:
/etc/init.d/o2cb enable
Ex:
# /etc/init.d/o2cb enable
Writing O2CB configuration: OK
Loading module "configfs": OK
Mounting configfs filesystem at /config: OK
Loading module "ocfs2_nodemanager": OK
Loading module "ocfs2_dlm": OK
Loading module "ocfs2_dlmfs": OK
Mounting ocfs2_dlmfs filesystem at /dlm: OK
Starting cluster ocfs2: OK
Create a mount point for the OCFS filesystem
As root on each of the cluster nodes, create the mount point directory for the OCFS2 filesystem
Ex:
# mkdir /u03
Create the OCFS2 filesystem on the unused disk partition
The example below creates an OCFS2 filesystem on the unused /dev/sdc1 partition with a
volume label of "/u03" (-L /u03), a block size of 4K (-b 4K) and a cluster size of 32K (-C 32K)
with 4 node slots (-N 4). See the OCFS2 Users Guide for more information on mkfs.ocfs2
command line options.
Ex:
# mkfs.ocfs2 -b 4K -C 32K -N 4 -L /u03 /dev/sdc1
mkfs.ocfs2 1.0.3
Filesystem label=/u03
Block size=4096 (bits=12)
Cluster size=32768 (bits=15)
Volume size=36413280256 (1111245 clusters) (8889960 blocks)
35 cluster groups (tail covers 14541 clusters, rest cover 32256 clusters)
Journal size=33554432
Initial number of node slots: 4
Creating bitmaps: done
Initializing superblock: done
Writing system files: done
Writing superblock: done
Writing lost+found: done
mkfs.ocfs2 successful
Mount the OCFS2 filesystem
Since this filesystem will contain the Oracle Clusterware files and Oracle RAC database files, we
must ensure that all I/O to these files uses direct I/O (O_DIRECT). Use the "datavolume" option
whenever mounting the OCFS2 filesystem to enable direct I/O. Failure to do this can lead to
data loss in the event of system failure.
Ex:
# mount -t ocfs2 -L /u03 -o datavolume /u03
Notice that the mount command uses the filesystem label (-L u03) used during the creation of
the filesystem. This is a handy way to refer to the filesystem without having to remember the
device name.
To verify that the OCFS2 filesystem is mounted, issue the mount command or run df:
# mount -t ocfs2
/dev/sdc1 on /u03 type ocfs2 (rw,_netdev,datavolume)
# df /u03
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sdc1 35559840 138432 35421408 1% /u03
The OCFS2 filesystem can now be mounted on the other cluster nodes.
To automatically mount the OCFS2 filesystem at system boot, add a line similar to the one
below to /etc/fstab on each cluster node:
LABEL=/u03 /u03 ocfs2 _netdev,datavolume,nointr 0 0
Create the directories for shared files
CRS files
mkdir /u03/oracrs
chown oracle:oinstall /u03/oracrs
chmod 775 /u03/oracrs
Database files
mkdir /u03/oradata
chown oracle:oinstall /u03/oradata
chmod 775 /u03/oradata
Automatic Storage Management (ASM)
ASM was a new storage option introduced with Oracle Database 10gR1 that provides the
services of a filesystem, logical volume manager, and software RAID in a platform-independent
manner. ASM can stripe and mirror your disks, allow disks to be added or removed while the
database is under load, and automatically balance I/O to remove "hot spots." It also supports
direct and asynchronous I/O and implements the Oracle Data Manager API (simplified I/O
system call interface) introduced in Oracle9i.
ASM is not a general-purpose filesystem and can be used only for Oracle data files, redo logs,
control files, and flash recovery area. Files in ASM can be created and named automatically by
the database (by use of the Oracle Managed Files feature) or manually by the DBA. Because the
files stored in ASM are not accessible to the operating system, the only way to perform backup
and recovery operations on databases that use ASM files is through Recovery Manager (RMAN).
ASM is implemented as a separate Oracle instance that must be up if other databases are to be
able to access it. Memory requirements for ASM are light: only 64 MB for most systems.
Installing ASM
On Linux platforms, ASM can use raw devices or devices managed via the ASMLib interface.
Oracle recommends ASMLib over raw devices for ease-of-use and performance reasons.
ASMLib 2.0 is available for free download from OTN. This section walks through the process of
configuring a simple ASM instance by using ASMLib 2.0 and building a database that uses ASM
for disk storage.
Determine Which Version of ASMLib You Need
ASMLib 2.0 is delivered as a set of three Linux packages:
oracleasmlib-2.0 - the ASM libraries
oracleasm-support-2.0 - utilities needed to administer ASMLib
oracleasm - a kernel module for the ASM library
Each Linux distribution has its own set of ASMLib 2.0 packages, and within each distribution,
each kernel version has a corresponding oracleasm package. The following paragraphs describe
how to determine which set of packages you need.
First, determine which kernel you are using by logging in as root and running the following
command:
uname -rm
Ex:
# uname -rm
2.6.9-22.ELsmp i686
The example shows that this is a 2.6.9-22 kernel for an SMP (multiprocessor) box using Intel
i686 CPUs.
Use this information to find the correct ASMLib packages on OTN:
1. Point your Web browser
to http://www.oracle.com/technology/tech/linux/asmlib/index.html
2. Select the link for your version of Linux.
3. Download the oracleasmlib and oracleasm-support packages for your version of Linux
4. Download the oracleasm package corresponding to your kernel. In the example above,
the oracleasm-2.6.9-22.ELsmp-2.0.0-1.i686.rpm package was used.
Next, install the packages by executing the following command as root:
rpm -Uvh oracleasm-kernel_version-
asmlib_version.cpu_type.rpm \
oracleasmlib-asmlib_version.cpu_type.rpm \
oracleasm-support-asmlib_version.cpu_type.rpm
Ex:
# rpm -Uvh \
> oracleasm-2.6.9-22.ELsmp-2.0.0-1.i686.rpm \
> oracleasmlib-2.0.1-1.i386.rpm \
> oracleasm-support-2.0.1-1.i386.rpm
Preparing...
########################################### [100%]
1:oracleasm-support
########################################### [ 33%]
2:oracleasm-2.6.9-
22.ELsm########################################### [ 67%]
3:oracleasmlib
########################################### [100%]
Configuring ASMLib
Before using ASMLib, you must run a configuration script to prepare the driver. Run the
following command as root, and answer the prompts as shown in the example below. Run this
on each node in the cluster.
# /etc/init.d/oracleasm configure
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 without typing an
answer will keep that current value. Ctrl-C will abort.
Default user to own the driver interface []: oracle
Default group to own the driver interface []: dba
Start Oracle ASM library driver on boot (y/n) [n]: y
Fix permissions of Oracle ASM disks on boot (y/n) [y]: y
Writing Oracle ASM library driver configuration: [ OK ]
Creating /dev/oracleasm mount point: [ OK ]
Loading module "oracleasm": [ OK ]
Mounting ASMlib driver filesystem: [ OK ]
Scanning system for ASM disks: [ OK ]
Next you tell the ASM driver which disks you want it to use. Oracle recommends that each disk
contain a single partition for the entire disk. See Partitioning the Disks at the beginning of this
section for an example of creating disk partitions.
You mark disks for use by ASMLib by running the following command as root from one of the
cluster nodes:
/etc/init.d/oracleasm createdisk DISK_NAME device_name
Tip: Enter the DISK_NAME in UPPERCASE letters.
Ex:
# /etc/init.d/oracleasm createdisk VOL1 /dev/sdb1
Marking disk "/dev/sdb1" as an ASM disk: [ OK ]
# /etc/init.d/oracleasm createdisk VOL1 /dev/sdc1
Marking disk "/dev/sdc1" as an ASM disk: [ OK ]
# /etc/init.d/oracleasm createdisk VOL1 /dev/sdd1
Marking disk "/dev/sdd1" as an ASM disk: [ OK ]
Verify that ASMLib has marked the disks:
# /etc/init.d/oracleasm listdisks
VOL1
VOL2
VOL3
On all other cluster nodes, run the following command as root to scan for configured ASMLib
disks:
/etc/init.d/oracleasm scandisks
Part IV: Install Oracle Software
Oracle Database 10g Release 2 can be downloaded from OTN. Oracle offers a development and
testing license free of charge. However, no support is provided and the license does not permit
production use. A full description of the license agreement is available on OTN.
The easiest way to make the Oracle Database 10g Release 2 distribution media available on your
server is to download them directly to the server.
Use the graphical login to log in as oracle.
Create a directory to contain the Oracle Database 10g Release 2 distribution:
mkdir 10gR2
To download Oracle Database 10g Release 2 from OTN, point your browser (Firefox works
well) to
http://www.oracle.com/technology/software/products/database/oracle10g/htdocs/10201linuxsoft.
html. Fill out the Eligibility Export Restrictions page, and read the OTN License agreement. If
you agree with the restrictions and the license agreement, click on I Accept.
Click on the 10201_database_linux32.zip link, and save the file in the directory you created for
this purpose —if you have not already logged in to OTN, you may be prompted to do so at this
point.
Since you will be creating a RAC database, you will also need to download and install Oracle
Clusterware Release 2. Click on the 10201_clusterware_linux32.zip link and save the file.
Unzip and extract the files:
cd 10gR2
unzip 10201_database_linux32.zip
unzip 10201_clusterware_linux32.zip
Establish User Equivalency and Set Environment Variables
If you have not already done so, login as oracle and establish user equivalency between nodes:
exec /usr/bin/ssh-agent $SHELL
/usr/bin/ssh-add
Enter passphrase for /home/oracle/.ssh/id_rsa:
Identity added: /home/oracle/.ssh/id_rsa (/home/oracle/.ssh/id_rsa)
Identity added: /home/oracle/.ssh/id_dsa (/home/oracle/.ssh/id_dsa)
Set the ORACLE_BASE environment variable:
ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE
Install Oracle Clusterware
Before installing the Oracle RAC 10g Release 2 database software, you must first install Oracle
Clusterware. Oracle Clusterware requires two files to be shared among all of the nodes in the
cluster: the Oracle Cluster Registry (100MB) and the Voting Disk (20MB). These files may be
stored on raw devices or on a cluster filesystem. (NFS is also supported for certified NAS
systems, but that is beyond the scope of this guide.) Oracle ASM may not be used for these files
because ASM is dependent upon services provided by Clusterware. This guide will use OCFS2
as a cluster filesystem to store the Oracle Cluster Registry and Voting Disk files.
Start the installation using "runInstaller" from the "clusterware" directory:
1. Welcome
o Click on Next
2. Specify Inventory Directory and Credentials
o The defaults should be correct
o Click on Next
3. Specify Home Details
o Name: OraCRS_Home
o Path: /u01/app/oracle/product/crs
3.
Product-Specific Prerequisite Checks
o Correct any problems found before proceeding.
o Click on Next
Specify Cluster Configuration
o Enter the cluster name (or accept the default of "crs");
Specify Network Interface Usage - Specify the Interface Type (public, private, or "do no
use") for each interface
Specify Oracle Cluster Registry (OCR) Location
o Choose External Redundancy and enter the full pathname of the OCR file (ex:
/u03/oracrs/ocr.crs).
Specify Voting Disk Location
o Choose External Redundancy and enter the full pathname of the voting disk file
(ex: /u03/oracrs/vote.crs)
Summary
o Click on Install
Execute Configuration Scripts
o Execute the scripts as root on each node, one at a time, starting with the
installation node.
o Do not run the scripts simultaneously. Wait for one to finish before starting
another.
o Click on OK to dismiss the window when done.
End of Clusterware Installation
Verify that the installation succeeded by running olsnodes from the
$ORACLE_BASE/product/crs/bin directory; for example:
$ /u01/app/oracle/product/crs/bin/olsnodes
ds1
ds2
Once Oracle Clusterware is installed and operating, it's time to install the rest of the Oracle RAC
software.
Create the ASM Instance
If you are planning to use OCFS2 for database storage, skip this section and continue with Create
the RAC Database. If you plan to use Automatic Storage Management (ASM) for database
storage, follow the instructions below to create an ASM instance on each cluster node. Be sure
you have installed the ASMLib software as described earlier in this guide before proceeding.
Start the installation using "runInstaller" from the "database" directory:
1. Welcome
o Click on Next
2. Select Installation Type
o Select Enterprise Edition
o Click on Next
3. Specify Home Details
o Name: Ora10gASM
o Path: /u01/app/oracle/product/10.2.0/asm
Note:Oracle recommends using a different ORACLE_HOME for ASM than the
ORACLE_HOME used for the database for ease of administration.
o Click on Next
4. Specify Hardware Cluster Installation Mode
o Select Cluster Installation
o Click on Select All
o Click on Next
5. Product-specific Prerequisite Checks
o If you've been following the steps in this guide, all the checks should pass without
difficulty. If one or more checks fail, correct the problem before proceeding.
o Click on Next
6. Select Configuration Option
o Select Configure Automatic Storage Management (ASM)
o Enter the ASM SYS password and confirm
o Click on Next
7. Configure Automatic Storage Management
o Disk Group Name: DATA
o Redundancy
- High mirrors data twice.
- Normal mirrors data once. This is the default.
- External does not mirror data within ASM. This is typically used if an external
RAID array is providing redundancy.
o Add Disks
The disks you configured for use with ASMLib are listed as Candidate Disks.
Select each disk you wish to include in the disk group.
o Click on Next
8. Summary
o A summary of the products being installed is presented.
o Click on Install.
9. Execute Configuration Scripts
o At the end of the installation, a pop up window will appear indicating scripts that
need to be run as root. Login as root and run the indicated scripts.
o Click on OK when finished.
10. End of Installation
o Make note of the URLs presented in the summary, and click on Exit when ready.
11. Congratulations! Your new Oracle ASM Instance is up and ready for use.
Create the RAC Database
Start the installation using "runInstaller" from the "database" directory:
1. Welcome
o Click on Next
2. Select Installation Type
o Select Enterprise Edition
o Click on Next
3. Specify Home Details
o Name: OraDb10g_home1
o Path: /u01/app/oracle/product/10.2.0/db_1
Note:Oracle recommends using a different ORACLE_HOME for the database than the
ORACLE_HOME used for ASM.
o Click on Next
4. Specify Hardware Cluster Installation Mode
o Select Cluster Installation
o Click on Select All
o Click on Next
5. Product-specific Prerequisite Checks
o If you've been following the steps in this guide, all the checks should pass without
difficulty. If one or more checks fail, correct the problem before proceeding.
o Click on Next
6. Select Configuration Option
o Select Create a Database
o Click on Next
7. Select Databse Configuration
o Select General Purpose
o Click on Next
8. Specify Database Configuration Options
o Database Naming: Enter the Global Database Name and SID
o Database Character Set: Accept the default
o Database Examples: Select Create database with sample schemas
o Click on Next
9. Select Database Management Option
o Select Use Database Control for Database Management
o Click on Next
10. Specify Database Storage Option
o If you are using OCFS2 for database storage
Select File System
Specify Database fle location: Enter the path name to the OCFS2
filesystem directory you wish to use.
ex: /u03/oradata/racdemo
o If you are using ASM for database storage
Select Automatic Storage Management (ASM)
o Click on Next
11. Specify Backup and Recovery Options
o Select Do not enable Automated backups
o Click on Next
12. For ASM Installations Only:
o Select ASM Disk Group
Select the DATA disk group created in the previous section
Click on Next
13. Specify Database Schema Passwords
o Select Use the same password for all the accounts
o Enter the password and confirm
o Click on Next
14. Summary
o A summary of the products being installed is presented.
o Click on Install.
15. Configuration Assistants
o The Oracle Net, Oracle Database, and iSQL*Plus configuration assistants will run
automatically
16. Execute Configuration Scripts
o At the end of the installation, a pop up window will appear indicating scripts that
need to be run as root. Login as root and run the indicated scripts.
o Click on OK when finished.
17. End of Installation
o Make note of the URLs presented in the summary, and click on Exit when ready.
18. Congratulations! Your new Oracle Database is up and ready for use.
Conclusion
Now that your database is up and running, you can begin exploring the many new features
offered in Oracle Database 10g Release 2. A great place to start is Oracle Enterprise Manager,
which has been completely re-written with a crisp new Web-based interface. If you're unsure
where to begin, the Oracle Database Concepts 10g Release 2 and the 2-Day DBA Guide will
help familiarize you with your new database. OTN also has a number of guides designed to help
you get the most out of Oracle Database 10g Release 2.
John Smiley [jrsmiley@gmail.com] works as a senior database engineer for a major online
retailer and is an Oracle Certified Master DBA with over 19 years of experience with Oracle
databases running on all major platforms. He specializes in engineering high-volume Oracle
databases, advanced performance tuning methods, and RAC, and enjoys developing with
PL/SQL, C, and Perl.