最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
oracle中rename asm diskgroup的例子
时间:2022-06-29 09:43:45 编辑:袖梨 来源:一聚教程网
在11.2之后,已经可以rename asm diskgroup了,而不必再新建diskgroup之后,再做image copy。
在11.2.中的gi home中,自带了一个命令renamedg,看下面的例子:
renamedg phase=
其步骤可以分成2个phase,第一个是生成一个configure文件(renamedg_config),第二个phase是执行这个configure文件,而文档中说的phase=both,是表示生成完后直接执行。
此外,在10g和11gR1也可以修改,但其实也是利用11gR2的renamedg工具。
注意:在操作的时候,踩了几个坑,在这里和大家分享一下。
(一)有可能需要设置asm_diskstring,我第一次没加这个参数,报错了KFNDG-00407:
[oracle@rac1 ~]$ renamedg phase=both dgname=FRA newdgname=NEW_FRA verbose=true
NOTE: No asm libraries found in the system
Parsing parameters..
Parameters in effect:
Old DG name : FRA
New DG name : NEW_FRA
Phases :
Phase 1
Phase 2
Discovery str : (null)
Clean : TRUE
Raw only : TRUE
renamedg operation: phase=both dgname=FRA newdgname=NEW_FRA verbose=true
Executing phase 1
Discovering the group
Performing discovery with string:
KFNDG-00407: file not found; arguments: []
Terminating kgfd context 0x7fd4b29520a0
[oracle@rac1 ~]$
注,disk所在的路径,可以参考asm实例中初始化参数asm_diskstring的设置,或者直接用kfod disks=all看也可以。
(二)第二次的时候,加了asm_diskstring这个参数,但是只是操作前仅umount了node1,忘记umount node2上的diskgroup,报错了KFNDG-00305:
[oracle@rac1 dev]$ renamedg phase=both dgname=FRA newdgname=NEW_FRA asm_diskstring='/dev/asm*' verbose=true
NOTE: No asm libraries found in the system
Parsing parameters..
Parameters in effect:
Old DG name : FRA
New DG name : NEW_FRA
Phases :
Phase 1
Phase 2
Discovery str : /dev/asm*
Clean : TRUE
Raw only : TRUE
renamedg operation: phase=both dgname=FRA newdgname=NEW_FRA asm_diskstring=/dev/asm* verbose=true
Executing phase 1
Discovering the group
Performing discovery with string:/dev/asm*
Identified disk UFS:/dev/asm-fra03 with disk number:2 and timestamp (33005975 -1778129920)
Identified disk UFS:/dev/asm-fra04 with disk number:3 and timestamp (33005975 -1778129920)
Identified disk UFS:/dev/asm-fra01 with disk number:0 and timestamp (33005975 -1778129920)
Identified disk UFS:/dev/asm-fra02 with disk number:1 and timestamp (33005975 -1778129920)
Checking for hearbeat...
Re-discovering the group
Performing discovery with string:/dev/asm*
Identified disk UFS:/dev/asm-fra03 with disk number:2 and timestamp (33005975 -1778129920)
Identified disk UFS:/dev/asm-fra04 with disk number:3 and timestamp (33005975 -1778129920)
Identified disk UFS:/dev/asm-fra01 with disk number:0 and timestamp (33005975 -1778129920)
Identified disk UFS:/dev/asm-fra02 with disk number:1 and timestamp (33005975 -1778129920)
Checking if the diskgroup is mounted or used by CSS
Checking disk number:2
Checking disk number:3
Checking disk number:0
Checking disk number:1
Generating configuration file..
KFNDG-00305: file not found
Terminating kgfd context 0x7f82d62960a0
[oracle@rac1 dev]$
解决了上面的2个问题,才是正常修改成功:
[oracle@rac1 ~]$ renamedg phase=both dgname=FRA newdgname=NEW_FRA asm_diskstring='/dev/asm*' verbose=true
NOTE: No asm libraries found in the system
Parsing parameters..
Parameters in effect:
Old DG name : FRA
New DG name : NEW_FRA
Phases :
Phase 1
Phase 2
Discovery str : /dev/asm*
Clean : TRUE
Raw only : TRUE
renamedg operation: phase=both dgname=FRA newdgname=NEW_FRA asm_diskstring=/dev/asm* verbose=true
Executing phase 1
Discovering the group
Performing discovery with string:/dev/asm*
Identified disk UFS:/dev/asm-fra03 with disk number:2 and timestamp (33005975 -1778129920)
Identified disk UFS:/dev/asm-fra04 with disk number:3 and timestamp (33005975 -1778129920)
Identified disk UFS:/dev/asm-fra01 with disk number:0 and timestamp (33005975 -1778129920)
Identified disk UFS:/dev/asm-fra02 with disk number:1 and timestamp (33005975 -1778129920)
Checking for hearbeat...
Re-discovering the group
Performing discovery with string:/dev/asm*
Identified disk UFS:/dev/asm-fra03 with disk number:2 and timestamp (33005975 -1778129920)
Identified disk UFS:/dev/asm-fra04 with disk number:3 and timestamp (33005975 -1778129920)
Identified disk UFS:/dev/asm-fra01 with disk number:0 and timestamp (33005975 -1778129920)
Identified disk UFS:/dev/asm-fra02 with disk number:1 and timestamp (33005975 -1778129920)
Checking if the diskgroup is mounted or used by CSS
Checking disk number:2
Checking disk number:3
Checking disk number:0
Checking disk number:1
Generating configuration file..
Completed phase 1
Executing phase 2
Looking for /dev/asm-fra03
Modifying the header
Looking for /dev/asm-fra04
Modifying the header
Looking for /dev/asm-fra01
Modifying the header
Looking for /dev/asm-fra02
Modifying the header
Completed phase 2
Terminating kgfd context 0x7fa4f29790a0
[oracle@rac1 ~]$
看上面的log看,似乎是锁定对应diskgroup的盘之后,修改asm盘头信息(Modifying the header),从而实现rename的目的。
从这个角度讲,如果手工的kfed修改盘头信息,kfdhdb.grpname字段,再merge进去,其实也是可以做到rename diskgroup的。而从理论上讲,diskgroup name的信息,只是包含在盘头信息中,不涉及盘头信息中disk的create timestamp和disk directory中disk的create timestamp一致性的问题了。所以只需要修改盘头就可以了。
下面,我就把已经用renamedg工具改成NEW_FRA的diskgroup,再改回FRA的名字。修改过程如下:
(注:USE kfed at your own risk!)
[oracle@rac1 ~]$ kfod disks=all
--------------------------------------------------------------------------------
Disk Size Path User Group
================================================================================
1: 6142 Mb /dev/asm-acfs01 oracle dba
2: 6142 Mb /dev/asm-acfs02 oracle dba
3: 1019 Mb /dev/asm-data01 oracle dba
4: 1019 Mb /dev/asm-data02 oracle dba
5: 1019 Mb /dev/asm-data03 oracle dba
6: 1019 Mb /dev/asm-data04 oracle dba
7: 1019 Mb /dev/asm-data05 oracle dba
8: 1019 Mb /dev/asm-fra01 oracle dba
9: 1019 Mb /dev/asm-fra02 oracle dba
10: 1019 Mb /dev/asm-fra03 oracle dba
11: 1019 Mb /dev/asm-fra04 oracle dba
12: 611 Mb /dev/asm-ocrvot1 oracle dba
13: 611 Mb /dev/asm-ocrvot2 oracle dba
14: 611 Mb /dev/asm-ocrvot3 oracle dba
--------------------------------------------------------------------------------
ORACLE_SID ORACLE_HOME
================================================================================
+ASM1 /u01/app/11.2.0.3/grid
+ASM2 /u01/app/11.2.0.3/grid
[oracle@rac1 ~]$
[oracle@rac1 amdu_2016_02_17_14_25_33]$
[oracle@rac1 amdu_2016_02_17_14_25_33]$ kfed read /dev/asm-fra01 text=fra_1.txt
[oracle@rac1 amdu_2016_02_17_14_25_33]$ kfed read /dev/asm-fra02 text=fra_2.txt
[oracle@rac1 amdu_2016_02_17_14_25_33]$ kfed read /dev/asm-fra03 text=fra_3.txt
[oracle@rac1 amdu_2016_02_17_14_25_33]$ kfed read /dev/asm-fra04 text=fra_4.txt
[oracle@rac1 amdu_2016_02_17_14_25_33]$
[oracle@rac1 amdu_2016_02_17_14_25_33]$ ## 修改前
[oracle@rac1 amdu_2016_02_17_14_25_33]$ cat fra_1.txt |grep grpname
kfdhdb.grpname: NEW_FRA ; 0x048: length=7
[oracle@rac1 amdu_2016_02_17_14_25_33]$ vi fra_1.txt
[oracle@rac1 amdu_2016_02_17_14_25_33]$
[oracle@rac1 amdu_2016_02_17_14_25_33]$ ## 修改后
[oracle@rac1 amdu_2016_02_17_14_25_33]$ cat fra_1.txt |grep grpname
kfdhdb.grpname: FRA ; 0x048: length=3
[oracle@rac1 amdu_2016_02_17_14_25_33]$
[oracle@rac1 amdu_2016_02_17_14_25_33]$
[oracle@rac1 amdu_2016_02_17_14_25_33]$ ## 修改剩余fra_2.txt,fra_3.txt,fra_4.txt三个文件
[oracle@rac1 amdu_2016_02_17_14_25_33]$
[oracle@rac1 amdu_2016_02_17_14_25_33]$ cat *.txt |grep grpname
kfdhdb.grpname: FRA ; 0x048: length=3
kfdhdb.grpname: FRA ; 0x048: length=3
kfdhdb.grpname: FRA ; 0x048: length=3
kfdhdb.grpname: FRA ; 0x048: length=3
[oracle@rac1 amdu_2016_02_17_14_25_33]$
[oracle@rac1 amdu_2016_02_17_14_25_33]$
[oracle@rac1 amdu_2016_02_17_14_25_33]$ ## 用kfed merge进去
[oracle@rac1 amdu_2016_02_17_14_25_33]$ kfed merge /dev/asm-fra01 text=fra_1.txt
[oracle@rac1 amdu_2016_02_17_14_25_33]$ kfed merge /dev/asm-fra02 text=fra_2.txt
[oracle@rac1 amdu_2016_02_17_14_25_33]$ kfed merge /dev/asm-fra03 text=fra_3.txt
[oracle@rac1 amdu_2016_02_17_14_25_33]$ kfed merge /dev/asm-fra04 text=fra_4.txt
[oracle@rac1 amdu_2016_02_17_14_25_33]$
[oracle@rac1 amdu_2016_02_17_14_25_33]$
[oracle@rac1 amdu_2016_02_17_14_25_33]$
[oracle@rac1 amdu_2016_02_17_14_25_33]$
[oracle@rac1 amdu_2016_02_17_14_25_33]$ ##检查盘头是否已经都修改正确了
[oracle@rac1 amdu_2016_02_17_14_25_33]$ kfed read /dev/asm-fra01 |grep grpname
kfdhdb.grpname: FRA ; 0x048: length=3
[oracle@rac1 amdu_2016_02_17_14_25_33]$ kfed read /dev/asm-fra02 |grep grpname
kfdhdb.grpname: FRA ; 0x048: length=3
[oracle@rac1 amdu_2016_02_17_14_25_33]$ kfed read /dev/asm-fra03 |grep grpname
kfdhdb.grpname: FRA ; 0x048: length=3
[oracle@rac1 amdu_2016_02_17_14_25_33]$ kfed read /dev/asm-fra04 |grep grpname
kfdhdb.grpname: FRA ; 0x048: length=3
[oracle@rac1 amdu_2016_02_17_14_25_33]$
[oracle@rac1 amdu_2016_02_17_14_25_33]$ sqlplus "/ as sysasm"
SQL*Plus: Release 11.2.0.4.0 Production on Wed Feb 17 14:45:17 2016
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Real Application Clusters and Automatic Storage Management options
SQL> select GROUP_NUMBER,name,STATE from v$asm_diskgroup where name like '%FRA%';
GROUP_NUMBER NAME STATE
------------ ------------------------------ -----------
3 FRA MOUNTED
SQL>
SQL>
SQL> select DISK_NUMBER,name,PATH,MOUNT_STATUS,HEADER_STATUS,MODE_STATUS,STATE from v$asm_disk where GROUP_NUMBER=3;
DISK_NUMBER NAME PATH MOUNT_S HEADER_STATU MODE_ST STATE
----------- ------------------------------ ------------------------------ ------- ------------ ------- --------
0 FRA_0000 /dev/asm-fra01 CACHED MEMBER ONLINE NORMAL
2 FRA_0002 /dev/asm-fra03 CACHED MEMBER ONLINE NORMAL
1 FRA_0001 /dev/asm-fra02 CACHED MEMBER ONLINE NORMAL
3 FRA_0003 /dev/asm-fra04 CACHED MEMBER ONLINE NORMAL
SQL>
相关文章
- 人们熟悉的寄居蟹属于以下哪种分类 神奇海洋11月21日答案 11-21
- 第五人格11.22共研服有什么更新 11月22日共研服更新内容介绍 11-21
- 原神恰斯卡怎么培养 11-21
- 无期迷途四星装束是谁 11-21
- 王者荣耀帝丹高中校服怎么获得 11-21
- 光遇姆明季后续版本怎么玩 11-21