通过磁盘组反向确认磁盘信息
发布时间:2022-04-14
如何通过asm磁盘组反向查找是由哪些磁盘构成?
ASMCMD> lsdg
State Type Rebal Sector Logical_Sector Block AU Total_MB Free_MB Req_mir_free_MB Usable_file_MB Offline_disks Voting_files Name
MOUNTED EXTERN N 512 512 4096 4194304 30708 7988 0 7988 0 N DATA/
MOUNTED EXTERN N 512 512 4096 4194304 10236 9428 0 9428 0 N FRA/
比如此处DATA磁盘组由哪些磁盘构成的呢?
以下为磁盘信息:
[root@dbserver ~]# lsblk -p
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
/dev/sdf 8:80 0 10G 0 disk
└─/dev/sdf1 8:81 0 10G 0 part
/dev/sdd 8:48 0 10G 0 disk
└─/dev/sdd1 8:49 0 10G 0 part
/dev/sdb 8:16 0 10G 0 disk
└─/dev/sdb1 8:17 0 10G 0 part
/dev/sr0 11:0 1 4.5G 0 rom
/dev/sde 8:64 0 10G 0 disk
└─/dev/sde1 8:65 0 10G 0 part
/dev/sdc 8:32 0 10G 0 disk
└─/dev/sdc1 8:33 0 10G 0 part
/dev/sda 8:0 0 100G 0 disk
├─/dev/sda2 8:2 0 98G 0 part
│ ├─/dev/mapper/ol-swap 252:1 0 16G 0 lvm [SWAP]
│ ├─/dev/mapper/ol-home 252:2 0 40G 0 lvm /home
│ └─/dev/mapper/ol-root 252:0 0 42G 0 lvm /
└─/dev/sda1 8:1 0 2G 0 part /boot
SQL> select name,path from v$asm_disk
NAME PATH
------------------------------ ------------------------------
DATA01 ORCL:DATA01
DATA02 ORCL:DATA02
DATA03 ORCL:DATA03
DATA04 ORCL:DATA04
ORCL:DATA05
[root@dbserver ~]# oracleasm listdisks
DATA01
DATA02
DATA03
DATA04
DATA05
如何确认/dev/sd*与DATA*的对应关系?
方法1:
[root@dbserver ~]# oracleasm querydisk /dev/sdb1
Device "/dev/sdb1" is marked an ASM disk with the label "DATA01"
[root@dbserver ~]# oracleasm querydisk /dev/sdc1
Device "/dev/sdc1" is marked an ASM disk with the label "DATA02"
[root@dbserver ~]# oracleasm querydisk /dev/sdd1
Device "/dev/sdd1" is marked an ASM disk with the label "DATA03"
[root@dbserver ~]# oracleasm querydisk /dev/sde1
Device "/dev/sde1" is marked an ASM disk with the label "DATA04"
[root@dbserver ~]# oracleasm querydisk /dev/sdf1
Device "/dev/sdf1" is marked an ASM disk with the label "DATA05"
可知/dev/sdb1对应DATA01,后面磁盘依此类推.
方法2:
[root@dbserver ~]# oracleasm querydisk -d DATA01
Disk "DATA01" is a valid ASM disk on device [8,17]
[root@dbserver ~]# oracleasm querydisk -d DATA02
Disk "DATA02" is a valid ASM disk on device [8,33]
[root@dbserver ~]# oracleasm querydisk -d DATA03
Disk "DATA03" is a valid ASM disk on device [8,49]
[root@dbserver ~]# oracleasm querydisk -d DATA04
Disk "DATA04" is a valid ASM disk on device [8,65]
[root@dbserver ~]# oracleasm querydisk -d DATA05
Disk "DATA05" is a valid ASM disk on device [8,81]
[root@dbserver ~]# ll /dev/sd*
brw-rw---- 1 root disk 8, 0 Jan 25 10:37 /dev/sda
brw-rw---- 1 root disk 8, 1 Jan 25 10:37 /dev/sda1
brw-rw---- 1 root disk 8, 2 Jan 25 10:37 /dev/sda2
brw-rw---- 1 root disk 8, 16 Jan 25 10:38 /dev/sdb
brw-rw---- 1 root disk 8, 17 Jan 25 10:38 /dev/sdb1
brw-rw---- 1 root disk 8, 32 Jan 25 10:38 /dev/sdc
brw-rw---- 1 root disk 8, 33 Jan 25 10:38 /dev/sdc1
brw-rw---- 1 root disk 8, 48 Jan 25 10:38 /dev/sdd
brw-rw---- 1 root disk 8, 49 Jan 25 10:38 /dev/sdd1
brw-rw---- 1 root disk 8, 64 Jan 25 10:38 /dev/sde
brw-rw---- 1 root disk 8, 65 Jan 25 10:38 /dev/sde1
brw-rw---- 1 root disk 8, 80 Jan 25 10:38 /dev/sdf
brw-rw---- 1 root disk 8, 81 Jan 25 10:38 /dev/sdf1
通过以上可知DATA01对应device [8,17],device [8,17]对应/dev/sdb1,所以DATA01对应/dev/sdb1,其它磁盘依此类推.
那么现在如何确认+DATA与DATA*之间的对应关系?
使用如下sql语句:
SQL> select g.name group_name,d.name,g.group_number from v$asm_disk d full join v$asm_diskgroup g on g.group_number=d.group_number;
GROUP_NAME NAME GROUP_NUMBER
------------------------------ ---------- ------------
DATA DATA01 1
DATA DATA02 1
DATA DATA03 1
FRA DATA04 2
所以此处+DATA由DATA01、DATA02、DATA03组成,对应磁盘为/dev/sdb1、/dev/sdc1、/dev/sdd1
最终确认到+DATA磁盘组由/dev/sdb1、/dev/sdc1、/dev/sdd1三块盘组成.
ASMCMD> lsdg
State Type Rebal Sector Logical_Sector Block AU Total_MB Free_MB Req_mir_free_MB Usable_file_MB Offline_disks Voting_files Name
MOUNTED EXTERN N 512 512 4096 4194304 30708 7988 0 7988 0 N DATA/
MOUNTED EXTERN N 512 512 4096 4194304 10236 9428 0 9428 0 N FRA/
比如此处DATA磁盘组由哪些磁盘构成的呢?
以下为磁盘信息:
[root@dbserver ~]# lsblk -p
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
/dev/sdf 8:80 0 10G 0 disk
└─/dev/sdf1 8:81 0 10G 0 part
/dev/sdd 8:48 0 10G 0 disk
└─/dev/sdd1 8:49 0 10G 0 part
/dev/sdb 8:16 0 10G 0 disk
└─/dev/sdb1 8:17 0 10G 0 part
/dev/sr0 11:0 1 4.5G 0 rom
/dev/sde 8:64 0 10G 0 disk
└─/dev/sde1 8:65 0 10G 0 part
/dev/sdc 8:32 0 10G 0 disk
└─/dev/sdc1 8:33 0 10G 0 part
/dev/sda 8:0 0 100G 0 disk
├─/dev/sda2 8:2 0 98G 0 part
│ ├─/dev/mapper/ol-swap 252:1 0 16G 0 lvm [SWAP]
│ ├─/dev/mapper/ol-home 252:2 0 40G 0 lvm /home
│ └─/dev/mapper/ol-root 252:0 0 42G 0 lvm /
└─/dev/sda1 8:1 0 2G 0 part /boot
SQL> select name,path from v$asm_disk
NAME PATH
------------------------------ ------------------------------
DATA01 ORCL:DATA01
DATA02 ORCL:DATA02
DATA03 ORCL:DATA03
DATA04 ORCL:DATA04
ORCL:DATA05
[root@dbserver ~]# oracleasm listdisks
DATA01
DATA02
DATA03
DATA04
DATA05
如何确认/dev/sd*与DATA*的对应关系?
方法1:
[root@dbserver ~]# oracleasm querydisk /dev/sdb1
Device "/dev/sdb1" is marked an ASM disk with the label "DATA01"
[root@dbserver ~]# oracleasm querydisk /dev/sdc1
Device "/dev/sdc1" is marked an ASM disk with the label "DATA02"
[root@dbserver ~]# oracleasm querydisk /dev/sdd1
Device "/dev/sdd1" is marked an ASM disk with the label "DATA03"
[root@dbserver ~]# oracleasm querydisk /dev/sde1
Device "/dev/sde1" is marked an ASM disk with the label "DATA04"
[root@dbserver ~]# oracleasm querydisk /dev/sdf1
Device "/dev/sdf1" is marked an ASM disk with the label "DATA05"
可知/dev/sdb1对应DATA01,后面磁盘依此类推.
方法2:
[root@dbserver ~]# oracleasm querydisk -d DATA01
Disk "DATA01" is a valid ASM disk on device [8,17]
[root@dbserver ~]# oracleasm querydisk -d DATA02
Disk "DATA02" is a valid ASM disk on device [8,33]
[root@dbserver ~]# oracleasm querydisk -d DATA03
Disk "DATA03" is a valid ASM disk on device [8,49]
[root@dbserver ~]# oracleasm querydisk -d DATA04
Disk "DATA04" is a valid ASM disk on device [8,65]
[root@dbserver ~]# oracleasm querydisk -d DATA05
Disk "DATA05" is a valid ASM disk on device [8,81]
[root@dbserver ~]# ll /dev/sd*
brw-rw---- 1 root disk 8, 0 Jan 25 10:37 /dev/sda
brw-rw---- 1 root disk 8, 1 Jan 25 10:37 /dev/sda1
brw-rw---- 1 root disk 8, 2 Jan 25 10:37 /dev/sda2
brw-rw---- 1 root disk 8, 16 Jan 25 10:38 /dev/sdb
brw-rw---- 1 root disk 8, 17 Jan 25 10:38 /dev/sdb1
brw-rw---- 1 root disk 8, 32 Jan 25 10:38 /dev/sdc
brw-rw---- 1 root disk 8, 33 Jan 25 10:38 /dev/sdc1
brw-rw---- 1 root disk 8, 48 Jan 25 10:38 /dev/sdd
brw-rw---- 1 root disk 8, 49 Jan 25 10:38 /dev/sdd1
brw-rw---- 1 root disk 8, 64 Jan 25 10:38 /dev/sde
brw-rw---- 1 root disk 8, 65 Jan 25 10:38 /dev/sde1
brw-rw---- 1 root disk 8, 80 Jan 25 10:38 /dev/sdf
brw-rw---- 1 root disk 8, 81 Jan 25 10:38 /dev/sdf1
通过以上可知DATA01对应device [8,17],device [8,17]对应/dev/sdb1,所以DATA01对应/dev/sdb1,其它磁盘依此类推.
那么现在如何确认+DATA与DATA*之间的对应关系?
使用如下sql语句:
SQL> select g.name group_name,d.name,g.group_number from v$asm_disk d full join v$asm_diskgroup g on g.group_number=d.group_number;
GROUP_NAME NAME GROUP_NUMBER
------------------------------ ---------- ------------
DATA DATA01 1
DATA DATA02 1
DATA DATA03 1
FRA DATA04 2
所以此处+DATA由DATA01、DATA02、DATA03组成,对应磁盘为/dev/sdb1、/dev/sdc1、/dev/sdd1
最终确认到+DATA磁盘组由/dev/sdb1、/dev/sdc1、/dev/sdd1三块盘组成.