利用Oracle Rac 11gR2 新特性renamedg来更改diskgroup name

交代环境:
AIX7.1 + 双节点Oracle Rac 11.2.0.3

由于此套Rac并非自己部门安装,是开发部安装,现交由运维部分来管理,客户需要要将asm  diskgroup name 安装部门规范来命令。遂需要将oasmdgdata1更改为datadg。
幸好Oracle的版本是11gR2,在11gR2中,Oracle有一项新特性,可以直接使用renamedg命令更改diskgroup的名称。
下面是具体的操作步骤。

grid@sundb01:/home/grid>asmcmd
ASMCMD> lsdg
State    Type    Rebal  Sector  Block       AU  Total_MB  Free_MB  Req_mir_free_MB  Usable_file_MB  Offline_disks  Voting_files  Name
MOUNTED  NORMAL  N         512   4096  1048576    358400   358192                0          179096              0             N  OASMDGDATA01/
MOUNTED  NORMAL  N         512   4096  1048576     15360    14434             5120            4657              0             Y  OCRDG/
ASMCMD> umount oasmdgdata01
ASMCMD> lsdg
State    Type    Rebal  Sector  Block       AU  Total_MB  Free_MB  Req_mir_free_MB  Usable_file_MB  Offline_disks  Voting_files  Name
MOUNTED  NORMAL  N         512   4096  1048576     15360    14434             5120            4657              0             Y  OCRDG/

grid@sundb01:/home/grid>renamedg -help
NOTE: No asm libraries found in the system

Parsing parameters..
phase                           Phase to execute, 
                                (phase=ONE|TWO|BOTH), default BOTH

dgname                          Diskgroup to be renamed

newdgname                       New name for the diskgroup

config                          intermediate config file

check                           just check-do not perform actual operation,
                                (check=TRUE/FALSE), default FALSE

confirm                         confirm before committing changes to disks,
                                (confirm=TRUE/FALSE), default FALSE

clean                           ignore errors,
                                (clean=TRUE/FALSE), default TRUE

asm_diskstring                  ASM Diskstring (asm_diskstring='discoverystring',
                                'discoverystring1' ...)

verbose                         verbose execution, 
                                (verbose=TRUE|FALSE), default FALSE

keep_voting_files               Voting file attribute, 
                                (keep_voting_files=TRUE|FALSE), default FALSE

利用renamedg来更改diskgroup的名称:
grid@sundb01:/home/grid>renamedg phase=both dgname=oasmdgdata01 newdgname=datadg verbose=true
NOTE: No asm libraries found in the system

Parsing parameters..

Parameters in effect:

         Old DG name       : OASMDGDATA01 
         New DG name          : DATADG 
         Phases               :
                 Phase 1
                 Phase 2
         Discovery str        :  
         Clean              : TRUE
         Raw only           : TRUE
renamedg operation: phase=both dgname=oasmdgdata01 newdgname=datadg verbose=true
Executing phase 1
Discovering the group
Performing discovery with string:
Identified disk UFS:/dev/rhdisk2 with disk number:1 and timestamp (33002374 -296274944)
Identified disk UFS:/dev/rhdisk1 with disk number:0 and timestamp (33002374 -296274944)
Checking for hearbeat...
Re-discovering the group
Performing discovery with string:
Identified disk UFS:/dev/rhdisk2 with disk number:1 and timestamp (33002374 -296274944)
Identified disk UFS:/dev/rhdisk1 with disk number:0 and timestamp (33002374 -296274944)
Checking if the diskgroup is mounted or used by CSS 
Checking disk number:1
Checking disk number:0
Generating configuration file..
Completed phase 1
Executing phase 2
Looking for /dev/rhdisk2
Modifying the header
Looking for /dev/rhdisk1
Modifying the header
Completed phase 2
Terminating kgfd context 110285ba0
grid@sundb01:/home/grid>
grid@sundb01:/home/grid>sqlplus / as sysasm

SQL*Plus: Release 11.2.0.3.0 Production on Fri Oct 10 12:33:31 2014

Copyright (c) 1982, 2011, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Real Application Clusters and Automatic Storage Management options

SQL> select name,state from v$asm_diskgroup;

NAME                           STATE
------------------------------ -----------
DATADG                         DISMOUNTED
OCRDG                          MOUNTED

SQL> alter diskgroup datadg mount;

Diskgroup altered.

SQL> select name,state from v$asm_diskgroup;

NAME                           STATE
------------------------------ -----------
DATADG                         MOUNTED
OCRDG                          MOUNTED

grid@sundb01:/home/grid>asmcmd
ASMCMD> lsdg
State    Type    Rebal  Sector  Block       AU  Total_MB  Free_MB  Req_mir_free_MB  Usable_file_MB  Offline_disks  Voting_files  Name
MOUNTED  NORMAL  N         512   4096  1048576    358400   358192                0          179096              0             N  DATADG/
MOUNTED  NORMAL  N         512   4096  1048576     15360    14434             5120            4657              0             Y  OCRDG/
ASMCMD> 
ASMCMD> exit
grid@sundb01:/home/grid>sqlplus / as sysasm

SQL*Plus: Release 11.2.0.3.0 Production on Fri Oct 10 12:39:41 2014

Copyright (c) 1982, 2011, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Real Application Clusters and Automatic Storage Management options

SQL> select name,path from v$asm_disk;

NAME                           PATH
------------------------------ ----------------------------------------
OASMDGDATA01_0000              /dev/rhdisk1    -----从此处发现,其实即使更改了diskgroup的name,disk name也没有改变。
OASMDGDATA01_0001              /dev/rhdisk2     -----通过kfed查看磁盘头信息仍然会发现diskgroup name 还是之前的那个名称。
OCRDG_0000                     /dev/rhdisk3
OCRDG_0001                     /dev/rhdisk4
OCRDG_0002                     /dev/rhdisk5

此处还需要将crs中的OASMDGDATA01信息给删除:
grid@sundb01:/home/grid>crs_stat
NAME=ora.DATADG.dg
TYPE=ora.diskgroup.type
TARGET=ONLINE
STATE=ONLINE on sundb01

NAME=ora.OASMDGDATA01.dg
TYPE=ora.diskgroup.type
TARGET=OFFLINE
STATE=OFFLINE

grid@sundb01:/home/grid>crsctl delete resource ora.OASMDGDATA01.dg
grid@sundb01:/home/grid>crs_stat -t
Name           Type           Target    State     Host        
------------------------------------------------------------
ora.DATADG.dg  ora....up.type ONLINE    ONLINE    sundb01    
ora....ER.lsnr ora....er.type ONLINE    ONLINE    sundb01    
ora....R1.lsnr ora....er.type ONLINE    ONLINE    sundb01    
ora....N1.lsnr ora....er.type ONLINE    ONLINE    sundb01    
ora.OCRDG.dg   ora....up.type ONLINE    ONLINE    sundb01    
ora.asm        ora.asm.type   ONLINE    ONLINE    sundb01    
ora.cvu        ora.cvu.type   ONLINE    ONLINE    sundb01    
ora.gsd        ora.gsd.type   OFFLINE   OFFLINE               
ora....SM1.asm application    ONLINE    ONLINE    sundb01    
ora....01.lsnr application    ONLINE    ONLINE    sundb01    
ora....01.lsnr application    ONLINE    ONLINE    sundb01    
ora....b01.gsd application    OFFLINE   OFFLINE               
ora....b01.ons application    ONLINE    ONLINE    sundb01    
ora....b01.vip ora....t1.type ONLINE    ONLINE    sundb01    
ora....SM2.asm application    ONLINE    ONLINE    sundb02    
ora....02.lsnr application    ONLINE    ONLINE    sundb02    
ora....02.lsnr application    ONLINE    ONLINE    sundb02    
ora....b02.gsd application    OFFLINE   OFFLINE               
ora....b02.ons application    ONLINE    ONLINE    sundb02    
ora....b02.vip ora....t1.type ONLINE    ONLINE    sundb02    
ora....network ora....rk.type ONLINE    ONLINE    sundb01    
ora.oc4j       ora.oc4j.type  ONLINE    ONLINE    sundb02    
ora.ons        ora.ons.type   ONLINE    ONLINE    sundb01    
ora....ry.acfs ora....fs.type ONLINE    ONLINE    sundb01    
ora.scan1.vip  ora....ip.type ONLINE    ONLINE    sundb01    

你可能感兴趣的:(利用Oracle Rac 11gR2 新特性renamedg来更改diskgroup name)