2017-05-24 DBA日记,删除asm diskgroup过程

这篇DBA日记详细介绍了如何删除ASM(Automatic Storage Management)磁盘组的过程,包括为磁盘组分配唯一名称、设定冗余级别、定义故障组以及格式化为ASM磁盘。还提及在创建时磁盘将被格式化,并可选择设置软件兼容性和分配单元大小等磁盘组属性。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

背景:
新接手一台linux+oracle+asm的数据库db1,现在要对该db的asmdisk进行存储回收,为确保正确删除asmdisk及对应磁盘设备,需把asmdisk的与磁备设备映射出来,并进一步梳理好处理步骤。
处理步骤:
1) 确认回收的asm diskgroup,命令如下:
select * from v$asm_diskgroup;
col path format a100
col name format a30
select name,path,total_mb from v$asm_disk;

2) 确认要删除datadg ,并将空间回收给存储同一使用,根据1)的结果,返查DATADG_DISK01,DATADG_DISK02对的设备。
记得使用root用户执行
oracleasm querydisk -d DATADG_DISK01
oracleasm querydisk -d DATADG_DISK02
返回的结果如下:
Disk "DATADG_DISK01" is a valid ASM disk on device /dev/sdd1[8,49]
Disk "DATADG_DISK02" is a valid ASM disk on device /dev/sdf[8,80]
3)删除磁盘组
使用asm安装用户登录,并输出环境变量。
sqlplus / as sysasm
drop diskgroup datadg including contents; <<<删除磁盘组及其存储所有数据文件

4)删除磁盘
oracleasm deletedisk DATADG_DISK01
oracleasm deletedisk DATADG_DISK02
5) 完成,通知系统管理员回收DATADG_DISK01和DATADG_DISK02对的应的磁盘。

补充一点:
1. 除了用oracleasm querydisk -d asmdisk反查对应的物理设备外,我们还可以用kfed read /dev/sdd1 确认它的磁盘头信息是就是我们要删除的,当然这个是在oracle deletedisk前执行,双重保障,减少风险。
kfdhdb.dskname: DATADG_0001 ; 0x028: length=11
kfdhdb.grpname: DATADG ; 0x048: length=6
kfdhdb.fgname: DATADG_0001 ; 0x068: length=11
2. 关于asmdisk的重用,只要将asmdisk将一个diskgroup drop掉后,就可以立即重用。
alter diskgroup datadg drop disk datadg_disk01;
alter diskgroup fradg add disk datadg_disk01;
asm在增加asmdisk时会自动格式化,但在官方文档中只找create diskgroup时format disk的说明,没有明确增加disk时也会format,但是我在实测时,在add disk时,磁盘的容量的确format过了。
声明:可能每个版本及平台不一样,表现也不一样,在进行之前先在测试环境完成测试,以及确保数据库完成备分。
3.oracle官方文档记录
Creating Disk Groups
The  CREATE DISKGROUP  SQL statement is used to create disk groups. When creating a disk group, you need to:
  • Assign a unique name to the disk group.
  • Specify the redundancy level of the disk group.
If you want ASM to mirror files, you specify the redundancy level as  NORMAL REDUNDANCY  (2-way mirroring by default for most file types) or  HIGH REDUNDANCY  (3-way mirroring for all files). You specify  EXTERNAL REDUNDANCY  if you do not want mirroring by ASM. For example, you might choose  EXTERNAL REDUNDANCY  if you want to use storage array protection features.
For more information about redundancy levels, refer to  "ASM Mirroring and Failure Groups" .
  • Specify the disks as belonging to specific failure groups.
For information about failure groups, refer to  "Understanding ASM Concepts"  and  "ASM Mirroring and Failure Groups" .
  • Specify the disks that are to be formatted as ASM disks belonging to the disk group.<<<<<<<在创建磁盘组时,被指定的disk是会被格式化的。
The disks can be specified using operating system dependent wildcard characters in search strings that ASM then uses to find the disks. You can specify names for the disks with the  NAME clause or use the system-generated names.
  • Optionally specify disk group attributes, such software compatibility or allocation unit size.







评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值