環境使用 AFD 建立磁碟識別
0. 以 root 身份執行,並宣告 ORACLE_HOME、ORACLE_BASE 的路徑
[root@ora-test ~]# export ORACLE_HOME=/u01/app/19.0.0
[root@ora-test ~]# export ORACLE_BASE=/tmp
[root@ora-test ~]# cd $ORACLE_HOME/bin
1. 確認需要移除的磁碟名稱 (以 OCR01_2 /dev/sdg 為例)
[root@ora-test bin]# ./asmcmd afd_lslbl
--------------------------------------------------------------------------------
Label Duplicate Path
================================================================================
DATA01_1 /dev/sdi
DATA01_2 /dev/sdc
DATA02_1 /dev/sdj
DATA02_2 /dev/sdd
FRA01_1 /dev/sdk
FRA01_2 /dev/sde
FRA02_1 /dev/sdl
FRA02_2 /dev/sdf
OCR01_1 /dev/sdm
OCR01_2 /dev/sdg
OCR01_3 /dev/sdo
OCR02_1 /dev/sdn
OCR02_2 /dev/sdh
2. 移除時會出現 disk XXX is already provisioned for ASM 的訊息
[root@ora-test bin]# ./asmcmd afd_unlabel OCR01_2
disk AFD:OCR01_2 is already provisioned for ASM
No devices to be unlabeled.
ASMCMD-9514: ASM disk label clear operation failed.
[root@ora-test bin]# ./asmcmd afd_unlabel /dev/sdg
disk /dev/sdg is already provisioned for ASM
No devices to be unlabeled.
ASMCMD-9514: ASM disk label clear operation failed.
3. 需要帶入 -f 參數,才能退出 AFD 管理
[root@ora-test bin]# ./asmcmd afd_unlabel /dev/sdg -f
[root@ora-test bin]# ./asmcmd afd_lslbl
--------------------------------------------------------------------------------
Label Duplicate Path
================================================================================
DATA01_1 /dev/sdi
DATA01_2 /dev/sdc
DATA02_1 /dev/sdj
DATA02_2 /dev/sdd
FRA01_1 /dev/sdk
FRA01_2 /dev/sde
FRA02_1 /dev/sdl
FRA02_2 /dev/sdf
OCR01_1 /dev/sdm
OCR01_3 /dev/sdo
OCR02_1 /dev/sdn
OCR02_2 /dev/sdh
4. 清除此 DISK 曾經被標記 ASM 磁碟的表頭記錄 ( 一定要退出 AFD,才能執行 dd,不然 AFD 會過濾直接對 DISK 的所有操作 )
[root@ora-test bin]# dd if=/dev/zero of=/dev/sdg bs=1024 count=100
100+0 records in
100+0 records out
102400 bytes (102 kB) copied, 0.000793968 s, 129 MB/s
5. 重新加入 AFD 識別
[root@ora-test bin]# ./asmcmd afd_label OCR01_2 /dev/sdg
[root@ora-test bin]# ./asmcmd afd_lslbl
--------------------------------------------------------------------------------
Label Duplicate Path
================================================================================
DATA01_1 /dev/sdi
DATA01_2 /dev/sdc
DATA02_1 /dev/sdj
DATA02_2 /dev/sdd
FRA01_1 /dev/sdk
FRA01_2 /dev/sde
FRA02_1 /dev/sdl
FRA02_2 /dev/sdf
OCR01_1 /dev/sdm
OCR01_2 /dev/sdg
OCR01_3 /dev/sdo
OCR02_1 /dev/sdn
OCR02_2 /dev/sdh
6. 再將新加入的 DISK 加回原本要加入的 diskgroup 裡
[grid@ora-test bin]# sqlplus / as sysasm
SQL> ALTER DISKGROUP OCRDG ADD FAILGROUP FG2 DISK 'AFD:OCR01_2' SIZE 10240M REBALANCE WAIT;
7. 檢查各個 disk 儲存分配
set lines 999;
col diskgroup for a15
col diskname for a15
col path for a35
select a.name DiskGroup,b.name DiskName, b.total_mb, (b.total_mb-b.free_mb) Used_MB, b.free_mb,b.path,b.header_status
from v$asm_disk b, v$asm_diskgroup a
where a.group_number (+) =b.group_number
order by b.group_number,b.name;
8. 重新 balance disk
SQL> alter diskgroup groupname rebalance;
已轉向 blogger 記錄
https://slowlife-notes.blogspot.com