給ASM例項增加diskgroup

lovestanford發表於2014-06-16
測試虛擬機器作業系統版本是 Redhat 6.4 64位,資料庫版本是 oracle 11.2.0.4.0 64bit, GI版本 oracle 11.2.0.4 64bit,下文記錄了
使用udev給ASM例項新增一個磁碟組 diskgroup FRA,一共兩個硬碟 sdf, sdg,各20G空間.

step1:確認新硬碟並建立分割槽

[root@rhel ~]# ls -lt /dev/sd*

brw-rw----. 1 root disk 8,  1 Jun 16 03:42 /dev/sda1

brw-rw----. 1 root disk 8,  2 Jun 16 03:42 /dev/sda2

brw-rw----. 1 root disk 8, 16 Jun 16 03:  /dev/sdb

brw-rw----. 1 root disk 8, 32 Jun 16 03:42 /dev/sdc

brw-rw----. 1 root disk 8, 64 Jun 16 03:42 /dev/sde

brw-rw----. 1 root disk 8,  0 Jun 16 03:42 /dev/sda

brw-rw----. 1 root disk 8, 80 Jun 16 03:42 /dev/sdf

brw-rw----. 1 root disk 8, 48 Jun 16 03:42 /dev/sdd

brw-rw----. 1 root disk 8, 96 Jun 16 03:42 /dev/sdg

fdisk /dev/sdf

Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel

Building a new DOS disklabel with disk identifier 0x5cf28aa4.

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)
WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
         switch off the mode (command 'c') and change display units to
         sectors (command 'u').
Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p

Partition number (1-4): 1

First cylinder (1-2610, default 1): 1

Last cylinder, +cylinders or +size{K,M,G} (1-2610, default 2610):

Using default value 2610

Command (m for help): w

The partition table has been altered!
Calling ioctl() to re-read partition table.

Syncing disks.

partprobe  /dev/sdf1
partprobe   /dev/sdf

partprobe /dev/sdg1
partprobe /dev/sdg

step2:修改udev 的rules規則檔案
先備份原來使用的,然後在編輯。
vi  99-oracle-asmdevices.rules

KERNEL=="sdb1", NAME="asmdisk1_udev1", OWNER="grid", GROUP="asmadmin", MODE="0660"
KERNEL=="sdc1", NAME="asmdisk2_udev2", OWNER="grid", GROUP="asmadmin", MODE="0660"
KERNEL=="sdd1", NAME="asmdisk3_udev3", OWNER="grid", GROUP="asmadmin", MODE="0660"
KERNEL=="sde1", NAME="asmdisk4_udev4", OWNER="grid", GROUP="asmadmin", MODE="0660"

KERNEL=="sdf1", NAME="asmdisk4_udev5", OWNER="grid", GROUP="asmadmin", MODE="0660"
KERNEL=="sdg1", NAME="asmdisk4_udev6", OWNER="grid", GROUP="asmadmin", MODE="0660"

儲存後退出。

step3:重新載入規則檔案和啟動udev

[root@rhel rules.d]#udevadm control --reload-rules

[root@rhel rules.d]# start_udev
Starting udev:

檢視結果
[root@rhel rules.d]# ls -lt /dev/asm*

brw-rw----. 1 grid asmadmin 8, 17 Jun 16 03:53  /dev/asmdisk1_udev1

brw-rw----. 1 grid asmadmin 8, 33 Jun 16 03:53  /dev/asmdisk2_udev2

brw-rw----. 1 grid asmadmin 8, 49 Jun 16 03:53 /dev/asmdisk3_udev3

brw-rw----. 1 grid asmadmin 8, 97 Jun 16 03:53 /dev/asmdisk4_udev6

brw-rw----. 1 grid asmadmin 8, 81 Jun 16 03:53 /dev/asmdisk4_udev5

brw-rw----. 1 grid asmadmin 8, 65 Jun 16 03:53 /dev/asmdisk4_udev4

step4:建立新的diskgroup
[grid@rhel ~]$ sqlplus / as sysasm



SQL*Plus: Release 11.2.0.4.0 Production on Mon Jun 16 03:54:36 2014
Copyright (c) 1982, 2013, Oracle.  All rights reserved.
Connected to:

Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production

With the Automatic Storage Management option
SQL> select name,state,path from v$asm_disk;
NAME                   STATE    PATH

------------------------------ -------- ----------------------------------------------------------------------

                               NORMAL    /dev/asmdisk4_udev6

                                NORMAL    /dev/asmdisk4_udev5

DATA_0001               NORMAL    /dev/asmdisk2_udev2

DATA_0000               NORMAL    /dev/asmdisk1_udev1

DATA_0002               NORMAL    /dev/asmdisk3_udev3

DATA_0003               NORMAL    /dev/asmdisk4_udev4

6 rows selected.

SQL> select GROUP_NUMBER,NAME,STATE,SECTOR_SIZE from v$asm_diskgroup;

GROUP_NUMBER NAME                STATE    SECTOR_SIZE
------------ ------------------------------ ----------- -----------
       1 DATA                MOUNTED        512

SQL> create diskgroup FRA normal redundancy

failgroup fg1 disk '/dev/asmdisk4_udev5'

failgroup fg2 disk '/dev/asmdisk4_udev6';  2    3  

Diskgroup created.

SQL>  select name,path from v$asm_disk;

NAME                   PATH

------------------------------ ----------------------------------------------------------------------

DATA_0001               /dev/asmdisk2_udev2

DATA_0000               /dev/asmdisk1_udev1

DATA_0002               /dev/asmdisk3_udev3

DATA_0003               /dev/asmdisk4_udev4

FRA_0001                 /dev/asmdisk4_udev6

FRA_0000                 /dev/asmdisk4_udev5

6 rows selected.
SQL> select name,state from v$asm_diskgroup;

NAME                   STATE

------------------------------ -----------

DATA                   MOUNTED

FRA                      MOUNTED

之後就可以在RDBMS端建立tablespace 存放資料到新建立的磁碟組。
參考文件
How To Setup Partitioned Linux Block Devices Using UDEV (Non-ASMLIB) And Assign Them To ASM? (Doc ID 1528148.1)

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/21754115/viewspace-1184191/,如需轉載,請註明出處,否則將追究法律責任。

相關文章