Saturday, November 13, 2010

Installing Oracle on RAW Devices

1. What is a raw device?

A raw device, also known as a raw partition, is a disk partition that is
not mounted and written to via the UNIX filesystem, but is accessed via
a character-special device driver; it is up to the application how the
data is written, since there is no filesystem to do this on the
application's behalf.

2. What are the benefits of raw devices?

There can be a performance benefit from using raw devices, since a write
to a raw device bypasses the UNIX buffer cache; the data is transferred
direct from the Oracle buffer cache to the disk. This is not guaranteed,
though; if there is no I/O bottleneck, raw devices will not help. The
performance benefit if there is a bottleneck can vary between a few
percent to something like 40%. Note that the overall amount of I/O is
not reduced; it is just done more efficiently.

Another, lesser, benefit of raw devices is that no filesystem overhead
is incurred, in terms of inode allocation and maintenance, or free block
allocation and maintenance.

3. Can I use the entire raw partition for Oracle?

No. You should specify a tablespace slightly smaller in size than the
raw partition size, specifically at least two Oracle block sizes
smaller.

4. Who should own the raw device?

You will need to create the raw devices as root, but the ownership
should be changed to the oracle account afterwards. The group must also
be changed to the dba group (usually called dba).

5. How do I specify a raw device in Oracle commands?

Enclose the full pathname in single quotes, e.g. if there are two raw
devices, each 30Mb in size, and the database has a 4K block size, the
relevant command would look like this:

create tablespace raw_tabspace datafile '/dev/raw1' size 30712K
datafile '/dev/raw2' size 30712K

6. How can I back up my database files if they are on raw devices?

You cannot use utilities such as tar or cpio, which expect a filesystem
to be present. You must use the dd command, as follows:

dd if=/dev/raw1 of=/dev/rmt0 bs=16k

See the UNIX man page on dd for further details.

It is also possible to copy the raw device file (using dd) to a normal
UNIX file, and then use a utility such as tar or cpio, but this
requires more disk space and has a greater administrative overhead.

7. Can I use raw partitions for archive logs?

No. Archive logs must be stored on a partition with a UNIX filesystem.

8. Can I have more than one data file on a raw partition?

No. This means you should be careful when setting up up the raw
partition: too small a size will necessitate reorganisation when you
run out of space, whereas too large a size will waste any space the
file does not use.

9. What other UNIX-level changes could help to improve I/O performance?

RAID and disk mirroring can be beneficial, depending on the application
characteristics, especially whether it is read or write-intensive, or a
mixture.

Installing Oracle on Raw Devices:

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/sdb
Device Flag Start End Blocks Id System
/dev/sdb1 1 238 487424 83 Linux native
/dev/sdb2 239 477 487424 83 Linux native
/dev/sdb3 u 0 2558 5238784 5 Whole disk
/dev/sdb4 478 716 487424 83 Linux native
/dev/sdb5 717 836 243712 83 Linux native
/dev/sdb6 837 894 116736 83 Linux native
/dev/sdb7 895 952 116736 83 Linux native
/dev/sdb8 953 1005 106496 83 Linux native
# fdisk -l /dev/sdc
/dev/sdc1 1 57 116736 83 Linux native
/dev/sdc2 58 110 106496 83 Linux native
/dev/sdc3 u 0 2558 5238784 5 Whole disk
/dev/sdc4 111 135 49152 83 Linux native
/dev/sdc5 136 160 49152 83 Linux native
Add the Raw volume mapping in /etc/raw file
systemvol:sdb1
sysauxvol:sdb2
usersvol:sdb4
tempvol:sdb5
undovol:sdb6
redo1vol:sdb7
redo2vol:sdb8
control1vol:sdc1
control2vol:sdc2
spfilevol:sdc4
passfilevol:sdc5
-Red Hat equivalent /etc/sysconfig/rawdevices
Bind the partitions to the raw devices
# /etc/init.d/raw start
bind /dev/raw/systemvol to /dev/sdb1… done
bind /dev/raw/sysauxvol to /dev/sdb2… done
bind /dev/raw/usersvol to /dev/sdb4… done
bind /dev/raw/tempvol to /dev/sdb5… done
bind /dev/raw/undovol to /dev/sdb6… done
bind /dev/raw/redo1vol to /dev/sdb7… done
bind /dev/raw/redo2vol to /dev/sdb8… done
bind /dev/raw/control1vol to /dev/sdc1… done
bind /dev/raw/control2vol to /dev/sdc2… done
bind /dev/raw/spfilevol to /dev/sdc4… done
bind /dev/raw/passfilevol to /dev/sdc5… done
Then change the ownership and permissions
# chown oracle:oinstall /dev/raw/systemvol
# chown oracle:oinstall /dev/raw/sysauxvol
# chown oracle:oinstall /dev/raw/usersvol
# chown oracle:oinstall /dev/raw/tempvol
# chown oracle:oinstall /dev/raw/undovol
# chown oracle:oinstall /dev/raw/redo1vol
# chown oracle:oinstall /dev/raw/redo2vol
# chown oracle:oinstall /dev/raw/control1vol
# chown oracle:oinstall /dev/raw/control2vol
# chown oracle:oinstall /dev/raw/spfilevol
# chown oracle: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
To auto enable raw device binding, after system reboot
/sbin/chkconfig raw on
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
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
Set the environment variable for defining the configuration file
$ DBCA_RAW_CONFIG=
$ export DBCA_RAW_CONFIG
Start dbca and select the storage type as Raw Devices and check the Raw Device Mapping File. Rest of the install is same.





 
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

No comments:

Post a Comment