Anda di halaman 1dari 39

ASM CONFIGURATION USING STANDARD UNIX I/O | ORACLE 10g

ASM IMPLEMENTATION USING RAW DEVICES


This Tutorial was done on RHEL-AS (4.8) installed on VMWare for learning purpose.
ASM can be setup using the ASM Library Driver or RAW Devices. For older Oracle database
and Red-Hat Enterprise Linux versions RAW devices are still a recommended option for ASM
and data files, and remain supported. RAW Partitions allow Oracle to bypass the OS cache.
WHAT IS RAW ?

A raw device is simply a disk. Raw files are unformatted disk partitions that can be used
as one large file. It does NOT contain any File System it can still be partitioned.
Raw files have the benefit of no File-System overhead (in order to bypass a File System
overhead or File-System cache) because they are unformatted partitions.

Not buffered by OPERATING SYSTEM.

So Faster I/O without File-System overhead.

More efficient than cooked files because 10% to 15% we can get performance gain.

Once the raw partition is created, it cannot be Shrink or Expand.


We can place only one file into the raw device at a time.
The contents of RAW devices are not visible from the command line. In the case of Oracle,
this means you cannot view or manipulate the data files in the raw partition using standard
UNIX commands. The command ls (list) only works with a file system.
ASM Feature Supports 2 different types of IO.

Standard UNIX IO and ASMLib IO

ASM WITH ASMLIB I/O

It creates all Oracle database files on RAW BLOCK DEVICES managed by ASM using ASMLib
calls. RAW devices are NOT required with this method as ASMLib works with block devices.
ASM WITH STANDARD UNIX I/O

This method creates all Oracle database files on RAW CHARACTER DEVICES managed by ASM using
Standard Linux I/O system calls. You will be required to create RAW devices for all disk
partitions used by ASM.

ASM with UNIX I/O on Raw Character Devices /dev/raw/raw*

Devices are managed by ASM using Standard UNIX I/O

When we choose RAW devices (for database files) that ASM needs DIRECT access to the device
(it opens the device with a direct I/O flag enabled). No other s/w driver layer involves
that prevents direct I/O and provides some kind of write-through and buffering feature.

Exploring the Oracle DBA Technology by Gunasekaran ,Thiyagu

ASM CONFIGURATION USING STANDARD UNIX I/O | ORACLE 10g

In this article, we are going to implement ASM using UNIX IO. Oracle recommends that you
create a Single whole-disk Partition on each disk that you want to use.
DEVICE NAME BASED ON TYPE OF THE DISK

DISK TYPE

DEVICE NAME FORMAT

DESCRIPTION

SCSI Disk

/dev/sdxn

In this example, x is a letter that identifies the


SCSI Disk and n is the partition number.
For example, /dev/sda is the first disk on the first
SCSI bus.

IDE disk

/dev/hdxn

In this example, x is a letter that identifies the IDE


disk and n is the partition number. For example,
/dev/had is the first disk on the first IDE bus.

/dev/sd<x> SCSI Disk


/dev/hd<x> NON-SCSI Hard Disk (e.g. IDE)
/dev/sd<x><#> = (e.g /dev/sdb4)
Partition on the disk would be the 4th partition on second SCSI disk, sdb)
/dev/hd<x><#> = (e.g. /dev/hda1)
Partition on the disk would be the first partition on the first NON-SCSI disk, hda)

STEPS TO CREATE +ASM INSTANCE

1. Add disk(s) to the Linux Server


2. Create RAW disks (SCSI) on the Server.
3. Do Partition on attached RAW disk(s).
4. Configure RAW disks to use ASM disks.
5. Set the ownership on the RAW devices for oracle user.
6. As root user, run Oracle CSS script.
7. Create an +ASM Instance and Disk Groups using DBCA/MANUALLY.
8. Create a database with Automatic Storage Management.
ADD REQUIRED DISK(S) TO THE LINUX SERVER

I am adding 4 virtual disks size of size 10G each and all on different SCSI disk controller.
On VMWare Work Station you can see EDIT VIRTUAL MACHINE SETTINGS (Click it and add hardware
wizard will open). Demo shown for adding 1st disk. Follow same procedure for other 3 disks.

Exploring the Oracle DBA Technology by Gunasekaran ,Thiyagu

ASM CONFIGURATION USING STANDARD UNIX I/O | ORACLE 10g

Exploring the Oracle DBA Technology by Gunasekaran ,Thiyagu

ASM CONFIGURATION USING STANDARD UNIX I/O | ORACLE 10g

Exploring the Oracle DBA Technology by Gunasekaran ,Thiyagu

ASM CONFIGURATION USING STANDARD UNIX I/O | ORACLE 10g

Exploring the Oracle DBA Technology by Gunasekaran ,Thiyagu

ASM CONFIGURATION USING STANDARD UNIX I/O | ORACLE 10g

Exploring the Oracle DBA Technology by Gunasekaran ,Thiyagu

ASM CONFIGURATION USING STANDARD UNIX I/O | ORACLE 10g

Now you can create remaining 3 disks in the same way as shown in figure above steps.

Once we created required disks, then power on your Virtual machine just above left side of
the VMWARE WORK STATION and login as root # user.
# ls /dev/sd*
/dev/sda

/dev/sda2

/dev/sda4

/dev/sda6

/dev/sda8

/dev/sdc

/dev/sda1

/dev/sda3

/dev/sda5

/dev/sda7

/dev/sdb

/dev/sdd

/dev/sde

sda is our main disk where OS and other apps are installed and sda1 to sda6 are its
partitions. The output from 'cat /proc/partitions' shows they are not partitioned yet.
# cat /proc/partitions
major minor

#blocks

name

85983232 sda

112423 sda1

32764567 sda2

22531162 sda3

1 sda4

10546641 sda5

6144831 sda6

3068383 sda7

10811713 sda8

16

10485760 sdb

32

10485760 sdc

48

10485760 sdd

64

10485760 sde

Exploring the Oracle DBA Technology by Gunasekaran ,Thiyagu

ASM CONFIGURATION USING STANDARD UNIX I/O | ORACLE 10g

STEPS TO PARTITIONING DISKS

# fdisk -l |

grep ^Disk

Disk /dev/sdb doesn't contain a valid partition table


Disk /dev/sdc doesn't contain a valid partition table
Disk /dev/sdd doesn't contain a valid partition table
Disk /dev/sde doesn't contain a valid partition table
Disk /dev/sda: 88.0 GB, 88046829568 bytes
Disk /dev/sdb: 10.7 GB, 10737418240 bytes
Disk /dev/sdc: 10.7 GB, 10737418240 bytes
Disk /dev/sdd: 10.7 GB, 10737418240 bytes
Disk /dev/sde: 10.7 GB, 10737418240 bytes

4 disks (sdb, sdc, sdd, sde) are the raw disks that I just added. As of now no partitions,
I would like to create at-least one partition one each disk. Creating single partition on
the whole device is really good because the reason is you have one controller per disk in
this case so as faster IO.
For production environment it is recommended to spread the data over different Physical
disks, to keep IO low for a Single disk. Just spreading data over different mount points
(on the same Physical disk) has no effect. At the end all IO gets to the same disk multiple
partitions on the same Physical spindle will NOT increase your I/O.

# 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 2610.
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)
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
Command (m for help): p

<----- Printing partition table

Disk /dev/sdb: 21.4 GB, 21474836480 bytes


255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot

Start

End

Blocks

Id

System

Exploring the Oracle DBA Technology by Gunasekaran ,Thiyagu

ASM CONFIGURATION USING STANDARD UNIX I/O | ORACLE 10g

Command (m for help): n


Command action
e

extended

primary partition (1-4)

<-----

Primary Partition

Partition number (1-4): 1


First cylinder (1-2610, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-2610, default 2610):
Using default value 2610
Command (m for help): p

<-----

Printing Partition Table

Disk /dev/sdb: 10.7 GB, 10737418240 bytes


255 heads, 63 sectors/track, 1305 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot

Start

End

Blocks

Id

System

1305

10482381

83

Linux

/dev/sdb1
Command (m for help): w

The partition table has been altered!


Calling ioctl() to re-read partition table.
Syncing disks.
Repeat the fdisk operation for all remaining disks in the same way as demonstrated above.

# fdisk /dev/sdc
# fdisk /dev/sdd
# fdisk /dev/sde

Once you created new partition using fdisk then you need to reboot LINUX based systems to
get partition recognized. The new table will be used at the next reboot. However you can
use partition table changes, by requesting that the operating system re-read the partition
table without reboot by partprobe command.
# partprobe

or

# partprobe /dev/sdb
# partprobe /dev/sdc
# partprobe /dev/sdd
# partprobe /dev/sde

After I partitioned all attached disks, now all attached disks are ready to configure.

Exploring the Oracle DBA Technology by Gunasekaran ,Thiyagu

ASM CONFIGURATION USING STANDARD UNIX I/O | ORACLE 10g

# fdisk -l | grep ^Disk

TO LIST ALL PARTITION TABLES

# fdisk -l /dev/sdb /dev/sdc /dev/sdd /dev/sde

Following output shows that i have one partition for every disk.

# cat /proc/partitions
major minor

#blocks

name

85983232 sda

112423 sda1

32764567 sda2

22531162 sda3

1 sda4

10546641 sda5

6144831 sda6

3068383 sda7

10811713 sda8

16

10485760 sdb

17

10482381 sdb1

32

10485760 sdc

33

10482381 sdc1

48

10485760 sdd

49

10482381 sdd1

64

10485760 sde

65

10482381 sde1

Exploring the Oracle DBA Technology by Gunasekaran ,Thiyagu

ASM CONFIGURATION USING STANDARD UNIX I/O | ORACLE 10g

We need to bind this partitions with the raw devices on the Linux System. A raw device can
be assigned or bound to block devices such as disk or disk partitions. When a raw device
is bound to a disk, any read or write access to the raw device will perform a raw I/O with
the disk. A raw I/O through the /dev/raw interface bypasses the kernel's block buffer cache
entirely that is normally associated with block devices.
By bypassing the cache it accesses a physical device directly which allows applications
such as Oracle databases to have more control over the I/O to the physical device.
A utility called raw can be used to bind a raw device to an existing block device.The
rawdevices service can only initialize devices named according to the /dev/raw/rawN format.
The service rawdevices allows us to create raw devices in Linux.
# ntsysv

Exploring the Oracle DBA Technology by Gunasekaran ,Thiyagu

ASM CONFIGURATION USING STANDARD UNIX I/O | ORACLE 10g

BINDING RAW DEVICES

# raw
Usage:
raw /dev/raw/rawN /dev/<blockdev>
# raw /dev/raw/raw1 /dev/sdb1
/dev/raw/raw1:

bound to major 8, minor 17

# raw /dev/raw/raw2 /dev/sdc1


/dev/raw/raw2:

bound to major 8, minor 33

# raw /dev/raw/raw3 /dev/sdd1


/dev/raw/raw3:

bound to major 8, minor 49

# raw /dev/raw/raw4 /dev/sde1


/dev/raw/raw4:

bound to major 8, minor 65

LIST RAW DEVICES

# raw a
/dev/raw/raw1:

bound to major 8, minor 17

/dev/raw/raw2:

bound to major 8, minor 33

/dev/raw/raw3:

bound to major 8, minor 49

/dev/raw/raw4:

bound to major 8, minor 65

# ls -l /dev/raw/raw*
crw-rw----

1 root disk 162, 1 Jan 30 21:22 /dev/raw/raw1

crw-rw----

1 root disk 162, 2 Jan 30 21:22 /dev/raw/raw2

crw-rw----

1 root disk 162, 3 Jan 30 21:23 /dev/raw/raw3

crw-rw----

1 root disk 162, 4 Jan 30 21:23 /dev/raw/raw4

# ls -l /dev/sdb1 /dev/sdc1 /dev/sdd1 /dev/sde1


brw-rw----

1 root disk 8, 17 Jan 30 16:16 /dev/sdb1

brw-rw----

1 root disk 8, 33 Jan 30 16:16 /dev/sdc1

brw-rw----

1 root disk 8, 49 Jan 30 16:16 /dev/sdd1

brw-rw----

1 root disk 8, 65 Jan 30 16:16 /dev/sde1

By default raw devices are character devices.


The first entry in the permission field indicates either b --> block, or c --> character

/dev/raw/raw1 Character Special device.

/dev/sdb1

Block Special device.

We bound raw device with block device via a process called Binding.

Exploring the Oracle DBA Technology by Gunasekaran ,Thiyagu

ASM CONFIGURATION USING STANDARD UNIX I/O | ORACLE 10g

SETTING PERMISSIONS

However, raw devices do not have the correct ownership or permissions for an Oracle database
files by default. We have change from root to oracle user (who is going to mange ASM).

# chown oracle:dba /dev/raw/raw*


# ls -l /dev/raw/raw*
crw-rw----

1 oracle dba 162, 1 Jan 30 21:22 /dev/raw/raw1

crw-rw----

1 oracle dba 162, 2 Jan 30 21:22 /dev/raw/raw2

crw-rw----

1 oracle dba 162, 3 Jan 30 21:23 /dev/raw/raw3

crw-rw----

1 oracle dba 162, 4 Jan 30 21:23 /dev/raw/raw4

Once required raw devices are established, there is a problem every time I restart the
machine 2 things would happen.
1) The binding will disappear; e.g /dev/raw/raw*
2) Even I recreate that binding again default ownership and permissions will be set.
Because these device names are owned by the dev package, each time the package is updated
(for example, as part of an operating system update), all devices are recreated with the
default ownership and permissions at boot. It is therefore necessary to set ownership and
permissions each time the dev package is updated.
To make it persistent after the reboot
1) The raw device(s) binding should auto create itself.
2) The ownership should reset back to oracle:dba for /dev/raw/raw*
For a kernel release (2.6.9), use the /etc/sysconfig/rawdevices file to define the set of
raw device mappings automatically created during the system startup sequence. The format
of the file is the same used in the command line with the exception that the "raw" command
itself is omitted. So I have to map and bind raw partitions to raw device files into the
/etc/sysconfig/rawdevices file and restart the rawdevices service.

# cat /etc/redhat-release
Red Hat Enterprise Linux AS release 4 (Nahant Update 8)
# uname -r
2.6.9-89.EL
# vi /etc/sysconfig/rawdevices
/dev/raw/raw1 /dev/sdb1
/dev/raw/raw2 /dev/sdc1
/dev/raw/raw3 /dev/sdd1
/dev/raw/raw4 /dev/sde1

Exploring the Oracle DBA Technology by Gunasekaran ,Thiyagu

ASM CONFIGURATION USING STANDARD UNIX I/O | ORACLE 10g

# service rawdevices restart


Assigning devices:
/dev/raw/raw1
/dev/raw/raw1:

/dev/sdc1

-->

/dev/sdd1

bound to major 8, minor 49

/dev/raw/raw4
/dev/raw/raw4:

-->

bound to major 8, minor 33

/dev/raw/raw3
/dev/raw/raw3:

/dev/sdb1

bound to major 8, minor 17

/dev/raw/raw2
/dev/raw/raw2:

-->

-->

/dev/sde1

bound to major 8, minor 65

done

Also, you need to change the ownership of these devices to oracle user. Raw devices are
refreshed with the default permissions and ownership every time you reboot your system.
For this reason, I have to add following lines into the /etc/rc.local file so that every
time machine reboots, this devices are assigned correct ownership/permissions. First execute
the following commands to set access and ownership on the raw disks for user oracle.
CHANGING OWNER AND PERMISSIONS

# chown oracle:dba /dev/raw/raw1


# chown oracle:dba /dev/raw/raw2
# chown oracle:dba /dev/raw/raw3
# chown oracle:dba /dev/raw/raw4
# chmod 660 /dev/raw/raw1
# chmod 660 /dev/raw/raw2
# chmod 660 /dev/raw/raw3
# chmod 660 /dev/raw/raw4
# vi /etc/rc.local
# add above 8 lines

CHECK PERMISSION FOR RAW DEVICES

# ls -l /dev/raw/raw1 /dev/sdb1
crw-rw----

1 oracle dba

brw-rw----

1 root

disk

162,

1 Jan 31 05:52 /dev/raw/raw1

8, 17 Jan 30 16:16 /dev/sdb1

# ls -l /dev/raw/raw2 /dev/sdc1
crw-rw----

1 oracle dba

brw-rw----

1 root

disk

162,

2 Jan 31 05:52 /dev/raw/raw2

8, 33 Jan 30 16:16 /dev/sdc1

Exploring the Oracle DBA Technology by Gunasekaran ,Thiyagu

ASM CONFIGURATION USING STANDARD UNIX I/O | ORACLE 10g

# ls -l /dev/raw/raw3 /dev/sdd1
crw-rw----

1 oracle dba

brw-rw----

1 root

162,

disk

3 Jan 31 05:52 /dev/raw/raw3

8, 49 Jan 30 16:16 /dev/sdd1

# ls -l /dev/raw/raw4 /dev/sde1
crw-rw----

1 oracle dba

brw-rw----

1 root

162,

disk

4 Jan 31 05:52 /dev/raw/raw4

8, 65 Jan 30 16:16 /dev/sde1

You can verify newly created partitions using major and minor device number.
# ls -l /dev/* |grep
brw-rw----

'8,

17'

1 root disk

8,

17 Jan 30 16:16 /dev/sdb1

# ls -l /dev/* | grep -e '8, *\(17\|33\|49\|65\)'


brw-rw----

1 root disk

8,

17 Jan 30 16:16 /dev/sdb1

brw-rw----

1 root disk

8,

33 Jan 30 16:16 /dev/sdc1

brw-rw----

1 root disk

8,

49 Jan 30 16:16 /dev/sdd1

brw-rw----

1 root disk

8,

65 Jan 30 16:16 /dev/sde1

CONFIGURE ENVIRONMENT FILES

$ cat ora10.env
export ORACLE_BASE=/u02/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME/lib
export PATH=$ORACLE_HOME/bin:$PATH
export ORACLE_SID=orcl
$ cat asm.env
export ORACLE_BASE=/u02/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME/lib
export PATH=$ORACLE_HOME/bin:$PATH
export ORACLE_SID=+ASM

EXECUTE CSS SCRIPT AS SUPER USER

Before creating and starting +ASM instance, CSS service must be up and running so in order
to get your CSS service up and running just login as super user (root) run the localconfig
utility from $ORACLE_HOME/bin to start CSS service.

EX: # ORACLE_HOME_PATH/bin/localconfig add


# /u02/app/oracle/product/10.2.0/db_1/bin/localconfig add

Exploring the Oracle DBA Technology by Gunasekaran ,Thiyagu

ASM CONFIGURATION USING STANDARD UNIX I/O | ORACLE 10g

CSS DEAMON

ASM requires Oracle Cluster Synchronization Service(CSS).


CSS must be configured and running before attempting to use ASM.
For Single-node installations, the CSS daemon is installed and runs from the $ORACLE_HOME.
The CSS service must be running before ASM instance or database instance starts, Oracle
Universal Installer configures it to start automatically when the system starts. The CSS
service is required to enable synchronization between ASM instance and the RDBMS instance.
When we execute localconfig utility,
1) Starts CSS daemon to be up and running.
2) Creates a new directory named oracle under /ect/
3) Creates a file ocr.loc inside /etc/oracle directory.

# cd /u02/app/oracle/product/10.2.0/db_1/bin/
# ./localconfig add
/etc/oracle does not exist. Creating it now.
Successfully accumulated necessary OCR keys.
Creating OCR keys for user 'root', privgrp 'root'..
Operation successful.
Configuration for local CSS has been initialized
Adding to inittab
Startup will be queued to init within 30 seconds.
Checking the status of new Oracle init process...
Expecting the CRS daemons to be up within 600 seconds.
CSS is active on these nodes.
rac-server1
CSS is active on all nodes.
Oracle CSS service is installed and running under init(1M)

$ cd /etc/oracle/
[oracle@RAC-SERVER1 oracle]$ ls -l
total 12
-rw-r--r--

1 oracle oinstall

92 Feb

1 01:27 ocr.loc

drwxrwxr-x

5 root

root

4096 Feb

1 01:27 oprocd

drwxr-xr-x

3 root

root

4096 Feb

1 01:27 scls_scr

[oracle@RAC-SERVER1 oracle]$ cat ocr.loc


ocrconfig_loc=/u02/app/oracle/product/10.2.0/db_1/cdata/localhost/local.ocr
local_only=TRUE

Exploring the Oracle DBA Technology by Gunasekaran ,Thiyagu

ASM CONFIGURATION USING STANDARD UNIX I/O | ORACLE 10g

ocrconfig_loc parameter says the location of the Oracle Cluster Registry (OCR) used by CSS.
local_only = TRUE Means Single node Oracle Instance and FALSE means RAC

$ ps -ef | grep css


oracle

2348

2080

0 03:25 ?

00:00:03

/u02/app/oracle/product/10.2.0/db_1/bin/ocssd.bin

CSS is completely ASM dependency. For 10g versions of oracle ASM binaries are shipped
with RDBMS binaries so that CSS is started and running from the $ORACLE_HOME by default.
Running localconfig from $ORACLE_HOME will create a CSS deamon and will work well since
ORACLE_HOME is the same release as ASM_HOME where ASM Instance was configured.
We can configure the CSS to be run from the ASM home too.
To Setup/Remove/Modify a Cluster Synchronization Service daemon docid 369824.1

CONFIGURE +ASM INSTANCE

$ . ./asm.env

Exploring the Oracle DBA Technology by Gunasekaran ,Thiyagu

ASM CONFIGURATION USING STANDARD UNIX I/O | ORACLE 10g

Exploring the Oracle DBA Technology by Gunasekaran ,Thiyagu

ASM CONFIGURATION USING STANDARD UNIX I/O | ORACLE 10g

Exploring the Oracle DBA Technology by Gunasekaran ,Thiyagu

ASM CONFIGURATION USING STANDARD UNIX I/O | ORACLE 10g

Exploring the Oracle DBA Technology by Gunasekaran ,Thiyagu

ASM CONFIGURATION USING STANDARD UNIX I/O | ORACLE 10g

Exploring the Oracle DBA Technology by Gunasekaran ,Thiyagu

ASM CONFIGURATION USING STANDARD UNIX I/O | ORACLE 10g

Now you can see +ASM Instance has been setup successfully and running.
$ ps -ef | grep asm
oracle

21381

0 16:16 ?

00:00:00 asm_pmon_+ASM

oracle

21383

0 16:16 ?

00:00:00 asm_psp0_+ASM

oracle

21385

0 16:16 ?

00:00:00 asm_mman_+ASM

oracle

21387

0 16:16 ?

00:00:00 asm_dbw0_+ASM

oracle

21389

0 16:16 ?

00:00:00 asm_lgwr_+ASM

oracle

21391

0 16:16 ?

00:00:00 asm_ckpt_+ASM

oracle

21393

0 16:16 ?

00:00:00 asm_smon_+ASM

oracle

21395

0 16:16 ?

00:00:00 asm_rbal_+ASM

oracle

21397

0 16:16 ?

00:00:00 asm_gmon_+ASM

oracle

21438 21434

1 16:20 pts/1

00:00:27

/u02/app/oracle/product/10.2.0/db_1/jdk/jre/bin/java Dsun.java2d.font.DisableAlgorithmicStyles=true DORACLE_HOME=/u02/app/oracle/product/10.2.0/db_1 -DDISPLAY=:0.0 -DJDBC_PROTOCOL=thin mx128m -classpath


/u02/app/oracle/product/10.2.0/db_1/jdk/jre/lib/rt.jar:/u02/app/oracle/product/10.2.0/db_
1/jdk/jre/lib/i18n.jar:/u02/app/oracle/product/10.2.0/db_1/assistants/dbca/jlib/dbca.jar:
/u02/app/oracle/product/10.2.0/db_1/assistants/jlib/assistantsCommon.jar:/u02/app/oracle/
product/10.2.0/db_1/jlib/ewt3.jar:/u02/app/oracle/product/10.2.0/db_1/jlib/ewtcompat3_3_15.jar:/u02/app/oracle/product/10.2.0/db_1/jlib/share.jar:/u02/app/oracle/product/10.
2.0/db_1/jlib/help4.jar:/u02/app/oracle/product/10.2.0/db_1/jlib/jewt4.jar:/u02/app/oracl
e/product/10.2.0/db_1/jlib/oracle_ice5.jar:/u02/app/oracle/product/10.2.0/db_1/jlib/kodia
k.jar:/u02/app/oracle/product/10.2.0/db_1/jlib/swingall1_1_1.jar:/u02/app/oracle/product/10.2.0/db_1/lib/xmlparserv2.jar:/u02/app/oracle/product
/10.2.0/db_1/jlib/orai18n.jar:/u02/app/oracle/product/10.2.0/db_1/jlib/orai18nmapping.jar:/u02/app/oracle/product/10.2.0/db_1/jlib/orai18nutility.jar:/u02/app/oracle/product/10.2.0/db_1/jlib/orai18ncollation.jar:/u02/app/oracle/product/10.2.0/db_1/jlib/netcfg.jar:/u02/app/oracle/product
/10.2.0/db_1/jlib/ojmisc.jar:/u02/app/oracle/product/10.2.0/db_1/jlib/oraclepki103.jar:/u
02/app/oracle/product/10.2.0/db_1/jlib/ldapjclnt10.jar:/u02/app/oracle/product/10.2.0/db_
1/jlib/opm.jar:/u02/app/oracle/product/10.2.0/db_1/jdbc/lib/classes12.zip:/u02/app/oracle
/product/10.2.0/db_1/jlib/srvm.jar:/u02/app/oracle/product/10.2.0/db_1/jlib/srvmhas.jar:/
u02/app/oracle/product/10.2.0/db_1/jlib/srvmasm.jar:/u02/app/oracle/product/10.2.0/db_1/c
lasses:/u02/app/oracle/product/10.2.0/db_1/jlib/oemlt10_1_0.jar:/u02/app/oracle/product/10.2.0/db_1/jlib/emca.jar:/u02/app/oracle/product/10.2
.0/db_1/sysman/jlib/emCORE.jar:/u02/app/oracle/product/10.2.0/db_1/oc4j/j2ee/home/oc4j.ja
r:/u02/app/oracle/product/10.2.0/db_1/oc4j/j2ee/home/db_oc4j_deploy.jar:/u02/app/oracle/p
roduct/10.2.0/db_1/jlib/emConfigInstall.jar:/u02/app/oracle/product/10.2.0/db_1/oui/jlib/
OraInstaller.jar:/u02/app/oracle/product/10.2.0/db_1/oui/jlib/OraPrereq.jar:/u02/app/orac
le/product/10.2.0/db_1/inventory/prereqs/oui/OraPrereqChecks.jar:/u02/app/oracle/product/
10.2.0/db_1/oui/jlib/OraPrereqChecks.jar oracle.sysman.assistants.dbca.Dbca
oracle

21846 21632

0 17:02 pts/2

00:00:00 grep asm

Exploring the Oracle DBA Technology by Gunasekaran ,Thiyagu

ASM CONFIGURATION USING STANDARD UNIX I/O | ORACLE 10g

$ dbca

Exploring the Oracle DBA Technology by Gunasekaran ,Thiyagu

ASM CONFIGURATION USING STANDARD UNIX I/O | ORACLE 10g

Exploring the Oracle DBA Technology by Gunasekaran ,Thiyagu

ASM CONFIGURATION USING STANDARD UNIX I/O | ORACLE 10g

Exploring the Oracle DBA Technology by Gunasekaran ,Thiyagu

ASM CONFIGURATION USING STANDARD UNIX I/O | ORACLE 10g

Exploring the Oracle DBA Technology by Gunasekaran ,Thiyagu

ASM CONFIGURATION USING STANDARD UNIX I/O | ORACLE 10g

Exploring the Oracle DBA Technology by Gunasekaran ,Thiyagu

ASM CONFIGURATION USING STANDARD UNIX I/O | ORACLE 10g

Exploring the Oracle DBA Technology by Gunasekaran ,Thiyagu

ASM CONFIGURATION USING STANDARD UNIX I/O | ORACLE 10g

Exploring the Oracle DBA Technology by Gunasekaran ,Thiyagu

ASM CONFIGURATION USING STANDARD UNIX I/O | ORACLE 10g

Exploring the Oracle DBA Technology by Gunasekaran ,Thiyagu

ASM CONFIGURATION USING STANDARD UNIX I/O | ORACLE 10g

BACKGROUND PROCESSES FOR +ASM INSTANCE

$ ps -ef | grep asm


oracle

21381

0 16:16 ?

00:00:00 asm_pmon_+ASM

oracle

21383

0 16:16 ?

00:00:00 asm_psp0_+ASM

oracle

21385

0 16:16 ?

00:00:00 asm_mman_+ASM

oracle

21387

0 16:16 ?

00:00:00 asm_dbw0_+ASM

oracle

21389

0 16:16 ?

00:00:00 asm_lgwr_+ASM

oracle

21391

0 16:16 ?

00:00:00 asm_ckpt_+ASM

oracle

21393

0 16:16 ?

00:00:00 asm_smon_+ASM

oracle

21395

0 16:16 ?

00:00:00 asm_rbal_+ASM

oracle

21397

0 16:16 ?

00:00:00 asm_gmon_+ASM

oracle

22227

0 17:10 ?

00:00:00 asm_o000_+ASM

oracle

22259

0 17:10 ?

00:00:00 ora_asmb_orcl

oracle

26655 21632

0 17:15 pts/2

00:00:00 grep asm

$ ps -ef | grep pmon


oracle

21381

0 18:29 ?

00:00:00 asm_pmon_+ASM

oracle

22231

0 19:22 ?

00:00:00 ora_pmon_orcl

oracle

29916 21333

0 20:29 pts/1

00:00:00 grep pmon

Exploring the Oracle DBA Technology by Gunasekaran ,Thiyagu

ASM CONFIGURATION USING STANDARD UNIX I/O | ORACLE 10g

CONNECTING RDBMS INSTANCE

$ . ./ora10.env
ORACLE_SID = [oracle] ? orcl
SQL*Plus: Release 10.2.0.5.0 - Production on Mon Feb 1 20:41:55 2016
Copyright (c) 1982, 2010, Oracle.

All Rights Reserved.

Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> select name from v$datafile;
NAME
-------------------------------------------------------------------------------+ASM_DG_DATA/orcl/datafile/system.256.902682117
+ASM_DG_DATA/orcl/datafile/undotbs1.258.902682117
+ASM_DG_DATA/orcl/datafile/sysaux.257.902682117
+ASM_DG_DATA/orcl/datafile/users.259.902682119
+ASM_DG_DATA/orcl/datafile/example.265.902682395
SQL> select name from v$controlfile;
NAME
-------------------------------------------------------------------------------+ASM_DG_DATA/orcl/controlfile/current.260.902682293
+ASM_DG_FRA/orcl/controlfile/current.256.902682297
SQL> select member from v$logfile;
MEMBER
-------------------------------------------------------------------------------+ASM_DG_DATA/orcl/onlinelog/group_3.263.902682311
+ASM_DG_FRA/orcl/onlinelog/group_3.259.902682313
+ASM_DG_DATA/orcl/onlinelog/group_2.262.902682305
+ASM_DG_FRA/orcl/onlinelog/group_2.258.902682307
+ASM_DG_DATA/orcl/onlinelog/group_1.261.902682301
+ASM_DG_FRA/orcl/onlinelog/group_1.257.902682305
SQL> show parameter db_recovery_file_dest;
NAME

TYPE

VALUE

------------------------------------ ----------- -----------------------------db_recovery_file_dest

string

+ASM_DG_FRA

db_recovery_file_dest_size

big integer 2G

Exploring the Oracle DBA Technology by Gunasekaran ,Thiyagu

ASM CONFIGURATION USING STANDARD UNIX I/O | ORACLE 10g

CONNECTING +ASM INSTANCE

$. ./asm.env
$ echo $ORACLE_SID
+ASM
$ sqlplus "/as sysdba"
SQL*Plus: Release 10.2.0.5.0 - Production on Mon Feb 1 20:48:13 2016
Copyright (c) 1982, 2010, Oracle.

All Rights Reserved.

Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SYSL> select status from v$instance;
STATUS
-----------STARTED
SYS> show parameter instance_type;
NAME

TYPE

VALUE

------------------------------------ ----------- -----------------------------instance_type

string

asm

SYS> select instance_name from v$instance;


INSTANCE_NAME
---------------+ASM
SYS> select name from v$asm_diskgroup;
NAME
-----------------------------ASM_DG_DATA
ASM_DG_FRA
SYS> show parameter pfile;
NAME

TYPE

VALUE

------------------------------------ ----------- -----------------------------spfile

string

/u02/app/oracle/product/10.2.0
/db_1/dbs/spfile+ASM.ora

Exploring the Oracle DBA Technology by Gunasekaran ,Thiyagu

ASM CONFIGURATION USING STANDARD UNIX I/O | ORACLE 10g

CREATE PFILE OF ASM INSTANCE

SYS> create pfile='/tmp/initasm.ora' from spfile;


File created.

ASM INSTANCE INITIALIZATION PARAMETERS

$ cat /tmp/initasm.ora
+ASM.asm_diskgroups='ASM_DG_DATA','ASM_DG_FRA' #Manual Mount
*.asm_diskgroups='ASM_DG_DATA','ASM_DG_FRA'
*.background_dump_dest='/u02/app/oracle/admin/+ASM/bdump'
*.core_dump_dest='/u02/app/oracle/admin/+ASM/cdump'
*.instance_type='asm'
*.large_pool_size=12M
*.remote_login_passwordfile='SHARED'
*.user_dump_dest='/u02/app/oracle/admin/+ASM/udump'

CHECK ASM DISKGROUPS THROUGH OEM

I Hope this document would help someone to setup ASM based database.

Exploring the Oracle DBA Technology by Gunasekaran ,Thiyagu

ASM CONFIGURATION USING STANDARD UNIX I/O | ORACLE 10g

POINTS TO REMEMBER

A raw device can be bound to an existing block device (e.g. a disk) and be used to perform
"raw" IO with that existing block device. Such "raw" IO bypasses the caching that is
normally associated with block device.

MIGRATING FROM RAW DEVICES TO ASMLIB


Initially I started to work with ASM before ASMLib was available for RHEL, so I did
configure ASM with raw devices. Now that ASMLib is available it is convenient to migrate
ASM on raw devices to ASMLib.
DOWNLOAD ASMLIB RPMS FROM FOLLOWING URL

Oracle ASMLib is available for Linux; as a kernel module is needed only the supported Linux
distributions, the required RPM packages are downloadable from OTN. You need to pick exact
version that matches to your distribution based on kernel and architecture.

# cat /etc/redhat-release
Red Hat Enterprise Linux AS release 4 (Nahant Update 8)
Oracle ASMLib Downloads for Red Hat Enterprise Linux 4 AS
http://www.oracle.com/technetwork/server-storage/linux/downloads/rhel4-092650.html

There are 3 packages that one would normally install as part of ASM:
oracleasm + oracleasm-support + oracleasmlib

oracleasm (uname r) # Kernel Driver (Determines machine kernel version)


oracleasmlib

# ASM Libraries

oracleasm-support

# Support Scripts for the ASM driver up & running.

# uname r
2.6.9-89.EL
Drivers for kernel 2.6.9-89.EL
oracleasm-2.6.9-89.ELxenU-2.0.5-1.el4.i686.rpm
oracleasm-2.6.9-89.ELsmp-2.0.5-1.el4.i686.rpm
oracleasm-2.6.9-89.ELhugemem-2.0.5-1.el4.i686.rpm
oracleasm-2.6.9-89.EL-debuginfo-2.0.5-1.el4.i686.rpm
oracleasm-2.6.9-89.EL-2.0.5-1.el4.i686.rpm

The oracleasm-2.6 package is a kernel driver that ships for various different kind of Linux
kernels that existed under EL 4. But we only need the driver for the kernel we are using
and cannot install the driver for a kernel we do not have installed.

Exploring the Oracle DBA Technology by Gunasekaran ,Thiyagu

ASM CONFIGURATION USING STANDARD UNIX I/O | ORACLE 10g

All ASMLib installations require the oracleasmlib & oracleasm-support packages appropriate
for their machine. Library and Tools common for all.

# uname p i
i686 i386
Library and Tools
oracleasm-support-2.1.7-1.el4.i386.rpm
oracleasmlib-2.0.4-1.el4.i386.rpm

uname p

This command shows Processor Type

uname i

This command shows Hardware Platform

We need only following 3 packages.


oracleasmlib

oracleasmlib-2.0.4-1.el4.i386.rpm

oracleasm-support oracleasm-support-2.1.7-1.el4.i386.rpm
oracleasm kernel driver oracleasm-2.6.9-89.EL-2.0.5-1.el4.i686.rpm

Once you download above packages using ftp upload above all in Linux Server. You need #

(root) privilege to install all downloaded rpms. Install ASMLibs in following order to
avoid package dependency errors make sure you are logged in as # (root) user.

oracleasm-support +

oracleasm + oracleasmlib

# rpm -Uvih oracleasm-support-2.1.7-1.el4.i386.rpm


warning:

oracleasm-support-2.1.7-1.el4.i386.rpm:

V3

DSA

signature:

NOKEY,

key

b38a8516
Preparing...

########################################### [100%]

1:oracleasm-support

########################################### [100%]

# rpm -Uvih oracleasm-2.6.9-89.EL-2.0.5-1.el4.i686.rpm


warning: oracleasm-2.6.9-89.EL-2.0.5-1.el4.i686.rpm: V3 DSA signature: NOKEY, key ID
b38a8516
Preparing...

########################################### [100%]

1:oracleasm-2.6.9-89.EL

########################################### [100%]

# rpm -Uvih oracleasmlib-2.0.4-1.el4.i386.rpm


warning: oracleasmlib-2.0.4-1.el4.i386.rpm: V3 DSA signature: NOKEY, key ID b38a8516
Preparing...

########################################### [100%]

1:oracleasmlib

########################################### [100%]

Exploring the Oracle DBA Technology by Gunasekaran ,Thiyagu

ID

ASM CONFIGURATION USING STANDARD UNIX I/O | ORACLE 10g

CONFIGURE THE ASM LIBRARY

# /etc/init.d/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.


will be shown in brackets ('[]').

The current values

Hitting <ENTER> 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 []: oinstall
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
Initializing the Oracle ASMLib driver:

OK

Scanning the system for Oracle ASMLib disks:

OK

ASM DISK CONFIGURATION ON RAW DEVICES

ls -lrt /dev/raw
total 0
crw-rw----

1 oracle dba 162, 1 Feb

2 14:32 raw1

crw-rw----

1 oracle dba 162, 2 Feb

2 14:32 raw2

crw-rw----

1 oracle dba 162, 3 Feb

2 14:32 raw3

crw-rw----

1 oracle dba 162, 4 Feb

2 14:32 raw4

SYS> select path from v$asm_disk;


PATH
---------------/dev/raw/raw1
/dev/raw/raw2
/dev/raw/raw3
/dev/raw/raw4

SHUTDOWN THE RDBMS INSTANCE

SYS> shut immediate;


Database closed.
Database dismounted.
ORACLE instance shut down.
Shutdown any databases using the ASM instance, but leave the ASM instance itself running.

Exploring the Oracle DBA Technology by Gunasekaran ,Thiyagu

ASM CONFIGURATION USING STANDARD UNIX I/O | ORACLE 10g

Connect to the running ASM instance.

$ . ./asm.env
$ sqlplus / as sysdba
SYS> ALTER SYSTEM SET asm_diskstring = 'ORCL:VOL*' SCOPE=SPFILE;
System altered.
SYS> shutdown immediate;
ASM diskgroups dismounted
ASM instance shutdown

# ls -lrt /dev/sd*1
brw-rw----

1 root disk 8, 65 Feb

3 01:30 /dev/sde1

brw-rw----

1 root disk 8, 49 Feb

3 01:30 /dev/sdd1

brw-rw----

1 root disk 8, 33 Feb

3 01:30 /dev/sdc1

brw-rw----

1 root disk 8, 17 Feb

3 01:30 /dev/sdb1

We cannot use reatedisk command used to stamp above disks it would fail, so we must issue
the renamedisk command as the root user for each disk.
/etc/init.d/oracleasm renamedisk /dev/sdb1 VOL1
WARNING: Changing the label of an disk marked for ASM is a very dangerous
operation.

If this is really what you mean to do, you must

ensure that all Oracle and ASM instances have ceased using
this disk.

Otherwise, you may LOSE DATA.

If you are really sure you wish to change the label and are sure that
all of your Oracle and ASM instances have ceased using the disk,
rerun with the force-renamedisk command.
Renaming disk "/dev/sdb1" to "VOL1":

[FAILED]

We can use the force-renamedisk command (once again, ensure no databases are accessing the
diskgroup prior to doing this.
# /etc/init.d/oracleasm force-renamedisk /dev/sdb1 VOL1
Renaming disk "/dev/sdb1" to "VOL1":

OK

OK

OK

OK

# /etc/init.d/oracleasm force-renamedisk /dev/sdc1 VOL2


Renaming disk "/dev/sdc1" to "VOL2":
# /etc/init.d/oracleasm force-renamedisk /dev/sdd1 VOL3
Renaming disk "/dev/sdd1" to "VOL3":
# /etc/init.d/oracleasm force-renamedisk /dev/sde1 VOL4
Renaming disk "/dev/sde1" to "VOL4":

Exploring the Oracle DBA Technology by Gunasekaran ,Thiyagu

ASM CONFIGURATION USING STANDARD UNIX I/O | ORACLE 10g

We then unbind our current raw device mappings.

# raw /dev/raw/raw1 0 0
/dev/raw/raw1:

bound to major 0, minor 0

# raw /dev/raw/raw2 0 0
/dev/raw/raw2:

bound to major 0, minor 0

# raw /dev/raw/raw3 0 0
/dev/raw/raw3:

bound to major 0, minor 0

# raw /dev/raw/raw4 0 0
/dev/raw/raw4:

bound to major 0, minor 0

# ls -lrt /dev/raw
ls: /dev/raw: No such file or directory

STARTUP ASM INSTANCE

$ . ./asm.env
$ sqlplus / as sysdba
SYS> startup;
ASM instance started
..
...
ASM diskgroups mounted

STARTUP RDBMS INSTANCE

$ . ./ora10g.env
$ sqlplus / as sysdba
SYS> startup;
ORACLE instance started.
..
...
Database opened.
SYS> select path from v$asm_disk;
PATH
----------------------------ORCL:VOL1
ORCL:VOL2
ORCL:VOL3
ORCL:VOL4
REFERENCE DOC FROM HERE.

Exploring the Oracle DBA Technology by Gunasekaran ,Thiyagu

Anda mungkin juga menyukai