Oracle ASM Renaming Disks Groups
renamedg工具可以用来改变一个磁盘组的名称。在对磁盘组执行renamedg之前,磁盘组必须在所有节点中dismounted。renamedg工具重命名磁盘组由两个阶段组成:
1.步骤一会生成一个配置文件供步骤二使用
2.步骤二会使用步骤一生成的配置文件来重命名磁盘组
renamedg的语法如下:
[grid@jyrac1 ~]$ 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
phase=(ONE|TWO|BOTH):指定被执行的阶段。它的取值为one,two或both。这个参数是一个可选参数,它的缺省值为both。通过使用both。如果在第二个阶段出现问题,那么可以使用生成的配
置文件来重新执行two(第二个)阶段。
dgname=diskgroup:指定要被重新命名的磁盘组
newdgname=newdiskgroup:指定新磁盘组名
config=configfile:指定在第一阶段所生成的的配置文件路径或在第二阶段所使用的配置文件路径。这个参数是一个可选参数。缺省的配置文件名为renamedg_config并且它存储在执行
renamedg命令的目录中。在有些平台上配置文件可能需要使用单引号。
asm_diskstring=discoverystring,discoverystrig...:指定Oracle ASM发现字符串。如果Oracle ASM磁盘不是在操作系统的缺省位置,就必须指定asm_diskstring参数。在有些平台上配置
文件可能需要使用单引号,当指定通配符时通常需要使用单引号。
clean=(true|false):指定是否容忍错误,否则将会忽略。缺省值是true。
check=(true|false):指定一个boolean值将用在第二阶段。如果为true,那么renamedg工具将打印对磁盘所使用的改变信息列表。没有写操作被执行,这是一个可选参数,缺省值为false。
confirm=(true|false):指定一个boolean值将
用在第二阶段。如果为false,那么renamedg工具将打印所执行的改变并且在实际执行改变之前进行确认。这是一个可选参数,缺省值为false。
如果check参数被设置为true,那么这个参数值是多余的。
verbose=(true|false):当verbose=true时指定verbose执行。缺省值为false。
keep_voting_files=(true|false):指定voting文件是否被保留在被重命名的磁盘组中。它的缺省值为false,它将从被重命名的磁盘组中删除voting文件。
renamedg工具不会更新集群资源,也不会更新数据库所使用的任何文件路径。因为这个原因,在完成第二阶段操作之后,原来的磁盘组资源不会自动删除。旧磁盘组资源的状态可以通过
Oracle Clusterware Control(crsctl)的crsctl stat res -t命令来进行检查,并且然后使用Server Control Utility(srvctl)的srvctl remove diskgroup命令来进行删除。
下面将使用两个例子来演示renamedg工具的使用方法
1.将创建一个test磁盘组,并将test磁盘组使用带有asm_diskstring,verbose参数的renamedg命令重命名为new_test磁盘组。
SQL> create diskgroup test normal redundancy disk '/dev/raw/raw12','/dev/raw/raw13';
Diskgroup created.
SQL> select group_number,name from v$asm_diskgroup;
GROUP_NUMBER NAME
------------ ------------------------------
1 ACFS
2 ARCHDG
3 CRSDG
4 DATADG
5 TEST
SQL> select group_number,disk_number,name,path from v$asm_disk;
GROUP_NUMBER DISK_NUMBER NAME PATH
------------ ----------- ------------------------------ ------------------------------
0 3 /dev/raw/raw14
1 2 ACFS_0002 /dev/raw/raw7
5 1 TEST_0001 /dev/raw/raw13
5 0 TEST_0000 /dev/raw/raw12
4 0 DATADG_0001 /dev/raw/raw11
1 0 ACFS_0000 /dev/raw/raw5
4 3 DATADG_0000 /dev/raw/raw10
2 1 ARCHDG_0001 /dev/raw/raw9
3 1 CRSDG_0001 /dev/raw/raw8
1 1 ACFS_0001 /dev/raw/raw6
2 0 ARCHDG_0000 /dev/raw/raw2
4 1 DATADG_0003 /dev/raw/raw4
4 2 DATADG_0002 /dev/raw/raw3
3 0 CRSDG_0000 /dev/raw/raw1
14 rows selected.
在两节点上将磁盘组test执行dismout
SQL> alter diskgroup test dismount;
Diskgroup altered.
SQL> alter diskgroup test dismount;
Diskgroup altered.
将磁盘组test重命名为new_test
[grid@jyrac1 ~]$ renamedg phase=both dgname=test newdgname=new_test asm_diskstring='/dev/raw/raw*' verbose=true
NOTE: No asm libraries found in the system
Parsing parameters..
Parameters in effect:
Old DG name : TEST
New DG name : NEW_TEST
Phases :
Phase 1
Phase 2
Discovery str : (null)
Clean : TRUE
Raw only : TRUE
renamedg operation: phase=both dgname=test newdgname=new_test asm_diskstring='/dev/raw/raw*' verbose=true
Executing phase 1
Discovering the group
Performing discovery with string:
Identified disk UFS:/dev/raw/raw12 with disk number:0 and timestamp (33048873 -682272768)
Identified disk UFS:/dev/raw/raw13 with disk number:1 and timestamp (33048873 -682272768)
Checking for hearbeat...
Re-discovering the group
Performing discovery with string:
Identified disk UFS:/dev/raw/raw12 with disk number:0 and timestamp (33048873 -682272768)
Identified disk UFS:/dev/raw/raw13 with disk number:1 and timestamp (33048873 -682272768)
Checking if the diskgroup is mounted or used by CSS
Checking disk number:0
Checking disk number:1
Generating configuration file..
Completed phase 1
Executing phase 2
Looking for /dev/raw/raw12
Modifying the header
Looking for /dev/raw/raw13
Modifying the header
Completed phase 2
Terminating kgfd context 0x2b0307e120a0
检查生成的配置文件
[grid@jyrac1 ~]$ ls -lrt
total 58
-rw-r--r-- 1 grid oinstall 58 Feb 9 10:04 renamedg_config
[grid@jyrac1 ~]$ cat renamedg_config
/dev/raw/raw12 TEST NEW_TEST
/dev/raw/raw13 TEST NEW_TEST
在两节点上将命名为new_test的磁盘组执行mount操作
SQL> alter diskgroup new_test mount;
Diskgroup altered.
SQL> alter diskgroup new_test mount;
Diskgroup altered.
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 8763 5120 1821 0 N ACFS/
MOUNTED NORMAL N 512 4096 1048576 10240 2152 0 1076 0 N ARCHDG/
MOUNTED EXTERN N 512 4096 1048576 10240 9842 0 9842 0 Y CRSDG/
MOUNTED NORMAL N 512 4096 1048576 20480 12419 5120 3649 0 N DATADG/
MOUNTED NORMAL N 512 4096 1048576 10240 10054 0 5027 0 N NEW_TEST/
检查资源状态信息,可以看到原来的磁盘组test还存在,但处于offline状态,需要使用srvctl remove diskgroup命令将其删除
[grid@jyrac1 ~]$ crsctl stat res -t
--------------------------------------------------------------------------------
NAME TARGET STATE SERVER STATE_DETAILS
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.ACFS.dg
ONLINE ONLINE jyrac1
ONLINE ONLINE jyrac2
ora.ARCHDG.dg
ONLINE ONLINE jyrac1
ONLINE ONLINE jyrac2
ora.CRSDG.dg
ONLINE ONLINE jyrac1
ONLINE ONLINE jyrac2
ora.DATADG.dg
ONLINE ONLINE jyrac1
ONLINE ONLINE jyrac2
ora.LISTENER.lsnr
ONLINE ONLINE jyrac1
ONLINE ONLINE jyrac2
ora.NEW_TEST.dg
ONLINE ONLINE jyrac1
ONLINE ONLINE jyrac2
ora.TEST.dg
OFFLINE OFFLINE jyrac1
OFFLINE OFFLINE jyrac2
ora.asm
ONLINE ONLINE jyrac1 Started
ONLINE ONLINE jyrac2 Started
ora.gsd
OFFLINE OFFLINE jyrac1
OFFLINE OFFLINE jyrac2
ora.net1.network
ONLINE ONLINE jyrac1
ONLINE ONLINE jyrac2
ora.ons
ONLINE ONLINE jyrac1
ONLINE ONLINE jyrac2
ora.registry.acfs
ONLINE ONLINE jyrac1
ONLINE ONLINE jyrac2
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.LISTENER_SCAN1.lsnr
1 ONLINE ONLINE jyrac1
ora.LISTENER_SCAN2.lsnr
1 ONLINE ONLINE jyrac2
ora.LISTENER_SCAN3.lsnr
1 ONLINE ONLINE jyrac2
ora.cvu
1 ONLINE ONLINE jyrac2
ora.jyrac.db
1 ONLINE ONLINE jyrac1 Open
2 ONLINE ONLINE jyrac2 Open
ora.jyrac1.vip
1 ONLINE ONLINE jyrac1
ora.jyrac2.vip
1 ONLINE ONLINE jyrac2
ora.oc4j
1 ONLINE ONLINE jyrac2
ora.scan1.vip
1 ONLINE ONLINE jyrac1
ora.scan2.vip
1 ONLINE ONLINE jyrac2
ora.scan3.vip
1 ONLINE ONLINE jyrac2
使用srvctl remove diskgroup命令将资源ora.TEST.dg(磁盘组test)删除
[grid@jyrac1 ~]$ srvctl remove diskgroup -g test
再次检查资源状态信息,可以看到原来的磁盘组test不存在了。
[grid@jyrac1 ~]$ crsctl stat res -t
--------------------------------------------------------------------------------
NAME TARGET STATE SERVER STATE_DETAILS
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.ACFS.dg
ONLINE ONLINE jyrac1
ONLINE ONLINE jyrac2
ora.ARCHDG.dg
ONLINE ONLINE jyrac1
ONLINE ONLINE jyrac2
ora.CRSDG.dg
ONLINE ONLINE jyrac1
ONLINE ONLINE jyrac2
ora.DATADG.dg
ONLINE ONLINE jyrac1
ONLINE ONLINE jyrac2
ora.LISTENER.lsnr
ONLINE ONLINE jyrac1
ONLINE ONLINE jyrac2
ora.NEW_TEST.dg
ONLINE ONLINE jyrac1
ONLINE ONLINE jyrac2
ora.asm
ONLINE ONLINE jyrac1 Started
ONLINE ONLINE jyrac2 Started
ora.gsd
OFFLINE OFFLINE jyrac1
OFFLINE OFFLINE jyrac2
ora.net1.network
ONLINE ONLINE jyrac1
ONLINE ONLINE jyrac2
ora.ons
ONLINE ONLINE jyrac1
ONLINE ONLINE jyrac2
ora.registry.acfs
ONLINE ONLINE jyrac1
ONLINE ONLINE jyrac2
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.LISTENER_SCAN1.lsnr
1 ONLINE ONLINE jyrac1
ora.LISTENER_SCAN2.lsnr
1 ONLINE ONLINE jyrac2
ora.LISTENER_SCAN3.lsnr
1 ONLINE ONLINE jyrac2
ora.cvu
1 ONLINE ONLINE jyrac2
ora.jyrac.db
1 ONLINE ONLINE jyrac1 Open
2 ONLINE ONLINE jyrac2 Open
ora.jyrac1.vip
1 ONLINE ONLINE jyrac1
ora.jyrac2.vip
1 ONLINE ONLINE jyrac2
ora.oc4j
1 ONLINE ONLINE jyrac2
ora.scan1.vip
1 ONLINE ONLINE jyrac1
ora.scan2.vip
1 ONLINE ONLINE jyrac2
ora.scan3.vip
1 ONLINE ONLINE jyrac2
2.下面的例子将new_test磁盘组使用带有asm_diskstring,verbose参数的renamedg命令分两个阶段操作重命名为test磁盘组。
只生成第二阶段操作需要的配置文件
[grid@jyrac1 ~]$ renamedg phase=one dgname=new_test newdgname=test asm_diskstring='/dev/raw/raw*' config=/home/grid/new_test.conf verbose=true
NOTE: No asm libraries found in the system
Parsing parameters..
Parameters in effect:
Old DG name : NEW_TEST
New DG name : TEST
Phases :
Phase 1
Discovery str : /dev/raw/raw*
Clean : TRUE
Raw only : TRUE
renamedg operation: phase=one dgname=new_test newdgname=test asm_diskstring=/dev/raw/raw* config=/home/grid/new_test.conf verbose=true
Executing phase 1
Discovering the group
Performing discovery with string:/dev/raw/raw*
Identified disk UFS:/dev/raw/raw12 with disk number:0 and timestamp (33048873 -682272768)
Identified disk UFS:/dev/raw/raw13 with disk number:1 and timestamp (33048873 -682272768)
Checking for hearbeat...
Re-discovering the group
Performing discovery with string:/dev/raw/raw*
Identified disk UFS:/dev/raw/raw12 with disk number:0 and timestamp (33048873 -682272768)
Identified disk UFS:/dev/raw/raw13 with disk number:1 and timestamp (33048873 -682272768)
Checking if the diskgroup is mounted or used by CSS
Checking disk number:0
KFNDG-00405: file not found; arguments: [NEW_TEST]
出现了KFNDG-00405错误,这是因为在执行renamedg操作之前忘记了将磁盘组new_test在所有节点上执行dismount
在两节点上将磁盘组new_test执地dismount
SQL> alter diskgroup new_test dismount;
Diskgroup altered.
SQL> alter diskgroup new_test dismount;
Diskgroup altered.
Terminating kgfd context 0x2b34496f80a0
[grid@jyrac1 ~]$ renamedg phase=one dgname=new_test newdgname=test asm_diskstring='/dev/raw/raw*' config=/home/grid/new_test.conf verbose=true
NOTE: No asm libraries found in the system
Parsing parameters..
Parameters in effect:
Old DG name : NEW_TEST
New DG name : TEST
Phases :
Phase 1
Discovery str : /dev/raw/raw*
Clean : TRUE
Raw only : TRUE
renamedg operation: phase=one dgname=new_test newdgname=test asm_diskstring=/dev/raw/raw* config=/home/grid/new_test.conf verbose=true
Executing phase 1
Discovering the group
Performing discovery with string:/dev/raw/raw*
Identified disk UFS:/dev/raw/raw12 with disk number:0 and timestamp (33048873 -682272768)
Identified disk UFS:/dev/raw/raw13 with disk number:1 and timestamp (33048873 -682272768)
Checking for hearbeat...
Re-discovering the group
Performing discovery with string:/dev/raw/raw*
Identified disk UFS:/dev/raw/raw12 with disk number:0 and timestamp (33048873 -682272768)
Identified disk UFS:/dev/raw/raw13 with disk number:1 and timestamp (33048873 -682272768)
Checking if the diskgroup is mounted or used by CSS
Checking disk number:0
Checking disk number:1
Generating configuration file..
Completed phase 1
Terminating kgfd context 0x2b1c202a80a0
执行重命名磁盘组的第二阶段操作
[grid@jyrac1 ~]$ renamedg phase=two dgname=new_test newdgname=test config=/home/grid/new_test.conf verbose=true
NOTE: No asm libraries found in the system
Parsing parameters..
Parameters in effect:
Old DG name : NEW_TEST
New DG name : TEST
Phases :
Phase 2
Discovery str : (null)
Clean : TRUE
Raw only : TRUE
renamedg operation: phase=two dgname=new_test newdgname=test config=/home/grid/new_test.conf verbose=true
Executing phase 2
Looking for /dev/raw/raw12
Modifying the header
Looking for /dev/raw/raw13
Modifying the header
Completed phase 2
Terminating kgfd context 0x2b8da14950a0
检查磁盘组new_test是否成功被重命名为test
SQL> select group_number,name from v$asm_diskgroup;
GROUP_NUMBER NAME
------------ ------------------------------
1 ACFS
2 ARCHDG
3 CRSDG
4 DATADG
0 TEST
在两节点上将磁盘组test执行mount操作
SQL> alter diskgroup test mount;
Diskgroup altered.
SQL> alter diskgroup test mount;
Diskgroup altered.
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 8763 5120 1821 0 N ACFS/
MOUNTED NORMAL N 512 4096 1048576 10240 1958 0 979 0 N ARCHDG/
MOUNTED EXTERN N 512 4096 1048576 10240 9842 0 9842 0 Y CRSDG/
MOUNTED NORMAL N 512 4096 1048576 20480 12419 5120 3649 0 N DATADG/
MOUNTED NORMAL N 512 4096 1048576 10240 10054 0 5027 0 N TEST/
检查资源状态信息,可以看到原磁盘组new_test还存在,但为offline状态,重命名后的磁盘组test状态为online
[grid@jyrac1 ~]$ crsctl stat res -t
--------------------------------------------------------------------------------
NAME TARGET STATE SERVER STATE_DETAILS
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.ACFS.dg
ONLINE ONLINE jyrac1
ONLINE ONLINE jyrac2
ora.ARCHDG.dg
ONLINE ONLINE jyrac1
ONLINE ONLINE jyrac2
ora.CRSDG.dg
ONLINE ONLINE jyrac1
ONLINE ONLINE jyrac2
ora.DATADG.dg
ONLINE ONLINE jyrac1
ONLINE ONLINE jyrac2
ora.LISTENER.lsnr
ONLINE ONLINE jyrac1
ONLINE ONLINE jyrac2
ora.NEW_TEST.dg
OFFLINE OFFLINE jyrac1
OFFLINE OFFLINE jyrac2
ora.TEST.dg
ONLINE ONLINE jyrac1
ONLINE ONLINE jyrac2
ora.asm
ONLINE ONLINE jyrac1 Started
ONLINE ONLINE jyrac2 Started
ora.gsd
OFFLINE OFFLINE jyrac1
OFFLINE OFFLINE jyrac2
ora.net1.network
ONLINE ONLINE jyrac1
ONLINE ONLINE jyrac2
ora.ons
ONLINE ONLINE jyrac1
ONLINE ONLINE jyrac2
ora.registry.acfs
ONLINE ONLINE jyrac1
ONLINE ONLINE jyrac2
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.LISTENER_SCAN1.lsnr
1 ONLINE ONLINE jyrac1
ora.LISTENER_SCAN2.lsnr
1 ONLINE ONLINE jyrac2
ora.LISTENER_SCAN3.lsnr
1 ONLINE ONLINE jyrac2
ora.cvu
1 ONLINE ONLINE jyrac2
ora.jyrac.db
1 ONLINE ONLINE jyrac1 Open
2 ONLINE ONLINE jyrac2 Open
ora.jyrac1.vip
1 ONLINE ONLINE jyrac1
ora.jyrac2.vip
1 ONLINE ONLINE jyrac2
ora.oc4j
1 ONLINE ONLINE jyrac2
ora.scan1.vip
1 ONLINE ONLINE jyrac1
ora.scan2.vip
1 ONLINE ONLINE jyrac2
ora.scan3.vip
1 ONLINE ONLINE jyrac2
将原来的磁盘组new_test从资源信息中删除
[grid@jyrac1 ~]$ srvctl remove diskgroup -g new_test
再将检查资源状态信息,可以看到原磁盘组new_test不存在了
[grid@jyrac1 ~]$ crsctl stat res -t
--------------------------------------------------------------------------------
NAME TARGET STATE SERVER STATE_DETAILS
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.ACFS.dg
ONLINE ONLINE jyrac1
ONLINE ONLINE jyrac2
ora.ARCHDG.dg
ONLINE ONLINE jyrac1
ONLINE ONLINE jyrac2
ora.CRSDG.dg
ONLINE ONLINE jyrac1
ONLINE ONLINE jyrac2
ora.DATADG.dg
ONLINE ONLINE jyrac1
ONLINE ONLINE jyrac2
ora.LISTENER.lsnr
ONLINE ONLINE jyrac1
ONLINE ONLINE jyrac2
ora.TEST.dg
ONLINE ONLINE jyrac1
ONLINE ONLINE jyrac2
ora.asm
ONLINE ONLINE jyrac1 Started
ONLINE ONLINE jyrac2 Started
ora.gsd
OFFLINE OFFLINE jyrac1
OFFLINE OFFLINE jyrac2
ora.net1.network
ONLINE ONLINE jyrac1
ONLINE ONLINE jyrac2
ora.ons
ONLINE ONLINE jyrac1
ONLINE ONLINE jyrac2
ora.registry.acfs
ONLINE ONLINE jyrac1
ONLINE ONLINE jyrac2
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.LISTENER_SCAN1.lsnr
1 ONLINE ONLINE jyrac1
ora.LISTENER_SCAN2.lsnr
1 ONLINE ONLINE jyrac2
ora.LISTENER_SCAN3.lsnr
1 ONLINE ONLINE jyrac2
ora.cvu
1 ONLINE ONLINE jyrac2
ora.jyrac.db
1 ONLINE ONLINE jyrac1 Open
2 ONLINE ONLINE jyrac2 Open
ora.jyrac1.vip
1 ONLINE ONLINE jyrac1
ora.jyrac2.vip
1 ONLINE ONLINE jyrac2
ora.oc4j
1 ONLINE ONLINE jyrac2
ora.scan1.vip
1 ONLINE ONLINE jyrac1
ora.scan2.vip
1 ONLINE ONLINE jyrac2
ora.scan3.vip
1 ONLINE ONLINE jyrac2
正文到此结束