lab1 configuration of devices for asm

13
ASM HANDS-ON TRAINING Lab 1 Configuration of Devices for ASM Alejandro Vargas | Principal Support Consultant Oracle Advanced Customer Services INDEX Part 1 : Configure devices for ASM using file system files and loop devices .......................................................................... 2 Check the amount of space available on file system .................................................................................................... 2 Create a directory to hold the files to be used as ASM devices................................................................................... 2 Create the files to be used as Asm devices.................................................................................................................. 2 Check the created files .................................................................................................................................................. 3 Connect to root and check if there are loop devices ...................................................................................................................................................................................... 3  As root create the loop devices ....................................................................................................................................................................................... 4 Bind the loop devices to raw devices ....................................................................................................................................................................................... 4 Check the raw devices binding ....................................................................................................................................................................................... 4 Setup raw devices permissions and ownership ....................................................................................................................................................................................... 4 Part 2 : Configure devices for ASM using LUN’s..................................................................................................................... 6 Identify which devices are being used by the mounted file systems ............................................................................6 Identify available LUN’s and LUN’s sizes..................................................................................................................... 6 Create a single pa rtition per LUN using fdis k................................................................................................................ 6 Create single partitions on evary other LUN ................................................................................................................ 8 Change LUN’s Ownership to Oracle and Set Permissions ........................................................................................... 9 Part 3 : Confi gure File System Files to be Used as ASM Disks ............................................................................................ 11 Create a directory to store the files that will be used as ASM DISKS .......................................................................11 Create the files to be used as ASM DISKS................................................................................................................. 11 Change Ownership and Permissions of the ASM Files ..............................................................................................12 Setup ASM instance to Use File System Files............................................................................................................ 12 1/13

Upload: ashwadhama

Post on 03-Apr-2018

233 views

Category:

Documents


0 download

TRANSCRIPT

7/28/2019 Lab1 Configuration of Devices for ASM

http://slidepdf.com/reader/full/lab1-configuration-of-devices-for-asm 1/13

ASM HANDS-ON TRAININGLab 1 Configuration of Devices for ASM

Alejandro Vargas | Principal Support ConsultantOracle Advanced Customer Services

INDEX

Part 1 : Configure devices for ASM using file system files and loop devices .......................................................................... 2Check the amount of space available on file system .................................................................................................... 2Create a directory to hold the files to be used as ASM devices ................................................................................... 2Create the files to be used as Asm devices ..................................................................................................................2Check the created files ..................................................................................................................................................3Connect to root and check if there are loop devices......................................................................................................................................................................................3

 As root create the loop devices

.......................................................................................................................................................................................4Bind the loop devices to raw devices.......................................................................................................................................................................................4Check the raw devices binding.......................................................................................................................................................................................4Setup raw devices permissions and ownership.......................................................................................................................................................................................4

Part 2 : Configure devices for ASM using LUN’s ..................................................................................................................... 6Identify which devices are being used by the mounted file systems ............................................................................6Identify available LUN’s and LUN’s sizes ................................................................................................... ................. .6

Create a single partition per LUN using fdisk ................................................................................................................6Create single partitions on evary other LUN ................................................................................................................ 8Change LUN’s Ownership to Oracle and Set Permissions ...........................................................................................9

Part 3 : Configure File System Files to be Used as ASM Disks ........................................................................................ ....11Create a directory to store the files that will be used as ASM DISKS ................................................................. ...... 11Create the files to be used as ASM DISKS .................................................................................................................11Change Ownership and Permissions of the ASM Files ..............................................................................................12Setup ASM instance to Use File System Files ............................................................................................................12

1/13

7/28/2019 Lab1 Configuration of Devices for ASM

http://slidepdf.com/reader/full/lab1-configuration-of-devices-for-asm 2/13

ASM HANDS-ON TRAININGLab 1 Configuration of Devices for ASM

Part 1 : Configure devices for ASM using file system files and loop devices

Check the amount of space available on file system

[oracle@asmxpt ~]$ df -hFilesystem Size Used Avail Use% Mounted on/dev/sda3 18G 9.8G 6.8G

59% //dev/sda1 76M 9.9M 63M 14% /boottmpfs 633M 0 633M 0% /dev/shm

Create a directory to hold the files to be used as ASM devices

[oracle@asmxpt ~]$ mkdir /u01/app/asm_loop_devices[oracle@asmxpt ~]$ ls -l /u01/app/total 12drwxr-xr-x 2 oracle dba 4096 Jan 31 11:31 asm_loop_devicesdrwxr-xr-x 7 oracle dba 4096 Jan 26 09:34 oracledrwxrwx--- 6 oracle dba 4096 Jan 24 18:29 oraInventory

Create the files to be used as Asm devices

[oracle@asmxpt ~]$ cd /u01/app/asm_loop_devices[oracle@asmxpt asm_loop_devices]$ \? dd if=/dev/zero of=/u01/app/asm_loop_devices/fs_dsk1 bs=1M count=500500+0 records in500+0 records out

2/13

7/28/2019 Lab1 Configuration of Devices for ASM

http://slidepdf.com/reader/full/lab1-configuration-of-devices-for-asm 3/13

ASM HANDS-ON TRAININGLab 1 Configuration of Devices for ASM

524288000 bytes (524 MB) copied, 10.9365 seconds, 47.9 MB/s[oracle@asmxpt asm_loop_devices]$ \? dd if=/dev/zero of=/u01/app/asm_loop_devices/fs_dsk2 bs=1M count=500

500+0 records in500+0 records out524288000 bytes (524 MB) copied, 17.6032 seconds, 29.8 MB/s[oracle@asmxpt asm_loop_devices]$ \? dd if=/dev/zero of=/u01/app/asm_loop_devices/fs_dsk3 bs=1M count=500500+0 records in500+0 records out524288000 bytes (524 MB) copied, 12.8595 seconds, 40.8 MB/s[oracle@asmxpt asm_loop_devices]$ \? dd if=/dev/zero of=/u01/app/asm_loop_devices/fs_dsk4 bs=1M count=500500+0 records in500+0 records out524288000 bytes (524 MB) copied, 12.4761 seconds, 42.0 MB/s

Check the created files

 [oracle@asmxpt asm_loop_devices]$ ls -ltrtotal 2050016-rw-r--r-- 1 oracle dba 524288000 Jan 31 12:39 fs_dsk1-rw-r--r-- 1 oracle dba 524288000 Jan 31 12:42 fs_dsk2-rw-r--r-- 1 oracle dba 524288000 Jan 31 12:43 fs_dsk3-rw-r--r-- 1 oracle dba 524288000 Jan 31 12:44 fs_dsk4

Connect to root and check if there are loop devices 

[oracle@asmxpt asm_loop_devices]$ su -Password:[root@asmxpt ~]# raw –qa

3/13

7/28/2019 Lab1 Configuration of Devices for ASM

http://slidepdf.com/reader/full/lab1-configuration-of-devices-for-asm 4/13

ASM HANDS-ON TRAININGLab 1 Configuration of Devices for ASM

 As root create the loop devices

[root@asmxpt ~]# losetup /dev/loop1 /u01/app/asm_loop_devices/fs_dsk1

[root@asmxpt ~]# losetup /dev/loop2 /u01/app/asm_loop_devices/fs_dsk2[root@asmxpt ~]# losetup /dev/loop3 /u01/app/asm_loop_devices/fs_dsk3[root@asmxpt ~]# losetup /dev/loop4 /u01/app/asm_loop_devices/fs_dsk4

Bind the loop devices to raw devices

[root@asmxpt ~]# raw /dev/raw/raw1 /dev/loop1/dev/raw/raw1: bound to major 7, minor 1[root@asmxpt ~]# raw /dev/raw/raw2 /dev/loop2/dev/raw/raw2: bound to major 7, minor 2[root@asmxpt ~]# raw /dev/raw/raw3 /dev/loop3/dev/raw/raw3: bound to major 7, minor 3[root@asmxpt ~]# raw /dev/raw/raw4 /dev/loop4/dev/raw/raw4: bound to major 7, minor 4

Check the raw devices binding 

[root@asmxpt ~]# raw -qa

/dev/raw/raw1: bound to major 7, minor 1/dev/raw/raw2: bound to major 7, minor 2/dev/raw/raw3: bound to major 7, minor 3/dev/raw/raw4: bound to major 7, minor 4

Setup raw devices permissions and ownership

[root@asmxpt ~]# chmod 660 /dev/raw/raw[1-4]

4/13

7/28/2019 Lab1 Configuration of Devices for ASM

http://slidepdf.com/reader/full/lab1-configuration-of-devices-for-asm 5/13

ASM HANDS-ON TRAININGLab 1 Configuration of Devices for ASM

[root@asmxpt ~]# chown oracle:dba /dev/raw/raw[1-4]

[root@asmxpt ~]# ls -l /dev/raw/raw[1-4]

crw-rw---- 1 oracle dba 162, 1 Jan 31 12:54 /dev/raw/raw1crw-rw---- 1 oracle dba 162, 2 Jan 31 12:54 /dev/raw/raw2crw-rw---- 1 oracle dba 162, 3 Jan 31 12:54 /dev/raw/raw3crw-rw---- 1 oracle dba 162, 4 Jan 31 12:54 /dev/raw/raw4

Note that after reboot the ownership and permisions will change back to root and -rw-r--r--, they can be setup on file/etc/rc.local to be executed at startup:

echo "chmod 660 /dev/raw/raw[1-4]" >>/etc/rc.localecho "chown oracle:dba /dev/raw/raw[1-4]" >>/etc/rc.local

To delete a loop device use the following sintax: losetup –d /dev/loopX 

5/13

7/28/2019 Lab1 Configuration of Devices for ASM

http://slidepdf.com/reader/full/lab1-configuration-of-devices-for-asm 6/13

ASM HANDS-ON TRAININGLab 1 Configuration of Devices for ASM

Part 2 : Configure devices for ASM using LUN’s

Identify which devices are being used by the mounted file systems

[root@asmxpt ~]# df -kFilesystem 1K-blocks Used Available Use% Mounted on/dev/sda3 18253712 12243352 5068148 71% //dev/sda1 77749 10095 63640 14% /boottmpfs 647744 0 647744 0% /dev/shm

Identify available LUN’s and LUN’s sizes

[root@asmxpt ~]# fdisk -l | grep -v /dev/sda | grep ^DiskDisk /dev/sdb: 2147 MB, 2147483648 bytesDisk /dev/sdc: 2147 MB, 2147483648 bytesDisk /dev/sdd: 2147 MB, 2147483648 bytesDisk /dev/sde: 2147 MB, 2147483648 bytesDisk /dev/sdf: 2147 MB, 2147483648 bytesDisk /dev/sdg: 2147 MB, 2147483648 bytesDisk /dev/sdh: 2147 MB, 2147483648 bytesDisk /dev/sdi: 2147 MB, 2147483648 bytes

Create a single partition per LUN using fdisk 

Discussions about LUN alignement can be found at: 

Oracle Database 10g Release 2 Automatic Storage Management Overview and Technical Best PracticesMay 2007Author: Nitin Vengurlekar Contributing Authors: Rich Long, Ara Shakian

6/13

7/28/2019 Lab1 Configuration of Devices for ASM

http://slidepdf.com/reader/full/lab1-configuration-of-devices-for-asm 7/13

ASM HANDS-ON TRAININGLab 1 Configuration of Devices for ASM

 And

Aligning ASM Disks on Linux

by Christo Kutrovskyhttp://www.pythian.com/blogs/411/aligning-asm-disks-on-linux

[root@asmxpt ~]# fdisk /dev/sdb

Command (m for help): p

Disk /dev/sdb: 2147 MB, 2147483648 bytes255 heads, 63 sectors/track, 261 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System

Command (m for help): uChanging display/entry units to sectors

Command (m for help): p

Disk /dev/sdb: 2147 MB, 2147483648 bytes255 heads, 63 sectors/track, 261 cylinders, total 4194304 sectorsUnits = sectors of 1 * 512 = 512 bytes

Device Boot Start End Blocks Id System

Command (m for help): nCommand action

e extendedp primary partition (1-4)

 pPartition number (1-4): 1

7/13

7/28/2019 Lab1 Configuration of Devices for ASM

http://slidepdf.com/reader/full/lab1-configuration-of-devices-for-asm 8/13

ASM HANDS-ON TRAININGLab 1 Configuration of Devices for ASM

First sector (63-4194303, default 63): 2048 <<<< Start at 1M Last sector or +size or +sizeM or +sizeK (32768-4194303, default 4194303):Using default value 4194303

Command (m for help): p

Disk /dev/sdb: 2147 MB, 2147483648 bytes255 heads, 63 sectors/track, 261 cylinders, total 4194304 sectorsUnits = sectors of 1 * 512 = 512 bytes

Device Boot Start End Blocks Id System/dev/sdb1 2048 4194303 2080768 83 LinuxPartition 1 does not end on cylinder boundary.

Command (m for help): wThe partition table has been altered!

Calling ioctl() to re-read partition table.Syncing disks.

Create single partitions on evary other LUN 

 After repeating the previous step for each LUN available for ASM you will have these partitions:

[root@asmxpt ~]# fdisk -l | grep /dev/sd | grep -v sda

Disk /dev/sdb: 2147 MB, 2147483648 bytes/dev/sdb1 6 11916 2096128 83 LinuxDisk /dev/sdc: 2147 MB, 2147483648 bytes/dev/sdc1 6 11916 2096128 83 LinuxDisk /dev/sdd: 2147 MB, 2147483648 bytes/dev/sdd1 6 11916 2096128 83 LinuxDisk /dev/sde: 2147 MB, 2147483648 bytes/dev/sde1 6 11916 2096128 83 Linux

8/13

7/28/2019 Lab1 Configuration of Devices for ASM

http://slidepdf.com/reader/full/lab1-configuration-of-devices-for-asm 9/13

7/28/2019 Lab1 Configuration of Devices for ASM

http://slidepdf.com/reader/full/lab1-configuration-of-devices-for-asm 10/13

ASM HANDS-ON TRAININGLab 1 Configuration of Devices for ASM

brw-rw---- 1 oracle dba 8, 81 Jan 31 19:19 /dev/sdf1brw-rw---- 1 oracle dba 8, 97 Jan 31 19:21 /dev/sdg1brw-rw---- 1 oracle dba 8, 113 Jan 31 19:23 /dev/sdh1

brw-rw---- 1 oracle dba 8, 129 Jan 31 19:23 /dev/sdi1

10/13

7/28/2019 Lab1 Configuration of Devices for ASM

http://slidepdf.com/reader/full/lab1-configuration-of-devices-for-asm 11/13

ASM HANDS-ON TRAININGLab 1 Configuration of Devices for ASM

Part 3 : Configure File System Files to be Used as ASM Disks

The use of file system files as ASM disks is implemented using the parameter  _asm_allow_only_raw_disks = FALSEDetails can be found on Metalink Note: 293095.1

Create a directory to store the files that will be used as ASM DISKS 

[oracle@asmxpt ~]$ mkdir /u01/app/asm_filesystem_devices

Create the files to be used as ASM DISKS 

[oracle@asmxpt ~]$ dd if=/dev/zero of=/u01/app/asm_filesystem_devices/asm_filesystem_dsk1bs=1M count=500500+0 records in500+0 records out524288000 bytes (524 MB) copied, 12.951 seconds, 40.5 MB/s[oracle@asmxpt ~]$ dd if=/dev/zero of=/u01/app/asm_filesystem_devices/asm_filesystem_dsk2bs=1M count=500500+0 records in500+0 records out

524288000 bytes (524 MB) copied, 12.7267 seconds, 41.2 MB/s[oracle@asmxpt ~]$ dd if=/dev/zero of=/u01/app/asm_filesystem_devices/asm_filesystem_dsk3bs=1M count=500500+0 records in500+0 records out524288000 bytes (524 MB) copied, 11.3377 seconds, 46.2 MB/s[oracle@asmxpt ~]$ dd if=/dev/zero of=/u01/app/asm_filesystem_devices/asm_filesystem_dsk4bs=1M count=500

11/13

7/28/2019 Lab1 Configuration of Devices for ASM

http://slidepdf.com/reader/full/lab1-configuration-of-devices-for-asm 12/13

7/28/2019 Lab1 Configuration of Devices for ASM

http://slidepdf.com/reader/full/lab1-configuration-of-devices-for-asm 13/13

ASM HANDS-ON TRAININGLab 1 Configuration of Devices for ASM

The instance has to be restarted with parameter _asm_allow_only_raw_disks = FALSE.

• Check view v$asm_disk to see if the new disks asm_filesystem_dsk* was discovered:

Select header_status,path from v$asm_disk;

Kfod can be also used:

kfod p='$ORACLE_HOME/dbs/init\+ASM.ora'

• Create a diskgroup using the new file

Create diskgroup datadg_fs disk ‘/u01/app/asm_loop_devices/fs_dsk1’;

select TOTAL_MB, FREE_MB, NAME from v$asm_diskgroup;

• Create a tablespace using this diskgroup:

create tablespace ts_fs datafile ‘+dg_fs’;

End of Lab1

13/13