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
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
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/26015009/viewspace-2133264/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- [Oracle Script] ASM Disks Performance metricOracleASMORM
- [Oracle Script] ASM Disk Groups UsedOracleASM
- 手工建立ASM Disk Groups、為 ASM Disk Groups 新增 diskASM
- Discover Your Missed ASM Disks(轉)ASM
- Oracle ASM (10) - ASM中優先讀failure group配置ASM_PREFERRED_READ_FAILURE_GROUPSOracleASMAI
- Oracle ASM (11) - ASM中優先讀failure group配置ASM_PREFERRED_READ_FAILURE_GROUPSOracleASMAI
- Configuring Oracle ASM disks in Oracle Enterprise Linux r5u3OracleASMLinux
- 幾個重要的 ASM Disk Groups 引數ASM
- ASMIOSTAT Script to collect iostats for ASM disks mos 437996.1ASMiOS996
- ASMIOSTAT Script to collect iostats for ASM disks [ID 437996.1]ASMiOS996
- INS-30510: Insufficient number of ASM disks selected.ASM
- ORA-15196 WITH ASM DISKS LARGER THAN 2TB [ID 736891.1]ASM
- DBCA Does Not Display ASM Disk Groups In 11.2 [ID 1177483.1]ASM
- Oracle 12C Statistics on Column GroupsOracle
- Oracle11g維護分割槽(八)——Renaming PartitionsOracle
- Renaming a Datafile in the Primary DatabaseDatabase
- 【OH】3 Managing Oracle Cluster Registry and Voting DisksOracle
- I. Disks
- oracle asmOracleASM
- 【ORACLE ASM】ASM 支援工具簡介OracleASM
- oracle asm命令OracleASM
- Oracle ASM 管理OracleASM
- Oracle ASM 限制OracleASM
- oracle asm asmcmdOracleASM
- Renaming the default branch from master to main on GithubASTAIGithub
- Manage ASM instance-creating diskgroup,adding/dropping/resizing disks_270066.1ASM
- Disks of Dismounted DG Are Still Hold/Lock By Oracle Process 11.2.0.3_1485163.1Oracle
- Oracle GoldenGate Best Practice - Testing Maximum Performance of Disks in UNIX [ID 1356855.1]OracleGoORM
- Oracle ASM Disk DirectoryOracleASM
- Oracle ASM File DirectoryOracleASM
- Oracle ASM Allocation TableOracleASM
- Oracle ASM Disk PartnerOracleASM
- Oracle ASM Alias DirectoryOracleASM
- Oracle ASM Template DirectoryOracleASM
- Oracle Find block in ASMOracleBloCASM
- Oracle ASM 詳解OracleASM
- 全面學習ORACLE Scheduler特性(12)使用Windows和Window GroupsOracleWindows
- oracle ASM中ASM_POWER_LIMIT引數OracleASMMIT