利用OracleRac11gR2新特性renamedg來更改diskgroupname
交代環境:
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