维护磁盘组Maintaining Disk Groups

Mounting and Dismounting Disk Groups

下面的SQL语句将卸载当前挂载到Oracle ASM实例的所有磁盘组:

ALTER DISKGROUP ALL DISMOUNT;

The following SQL statement mounts disk group data1:

ALTER DISKGROUP data1 MOUNT;

Mounting Disk Groups Using the FORCE Option

ASM提供了一个带有ALTER DISKGROUP的挂载强制选项,允许以正常或高冗余模式挂载ASM磁盘组,即使在挂载时磁盘组可能无法使用某些ASM磁盘。

没有FORCE选项的默认行为是无法挂载已损坏或丢失磁盘的磁盘组。

挂载强制选项在磁盘暂时不可用的情况下非常有用,您希望在纠正导致停机的情况时挂载冗余更少的磁盘组。

 

要使用mount FORCE选项成功挂载,ASM必须能够为磁盘组中的所有文件找到至少一个区段的副本。在这种情况下,ASM可以成功地挂载磁盘组,但是可能会减少冗余。

 

ASM不能访问的磁盘处于脱机模式。然后ASM开始计时这些磁盘处于脱机模式的时间。如果磁盘脱机时间超过DISK_REPAIR_TIME磁盘组属性设置的计时器阈值,则这些磁盘将从磁盘组永久删除。通过使用ALTER DISKGROUP离线语句,可以在磁盘处于离线状态后更改离线计时器。

 

注意:根据指定的兼容性,ASM实例以不同的方式挂载不完整的磁盘组。

在集群化的ASM环境中,如果ASM实例不是挂载磁盘组的第一个实例,则使用mount FORCE语句失败。这是因为磁盘已被另一个实例访问,而磁盘不能在本地访问。

 

如果所有磁盘都可用,那么使用FORCE选项将导致挂载命令失败。这可以避免不必要和不恰当地使用该特性。

ALTER DISKGROUP data1 MOUNT FORCE;

Checking the Internal Consistency of Disk Group Metadata

检查磁盘组元数据的内部一致性

可以使用ALTER DISKGROUP语句和check关键字检查磁盘组元数据的内部一致性。可以使用此语句检查磁盘组中的特定文件、特定磁盘或磁盘组中的所有磁盘或磁盘组中的特定故障组。必须挂载磁盘组来执行这些检查。

 

默认情况下,CHECK DISK GROUP子句验证所有元数据目录。ASM显示摘要错误并将有关错误的详细信息写入警报日志。CHECK关键字执行以下操作:

 

验证磁盘的一致性

交叉检查所有的文件范围映射和分配表,以确保一致性

检查别名元数据目录和文件目录是否正确链接

验证别名目录树是否正确链接

检查ASM元数据目录中没有不可到达的已分配块

 

REPAIR | NOREPAIR子句指定ASM是否应该尝试修复在检查过程中发现的错误。默认是不可修复。使用NOREPAIR子句接收关于不一致性的警告,并阻止ASM自动解决错误。下面的示例语句检查data1磁盘组中所有磁盘的元数据的一致性:

ALTER DISKGROUP data1 CHECK ALL;

Dropping Disk Groups

如果还想删除磁盘组中包含的所有文件,可以指定include CONTENTS子句。默认值EXCLUDING CONTENTS,这提供了语法一致性,并防止您删除磁盘组(如果它有任何内容)

 

为了使DROP DISKGROUP语句成功,必须启动Oracle ASM实例,并且在不打开任何磁盘组文件的情况下挂载磁盘组。在删除磁盘组之前,语句不会返回。

 

删除磁盘组时,如果使用的是服务器参数文件,ASM会卸载磁盘组并从ASM_DISKGROUPS初始化参数中删除磁盘组名。如果正在使用一个文本初始化参数文件,磁盘组中提到ASM_DISKGROUPS初始化参数,然后你必须从ASM_DISKGROUPS删除磁盘组名称初始化参数之前,下次,你关闭并重新启动Oracle ASM实例。

The following statement deletes data1:

DROP DISKGROUP data1;

在确保data1中包含的所有文件都不是打开的之后,ASM重写磁盘组中每个磁盘的标头,以删除ASM格式化信息。该语句没有指定包含内容,因此如果磁盘组包含任何文件,删除操作将失败。

 

如果在磁盘组中包含的卷上安装了Oracle自动存储管理集群文件系统(Oracle ACFS)文件系统,则必须卸载该文件系统。如果文件系统已注册,则必须取消注册。必须使INCLUDING CONTENTS子句删除这个磁盘组。文件系统中的所有数据都被销毁。要查看与磁盘组关联的卷和挂载路径,可以查询V$ASM_VOLUME视图。

 

如果您不能挂载磁盘组,但必须删除它,您可以使用drop DISKGROUP语句的FORCE选项。该命令使您可以删除磁盘上属于磁盘组的标头,该磁盘组不能被任何Oracle ASM实例挂载,如下例所示:

SQL> DROP DISKGROUP data1 FORCE;

Renaming Disks Groups

使用renamedg工具可以更改克隆磁盘组的名称。在磁盘组上运行重挂之前,必须在集群中的所有节点上卸载磁盘组。

 

renamedg 重命名一个磁盘组使用两个步骤的过程:

第一阶段

此阶段生成将在第二阶段中使用的配置文件。

第二阶段

此阶段使用配置文件执行磁盘组的重命名。

 The syntax is:

renamedg {-help | help=true}

renamedg
     [phase={one|two |both}] dgname=diskgroup 
       newdgname=newdiskgroup [config=configfile]
     [asm_diskstring=discoverystring, discoverystring ...] 
     [clean={true|false}] [check={true|false}]
     [confirm={true|false}] [verbose={ true|false}]
     [keep_voting_files={true|false}]
  • phase={one|two|both}

    Specifies the phase to be run. Allowed values are onetwo, or both. This argument is optional. The default is both.

    Typically you would run both phases. If a problem occurs during the second phase, then you can rerun phase two using the generated configuration file.

  • dgname=diskgroup

    Specifies the name of the disk group to be renamed.

  • newdgname=newdiskgroup

    Specifies the new name for the disk group.

  • config=configfile

    Specifies the path to the configuration file to be generated during phase one or specifies the path to the configuration file to be used during phase two.

    This argument is optional. The default configuration file is named renamedg_config and is located in the directory in which the command is run. The single quotations may be required on some platforms.

  • asm_diskstring=discoverystring, discoverystring ...

    Specifies the Oracle ASM discovery strings. The asm_diskstring value must be specified if the Oracle ASM disks are not in the default location for the platform. The single quotations may be required on some platforms, usually when wildcard characters are specified.

  • clean={true|false}

    Specifies whether to clean errors that are otherwise ignored. The default is true.

  • check={true|false}

    Specifies a boolean value that is used in the second phase. If true, then the tool prints the list of changes that are to be made to the disks. No writes are issued. It is an optional parameter that defaults to false.

  • confirm={true|false}

    Specifies a boolean value that is used in the second phase. If false, then the tool prints the changes that are to be made and seeks confirmation before actually making the changes. It is an optional value that defaults to false. If check is set to true, then the value of this parameter is redundant.

  • verbose={true|false}

    Specifies verbose execution when verbose=true. The default is false.

  • keep_voting_files={true|false}

    Specifies whether voting files are kept in the renamed disk group. The default is false which deletes the voting files from the renamed disk group.

Note:

renamedg does not update resources, nor does renamedg update any file references within the database. Because of this behavior, the original disk group resource is not automatically deleted after the completion of phase two. The status of the old disk group resource can be checked with the Oracle Clusterware Control (CRSCTL) crsctl stat res -t command and then manually deleted with the Server Control Utility (SRVCTL) srvctl remove diskgroup command.

注意:renamedg不更新资源,也不更新数据库中的任何文件引用。由于这种行为,原始磁盘组资源在第二阶段完成后不会自动删除。可以使用Oracle Clusterware Control (CRSCTL) CRSCTL stat res -t命令检查旧磁盘组资源的状态,然后使用服务器控制实用工具(SRVCTL) SRVCTL remove diskgroup命令手动删除。

例4-12展示了几个使用renamedg的示例。第一个示例使用磁盘字符串将fra1磁盘组重命名为fra2,并启用了verbose选项。第二个示例仅在完成renamedg操作的第一阶段时创建配置文件。第三个示例使用从renamedg的第一阶段执行生成的配置文件运行renamedg操作的第二阶段。

 

在重命名磁盘组之后,可以重命名磁盘组中的磁盘以匹配新的磁盘组名。例如:

SQL> ALTER DISKGROUP fra2 RENAME DISKS ALL;

Using renamedg

$ renamedg dgname=fra1 newdgname=fra2 asm_diskstring='/devices/disk*'
      verbose=true

$ renamedg phase=one dgname=fra1 newdgname=fra2
      asm_diskstring='/devices/disk*' config=/tmp/fra2.conf verbose=true

$ renamedg phase=two dgname=fra1 newdgname=fra2 config=/tmp/fra2.conf
      verbose=true
原文地址:https://www.cnblogs.com/zykLove/p/12192465.html