ASM重命名包含OCR/vote file的磁盘组


Rename Diskgroup having OCR , Vote File , ASM SPILE [ID 1335975.1]适用于11R2;11R2提供renamedg,可在磁盘组dismount时将其重命名;如果该磁盘组包含OCR/vote file,则dismount前需将其迁移至中间磁盘;大致思路如下:创建一个临时磁盘组temp,将OCR/vote file迁移至此;将spfile也迁移到temp,重启CRS;卸载并重命名原磁盘组,并重新加载;将ocr/vote file/spfile迁回,重启CRS;创建临时磁盘组create diskgroup TEMP normal redundancydisk 'ORCL:DISK4' ,'ORCL:DISK5' ,'ORCL:DATA4' ,'ORCL:DATA6'attribute 'compatible.rdbms'='11.2.0.0', 'compatible.asm'='11.2.0.0', 'au_size'='4M';迁移ocr/vote file$ORACLE_HOME/bin/bin/ocrconfig -add +TEMP$ORACLE_HOME/bin/bin/ocrconfig -delete +DATA$ORACLE_HOME/bin/crsctl replace votedisk +TEMP完成后调用ocrcheck检查完整性迁移spfile重启CRScrsctl stop crscrsctl start crs重命名磁盘组alter diskgroup data dismount; renamedg phase=both dgname=DATA newdgname=CRS verbose=true输出如下Parsing parameters..Parameters in effect:Old DG name : DATANew DG name : CRSPhases :Phase 1Phase 2Discovery str : (null)Clean : TRUERaw only : TRUErenamedg operation: phase=both dgname=DATA newdgname=CRS verbose=trueExecuting phase 1Discovering the groupPerforming discovery with string:Identified disk ASM:/opt/oracle/extapi/32/asm/orcl/1/libasm.so:ORCL:DISK1 with disk number:0 and timestamp (32955539 -2120261632)Identified disk ASM:/opt/oracle/extapi/32/asm/orcl/1/libasm.so:ORCL:DISK2 with disk number:1 and timestamp (32955539 -2120261632)Identified disk ASM:/opt/oracle/extapi/32/asm/orcl/1/libasm.so:ORCL:DISK3 with disk number:2 and timestamp (32955539 -2120261632)Identified disk ASM:/opt/oracle/extapi/32/asm/orcl/1/libasm.so:ORCL:DISK6 with disk number:5 and timestamp (32955539 -2120261632)Checking for hearbeat...Re-discovering the groupPerforming discovery with string:Identified disk ASM:/opt/oracle/extapi/32/asm/orcl/1/libasm.so:ORCL:DISK1 with disk number:0 and timestamp (32955539 -2120261632)Identified disk ASM:/opt/oracle/extapi/32/asm/orcl/1/libasm.so:ORCL:DISK2 with disk number:1 and timestamp (32955539 -2120261632)Identified disk ASM:/opt/oracle/extapi/32/asm/orcl/1/libasm.so:ORCL:DISK3 with disk number:2 and timestamp (32955539 -2120261632)Identified disk ASM:/opt/oracle/extapi/32/asm/orcl/1/libasm.so:ORCL:DISK6 with disk number:5 and timestamp (32955539 -2120261632)Checking if the diskgroup is mounted or used by CSSChecking disk number:0Checking disk number:1Checking disk number:2Checking disk number:5Generating configuration file..Completed phase 1Executing phase 2Looking for ORCL:DISK1Modifying the headerLooking for ORCL:DISK2Modifying the headerLooking for ORCL:DISK3Modifying the headerLooking for ORCL:DISK6Modifying the headerCompleted phase 2Terminating kgfd context 0xb7ee8050重新加载磁盘组并迁回OCRalter diskgroup CRS mount$ORACLE_HOME/bin/ocrconfig -add +CRS$ORACLE_HOME/bin/ocrconfig -delete +TEMP$ORACLE_HOME/bin/crsctl replace votedisk +CRS迁回spfile并重启CRS删除temp磁盘组并将其信息从集群中移除alter diskgroup TEMP dismount;drop diskgroup temp including contents;srvctl remove diskgroup -g datasrvctl remove diskgroup -g TEMP

 



Rename Diskgroup having OCR , Vote File , ASM SPILE (文档 ID 1335975.1)


In this Document  


Goal

Solution


APPLIES TO:

Oracle Database - Enterprise Edition - Version 11.2.0.1 and later  
Information in this document applies to any platform.  

GOAL

Consider a 11.2 Grid Infrastructure with CLUSTER setup having OCR ,Vote File and ASM SPFILE on a diskgroup. Under certain circumstances you may wish to rename that diskgroup.

"renamedg" utility can be used to rename of the diskgroup when the diskgroup is dismounted.

 But since the diskgroup contains OCR and Vote File we need to use an intermediate diskgroup for storing OCR and Vote File temporarily while renaming the actual diskgroup.

SOLUTION

Basic Steps to rename the diskgroup :


1) Create a temporary diskgroup (TEMP) with suitable redundancy for OCR and Vote files.

2) Move OCR and Vote file from <current diskgroup> to <TEMP>.

3) Change ASM SPFILE location from <current diskgroup> to <TEMP> diskgroup.

4) Restart CRS in all Nodes to Startup CRS using New SPFILE from <TEMP> diskgroup.

5) Dismount the OLD diskgroup in all cluster nodes that is not used by CRS.

6) Rename OLD diskgroup to NEW diskgroup 

7) Mount the renamed diskgroup .

8) Move OCR and Vote file from TEMP diskgroup to renamed diskgroup.

9) Change ASM SPFILE location from <TEMP diskgroup> to renamed diskgroup.

10) Restart CRS in all nodes to startup CRS using new SPFILE from renamed diskgroup.
NOTE:   Modify the asm resource to have the correct password file location else startup CRS will not start the ASM resource 

11) Drop the intermediate diskgroup TEMP.

12) Need to remove the diskgroup resources TEMP and <OLD Diskgroup Name> from Oracle Clusterware .

13) Ensure ALL cluster resources are started successfully .

 

 Below assumptions are made :

-> Name of Temporary diskgroup is TEMP.
-> OCR,Voting Disks and ASM SPFILE are originally stored in a diskgroup DATA.
-> Diskgroup DATA should be renamed to CRS.
-> $ORACLE_HOME points to GRID Home.
-> Cluster is up and running in all nodes of RAC.




Detailed steps with commands to rename the diskgroup :

1) Create a temporary diskgroup :

Login as SYSASM using SQLPLUS into ASM instance on one node and run below commands:  

create diskgroup TEMP normal redundancy disk <disk_1> ,<disk_2> ,<disk_3> 
attribute 'compatible.rdbms'='11.2.0.0', 'compatible.asm'='11.2.0.0', 'au_size'=<desired_au_size>;

Sample Command Output:  

SQL>     create diskgroup TEMP normal redundancy     disk 'ORCL:DISK4' ,'ORCL:DISK5' ,'ORCL:DATA4'   
attribute 'compatible.rdbms'='11.2.0.0', 'compatible.asm'='11.2.0.0', 'au_size'='4M';  

Diskgroup created.




2) Move OCR and Vote file from <current diskgroup> to <TEMP> :  

$ORACLE_HOME/bin/bin/ocrconfig -add +TEMP  
$ORACLE_HOME/bin/bin/ocrconfig -delete +DATA  
$ORACLE_HOME/bin/crsctl replace votedisk +TEMP  



Sample Command Output:  

[root@test ~]# $ORACLE_HOME/bin/ocrconfig -add +TEMP  
[root@test ~]# date  
Mon Jul 4 21:10:16 IST 2011  

[root@test ~]# $ORACLE_HOME/bin/ocrconfig -delete +DATA  
[root@test ~]# date  
Mon Jul 4 21:10:40 IST 2011  


[root@test ~]# $ORACLE_HOME/bin/crsctl replace votedisk +TEMP  
Successful addition of voting disk 9d351cfdbef64facbfe2d1519880ef33.  
Successful addition of voting disk 302c23b19e864f92bfa68eda9045e5cc.  
Successful addition of voting disk 6eeca4920acb4f8fbf6ec5a4e2b8ea7b.  
Successful deletion of voting disk 32f7d65cf17d4fa3bf2932998251635f.  
Successful deletion of voting disk 10c31fb0891d4f5abfb38ef34cd49f4d.  
Successful deletion of voting disk 7d6f7d6480554f01bfc2621a3adb8f5f.  
Successfully replaced voting disk group with +TEMP.  
CRS-4266: Voting file(s) successfully replaced  

[root@test ~]# date  
Mon Jul 4 21:11:28 IST 2011  


[root@test ~]# $ORACLE_HOME/bin/crsctl query css votedisk  
## STATE File Universal Id File Name Disk group  
-- ----- ----------------- --------- ---------  
1. ONLINE 9d351cfdbef64facbfe2d1519880ef33 (ORCL:DISK4) [TEMP]  
2. ONLINE 302c23b19e864f92bfa68eda9045e5cc (ORCL:DISK5) [TEMP]  
3. ONLINE 6eeca4920acb4f8fbf6ec5a4e2b8ea7b (ORCL:DATA4) [TEMP]  
Located 3 voting disk(s).  
[root@test ~]#  


[root@test ~]# $ORACLE_HOME/bin/ocrcheck  
Status of Oracle Cluster Registry is as follows :  
Version : 3  
Total space (kbytes) : 262120  
Used space (kbytes) : 2804  
Available space (kbytes) : 259316  
ID : 1778064925  
Device/File Name : +TEMP  
Device/File integrity check succeeded  

Device/File not configured  
Device/File not configured  
Device/File not configured  
Device/File not configured  
Cluster registry integrity check succeeded  
Logical corruption check succeeded




3) Change ASM SPFILE location from <Current diskgroup> to <TEMP> diskgroup.  

Login as SYSASM using SQLPLUS into ASM instance on one node and run below commands:  

create pfile='/tmp/init/init' from spfile;  
create spfile='+TEMP' from pfile='/tmp/init/init';  

Now GPNPTOOL will get updated with new ASM SPFILE location.

That can be verified by below command :
$ORACLE_HOME/bin/gpnptool get




4) Restart CRS on all nodes to startup CRS using new SPFILE from TEMP diskgroup :  

crsctl stop crs  
crsctl start crs




5) Dismount the OLD Diskgroup on all cluster nodes:  

Login as SYSASM using SQLPLUS into ASM instance on one node and run below commands:  

SQL>alter diskgroup data dismount;  

Sample Command Output:  
SQL> alter diskgroup data dismount;  
Diskgroup altered.  

SQL> !date  
Mon Jul 4 21:38:28 IST 2011



6) Rename OLD diskgroup to NEW diskgroup name :  

renamedg phase=both dgname=DATA newdgname=CRS verbose=true   

Sample Command Output:  
[grid@test ~]$ renamedg phase=both dgname=DATA newdgname=CRS asm_diskstring='<disk string>' verbose=true  

Parsing parameters..  
Parameters in effect:  
Old DG name : DATA  
New DG name : CRS  
Phases :  
Phase 1  
Phase 2  
Discovery str : (null)  
Clean : TRUE  
Raw only : TRUE  
renamedg operation: phase=both dgname=DATA newdgname=CRS verbose=true  
Executing phase 1  
Discovering the group  
Performing discovery with string:  
Identified disk ASM:/opt/oracle/extapi/32/asm/orcl/1/libasm.so:ORCL:DISK1 with disk number:0 and timestamp (32955539 -2120261632)  
Identified disk ASM:/opt/oracle/extapi/32/asm/orcl/1/libasm.so:ORCL:DISK2 with disk number:1 and timestamp (32955539 -2120261632)  
Identified disk ASM:/opt/oracle/extapi/32/asm/orcl/1/libasm.so:ORCL:DISK3 with disk number:2 and timestamp (32955539 -2120261632)  
Checking for hearbeat...  
Re-discovering the group  
Performing discovery with string:  
Identified disk ASM:/opt/oracle/extapi/32/asm/orcl/1/libasm.so:ORCL:DISK1 with disk number:0 and timestamp (32955539 -2120261632)  
Identified disk ASM:/opt/oracle/extapi/32/asm/orcl/1/libasm.so:ORCL:DISK2 with disk number:1 and timestamp (32955539 -2120261632)  
Identified disk ASM:/opt/oracle/extapi/32/asm/orcl/1/libasm.so:ORCL:DISK3 with disk number:2 and timestamp (32955539 -2120261632)  
Checking if the diskgroup is mounted or used by CSS  
Checking disk number:0  
Checking disk number:1  
Checking disk number:2  
Generating configuration file..  
Completed phase 1  
Executing phase 2  
Looking for ORCL:DISK1  
Modifying the header  
Looking for ORCL:DISK2  
Modifying the header  
Looking for ORCL:DISK3  
Modifying the header  
Completed phase 2  
Terminating kgfd context 0xb7ee8050  
[grid@test ~]$  



S  QL> set line 1000  
set pages 599  
col path format a30  
select name,path,group_number,header_status,total_mb,free_mb from v$asm_disk;  
select name,state,usable_file_mb,total_mb,free_mb,required_mirror_free_mb from v$asm_diskgroup;  

NAME PATH GROUP_NUMBER HEADER_STATU TOTAL_MB FREE_MB  
------------------------------ ------------------------------ ------------ ------------ ---------- ----------  
ORCL:DISK1 0 MEMBER 0 0  
ORCL:DISK2 0 MEMBER 0 0  
ORCL:DISK3 0 MEMBER 0 0  
ORCL:DISK6 0 MEMBER 0 0  
DATA1 ORCL:DATA1 2 MEMBER 977 642  
DATA2 ORCL:DATA2 2 MEMBER 977 642  
DATA3 ORCL:DATA3 1 MEMBER 15109 9982  
DATA4 ORCL:DATA4 3 MEMBER 252 76  
DATA6 ORCL:DATA6 3 MEMBER 860 576  
DISK4 ORCL:DISK4 3 MEMBER 668 376  
DISK5 ORCL:DISK5 3 MEMBER 668 372  

11 rows selected.  

SQL>  
NAME STATE USABLE_FILE_MB TOTAL_MB FREE_MB REQUIRED_MIRROR_FREE_MB  
------------------------------ ----------- -------------- ---------- ---------- -----------------------  
DATA1 MOUNTED 9982 15109 9982 0  
FLASH MOUNTED 642 1954 1284 0  
TEMP MOUNTED 552 2448 1400 296  
CRS DISMOUNTED 0 0 0 0  

 

7) Mount the renamed diskgroup on All the nodes:  

Login as SYSASM using SQLPLUS into ASM instance on one node and run below commands:  

SQL>alter diskgroup CRS mount;  

Sample Command Output:  

SQL> alter diskgroup CRS mount;  
Diskgroup altered.  


SQL> select name,state,usable_file_mb,total_mb,free_mb,required_mirror_free_mb from v$asm_diskgroup;  

NAME STATE USABLE_FILE_MB TOTAL_MB FREE_MB REQUIRED_MIRROR_FREE_MB  
------------------------------ ----------- -------------- ---------- ---------- -----------------------  
DATA1 MOUNTED 9982 15109 9982 0  
FLASH MOUNTED 642 1954 1284 0  
TEMP MOUNTED 552 2448 1400 296  
CRS MOUNTED 1196 3596 2644 252  

SQL> !date  
Mon Jul 4 21:52:05 IST 2011

 

8) Move OCR and Vote file from TEMP Diskgroup to Renamed Diskgroup :  

$ORACLE_HOME/bin/ocrconfig -add +CRS  
$ORACLE_HOME/bin/ocrconfig -delete +TEMP  
$ORACLE_HOME/bin/crsctl replace votedisk +CRS  

Sample Command Output:  

[root@test ~]# $ORACLE_HOME/bin/ocrconfig -add +CRS  
[root@test ~]# $ORACLE_HOME/bin/ocrconfig -delete +TEMP  
[root@test ~]# $ORACLE_HOME/bin/crsctl replace votedisk +CRS  
Successful addition of voting disk ae0f06430e724fb7bf3757a7cdf8a101.  
Successful addition of voting disk 1b355413f5904f5abff181938191ed97.  
Successful addition of voting disk a7f75c9872ac4f6fbf77bbcb10ea17a6.  
Successful deletion of voting disk 9d351cfdbef64facbfe2d1519880ef33.  
Successful deletion of voting disk 302c23b19e864f92bfa68eda9045e5cc.  
Successful deletion of voting disk 6eeca4920acb4f8fbf6ec5a4e2b8ea7b.  
Successfully replaced voting disk group with +CRS.  
CRS-4266: Voting file(s) successfully replaced  
[root@test ~]# date  
Mon Jul 4 21:55:48 IST 2011

 

9) Change ASM SPFILE location from <TEMP diskgroup> to Renamed Diskgroup  :  

Login as SYSASM using SQLPLUS into ASM instance on one node and run below commands:  

create spfile='+CRS' from pfile='/tmp/init/init';  

Sample Command Output:  

SQL> create spfile='+CRS' from pfile='/tmp/init/init';  
File created.  

SQL> !date  
Mon Jul 4 21:56:56 IST 2011

 

10) Restart CRS on all nodes to Startup CRS using new SPFILE from renamed diskgroup :  

crsctl stop crs  
crsctl start crs  

 

11) Drop the Intermediate Diskgroup TEMP :  

Login as SYSASM using SQLPLUS into ASM instance on one node and run below commands:  :

SQL>drop diskgroup temp including contents;

NOTE: Diskgroup TEMP must be mounted in order to be able to drop it.You need to mount it (if it is not already mounted at CRS startup) and then run "drop diskgroup.."

 


12) Need to Remove the Diskgroup Resources TEMP and <OLD Diskgroup Name> from Oracle Clusterware :  

srvctl remove diskgroup -g data  
srvctl remove diskgroup -g TEMP  

Sample Command Output:  

[root@test ~]# $ORACLE_HOME/bin/srvctl remove diskgroup -g data  
[root@test ~]# $ORACLE_HOME/bin/srvctl remove diskgroup -g TEMP  
[root@test ~]# date

NOTE: Normally diskgroup TEMP as resource should be removed by "drop diskgroup.." command, hence you need to run above command only if the resource is not already dropped.
In case of DATA diskgroup resource you need to explicitly remove it using srvctl command as the diskgroup was just renamed not dropped.

 

13) Ensure ALL Cluster resources are started successfully using below sample commands :  

$ORACLE_HOME/bin/crsctl stat res -init -t  
$ORACLE_HOME/bin/crsctl check cluster -all  
$ORACLE_HOME/bin/crsctl stat res -t


©著作权归作者所有:来自51CTO博客作者小麦苗DB宝的原创作品,如需转载,请注明出处,否则将追究法律责任

更多相关文章

  1. Jira/Confluence的备份、恢复和迁移
  2. 【Linux】虚拟磁盘挂载错误,不能进入系统(fsck.ext3:no such file
  3. Linux 磁盘分区管理
  4. 磁盘挂载问题:Fdisk最大只能创建2T分区的盘,超过2T使用parted
  5. 将磁盘误挂载到根分区下的问题处理记录
  6. 联邦学习 OR 迁移学习?No,我们需要联邦迁移学习
  7. drbd磁盘扩容
  8. 如何使用“迁移助理”将文件从旧 Mac 移到新Mac?
  9. 磁盘空间不足的解决办法

随机推荐

  1. android lisetview的多列模版
  2. android倒计时(整理)
  3. 【Android】自带Theme
  4. Android点滴积累(一)
  5. Android layout布局属性、标签属性总结大
  6. Android(安卓)修改SeekBar样式,打造理想进
  7. [摘]android 入门xml布局文件
  8. ok6410 android driver(11)
  9. Android API中文文档GridView
  10. NestedScrollingParent, NestedScrolling