The ASM disks can be non formatted partitions from
your disk already installed for OS and they can even be OS files configured as
disks. But if we use VMWare then we can add more virtual disks to the system
without any cost simulating our test environment with a real time ASM
configurations where many disks are used on different controllers to take
benefit of ASM mirroring and stripping of data. See below how to add more disks
to the Virtual machine.
NOTE: This tutorial was done on RHEL installed on
VMWare.
On VMWare server web console you will see a link
"Add Hardware" in the Commands section on the right side panel. Click
it and add hardware wizard will open.
1. From hardware types select "Hard Disk".
2. Select "Create a new virtual disk" from
the next page.
3. On the Hard Disk Properties page select the
capacity for the disk along with other options.
Notice the "Allocate all disk space now"
unchecked. Its best to leave it unchecked.
4. See the hardware that is going to be added.
On this page select More Hardware and click "Hard
Disk".
Repeat this process for all the disks you want to add
to the system. When done press finish.
5. After you finish the add hardware wizard you should
see your changes in the hardware on the summary page of the virtual machine.
I have added 4 disks of size 4G each and all on
different SCSI disk controller. We usually do this to get most out of the ASM
disk mirroring i.e. even if one disk is dead, Oracle will still be able to read
data from mirrored copies from other disks. But think about all of your disks
are on one disk controller and that whole controller is burnt, then you loose
all of your data.
Now power on your Virtual machine from the commands
panel on the right side of the VM console and login as root.
# ls /dev/sd*
/dev/sda /dev/sda2 /dev/sda4 /dev/sda6 /dev/sdc /dev/sde
/dev/sda1 /dev/sda3 /dev/sda5 /dev/sdb /dev/sdd
/dev/sda /dev/sda2 /dev/sda4 /dev/sda6 /dev/sdc /dev/sde
/dev/sda1 /dev/sda3 /dev/sda5 /dev/sdb /dev/sdd
# cat /proc/partitions
major minor #blocks name
major minor #blocks name
8 0 26214400 sda
8 1 104391 sda1
8 2 10482412 sda2
8 3 3148740 sda3
8 4 1 sda4
8 5 1052226 sda5
8 6 11422183 sda6
8 16 4194304 sdb
8 32 4194304 sdc
8 48 4194304 sdd
8 64 4194304 sde
8 1 104391 sda1
8 2 10482412 sda2
8 3 3148740 sda3
8 4 1 sda4
8 5 1052226 sda5
8 6 11422183 sda6
8 16 4194304 sdb
8 32 4194304 sdc
8 48 4194304 sdd
8 64 4194304 sde
/*
Since we added SCSI disks so you should see then in /dev/sd*.
sda is our main disk where OS and other apps are installed and
sda1 to sda6 are its partitions.
sdb to sde are the new four disks that we have just added.
The output from 'cat /proc/partitions' shows they are not
partitioned yet. We have to create at least one partition in each
disk.
We can have more then one partitions and use each partition as a
different ASM disk.
I am going to create one partition in all disks.
*/
Since we added SCSI disks so you should see then in /dev/sd*.
sda is our main disk where OS and other apps are installed and
sda1 to sda6 are its partitions.
sdb to sde are the new four disks that we have just added.
The output from 'cat /proc/partitions' shows they are not
partitioned yet. We have to create at least one partition in each
disk.
We can have more then one partitions and use each partition as a
different ASM disk.
I am going to create one partition in all disks.
*/
# 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.
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.
Warning: invalid flag 0x0000 of partition table 4 will
be corrected
by w(rite)
by w(rite)
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-522, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-522, default 522):
Using default value 522
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-522, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-522, default 522):
Using default value 522
Command (m for help): w
The partition table has been altered!
The partition table has been altered!
Calling ioctl() to re-read partition
table.
Syncing disks.
Syncing disks.
/*
Repeat the fdisk operation for all 4 disks in the same way as
demonstrated above.
*/
Repeat the fdisk operation for all 4 disks in the same way as
demonstrated above.
*/
# cat /proc/partitions
major minor #blocks name
major minor #blocks name
8 0 26214400 sda
8 1 104391 sda1
8 2 10482412 sda2
8 3 3148740 sda3
8 4 1 sda4
8 5 1052226 sda5
8 6 11422183 sda6
8 16 4194304 sdb
8 17 4192933 sdb1
8 32 4194304 sdc
8 33 4192933 sdc1
8 48 4194304 sdd
8 49 4192933 sdd1
8 64 4194304 sde
8 65 4192933 sde1
#
8 1 104391 sda1
8 2 10482412 sda2
8 3 3148740 sda3
8 4 1 sda4
8 5 1052226 sda5
8 6 11422183 sda6
8 16 4194304 sdb
8 17 4192933 sdb1
8 32 4194304 sdc
8 33 4192933 sdc1
8 48 4194304 sdd
8 49 4192933 sdd1
8 64 4194304 sde
8 65 4192933 sde1
#
Verify that you have one partition for every disk.
Use ASMLib to stamp the disks as ASM
disks:
Oracle provides ASM libraries to stamp the disks
as ASM disks. These libraries are distributed on the Linux kernel basis. You
need to know which kernel version you are using then get the libraries from
the OTN website to download libs
for your kernel.
# uname -r
2.6.18-164.el5
/* This is the kernel version I am using. */
# uname -p
i686
/* This is the processor type. */
# uname -i
i386
/* This is the hardware platform. */
2.6.18-164.el5
/* This is the kernel version I am using. */
# uname -p
i686
/* This is the processor type. */
# uname -i
i386
/* This is the hardware platform. */
According to the above information I need following
libraries.
# rpm -Uvih oracleasm-support-2.1.3-1.el5.i386.rpm \
> oracleasmlib-2.0.4-1.el5.i386.rpm \
> oracleasm-2.6.18-164.el5-2.0.5-1.el5.i686.rpm
warning: oracleasm-support-2.1.3-1.el5.i386.rpm: Header V3 DSA
signature: NOKEY, key ID 1e5e0159
Preparing... ################################# [100%]
1:oracleasm-support ################################# [ 33%]
2:oracleasm-2.6.18-164.el ################################# [ 67%]
3:oracleasmlib ################################# [100%]
> oracleasmlib-2.0.4-1.el5.i386.rpm \
> oracleasm-2.6.18-164.el5-2.0.5-1.el5.i686.rpm
warning: oracleasm-support-2.1.3-1.el5.i386.rpm: Header V3 DSA
signature: NOKEY, key ID 1e5e0159
Preparing... ################################# [100%]
1:oracleasm-support ################################# [ 33%]
2:oracleasm-2.6.18-164.el ################################# [ 67%]
3:oracleasmlib ################################# [100%]
With the oracleasm utility installed, configure the
kernel module for ASM.
# /etc/init.d/oracleasm configure
Configuring the Oracle ASM library driver.
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.
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 []: oinstall
Start Oracle ASM library driver on boot (y/n) [n]: y
Scan for Oracle ASM disks on boot (y/n) [y]:
Writing Oracle ASM library driver configuration: done
Initializing the Oracle ASMLib driver: [ OK ]
Scanning the system for Oracle ASMLib disks: [ OK ]
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]:
Writing Oracle ASM library driver configuration: done
Initializing the Oracle ASMLib driver: [ OK ]
Scanning the system for Oracle ASMLib disks: [ OK ]
After the kernel module is updated, label the disks as
ASM disks and give then an ASM name.
# /etc/init.d/oracleasm createdisk ASM1
/dev/sdb1
Marking disk "ASM1" as an ASM disk: [ OK ]
Marking disk "ASM1" as an ASM disk: [ OK ]
# /etc/init.d/oracleasm createdisk ASM2
/dev/sdc1
Marking disk "ASM2" as an ASM disk: [ OK ]
Marking disk "ASM2" as an ASM disk: [ OK ]
# /etc/init.d/oracleasm createdisk ASM3
/dev/sdd1
Marking disk "ASM3" as an ASM disk: [ OK ]
Marking disk "ASM3" as an ASM disk: [ OK ]
# /etc/init.d/oracleasm createdisk ASM4
/dev/sde1
Marking disk "ASM4" as an ASM disk: [ OK ]
Marking disk "ASM4" as an ASM disk: [ OK ]
NOw issue a scandisks on all ASM disks.
# /etc/init.d/oracleasm scandisks
Scanning the system for Oracle ASMLib disks: [ OK ]
Scanning the system for Oracle ASMLib disks: [ OK ]
listsdisks will list all ASM disks. Make sure you see
all the disks you configured.
# /etc/init.d/oracleasm
listdisks
ASM1
ASM2
ASM3
ASM4
#
ASM1
ASM2
ASM3
ASM4
#
Configure RAW disks to use as ASM
disks:
Open /etc/sysconfig/rawdevices and add following
lines:
/dev/raw/raw1 /dev/sdb1
/dev/raw/raw2 /dev/sdc1
/dev/raw/raw3 /dev/sdd1
/dev/raw/raw4 /dev/sde1
/dev/raw/raw2 /dev/sdc1
/dev/raw/raw3 /dev/sdd1
/dev/raw/raw4 /dev/sde1
Restart the rwdevices service to make your changes
effective.
# service rawdevices restart
Assigning devices:
/dev/raw/raw1 --> /dev/sdb1
/dev/raw/raw1: bound to major 8, minor 17
/dev/raw/raw2 --> /dev/sdc1
/dev/raw/raw2: bound to major 8, minor 33
/dev/raw/raw3 --> /dev/sdd1
/dev/raw/raw3: bound to major 8, minor 49
/dev/raw/raw4 --> /dev/sde1
/dev/raw/raw4: bound to major 8, minor 65
done
#
Assigning devices:
/dev/raw/raw1 --> /dev/sdb1
/dev/raw/raw1: bound to major 8, minor 17
/dev/raw/raw2 --> /dev/sdc1
/dev/raw/raw2: bound to major 8, minor 33
/dev/raw/raw3 --> /dev/sdd1
/dev/raw/raw3: bound to major 8, minor 49
/dev/raw/raw4 --> /dev/sde1
/dev/raw/raw4: bound to major 8, minor 65
done
#
This will bound the disks with raw devices.
Execute the following commands to set access and
ownership on the raw disks for user oracle.
Also add these lines in /etc/rc.local to preserve
these settings after system restart.
# chown oracle:oinstall /dev/raw/raw1
# chown oracle:oinstall /dev/raw/raw2
# chown oracle:oinstall /dev/raw/raw3
# chown oracle:oinstall /dev/raw/raw4
# chmod 660 /dev/raw/raw1
# chmod 660 /dev/raw/raw2
# chmod 660 /dev/raw/raw3
# chmod 660 /dev/raw/raw4
# chown oracle:oinstall /dev/raw/raw2
# chown oracle:oinstall /dev/raw/raw3
# chown oracle:oinstall /dev/raw/raw4
# chmod 660 /dev/raw/raw1
# chmod 660 /dev/raw/raw2
# chmod 660 /dev/raw/raw3
# chmod 660 /dev/raw/raw4
NOTE: Raw devices setup or the ASMLib setup are two different mutually
exclusive ways to configure ASM disks. You will use either one of those not
both.
If you are using RHEL5.0 or 5.1 then you won't find
the rawdevices service or the /etc/sysconfig/rawdevices file, please refer to
the links provided below.
See also:
----------------All of the blogs are for my own reference only---------------------
No comments:
Post a Comment