ITPub博客

首页 > 数据库 > Oracle > Oracle RAC环境下重建ASM磁盘组 Re-create ASM diskgroup with Oracle RAC

Oracle RAC环境下重建ASM磁盘组 Re-create ASM diskgroup with Oracle RAC

原创 Oracle 作者:xunzhaoxz 时间:2010-03-31 15:18:15 0 删除 编辑

Oracle RAC环境下重建ASM磁盘组

Re-create ASM diskgroup with Oracle RAC

本文PDF下载 http://xunzhaoxz.itpub.net/resource/40016/31455

作者:xunzhao【转载时请以超链接形式标明文章出处和作者信息】

链接:http://xunzhaoxz.itpub.net/post/40016/498778

1) 问题发现

SQL> select name,total_mb,free_mb,usable_file_mb ,round((free_mb/total_mb)*100) "% free" from v$asm_diskgroup;

ERROR:

ORA-01476: divisor is equal to zero

no rows selected

SQL>

我要啦免费统计[@more@]

2) 寻根究底,寻找故障源头

SQL> select name,total_mb,free_mb from v$asm_diskgroup;

NAME TOTAL_MB FREE_MB

-------------------- ---------- ----------

DGCHUZU 307200 298962

DGGIS 307200 307103

DGWEIXIU 0 0

DGYUNGUAN 409600 398799

SQL>

3) 3)初步探究 检查磁盘属主、权限信息

crw-rw---- 1 oracle dba 13 0x000010 Mar 28 19:58 /dev/rdisk/disk30

crw-rw---- 1 oracle dba 13 0x000011 Feb 26 22:03 /dev/rdisk/disk31

crw-rw---- 1 oracle dba 13 0x000012 Mar 30 15:43 /dev/rdisk/disk32

crw-rw---- 1 oracle dba 13 0x000013 Mar 30 15:43 /dev/rdisk/disk33

crw-rw---- 1 oracle dba 13 0x000014 Mar 31 11:18 /dev/rdisk/disk34

crw-rw---- 1 oracle dba 13 0x000015 Mar 31 11:18 /dev/rdisk/disk35

crw-rw---- 1 oracle dba 13 0x000016 Mar 30 15:41 /dev/rdisk/disk36

crw-rw---- 1 oracle dba 13 0x000017 Mar 5 12:31 /dev/rdisk/disk37

4) 4)关闭Oracle RAC数据库,重启服务器后问题依旧

5) 查看ASMalter log存在以下信息:

ERROR: diskgroup DGWEIXIU was not mounted

6) 尝试手工mount,获取详细的错误日志信息

SQL> alter diskgroup DGWEIXIU mount;

alter diskgroup DGWEIXIU mount

*

ERROR at line 1:

ORA-15032: not all alterations performed

ORA-15040: diskgroup is incomplete

ORA-15042: ASM disk "1" is missing

SQL>

7) 7)mount不成,尝试dismount

SQL> alter diskgroup DGWEIXIU dismount;

alter diskgroup DGWEIXIU dismount

*

ERROR at line 1:

ORA-15032: not all alterations performed

ORA-15001: diskgroup "DGWEIXIU" does not exist or is not mounted

SQL>

8) dismount也不成,根据错误信息尝试drop disk

SQL> alter diskgroup DGWEIXIU drop disk DGWEIXIU_0000;

alter diskgroup DGWEIXIU drop disk DGWEIXIU_0000

*

ERROR at line 1:

ORA-15032: not all alterations performed

ORA-15001: diskgroup "DGWEIXIU" does not exist or is not mounted

9) drop disk也不成,尝试drop diskgroup

SQL> drop diskgroup DGWEIXIU;

drop diskgroup DGWEIXIU

*

ERROR at line 1:

ORA-15039: diskgroup not dropped

ORA-15001: diskgroup "DGWEIXIU" does not exist or is not mounted

SQL>

10) Drop diskgroup失败,登高远眺

http://www.itpub.net/thread-1050508-2-1.html

第10楼 作者:sjgggl

Drop Diskgroup Force
当一个磁盘不再可用时(损坏到无法修复的程度)会发生什么?您希望完全删除该磁盘组然后重新创建,或者将该磁盘组的磁盘添加到其他磁盘组。该磁盘组尚未挂载。由于其中一个磁盘缺少,您甚至无法挂载它。要删除该磁盘组,您必须挂载它,但由于缺少磁盘,您无法进行挂载 — 绝对是一个“无法摆脱的困境”。您应该做些什么?

在 Oracle 数据库 10g 中,您可以使用一种变通方法 — 使用 dd 命令擦除磁盘表头:
$ dd if=/dev/zero of=/dev/raw/raw13 bs=1024 count=4

这将在磁盘 /dev/raw/raw13 的表头中放入零,擦除所有信息。如果该方法生效,它将完全擦除磁盘表头的信息,并删除用作磁盘组一部分的磁盘。
在 Oracle 数据库 11g 中,您不必求助于该变通方法。您只需执行带 force 选项的 drop 命令:

SQL> drop diskgroup dg7 force including contents;

使用该命令,即使没有挂载磁盘,也可以删除磁盘组。可用的磁盘显示为 FORMER;即,它们用作某个磁盘组的一部分。(注:您必须使用“including contents”子句。)

第12楼 作者:jieyancai

Subject: Steps to Re-Create ASM Diskgroups
Doc ID: Note:268481.1 Type: BULLETIN

11) 查看DGWEIXIU下的物理磁盘信息

由以上信息得知,磁盘组DGWEIXIU建立在/dev/rdisk/disk36/dev/rdisk/disk37两个物理磁盘上。

12) 正常关闭数据库、ASM

oracle@node01$Srvctl stop database –d testdb

oracle@node01$srvctl stop asm –n node01

oracle@node01$srvctl stop asm –n node02

13) 使用dd清除disk上的ASM Diskgroup metadata信息

root@node01:/#ll /dev/zero

crw-rw-rw- 1 bin sys 3 0x000004 Feb 26 20:55 /dev/zero

root@node01:/#dd if=/dev/zero of=/dev/rdisk/disk36 bs=8192 count=12800

12800+0 records in

12800+0 records out

root@node01:/#

root@node01:/#dd if=/dev/zero of=/dev/rdisk/disk37 bs=8192 count=12800

12800+0 records in

12800+0 records out

root@node01:/#

14) 启动数据库,进入ASM查看当前的Diskgroup信息

oracle@node01:/$ export ORACLE_SID=+ASM2

oracle@node01:/$ sqlplus / as sysdba;

15) 启动DBCA,重新创建ASM磁盘组 Re-Create ASM Diskgroup

oracle@node01:/$dbca

查看创建结果:

16) 最后,引用原文如下:

Steps to Re-Create ASM Diskgroups [ID 268481.1]

修改时间 17-MAR-2011 类型 BULLETIN 状态 PUBLISHED

In this Document
Purpose
Scope and Application
Steps to Re-Create ASM Diskgroups
Step 1: Ensure that you have a prior RMAN backup of all databases using ASM
Step 2: Shutdown your ASM instance(s)
Step 3: Re-create your ASM disk group(s)
Step 4: Restore database
References


Applies to:

Oracle Server - Enterprise Edition - Version: 10.1.0.2 to 11.2.0.2 - Release: 10.1 to 11.2
Information in this document applies to any platform.

Purpose

To provide a method of re-creating ASM diskgroups.

Scope and Application

This document is intended for DBAs and Support Engineers who need to re-create ASM diskgroups.

Steps to Re-Create ASM Diskgroups

In the event you cannot mount your ASM disk groups, you will be unable to start any databases using those disk groups. Here is a possible error reported when mounting ASM disk groups:

SQL> startup mount

ORA-15032: not all alterations performed
ORA-15063: diskgroup "" lacks quorum of 2 PST disks; 0 found

This error may occur if:

a) ASM disk(s) is not visible on the operating system.
b) asm_diskstring parameter is not set correctly on ASM instance(s)
c) ASM metadata in disk is overwritten or corrupted

If you have seen this error or another error indicating ASM metadata corruption and have verified that the disk(s) is visable with correct permissions on the operating system and that the asm_diskstring parameter is set correctly, your ASM metadata may be corrupted. If this is the case, you may need to re-create your ASM instance(s) and disk group(s). The steps are:

1. Ensure that you have a prior RMAN backup of all databases using ASM
2. Shut down your ASM instance(s)
3. Re-create your ASM disk group(s)
4. Restore databases

Step 1: Ensure that you have a prior RMAN backup of all databases using ASM

The only way you can recover from ASM metadata corruption is to have a prior RMAN backup of the database in an area that would not be affected by an ASM instance outage. As part of your recovery strategy, you should consider integrating tape or other tertiary storage to safeguard your backups.

Example of RMAN backup:

1. Connect RMAN to the target database for backup

rman nocatalog target /

2. Now Backup your Database, Archive logs and Control files. Example:

RMAN> backup device type disk format '/u03/backup/%U' database plus archivelog;
RMAN> backup device type disk format '/u03/backup/ctrlf_%U' current controlfile;

3. Manually make copies of your spfiles. Example:

CREATE PFILE='/u03/app/oracle/product/10.1.0/dbs/init.ora'
FROM SPFILE='/+DATA/V10FJ/spfile.ora';

If you do not have a good backup of all databases (datafiles, controlfiles,
redo logs, archive logs), DO NOT CONTINUE BEYOND STEP 1!

Step 2: Shutdown your ASM instance(s)

Stop your database instances and ASM instances with sqlplus or srvctl (RAC)

SQLPLUS Example:

setenv ORACLE_SID +ASM
sqlplus '/ as sysdba'
SQL> shutdown immediate

setenv ORACLE_SID DBSCOTT
sqlplus '/ as sysdba'
SQL> shutdown immediate

SRVCTL (RAC) Example:

srvctl stop asm -n
srvctl stop asm -n
srvctl stop database -d

Step 3: Re-create your ASM disk group(s)

Set your ORACLE_SID to your ASM instance and create a new diskgroup. Example:

setenv ORACLE_SID +ASM
sqlplus '/ as sysdba'
SQL> startup nomount
SQL> create diskgroup data disk '/dev/rdsk/c1t4d0s4' force;
SQL> shutdown immediate
SQL> startup mount

Step 4: Restore database

1. Start instance using the local copy of your pfile from step 1.

setenv ORACLE_SID DBSCOTT
sqlplus '/ as sysdba'
SQL> startup nomount pfile=init.ora

2. Use RMAN to restore the controlfiles and database. Example:

rman target /
RMAN> restore controlfile from '/u03/backup/ctrlf_'; -- where is the unique string generated by %U.
RMAN> alter database mount;
RMAN> restore database;
RMAN> recover database;
RMAN> alter database open resetlogs;

3. Connect to the ASM instance and get the controlfile name. Example:

setenv ORACLE_SID +ASM
sqlplus '/ as sysdba'
SQL> select name, alias_directory from v$asm_alias;

Look for the controlfile name under the CONTROLFILE directory eg: Current.256.1

4. Edit the init.ora and change the control_files parameter to point to
the one identified from the ASM v$asm_alias view.

5. Re-create the spfile. Example:

SQL> create spfile='+DATA/V10FJ/spfileV10FJ.ora'
from pfile='/u03/app/oracle/product/10.1.0/dbs/pfile.out';

6. Shutdown and restart the instance to use the newly created spfile.

7. Repeat the "STEP 5" section for additional databases.

References

___________________________________________________________________

延伸阅读(近期整理文档)

主机AIX

【信息采集】IBM AIX系统硬件信息查看命令(shell脚本)(附PDF完整版下载)

操作规范(一)—— AIX rootvg mirror(附PDF下载)

AIX系统安全加固(一)限制密码重试次数,超过限制次数后锁定用户(附截图PDF完整版下载)

AIX平台下创建文件系统需要注意的问题

IBM服务器虚拟化PowerVM——也谈“云计算”

数据库Oracle

新装Oracle11gR2 11.2.0.2重要说明——Patchsetp10098816(附补丁下载地址)

Attention:new installation of Oracle 11.2.0.2

AIX 5.3/6.1环境下安装Oracle10gR2 RAC常见报错(注意事项)

【数据迁移1】Oracle10gR2 rman异机恢复实验(FS->RAW)(附截图PDF完整版下载)

【数据迁移2】Oracle10gR2 rman异机恢复实验(FS-FS)(附截图PDF完整版下载)

操作规范(二)——RHEL5.4安装Oracle 10.2.0.4(附截图PDF完整版下载)

操作规范(三)——Linux5.4安装Oracle 11gR1(附截图PDF完整版下载)

操作规范(四)——Linux5.4安装Oracle 11gR2(附截图PDF完整版下载)

Oracle RAC环境下重建ASM磁盘组(Re-createASM diskgroup)(附截图PDF完整版下载)

Oracle RAC srv服务“首选”与“可用”状态的调整——srvctl modify service 的使用(附截图PDF完整版下载)

Linux+ASM+OCFS环境下增加ORACLE RAC联机重做日志文件(附截图PDF完整版下载)

备份还原Symantec Netbackup:

搭建NBU实验环境——解决虚拟带库vistor License过期问题(附截图PDF完整版下载)

NBU常用命令1——介质管理

----------------------------------------------------------------------------------------------------------------------

亲,留个脚印,发表下您的宝贵意见,或者点击左边“订阅我的Blog”吧.......

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/22085031/viewspace-1032502/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2010-11-09

  • 博文量
    27
  • 访问量
    698553