Sunday, May 17, 2009

Setting up ASM in a Windows environment

Recently at the OTN Oracle Install forum I found a question about setting up ASM in a windows environment. The procedure to setup ASM in windows is quite different from the procedure in a linux environment. The reason is because of the partition concepts and the way windows adminsiters partitions.

ASM Setup

There is a procedure to prepare raw disks to be used in a ASM environment in a Window platform. I should point out that you didn't specified the actual windows version. The following procedure applies to a Windows 2003 O.S.

Disk Layout

At least a raw partition is available.
the DISKPART utility should be used (Win2K3) or Disk Manager (Win2K & Win2k3).

Windows does not automatically mount raw disks and make them visible. You must enable automounting. Using Diskpart at the Diskpart, at the Diskpart prompt type:
DISKPART> automount enable

At the Command Prompt type diskmgmt.msc this will start the Disk Management windows utility.
In case the disk is in dynamic mode, change it to Basic mode.
Create a new partition on the empty disk and select an extended partition. Select the partition size to fill the disk. Once the wizard is ready it will create the extended partition.

Logical Partitions

Once the extended partition is created, next step is to create the logical partitions. Being in the disk management utility, you should be able to see the extended partition created. Right click on the extended partition and create as many logical partitions as required. Make sure you don't assign a drive letter to the partition. One more thing, considering this partition MUST remain as a raw partition, do not format the logical partitions; the assistant displays the option, ensure no format is performed on the raw disk.
At this point you should be able to see the logical partition created.
Repeat these steps for as many logical partitions as required.

Setup ASM

Once you are ready with the logical partitions, the next phase is to setup the ASM environment. Once in the Configure ASM assistant, define the Disk Group Name (DATA for example) click on the Stamp Disks, since there are currently no disk labeled, the asmtool performs the disk labeling. At the asmtool you should be able to see the partitions, there you can see the disk status, if the flag is 'Candidate devivce' then it ca be selected and labeled. The disk name format is something like \Device\Harddisk1\Partition_N. Once they are labeled they will appear as candidate disks, you should be able to see them as a candidate disk back in the ASM assistant, there you should be able to see the candidate raw device in the format similar to this:
\\.\ORCLDISKDATA_N

In the final step you should be able to see the candidate disks, just compose the ASM disk groups as required and you are done with the ASM setup procedure.