乔巴超人2014-03-16 16:15:04博主文章分类:oracle©著作权
文章标签oracle rac 存储迁移文章分类Oracle数据库阅读数3777
1、关闭节点1服务,挂载裸设备并创建ASM磁盘,由于是RAC,节点2服务并没有停止,所以业务能正常运行;
关闭节点1上的CRS服务
查看服务状态,目前只有节点2正常运行,scanIP与vip迁移至节点2;
裸设备映射,并重启udev,查看裸设备映射情况;
创建ASM磁盘
查看创建好的ASM磁盘
启动节点1的CRS服务;
查看CRS运行状态,此时CRS服务在两个节点同时运行,
2、使用同节点1同样的方法在节点2上将裸设备挂载映射并创建ASM磁盘,创建ASM磁盘时,节点2只需要scandisk即可,同样,操作过程中业务是不会中断的;
3、通过grid用户使用asmca命令创建磁盘组,利用CRS1,CRS2,CRS3创建磁盘组CRS,使用normal模式,利用CRS4创建磁盘组CRSTEMP,使用extern模式;(为什么要创建CRSTEMP磁盘组下面会说明)
4、迁移OCR磁盘;
通过ocrcheck命令查看ocr磁盘相关信息;
可以发现OCR磁盘存储位置为磁盘组+DATA;
也可以通过/etc/oracle/ocr.loc文件查看
确认CRS运行健康;
通过root用户使用ocrconfig -replace <current filename> -replacement <new filename>的命令迁移OCR磁盘;
(11gR1的命令为ocrconfig -replace ocr <new filename>)
发现不能进行迁移,查找原因为OCR磁盘没有镜像ocrmirror,因此必须先创建mirror,这里就用到了CRSTEMP磁盘组;
查看添加mirror后的OCR磁盘状态,可以发现CRSTEMP磁盘组现已为ocrmirror;
再次迁移OCR磁盘;
迁移成功,CRS磁盘组已替代DATA磁盘组成为OCR存储位置;
5、迁移VOTE磁盘
查看vote磁盘当前状态,存储在+DATA磁盘组上;
通过grid用户使用crsctl replace votedisk <new filename>命令迁移vote磁盘;
迁移成功,查看vote磁盘已有3个路径;
(11gR1只能采用添加删除的方式进行迁移,
crsctl delete css votedisk /dev/raw/raw9
crsctl add css votedisk /dev/raw/raw5
当试图删除表决磁盘首个存放路径的时候会收到报错:
Failure8withClusterSynchronizationServiceswhile deleting voting disk.
添加force选项强制删除;
crsctl delete css votedisk /dev/raw/raw7 -force)
6、使用ASM的REBALANCE技术来解决在线迁移数据。
查看磁盘组信息;
sqlplus / as sysasm
SQL*Plus: Release 11.2.0.2.0 Production on Fri Mar 14 15:38:19 2014
Copyright (c) 1982, 2010, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
With the Real Application Clusters and Automatic Storage Management options
SQL> col name for a10
SQL> set line 120
SQL> desc gv$asm_diskgroup;
Name Null? Type
----------------------------------------------------------------- -------- --------------------------------------------
INST_ID NUMBER
GROUP_NUMBER NUMBER
NAME VARCHAR2(30)
SECTOR_SIZE NUMBER
BLOCK_SIZE NUMBER
ALLOCATION_UNIT_SIZE NUMBER
STATE VARCHAR2(11)
TYPE VARCHAR2(6)
TOTAL_MB NUMBER
FREE_MB NUMBER
HOT_USED_MB NUMBER
COLD_USED_MB NUMBER
REQUIRED_MIRROR_FREE_MB NUMBER
USABLE_FILE_MB NUMBER
OFFLINE_DISKS NUMBER
COMPATIBILITY VARCHAR2(60)
DATABASE_COMPATIBILITY VARCHAR2(60)
VOTING_FILES VARCHAR2(1)
SQL> select name,allocation_unit_size,state,total_mb,free_mb from gv$asm_diskgroup;
NAME ALLOCATION_UNIT_SIZE STATE TOTAL_MB FREE_MB
---------- -------------------- ----------- ---------- ----------
DATA 1048576 MOUNTED 51199 48915
CRS 1048576 MOUNTED 3057 2133
CRSTEMP 1048576 MOUNTED 1019 656
DATA 1048576 MOUNTED 51199 48915
CRS 1048576 MOUNTED 3057 2133
CRSTEMP 1048576 MOUNTED 1019 656
6 rows selected.
SQL> select failgroup,name from v$asm_disk where group_number=(select group_number from v$asm_diskgroup where name = 'DATA');
FAILGROUP NAME
------------------------------ ----------
DATA_0000 DATA_0000
往该磁盘组里添加一个新创建的ASM磁盘,指定REBALANCE的速度
SQL> alter diskgroup DATA add disk '/dev/raw/raw2' name newdata rebalance power 10;
Diskgroup altered.
SQL> select name,allocation_unit_size,state,total_mb,free_mb from gv$asm_diskgroup;
NAME ALLOCATION_UNIT_SIZE STATE TOTAL_MB FREE_MB
---------- -------------------- ----------- ---------- ----------
CRSTEMP 1048576 MOUNTED 1019 656
CRS 1048576 MOUNTED 3057 2133
DATA 1048576 MOUNTED 102398 100112
CRSTEMP 1048576 MOUNTED 1019 656
CRS 1048576 MOUNTED 3057 2133
DATA 1048576 MOUNTED 102398 100112
6 rows selected.
SQL> select failgroup,name,path from v$asm_disk where group_number=(select group_number from v$asm_diskgroup where name = 'DATA');
FAILGROUP NAME
------------------------------ ----------
NEWDATA NEWDATA
DATA_0000 DATA_0000
发现磁盘组DATA容量改变;
REBALANCE过程可以通过v$asm_operation视图来查看:
SQL>set line 150
SQL> col ERROR_CODE for a5
SQL>select*from v$asm_operation;
REBALANCE完成后记录将消失;
删除旧的ASM磁盘;
QL> select failgroup,name,path from v$asm_disk where group_number=(select group_number from v$asm_diskgroup where name = 'DATA');
FAILGROUP NAME PATH
-------------------- -------------------- --------------------
NEWDATA NEWDATA /dev/raw/raw2
DATA_0000 DATA_0000 /dev/raw/raw1
SQL> alter diskgroup DATA drop disk DATA_0000 rebalance power 5;
Diskgroup altered.
SQL> select * from v$asm_operation;
GROUP_NUMBER OPERA STAT POWER ACTUAL SOFAR EST_WORK EST_RATE EST_MINUTES
------------ ----- ---- ---------- ---------- ---------- ---------- ---------- -----------
ERROR_CODE
--------------------------------------------
3 REBAL RUN 5 5 660 1148 2664 0
SQL> select * from v$asm_operation;
no rows selected
这样数据全部迁移至新存储;
7、同样使用滚动方式卸载旧磁盘,停止节点1服务,删除ASM磁盘及裸设备映射,启动节点1的CRS服务,停止节点2服务,scan ASM磁盘,删除裸设备映射,启动节点2服务。