新增磁碟多連路磁碟併為ASM磁碟組擴容

yuntui發表於2016-11-03

1、先保留現有的多路徑配置

#/sbin/multipath -ll | grep 3PARdata>/tmp/out

2、安裝磁碟掃描外掛(如果不存在的話)

#yum install sg3_utils

3、執行磁碟重新掃描,獲取wwid(需要提前獲取新增加的磁碟連路條數是否符合)

#rescan-scsi-bus.sh -l -w -c

4、逐一掃描磁碟

#for i in `cat /proc/partitions | awk '{print $4}' | grep sd`; do echo "### $i: `scsi_id -g -u  /dev/$i `"; done | sort -k 3 | awk '{print $NF}' | sort | uniq

5、對比兩個檔案差異即是新增的磁碟wwid

將新增的磁碟wwid新增到配置檔案multipath.conf中

#diff /etc/multipath.conf multipath.conf

6、建立ASM需要的裸盤


[root@cnhkpgs10 mapper]# oracleasm createdisk DATA_DISK07 /dev/mapper/data_lun07

Writing disk header: done

Instantiating disk: done


[root@cnhkpgs10 mapper]# oracleasm createdisk DATA_DISK08 /dev/mapper/data_lun08

Writing disk header: done

Instantiating disk: done

[root@cnhkpgs10 mapper]# oracleasm createdisk DATA_DISK09 /dev/mapper/data_lun09

Writing disk header: done

Instantiating disk: done

7、掃描新增磁碟


[root@cnhkpgs11 disks]# oracleasm scandisks

Reloading disk partitions: done

Cleaning any stale ASM disks...

Scanning system for ASM disks...

Instantiating disk "DATA_DISK09"

Instantiating disk "DATA_DISK08"

Instantiating disk "DATA_DISK07"



[root@cnhkpgs10 mapper]# oracleasm listdisks

DATA_DISK01

DATA_DISK02

DATA_DISK03

DATA_DISK04

DATA_DISK05

DATA_DISK06

DATA_DISK07

DATA_DISK08

DATA_DISK09

OCRVD_DISK01

OCRVD_DISK02

OCRVD_DISK03


8、檢查新增磁碟及許可權


[root@cnhkpgs11 disks]# ls -lrt /dev/oracleasm/disks/

total 0

brw-rw---- 1 grid asmadmin 252, 11 Oct 25 17:03 DATA_DISK07

brw-rw---- 1 grid asmadmin 252,  9 Oct 25 17:04 DATA_DISK09

brw-rw---- 1 grid asmadmin 252, 10 Oct 25 17:04 DATA_DISK08

brw-rw---- 1 grid asmadmin 252,  7 Oct 25 17:06 DATA_DISK02

brw-rw---- 1 grid asmadmin 252,  0 Oct 25 17:06 OCRVD_DISK03

brw-rw---- 1 grid asmadmin 252,  1 Oct 25 17:06 OCRVD_DISK02

brw-rw---- 1 grid asmadmin 252,  2 Oct 25 17:06 OCRVD_DISK01

brw-rw---- 1 grid asmadmin 252,  5 Oct 25 17:06 DATA_DISK06

brw-rw---- 1 grid asmadmin 252,  4 Oct 25 17:06 DATA_DISK05

brw-rw---- 1 grid asmadmin 252,  3 Oct 25 17:06 DATA_DISK04

brw-rw---- 1 grid asmadmin 252,  8 Oct 25 17:06 DATA_DISK03

brw-rw---- 1 grid asmadmin 252,  6 Oct 25 17:06 DATA_DISK01


9、查詢Oracle資料庫中是否識別出新增的磁碟

SQL> select name,path,total_mb,free_mb,os_mb from v$asm_disk;


NAME                 PATH                                       TOTAL_MB    FREE_MB      OS_MB

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

DATADG_0002          /dev/oracleasm/disks/DATA_DISK03             102400      14927     102400

DATADG_0001          /dev/oracleasm/disks/DATA_DISK02             102400      14923     102400

DATADG_0000          /dev/oracleasm/disks/DATA_DISK01             102400      14919     102400

DATADG_0005          /dev/oracleasm/disks/DATA_DISK06             102400      14927     102400

DATADG_0004          /dev/oracleasm/disks/DATA_DISK05             102400      14917     102400

DATADG_0003          /dev/oracleasm/disks/DATA_DISK04             102400      14924     102400

OCRDG_0000           /dev/oracleasm/disks/OCRVD_DISK01              5120       4811       5120

OCRDG_0001           /dev/oracleasm/disks/OCRVD_DISK02              5120       4812       5120

OCRDG_0002           /dev/oracleasm/disks/OCRVD_DISK03              5120       4811       5120

                     /dev/oracleasm/disks/DATA_DISK08                  0          0     102400

                     /dev/oracleasm/disks/DATA_DISK09                  0          0     102400

                     /dev/oracleasm/disks/DATA_DISK07                  0          0     102400


12 rows selected.



10、將新增磁碟新增到ASM磁碟組中

SQL> select name,free_mb,total_mb from v$asm_diskgroup;


NAME                              FREE_MB   TOTAL_MB

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

OCRDG                               14434      15360

DATADG                              89537     614400


SQL> select name,free_mb,total_mb^C


SQL> select name,path,failgroup from v$asm_disk;


NAME                           PATH                                     FAILGROUP

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

                               /dev/oracleasm/disks/DATA_DISK07

                               /dev/oracleasm/disks/DATA_DISK09

                               /dev/oracleasm/disks/DATA_DISK08

DATADG_0002                    /dev/oracleasm/disks/DATA_DISK03         DATADG_0002

DATADG_0001                    /dev/oracleasm/disks/DATA_DISK02         DATADG_0001

DATADG_0000                    /dev/oracleasm/disks/DATA_DISK01         DATADG_0000

DATADG_0005                    /dev/oracleasm/disks/DATA_DISK06         DATADG_0005

DATADG_0004                    /dev/oracleasm/disks/DATA_DISK05         DATADG_0004

DATADG_0003                    /dev/oracleasm/disks/DATA_DISK04         DATADG_0003

OCRDG_0000                     /dev/oracleasm/disks/OCRVD_DISK01        OCRDG_0000

OCRDG_0001                     /dev/oracleasm/disks/OCRVD_DISK02        OCRDG_0001

OCRDG_0002                     /dev/oracleasm/disks/OCRVD_DISK03        OCRDG_0002


12 rows selected.


SQL> alter diskgroup DATADG add disk '/dev/oracleasm/disks/DATA_DISK07';


Diskgroup altered.

SQL> alter diskgroup DATADG add disk '/dev/oracleasm/disks/DATA_DISK08';    


Diskgroup altered.

SQL> alter diskgroup DATADG add disk '/dev/oracleasm/disks/DATA_DISK09';


Diskgroup altered.

SQL> select * from v$asm_operation;


GROUP_NUMBER OPERA STAT      POWER     ACTUAL      SOFAR   EST_WORK   EST_RATE EST_MINUTES ERROR_CODE

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

           2 REBAL RUN           1          1       2238     170005       2999          55


SQL> select name,free_mb,total_mb from v$asm_diskgroup;


NAME                              FREE_MB   TOTAL_MB

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

OCRDG                               14434      15360

DATADG                             396731     921600


SQL> select name,path,failgroup from v$asm_disk;


NAME                           PATH                                     FAILGROUP

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

DATADG_0002                    /dev/oracleasm/disks/DATA_DISK03         DATADG_0002

DATADG_0001                    /dev/oracleasm/disks/DATA_DISK02         DATADG_0001

DATADG_0000                    /dev/oracleasm/disks/DATA_DISK01         DATADG_0000

DATADG_0005                    /dev/oracleasm/disks/DATA_DISK06         DATADG_0005

DATADG_0004                    /dev/oracleasm/disks/DATA_DISK05         DATADG_0004

DATADG_0003                    /dev/oracleasm/disks/DATA_DISK04         DATADG_0003

OCRDG_0000                     /dev/oracleasm/disks/OCRVD_DISK01        OCRDG_0000

OCRDG_0001                     /dev/oracleasm/disks/OCRVD_DISK02        OCRDG_0001

OCRDG_0002                     /dev/oracleasm/disks/OCRVD_DISK03        OCRDG_0002

DATADG_0007                    /dev/oracleasm/disks/DATA_DISK08         DATADG_0007

DATADG_0008                    /dev/oracleasm/disks/DATA_DISK09         DATADG_0008

DATADG_0006                    /dev/oracleasm/disks/DATA_DISK07         DATADG_0006


12 rows selected.


------------------------End TangYun[Tony.Tang]2016.10.26------------------------------------------------------

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

相關文章