这篇文章将为大家详细讲解有关ASM磁盘组如何更换磁盘,小编觉得挺实用的,因此分享给大家做个参考,希望大家阅读完这篇文章后可以有所收获。
更换存储操作步骤
1、增加新磁盘,对新磁盘创建新asm disk
2、把新asm disk加入asm group
3、等待asm group数据重平衡完毕
4、再从asm group删除旧磁盘对应的旧asm disk
5、等待asm group数据重平衡完毕
6、拆下旧磁盘
磁盘组asm group要改变大小:
如果原来磁盘组1T,现在想换成100G
如asm group是外部冗余,里面只有一个asm disk,这个asm disk 1T,则新增一个asm disk 100G,再删除1T的asm disk
如asm group是normal冗余,里面有两个asm disk,这两个asm disk 总计1T,则新增两个asm disk 总结100G,再删除1T的两个asm dis
v$asm_operation
显示asm重平衡的信息
V$ASM_OPERATION displays one row for every active Oracle ASM long running operation executing in the Oracle ASM instance.
select * from v$asm_operation; --此语句在ASM实例上执行才能看到准确信息
ASM_POWER_LIMIT
ASM_POWER_LIMIT指定用于磁盘再平衡的自动存储管理实例的最大功耗。上限越高,再平衡的速度就越快。较低的值需要更长的时间,但是消耗更少的处理和I/O资源。
ASM_POWER_LIMIT specifies the maximum power on an Automatic Storage Management instance for disk rebalancing. The higher the limit, the faster rebalancing will complete. Lower values will take longer, but consume fewer processing and I/O resources
ASM_POWER_LIMIT设置为0时,不会自动重平衡,但是可以使用下面的语句来手动重平衡(比如白天加盘了,晚上再让它手动执行)
alter diskgroup DATA rebalance power 10; --此语句只能在ASM实例上运行,且连接方式为as sysasm
旧磁盘可以直接物理拆除,拆除后对应的asm disks自动消失了,这个asm disk可以给后面的磁盘重用,比如sdd1对应的asm disk是/dev/oracleasm/disks/OCPFRA1,把物理磁盘sdd拆掉后,/dev/oracleasm/disks/OCPFRA1自动消失了,如果以后来了个新磁盘sdk,可以oracleasm createdisk OCPFRA1 /dev/sdk1
ASM磁盘组更换磁盘的实践案例,对空间不足的asm group更换空间更大的asm disk(本案例4-9步骤对应本文最上说明更换存储操作步骤的1-6个步骤)
1、确定空间不足的ASM磁盘组,结果是FRA,可用空间36%
SQL> select name,total_mb,free_mb,round((free_mb/total_mb)*100) from gv$asm_diskgroup;
NAME TOTAL_MB FREE_MB ROUND((FREE_MB/TOTAL_MB)*100)
-------------------- ---------- ---------- -----------------------------
DATA 6141 4195 68
FRA 2047 739 36
2、确定FRA的冗余方式和对应的asm disk,结果是EXTERN和/dev/oracleasm/disks/OCPFRA1
SQL> select a.path,a.name,a.mode_status,b.name diskgroupname,b.type from v$asm_disk a,v$asm_diskgroup b where a.group_number=b.group_number and b.name='FRA';
PATH NAME MODE_ST DISKGROUPN TYPE
-------------------------------------------------- -------------------- ------- ---------- ------
/dev/oracleasm/disks/OCPFRA1 FRA_0000 ONLINE FRA EXTERN
3、确定/dev/oracleasm/disks/OCPFRA1对应的物理磁盘信息、对应的数据库对象,结果是sdd1容量2G、对应表TABLE_TEW
[root@ASMDB ~]# ll /dev/oracleasm/disks/OCPFRA1
brw-rw---- 1 grid dba 8, 49 Jun 7 19:11 /dev/oracleasm/disks/OCPFRA1
[root@ASMDB ~]# ll /dev |grep disk |grep 8 |grep 49
brw-r----- 1 root disk 8, 49 Jun 7 16:11 sdd1
[root@ASMDB ~]# fdisk -l |grep sdd
Disk /dev/sdd: 2147 MB, 2147483648 bytes
/dev/sdd1 1 261 2096451 83 Linux
[oracle@ASMDB ~]$ sqlplus / as sysdba
SQL> select tablespace_name,file_name from dba_data_files where file_name like '%FRA%';
TABLESPACE_NAME FILE_NAME
-------------------- ------------------------------------------------------------
TEW +FRA/tew01.dbf
SQL> select table_name,tablespace_name from dba_tables where tablespace_name='TEW' and rownum<2;
TABLE_NAME TABLESPACE_NAME
------------------------------ --------------------
TABLE_TEW TEW
SQL> select count(*) from TABLE_TEW;
COUNT(*)
----------
601480
4、新增的物理磁盘是sdg1,创建asm disk为/dev/oracleasm/disks/OCPFRA2
[root@ASMDB ~]# oracleasm createdisk OCPFRA2 /dev/sdg1
[root@ASMDB ~]# oracleasm scandisks
Reloading disk partitions: done
Cleaning any stale ASM disks...
Scanning system for ASM disks...
[root@ASMDB ~]# oracleasm listdisks
OCPDATA1
OCPDATA2
OCPDATA3
OCPFRA1
OCPFRA2
[grid@ASMDB ~]$ asmcmd lsdsk --candidate
Path
/dev/oracleasm/disks/OCPFRA2
5、把新asm disk加入asm group,必须使用as sysasm
[grid@ASMDB ~]$ sqlplus / as sysasm
SQL> alter diskgroup FRA add disk '/dev/oracleasm/disks/OCPFRA2' rebalance power 10;
Diskgroup altered.
6、等待asm group数据重平衡完毕,即v$asm_operation查询结果为空,重平衡后立即发现asm group的空间和asm disk有变化,空间变成了新旧两块asm disk的总空间,可用空间74%,新asm disk /dev/oracleasm/disks/OCPFRA2加上来了
SQL> select * from v$asm_operation;
GROUP_NUMBER OPERA STAT POWER ACTUAL SOFAR EST_WORK EST_RATE
------------ ----- ---- ---------- ---------- ---------- ---------- ----------
EST_MINUTES ERROR_CODE
----------- --------------------------------------------
2 REBAL RUN 10 10 495 785 672
0
.
.
.
SQL> select * from v$asm_operation;
no rows selected
SQL> select name,total_mb,free_mb,round((free_mb/total_mb)*100) from gv$asm_diskgroup;
NAME TOTAL_MB FREE_MB ROUND((FREE_MB/TOTAL_MB)*100)
-------------------- ---------- ---------- -----------------------------
DATA 6141 4195 68
FRA 5114 3779 74
SQL> select a.path,a.name,a.mode_status,b.name diskgroupname,b.type from v$asm_disk a,v$asm_diskgroup b where a.group_number=b.group_number and b.name='FRA';
PATH NAME MODE_ST DISKGROUPN TYPE
-------------------------------------------------- -------------------- ------- ---------- ------
/dev/oracleasm/disks/OCPFRA1 FRA_0000 ONLINE FRA EXTERN
/dev/oracleasm/disks/OCPFRA2 FRA_0001 ONLINE FRA EXTERN
7、再从asm group删除旧磁盘对应的旧asm disk,参考第三步信息,旧磁盘sdd1对应asm disk是/dev/oracleasm/disks/OCPFRA1,但是这里不能写asm disk路径名称,只能写asm disk名称,即v$asm_disk.name
SQL> alter diskgroup FRA drop disk 'FRA_0000' rebalance power 10;
Diskgroup altered.
8、等待asm group数据重平衡完毕,即v$asm_operation查询结果为空,重平衡后立即发现asm group的空间和asm disk有变化,空间变成了新asm disk的总空间,可用空间57%,旧asm disk被删除了,且验证该asm group上的表正常
SQL> select * from v$asm_operation;
no rows selected
SQL> select name,total_mb,free_mb,round((free_mb/total_mb)*100) from gv$asm_diskgroup;
NAME TOTAL_MB FREE_MB ROUND((FREE_MB/TOTAL_MB)*100)
-------------------- ---------- ---------- -----------------------------
DATA 6141 4195 68
FRA 3067 1734 57
SQL> select a.path,a.name,a.mode_status,b.name diskgroupname,b.type from v$asm_disk a,v$asm_diskgroup b where a.group_number=b.group_number and b.name='FRA';
PATH NAME MODE_ST DISKGROUPN TYPE
-------------------------------------------------- -------------------- ------- ---------- ------
/dev/oracleasm/disks/OCPFRA2 FRA_0001 ONLINE FRA EXTERN
[oracle@ASMDB ~]$ sqlplus / as sysdba
SQL> select count(*) from TABLE_TEW;
COUNT(*)
----------
601480
9、拆下旧磁盘,重启电脑后启动DB,发现一切正常,验证结果和上面第8步的结果一致
关于“ASM磁盘组如何更换磁盘”这篇文章就分享到这里了,希望以上内容可以对大家有一定的帮助,使各位可以学到更多知识,如果觉得文章不错,请把它分享出去让更多的人看到。
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。