How To Drop and Recreate ASM Diskgroup

This article describe how we can drop and recreate ASM diskgroup when its not possible to perform this through SQL command.

When a member disk in external redundancy diskgroup is no longer present (or destroyed beyond repair) and you want to drop the diskgroup completely and recreate it or add the disks of the diskgroup to other diskgroups. The diskgroup can not be mounted, because one of the disks is missing, hence the "drop diskgroup" command will not work.

In 10g you can use a workaround by erasing the header of the disk using the dd command.

In 11g, the diskgroup can be dropped when its dismounted with FORCE option:

Oracle Database Storage Administrator's Guide - 11g Release 1 (11.1)
Administering ASM Disk Groups
Dropping Disk Groups
http://download.oracle.com/docs/cd/B28359_01/server.111/b31107/asmdiskgrps.htm#i1020539


Erasing the header using "dd" command is very dangerous operation and need to be done under support supervision and when it confirmed by support that fixing the header is impossible.

In all cases and before the erasing operation you should gather the following information:

1. alert.log file from all ASM instances going back to last successful mount for diskgroup.
2. OS logs.
3. Backup disk header for all member disks in diskgroup:

ddif=/dev/raw/raw13of=/tmp/raw13.txt bs=1048576 count=100

Solution

1. Erase ASM metadata information for disk using OS command:

!!! YOU HAVE TO BE CAREFUL WHEN TYPING DISK NAME !!!

For Unix platforms using 'dd' Unix command.
==================================

Example:

ddif=/dev/zeroof=/dev/raw/raw13bs=1048576 count=50

Theddutilitycopiesthespecifiedinputfiletothespecifiedoutput.

Description for used options:

'if=file'
Readfromfile/device.
'of=file'
Writetofile/device.
'bs=bytes'
Setbothinputandoutputblocksizestobytes.
'count=blocks'
Copyblocks'ibs'-byteblocksfromtheinputfile


This puts zeroes to the first 50 MB of disk /dev/raw/raw13, erasing all information.

For MS Windows platforms using 'asmtool' (command line) or 'asmtoolg' (GUI)
============================================================

Example:

C:\>asmtool-delete\\.\ORCLDISKASM7


2. Connect to ASM instance to check the current disk status:

SQL>selectheader_status,pathfromv$asm_disk;


You should see the header_status for the cleared disks as " CANDIDATE " which means that disk's metadata erased and it can be used again.

selectGROUP_NUMBER,NAME,HEADER_STATUS,TOTAL_MB,FREE_MBfromV$ASM_DISK;

GROUP_NUMBERNAMEHEADER_STATUTOTAL_MBFREE_MB
--------------------------------------------------------------------------
0CANDIDATE 100000
1DATA_0000MEMBER 10000 9933
1DATA_0003MEMBER 10000 9933


If you dropped all diskgroup member disks, you should not see the diskgroup any more because all its member disks were cleared.

SQL>selectname,STATEfromv$asm_diskgroup;


3. Now, you can use the erased disk(s) to create a new disk group or add the disk to existing diskgroup.

From Oracle

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

Blog http://blog.youkuaiyun.com/tianlesoftware

Email: dvd.dba@gmail.com

DBA1 群:62697716(); DBA2 群:62697977() DBA3 群:62697850()

DBA 超级群:63306533(); DBA4 群: 83829929 DBA5群: 142216823

聊天 群:40132017 聊天2群:69087192

--加群需要在备注说明Oracle表空间和数据文件的关系,否则拒绝申请

### 如何重新创建 IT 资源或项目 要重新创建 IT 资源或项目,需遵循一系列专业的流程来确保新资源或项目的成功构建。以下是关于此过程的关键要素: #### 1. **需求分析** 在重新创建 IT 资源或项目之前,必须进行全面的需求分析。这一步骤旨在识别现有系统的不足之处以及改进的机会。通过评估当前的技术架构、业务目标和用户反馈,可以制定清晰的目标和范围定义[^1]。 #### 2. **规划阶段** 在此阶段,应设计详细的计划文档,其中包括时间表、预算分配和技术规格说明。有效的规划能够帮助团队预测潜在风险并提前准备解决方案。此外,还需要考虑资源调配问题,比如人员安排和技术工具的选择[^4]。 #### 3. **资源配置与团队建设** 为了实现成功的重建工作,需要一支高效协作的团队支持整个生命周期活动。根据具体任务性质挑选合适的人才加入其中至关重要;同时也要注重培养良好的沟通机制促进内部交流共享经验教训提升整体效率水平[^2]。 #### 4. **执行与监控** 一旦准备工作完成,则进入实际操作环节——即按照既定方案逐步推进各项子任务直至最终交付成果为止 。在整个过程中持续跟踪进度情况并与预期目标对比找出偏差及时调整策略以保证按时按质达成预定目的。 #### 5. **测试与部署** 当主要功能模块开发完毕后 ,对其进行严格的质量检验必不可少 —— 这不仅有助于发现隐藏错误还能验证其是否满足最初设定的要求标准 。只有经过充分验证后的版本才可以正式上线投入使用 . #### 示例代码片段 下面是一个简单的 Python 函数用于模拟某个特定条件下重启服务的操作: ```python def restart_service(service_name): import subprocess try: result = subprocess.run(['sudo', 'systemctl', 'restart', service_name], check=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) return f"Service {service_name} restarted successfully." except Exception as e: return f"Failed to restart service {service_name}: {e}" ``` 上述脚本展示了如何利用 `subprocess` 库调用系统命令行接口从而达到控制后台进程的效果,在某些情况下可能适用于自动化维护作业当中的一部分逻辑处理部分。 ---
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值