oracle中rename asm diskgroup的例子

在11.2之后,已经可以rename asm diskgroup了,而不必再新建diskgroup之后,再做image copy。

在11.2.中的gi home中,自带了一个命令renamedg,看下面的例子:

renamedg phase=<both|one|two> dgname=<old_diskgroup_name>  newdgname=<new_diskgroup_name> [asm_diskstring='<path_name>' ] [verbose=true]
其步骤可以分成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>

时间: 2025-01-28 07:45:02

oracle中rename asm diskgroup的例子的相关文章

oracle中的asm文化

从oracle中ASM的发展来看,到今天的普及使用,应该可以算做一种文化,因为这体现的不仅是ASM技术在实际工作中的成功普及,而且从某种程度来说,都代表了一个新生事物的发展历程,无论是java的发展还是各种开源项目的普及,都有着相似的痕迹. asm从Oracle 10g版本推出,是作为grid的一部分鼓励使用的.而在这段漫长的时间里面,其实asm就在逐渐完善. 就如同你去公司内部推广一套很新技术的时候,人家肯定得衡量你的东西是不是足够好,如果性能指标能够达到指数级的提升,或者操作能够简化到极致,

oracle中ADHU(ASM Disk Header Utility)—asm disk header备份恢复工具

adhu(ASM Disk Header Utility)作为oracle asm中和kfed,amdu齐名的asm三大恢复神器之一,没有被oracle大力推广(属于内部工具),随着kfed功能增强和asm disk header自动备份功能的完善,adhu oracle基本上停止的开发支持,可以用来作为10.2.0.5之前asm版本的磁盘头保护工具 adhu预览 这里可以通过shell封装的utildhu调用adhu程序,实现更加人性化和自动化操作,它含有install,check,repai

Oracle中使用Rownum分页详细例子_oracle

在MySQL中,我们通常都使用limit来完成数据集获取的分页操作,而在Oracle数据库中,并没有类似limit一样的方便方法来实现分页,因此我们通常都是直接在SQL语句中完成分页,这里就需要借助于rownum伪列或row_number()函数了,本文将分别展示使用rownum伪列和row_number()分析函数来完成Oracle数据分页操作的具体使用方法,并分析和比较两者的性能优劣. 一.初始化测试数据 首先测试数据我选取了数据字典all_objects表中的70000条数据,创建步骤如下

Oracle中的ASM DISK HEADER 备份与恢复

最近遇到几次ASM DATA HEADER出问题导致DISK GROUP 不能正常的MOUNT,是的数据库不能正常工作,从来带来了无穷的麻烦,这个时候心想,如果我做了ASM DATA HEADER的备份该多好啊,可惜世上没有后悔药,建议大家检查下自己的ASM库,ASM HEADER是否已经做了备份,如果没有请及时处理下.这里试验提供了dd和kfed备份和恢复ASM HEADER 查询ASM相关信息 SQL> select group_number,name,state,total_mb,free

Oracle中使用索引提示的例子

今天早上在做数据库的安检时候,发现一个ORA-01555错误: 这个SQL语句明显运行了很长时间而没有完成.在观察Statspack报告中这个SQL也在top SQL中占用了大量的db cache.物理读很大. 下午做完其他的就打算优化一下这个SQL 首先查看这个SQL的执行计划 在PL/SQL Developer中的执行计划窗口中执行这个SQL然后得到执行计划:如下

Oracle数据恢复: 50TB ASM crash例子

某客户50 TB的ASM发生故障,经过合力拯救,恢复正常,在此简单记录一下!实际上最后发现比我想象中的简单的多.如下是关于该故障的详细描述情况. –db alert log信息 Mon Jul  6 15:17:43 2015 Errors in file /oraclehome/admin/xxxx/udump/xxxx_ora_262606.trc: ORA-27063: number of bytes read/written is incorrect IBM AIX RISC Syste

oracle中存储精简卷导致asm磁盘组异常

有朋友在一个存储空间给asm使用,发生空间不足,然后使用另外一个存储中的lun给asm的data磁盘组增加asm disk,运行了大概1天之后,asm磁盘组直接dismount,数据库crash.然后就无法正常mount.包括这个存储上的几个其他磁盘组也无法正常mount. 数据库异常日志 Sun Oct 23 08:43:59 2016 SUCCESS: diskgroup DATA was dismounted SUCCESS: diskgroup DATA was dismounted S

Oracle中Trigger例子1

oracle erOracle中Triggle例子1 CREATE OR REPLACE TRIGGER QMAILB.T_MSG_SI_TRIGGERAFTER INSERTON QMAILB.T_MSG_MO REFERENCING NEW AS NEW OLD AS OLDFOR EACH ROWDECLAREtmpVar NUMBER;v_link_id t_msg_mt.LINK_ID%type;v_src_termid t_msg_mt.SRC_TERMID%type;v_dst_t

Oracle中序列的使用例子

曾经在触发器中使用序列(SEQUENCE): create or replace trigger TRI_SUPPLIER before insert on SUPPLIER for each row begin select seq_supid.NEXTVAL into:new.supcode from dual; select seq_supid.CURRVAL into:new.supID from dual; end; 显然,忽略了并发,修改后如下: create or replace