说明:
文章整理自2020-09-05我在ITPUB博客发布的以下文章:
https://blog.itpub.net/29785807/viewspace-2717409/
环境:
DB:Oracle RAC+DG 11.2.0.4.0
OS:AIX 7.1
备注:DG主、备节点都是两节点的RAC,本次操作步骤主要针对备库,主库扩容ASM磁盘组方式相同。
注意:不同存储、操作系统等命令不同,请勿直接用于生产。
操作:
扩容DG备库ASM磁盘组
一:查看磁盘属性
(1)存储工程师已经添加磁盘,8块100G数据盘,2块50G归档盘
(2)新加磁盘为/dev/rhdiskpower21到/dev/rhdiskpower30
[dpc-cjcdb-db01][/]#ls -l /dev/rhdiskpower*
......
crw-rw---- 1 root system 48, 21 Aug 27 19:31 /dev/rhdiskpower21
crw-rw---- 1 root system 48, 22 Aug 27 19:31 /dev/rhdiskpower22
crw-rw---- 1 root system 48, 23 Aug 27 19:31 /dev/rhdiskpower23
crw-rw---- 1 root system 48, 24 Aug 27 19:31 /dev/rhdiskpower24
crw-rw---- 1 root system 48, 25 Aug 27 19:31 /dev/rhdiskpower25
crw-rw---- 1 root system 48, 26 Aug 27 19:31 /dev/rhdiskpower26
crw-rw---- 1 root system 48, 27 Aug 27 19:31 /dev/rhdiskpower27
crw-rw---- 1 root system 48, 28 Aug 27 19:31 /dev/rhdiskpower28
crw-rw---- 1 root system 48, 29 Aug 27 19:31 /dev/rhdiskpower29
crw-rw---- 1 root system 48, 30 Aug 27 19:31 /dev/rhdiskpower30
......
二:修改新加磁盘属性(节点一和节点二)
[dpc-cjcdb-db01][/]#chmod 660 /dev/rhdiskpower21
[dpc-cjcdb-db01][/]#chmod 660 /dev/rhdiskpower22
[dpc-cjcdb-db01][/]#chmod 660 /dev/rhdiskpower23
[dpc-cjcdb-db01][/]#chmod 660 /dev/rhdiskpower24
[dpc-cjcdb-db01][/]#chmod 660 /dev/rhdiskpower25
[dpc-cjcdb-db01][/]#chmod 660 /dev/rhdiskpower26
[dpc-cjcdb-db01][/]#chmod 660 /dev/rhdiskpower27
[dpc-cjcdb-db01][/]#chmod 660 /dev/rhdiskpower28
[dpc-cjcdb-db01][/]#chmod 660 /dev/rhdiskpower29
[dpc-cjcdb-db01][/]#chmod 660 /dev/rhdiskpower30
[dpc-cjcdb-db01][/]#chown grid:asmadmin /dev/rhdiskpower21
[dpc-cjcdb-db01][/]#chown grid:asmadmin /dev/rhdiskpower22
[dpc-cjcdb-db01][/]#chown grid:asmadmin /dev/rhdiskpower23
[dpc-cjcdb-db01][/]#chown grid:asmadmin /dev/rhdiskpower24
[dpc-cjcdb-db01][/]#chown grid:asmadmin /dev/rhdiskpower25
[dpc-cjcdb-db01][/]#chown grid:asmadmin /dev/rhdiskpower26
[dpc-cjcdb-db01][/]#chown grid:asmadmin /dev/rhdiskpower27
[dpc-cjcdb-db01][/]#chown grid:asmadmin /dev/rhdiskpower28
[dpc-cjcdb-db01][/]#chown grid:asmadmin /dev/rhdiskpower29
[dpc-cjcdb-db01][/]#chown grid:asmadmin /dev/rhdiskpower30
查看磁盘属性是否修改成功(节点一和节点二)
[dpc-cjcdb-db01][/]#ls -l /dev/rhdiskpower*
......
crw-rw---- 1 grid asmadmin 48, 21 Aug 27 19:31 /dev/rhdiskpower21
crw-rw---- 1 grid asmadmin 48, 22 Aug 27 19:31 /dev/rhdiskpower22
crw-rw---- 1 grid asmadmin 48, 23 Aug 27 19:31 /dev/rhdiskpower23
crw-rw---- 1 grid asmadmin 48, 24 Aug 27 19:31 /dev/rhdiskpower24
crw-rw---- 1 grid asmadmin 48, 25 Aug 27 19:31 /dev/rhdiskpower25
crw-rw---- 1 grid asmadmin 48, 26 Aug 27 19:31 /dev/rhdiskpower26
crw-rw---- 1 grid asmadmin 48, 27 Aug 27 19:31 /dev/rhdiskpower27
crw-rw---- 1 grid asmadmin 48, 28 Aug 27 19:31 /dev/rhdiskpower28
crw-rw---- 1 grid asmadmin 48, 29 Aug 27 19:31 /dev/rhdiskpower29
crw-rw---- 1 grid asmadmin 48, 30 Aug 27 19:31 /dev/rhdiskpower30
......
三:检查reserve_policy模式,reserve_policy是no_reserve
lsattr -El hdiskpower21 | grep reserve_policy
lsattr -El hdiskpower22 | grep reserve_policy
lsattr -El hdiskpower23 | grep reserve_policy
lsattr -El hdiskpower24 | grep reserve_policy
lsattr -El hdiskpower25 | grep reserve_policy
lsattr -El hdiskpower26 | grep reserve_policy
lsattr -El hdiskpower27 | grep reserve_policy
lsattr -El hdiskpower28 | grep reserve_policy
lsattr -El hdiskpower29 | grep reserve_policy
lsattr -El hdiskpower30 | grep reserve_policy
[dpc-cjcdb-db01][/]#lsattr -El hdiskpower21 | grep reserve_policy
reserve_policy no_reserve Reserve Policy used to reserve device on open. True
[dpc-cjcdb-db01][/]#lsattr -El hdiskpower22 | grep reserve_policy
reserve_policy no_reserve Reserve Policy used to reserve device on open. True
[dpc-cjcdb-db01][/]#lsattr -El hdiskpower23 | grep reserve_policy
reserve_policy no_reserve Reserve Policy used to reserve device on open. True
[dpc-cjcdb-db01][/]#lsattr -El hdiskpower24 | grep reserve_policy
reserve_policy no_reserve Reserve Policy used to reserve device on open. True
[dpc-cjcdb-db01][/]#lsattr -El hdiskpower25 | grep reserve_policy
reserve_policy no_reserve Reserve Policy used to reserve device on open. True
[dpc-cjcdb-db01][/]#lsattr -El hdiskpower26 | grep reserve_policy
reserve_policy no_reserve Reserve Policy used to reserve device on open. True
[dpc-cjcdb-db01][/]#lsattr -El hdiskpower27 | grep reserve_policy
reserve_policy no_reserve Reserve Policy used to reserve device on open. True
[dpc-cjcdb-db01][/]#lsattr -El hdiskpower28 | grep reserve_policy
reserve_policy no_reserve Reserve Policy used to reserve device on open. True
[dpc-cjcdb-db01][/]#lsattr -El hdiskpower29 | grep reserve_policy
reserve_policy no_reserve Reserve Policy used to reserve device on open. True
[dpc-cjcdb-db01][/]#lsattr -El hdiskpower30 | grep reserve_policy
reserve_policy no_reserve Reserve Policy used to reserve device on open. True
[dpc-cjcdb-db02][/]#lsattr -El hdiskpower21 | grep reserve_policy
reserve_policy no_reserve Reserve Policy used to reserve device on open. True
[dpc-cjcdb-db02][/]#lsattr -El hdiskpower22 | grep reserve_policy
reserve_policy no_reserve Reserve Policy used to reserve device on open. True
[dpc-cjcdb-db02][/]#lsattr -El hdiskpower23 | grep reserve_policy
reserve_policy no_reserve Reserve Policy used to reserve device on open. True
[dpc-cjcdb-db02][/]#lsattr -El hdiskpower24 | grep reserve_policy
reserve_policy no_reserve Reserve Policy used to reserve device on open. True
[dpc-cjcdb-db02][/]#lsattr -El hdiskpower25 | grep reserve_policy
reserve_policy no_reserve Reserve Policy used to reserve device on open. True
[dpc-cjcdb-db02][/]#lsattr -El hdiskpower26 | grep reserve_policy
reserve_policy no_reserve Reserve Policy used to reserve device on open. True
[dpc-cjcdb-db02][/]#lsattr -El hdiskpower27 | grep reserve_policy
reserve_policy no_reserve Reserve Policy used to reserve device on open. True
[dpc-cjcdb-db02][/]#lsattr -El hdiskpower28 | grep reserve_policy
reserve_policy no_reserve Reserve Policy used to reserve device on open. True
[dpc-cjcdb-db02][/]#lsattr -El hdiskpower29 | grep reserve_policy
reserve_policy no_reserve Reserve Policy used to reserve device on open. True
[dpc-cjcdb-db02][/]#lsattr -El hdiskpower30 | grep reserve_policy
reserve_policy no_reserve Reserve Policy used to reserve device on open. True
如不是no_reserve,进行修改
###chdev -l hdiskpower21 -a reserve_policy=no_reserve
###chdev -l hdiskpower22 -a reserve_policy=no_reserve
###chdev -l hdiskpower23 -a reserve_policy=no_reserve
###chdev -l hdiskpower24 -a reserve_policy=no_reserve
###chdev -l hdiskpower25 -a reserve_policy=no_reserve
###chdev -l hdiskpower26 -a reserve_policy=no_reserve
###chdev -l hdiskpower27 -a reserve_policy=no_reserve
###chdev -l hdiskpower28 -a reserve_policy=no_reserve
###chdev -l hdiskpower29 -a reserve_policy=no_reserve
###chdev -l hdiskpower30 -a reserve_policy=no_reserve
四:检查现有磁盘组信息
SQL> select group_number,name,state,total_mb,free_mb from v$asm_diskgroup;
GROUP_NUMBER NAME STATE TOTAL_MB FREE_MB
------------ ------------------------------ ----------- ---------- ----------
1 DUNHUA_DAPUCHAI_cjcdb_OCR MOUNTED 6186 5260
2 DUNHUA_DAPUCHAI_cjcdb_DATA MOUNTED 819208 85512
3 DUNHUA_DAPUCHAI_cjcdb_ARCH MOUNTED 102400 45200
检查磁盘信息
SQL> set line 200
col path for a40
select group_number,mount_status,header_status,path,total_mb,free_mb from v$asm_disk;SQL> SQL>
GROUP_NUMBER MOUNT_S HEADER_STATU PATH TOTAL_MB FREE_MB
------------ ------- ------------ ---------------------------------------- ---------- ----------
0 CLOSED CANDIDATE /dev/rhdiskpower21 0 0
0 CLOSED CANDIDATE /dev/rhdiskpower22 0 0
0 CLOSED CANDIDATE /dev/rhdiskpower23 0 0
0 CLOSED CANDIDATE /dev/rhdiskpower24 0 0
0 CLOSED CANDIDATE /dev/rhdiskpower25 0 0
0 CLOSED CANDIDATE /dev/rhdiskpower26 0 0
0 CLOSED CANDIDATE /dev/rhdiskpower27 0 0
0 CLOSED CANDIDATE /dev/rhdiskpower28 0 0
0 CLOSED CANDIDATE /dev/rhdiskpower29 0 0
0 CLOSED CANDIDATE /dev/rhdiskpower30 0 0
1 CACHED MEMBER /dev/rhdiskpower10 2062 1753
3 CACHED MEMBER /dev/rhdiskpower11 51200 22591
3 CACHED MEMBER /dev/rhdiskpower12 51200 22609
2 CACHED MEMBER /dev/rhdiskpower13 102401 10685
2 CACHED MEMBER /dev/rhdiskpower14 102401 10693
2 CACHED MEMBER /dev/rhdiskpower15 102401 10693
2 CACHED MEMBER /dev/rhdiskpower16 102401 10687
2 CACHED MEMBER /dev/rhdiskpower17 102401 10683
2 CACHED MEMBER /dev/rhdiskpower18 102401 10690
2 CACHED MEMBER /dev/rhdiskpower19 102401 10688
2 CACHED MEMBER /dev/rhdiskpower20 102401 10693
1 CACHED MEMBER /dev/rhdiskpower8 2062 1753
1 CACHED MEMBER /dev/rhdiskpower9 2062 1754
23 rows selected.
五:asmca启动图形add disk(也可以使用命令行扩容)
su - grid
export DISPLAY=10.100.100.20:3.0 【xmanager端口号】
asmca
点击add disks,注意,提前规划好要加的磁盘,不要添加多或加少了。
为DATA磁盘组新增磁盘。
为ARCH磁盘组新增磁盘。
六:检查再平衡进度,磁盘组空间
su - grid
sqlplus / as sysasm
select group_number,operation,state,power,actual,sofar,est_work,est_rate,est_minutes,error_code from v$asm_operation;
select group_number,name,state,total_mb,free_mb from v$asm_diskgroup;
查看总容量是否增加
su - grid
asmcmd
lsdg
查看磁盘信息
SQL> set line 200
col path for a40
select group_number,mount_status,header_status,path,total_mb,free_mb from v$asm_disk;SQL> SQL>
GROUP_NUMBER MOUNT_S HEADER_STATU PATH TOTAL_MB FREE_MB
------------ ------- ------------ ---------------------------------------- ---------- ----------
1 CACHED MEMBER /dev/rhdiskpower10 2062 1753
3 CACHED MEMBER /dev/rhdiskpower11 51200 22591
3 CACHED MEMBER /dev/rhdiskpower12 51200 22609
2 CACHED MEMBER /dev/rhdiskpower13 102401 14766
2 CACHED MEMBER /dev/rhdiskpower14 102401 14773
2 CACHED MEMBER /dev/rhdiskpower15 102401 14773
2 CACHED MEMBER /dev/rhdiskpower16 102401 14768
2 CACHED MEMBER /dev/rhdiskpower17 102401 14764
2 CACHED MEMBER /dev/rhdiskpower18 102401 14769
2 CACHED MEMBER /dev/rhdiskpower19 102401 14769
2 CACHED MEMBER /dev/rhdiskpower20 102401 14774
1 CACHED MEMBER /dev/rhdiskpower8 2062 1753
1 CACHED MEMBER /dev/rhdiskpower9 2062 1754
3 CACHED MEMBER /dev/rhdiskpower21 51200 51198
3 CACHED MEMBER /dev/rhdiskpower22 51200 51198
2 CACHED MEMBER /dev/rhdiskpower23 102401 98318
2 CACHED MEMBER /dev/rhdiskpower24 102401 98318
2 CACHED MEMBER /dev/rhdiskpower25 102401 98319
2 CACHED MEMBER /dev/rhdiskpower26 102401 98318
2 CACHED MEMBER /dev/rhdiskpower27 102401 98319
2 CACHED MEMBER /dev/rhdiskpower28 102401 98319
2 CACHED MEMBER /dev/rhdiskpower29 102401 98318
2 CACHED MEMBER /dev/rhdiskpower30 102401 98318
23 rows selected.
查看磁盘组信息
SQL> select group_number,name,state,total_mb,free_mb from v$asm_diskgroup;
GROUP_NUMBER NAME STATE TOTAL_MB FREE_MB
------------ ------------------------------ ----------- ---------- ----------
1 DUNHUA_DAPUCHAI_cjcdb_OCR MOUNTED 6186 5260
2 DUNHUA_DAPUCHAI_cjcdb_DATA MOUNTED 1638416 904704
3 DUNHUA_DAPUCHAI_cjcdb_ARCH MOUNTED 204800 147596
查看平衡度
默认power=1,单块盘数据平衡预计需要44分钟
SQL> set line 200
SQL> select group_number,operation,state,power,actual,sofar,est_work,est_rate,est_minutes,error_code from v$asm_operation;
GROUP_NUMBER OPERA STAT POWER ACTUAL SOFAR EST_WORK EST_RATE EST_MINUTES ERROR_CODE
------------ ----- ---- ---------- ---------- ---------- ---------- ---------- ----------- --------------------------------------------
2 REBAL RUN 1 1 19750 366830 7730 44
3 REBAL WAIT 1
检查日志
......
Tue Sep 01 18:00:11 2020
SUCCESS: disk DUNHUA_DAPUCHAI_cjcdb_DATA_0008 (8.3932265494) added to diskgroup DUNHUA_DAPUCHAI_cjcdb_DATA
SUCCESS: disk DUNHUA_DAPUCHAI_cjcdb_DATA_0009 (9.3932265495) added to diskgroup DUNHUA_DAPUCHAI_cjcdb_DATA
SUCCESS: disk DUNHUA_DAPUCHAI_cjcdb_DATA_0010 (10.3932265496) added to diskgroup DUNHUA_DAPUCHAI_cjcdb_DATA
SUCCESS: disk DUNHUA_DAPUCHAI_cjcdb_DATA_0011 (11.3932265497) added to diskgroup DUNHUA_DAPUCHAI_cjcdb_DATA
SUCCESS: disk DUNHUA_DAPUCHAI_cjcdb_DATA_0012 (12.3932265498) added to diskgroup DUNHUA_DAPUCHAI_cjcdb_DATA
SUCCESS: disk DUNHUA_DAPUCHAI_cjcdb_DATA_0013 (13.3932265499) added to diskgroup DUNHUA_DAPUCHAI_cjcdb_DATA
SUCCESS: disk DUNHUA_DAPUCHAI_cjcdb_DATA_0014 (14.3932265500) added to diskgroup DUNHUA_DAPUCHAI_cjcdb_DATA
SUCCESS: disk DUNHUA_DAPUCHAI_cjcdb_DATA_0015 (15.3932265501) added to diskgroup DUNHUA_DAPUCHAI_cjcdb_DATA
Tue Sep 01 18:01:21 2020
SUCCESS: disk DUNHUA_DAPUCHAI_cjcdb_ARCH_0002 (2.3932265502) added to diskgroup DUNHUA_DAPUCHAI_cjcdb_ARCH
SUCCESS: disk DUNHUA_DAPUCHAI_cjcdb_ARCH_0003 (3.3932265503) added to diskgroup DUNHUA_DAPUCHAI_cjcdb_ARCH
......
###chenjuchao 20240412###
欢迎关注我的公众号《IT小Chen》