12c开始,更换ASM磁盘更加便捷。
首先确认当前ASM磁盘和磁盘组的对应情况。
点击(此处)折叠或打开
-
$ sqlplus / as sysasm
-
-
col disk_name format a20
-
col diskgroup_name format a40
-
select a.name as disk_name, b.name as diskgroup_name from v$asm_disk a, v$asm_diskgroup b
- where a.group_number = b.group_number;
DISK_NAME DISKGROUP_NAME
-------------------- ----------------------------------------
DATA1 DATA
DATA2 DATA
DATA3 DATA
FRA1 FRA
FRA2 FRA
FRA3 FRA
OCR1 OCRV
OCR2 OCRV
OCR3 OCRV
VD1 OCRV
VD2 OCRV
VD3 OCRV
点击(此处)折叠或打开
-
# oracleasm querydisk /dev/sdc1
- Device "/dev/sdc1" is marked an ASM disk with the label "OCR1"
点击(此处)折叠或打开
-
SQL> alter diskgroup OCRV replace disk OCR1 with '/dev/sdo1' power 4;
-
alter diskgroup OCRV replace disk OCR1 with '/dev/sdo1' power 4
-
*
-
ERROR at line 1:
-
ORA-15032: not all alterations performed
- ORA-15145: ASM disk 'OCR1' is online and cannot be replaced.
点击(此处)折叠或打开
-
SQL> ALTER DISKGROUP OCRV OFFLINE DISK OCR1;
-
ALTER DISKGROUP OCRV OFFLINE DISK OCR1
-
*
-
ERROR at line 1:
-
ORA-15032: not all alterations performed
- ORA-15283: ASM operation requires compatible.rdbms of 11.1.0.0.0 or higher
需要设置参数。
先查看当前参数:
点击(此处)折叠或打开
-
SQL> select NAME ,COMPATIBILITY,DATABASE_COMPATIBILITY from v$asm_diskgroup where name='OCRV';
-
-
NAME
-
------------------------------------------------------------
-
COMPATIBILITY
-
--------------------------------------------------------------------------------
-
DATABASE_COMPATIBILITY
-
--------------------------------------------------------------------------------
-
OCRV
-
12.1.0.0.0
- 10.1.0.0.0
点击(此处)折叠或打开
-
SQL> ALTER DISKGROUP OCRV SET ATTRIBUTE 'COMPATIBLE.RDBMS'='12.1.0.0.0';
-
-
Diskgroup altered.
-
-
SQL> select NAME ,COMPATIBILITY,DATABASE_COMPATIBILITY from v$asm_diskgroup where name='OCRV';
-
-
NAME
-
------------------------------------------------------------
-
COMPATIBILITY
-
--------------------------------------------------------------------------------
-
DATABASE_COMPATIBILITY
-
--------------------------------------------------------------------------------
-
OCRV
-
12.1.0.0.0
- 12.1.0.0.0
此时,可以将磁盘offline
点击(此处)折叠或打开
-
SQL> ALTER DISKGROUP OCRV OFFLINE DISK OCR1;
-
- Diskgroup altered.
1)RAC中其他节点也可访问;
2)设备所有者和权限符合要求,可用裸设备方式(详见http://blog.itpub.net/22621861/viewspace-2116865/);
3)设备名符合参数asm_diskstring。
点击(此处)折叠或打开
-
SQL> alter system set asm_diskstring='ORCL:*','/dev/raw/raw*' sid='*' scope=both;
-
-
System altered.
-
-
SQL> show parameter asm_diskstring
-
-
NAME TYPE
-
------------------------------------ ----------------------
-
VALUE
-
------------------------------
-
asm_diskstring string
- ORCL:*, /dev/raw/raw*
点击(此处)折叠或打开
-
alter diskgroup OCRV replace disk OCR1 with '/dev/raw/raw1' power 4;
-
- Diskgroup altered.
点击(此处)折叠或打开
-
col name format a10
-
col path format a20
-
select name,path,total_mb from v$asm_disk;
-
-
NAME PATH TOTAL_MB
-
---------- -------------------- ----------
-
- OCR1 /dev/raw/raw1 4094
点击(此处)折叠或打开
-
select name,state from v$asm_disk;
-
-
NAME STATE
-
---------- ----------------
-
VD3 NORMAL
- OCR1 NORMAL
点击(此处)折叠或打开
-
# oracleasm querydisk /dev/sdc1
- Device "/dev/sdc1" is marked an ASM disk with the label "OCR1"
点击(此处)折叠或打开
-
//删除旧标记
-
# oracleasm deletedisk /dev/sdc1
-
Clearing disk header: done
-
Dropping disk: done
-
-
//其他节点运行
- oracleasm scandisks
至此,全部完成。