How to create a Oracle Database on RAW devices

SUSE Linux Enterprise Server 10 (x86_64)
VERSION = 10
PATCHLEVEL = 2

Some of the commands I’ve mentioned here are specific to SUSE and may not work on other Linux operating systems like RedHat.

STEP 1
======

Select the disk(s) which we need to use for storage and create required devices. Here I’ll be using 2 disks  /dev/sdf & /dev/sdg.

Number of partitions and the size of the partitions depends on the tablespaces, log files, control files we’ll be creating. Normal layout of the database would be something like following

1 x 500M for SYSTEM tablespace
1 x 300M for SYSAUX tablespace
1 x 500M for UNDOTBS tablespace
1 x 250M for TEMP tablespace
1 x 160M for EXAMPLE tablespace  (we can skip this)
1 x 120M for USERS tablespace
2 x 120M for REDO log files
2 x 110M for Control files
1 x 10M  for Server parameter file (SPFILE)
1 x 10M  for Password file

After we are done with the partitions, we can check the disk layout using
# fdisk -l /dev/sdf

Disk /dev/sdf (Sun disk label): 128 heads, 32 sectors, 2558 cylinders
Units = cylinders of 4096 * 512 bytes

Device Flag    Start       End    Blocks   Id  System
/dev/sdf1             1       238    487424   83  Linux native
/dev/sdf2           239       477    487424   83  Linux native
/dev/sdf3  u          0      2558   5238784    5  Whole disk
/dev/sdf4           478       716    487424   83  Linux native
/dev/sdf5           717       836    243712   83  Linux native
/dev/sdf6           837       894    116736   83  Linux native
/dev/sdf7           895       952    116736   83  Linux native
/dev/sdf8           953      1005    106496   83  Linux native

# fdisk -l /dev/sdg

/dev/sdg1             1        57    116736   83  Linux native
/dev/sdg2            58       110    106496   83  Linux native
/dev/sdg3  u          0      2558   5238784    5  Whole disk
/dev/sdg4           111       135     49152   83  Linux native
/dev/sdg5           136       160     49152   83  Linux native

Please make sure that the first partition starts from 1 and 0. Otherwise we’ll get  “ORA-27094: raw volume used can damage partition table” error.

STEP 2
======

Add the Raw volume mapping in /etc/raw file

systemvol:sdf1
sysauxvol:sdf2
usersvol:sdf4
tempvol:sdf5
undovol:sdf6
redo1vol:sdf7
redo2vol:sdf8
control1vol:sdg1
control2vol:sdg2
spfilevol:sdg4
passfilevol:sdg5

-Red Hat equivalent /etc/sysconfig/rawdevices

STEP 3
======

Bind the partitions to the raw devices 

# /etc/init.d/raw start

bind /dev/raw/systemvol to /dev/sdf1…  done
bind /dev/raw/sysauxvol to /dev/sdf2…  done
bind /dev/raw/usersvol to /dev/sdf4…                          done
bind /dev/raw/tempvol to /dev/sdf5…                           done
bind /dev/raw/undovol to /dev/sdf6…                           done
bind /dev/raw/redo1vol to /dev/sdf7…                          done
bind /dev/raw/redo2vol to /dev/sdf8…                          done
bind /dev/raw/control1vol to /dev/sdg1…                       done
bind /dev/raw/control2vol to /dev/sdg2…                       done
bind /dev/raw/spfilevol to /dev/sdg4…                         done
bind /dev/raw/passfilevol to /dev/sdg5…                       done

– Red Hat equivalent /sbin/service rawdevices restart

STEP 4
======

Then change the ownership and permissions

# chown ora10gr2:oinstall /dev/raw/systemvol
# chown ora10gr2:oinstall /dev/raw/sysauxvol
# chown ora10gr2:oinstall /dev/raw/usersvol
# chown ora10gr2:oinstall /dev/raw/tempvol
# chown ora10gr2:oinstall /dev/raw/undovol
# chown ora10gr2:oinstall /dev/raw/redo1vol
# chown ora10gr2:oinstall /dev/raw/redo2vol
# chown ora10gr2:oinstall /dev/raw/control1vol
# chown ora10gr2:oinstall /dev/raw/control2vol
# chown ora10gr2:oinstall /dev/raw/spfilevol
# chown ora10gr2:oinstall /dev/raw/passfilevol
# chmod 660 /dev/raw/systemvol
# chmod 660 /dev/raw/sysauxvol
# chmod 660 /dev/raw/usersvol
# chmod 660 /dev/raw/tempvol
# chmod 660 /dev/raw/undovol
# chmod 660 /dev/raw/redo1vol
# chmod 660 /dev/raw/redo2vol
# chmod 660 /dev/raw/control1vol
# chmod 660 /dev/raw/control2vol
# chmod 660 /dev/raw/spfilevol
# chmod 660 /dev/raw/passfilevol

STEP 5
======

To auto enable raw device binding, after system reboot

/sbin/chkconfig raw on

STEP 6
======

Check raw device binding

# raw -qa

/dev/raw/systemvol:       bound to major 8, minor 81
/dev/raw/sysauxvol:       bound to major 8, minor 82
/dev/raw/usersvol:        bound to major 8, minor 84
/dev/raw/tempvol:         bound to major 8, minor 85
/dev/raw/undovol:         bound to major 8, minor 86
/dev/raw/redo1vol:        bound to major 8, minor 87
/dev/raw/redo2vol:        bound to major 8, minor 88
/dev/raw/control1vol:     bound to major 8, minor 97
/dev/raw/control2vol:     bound to major 8, minor 98
/dev/raw/spfilevol:       bound to major 8, minor 100
/dev/raw/passfilevol:     bound to major 8, minor 101

STEP 7
======

Create raw configuration file for dbca
system=/dev/raw/systemvol
sysaux=/dev/raw/sysauxvol
users=/dev/raw/usersvol
temp=/dev/raw/tempvol
undotbs1=/dev/raw/undovol
redo1_1=/dev/raw/redo1vol
redo1_2=/dev/raw/redo2vol
control1=/dev/raw/control1vol
control2=/dev/raw/control2vol
spfile=/dev/raw/spfilevol
pwdfile=/dev/raw/passfilevol

STEP 8
======

Set the environment variable for defining the configuration file

NOTE: This step is optional. One can always choose the file while install. By setting this variable, DBCA will automatically populate this name in the raw devices section.
$ DBCA_RAW_CONFIG=<path>
$ export DBCA_RAW_CONFIG

STEP 9
======

Start dbca and select the storage type as Raw Devices and check the Raw Device Mapping File.  Rest of the install is same.

Storage selection 

STEP 10
=======
Crosscheck the details

SQL> select name from v$datafile union select name from v$tempfile;

NAME
——————————————————————————–
/dev/raw/systemvol
/dev/raw/sysauxvol
/dev/raw/usersvol
/dev/raw/tempvol
/dev/raw/undovol

SQL> select member from v$logfile;

MEMBER
——————————————————————————–
/dev/raw/redo1vol
/dev/raw/redo2vol

SQL> show parameter spfile

NAME                                 TYPE        VALUE
———————————— ———– ——————————
spfile                               string      /dev/raw/spfilevol

Advertisements
This entry was posted in Oracle Database Creation Assistant and tagged , . Bookmark the permalink.

One Response to How to create a Oracle Database on RAW devices

  1. Christian Klammer says:

    Just a reminder: raw devices are only supported up to and including Oracle Datbase 11.2.0.4. Even in 11.2.0.x one would have to create the raw device data files with the command line as tools as dbca would not support the creation of raw device data files in the UI anymore …

    Starting in Oracle 12.1 the use of raw device data files is de-supported meaning not available anymore … resulting in the need to move to ASM- or file-system-stored datafiles.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s