linux 卸载asm,一次卸载ASM磁盘的操作日志

由于需要重建Stream,导出使用的是expdp,源库版本为10.2.0.1(目标库11.2.0.2),10g中expdp的COMPRESSION效果不好,导出来的dmp比较大,有450G左右,而本地磁盘空间不够只有400左右,查看ASM空间还有很多空闲空间,下面操作为从Oracle ASM中分出来一个100G左右的LUN给本地文件系统使用

1操作环境

操作系统版本:AIX

6.1

数据库版本:Oracle

11.2.0.2 RAC

2查看asm磁盘的大小

SQL> select

t.name,t.GROUP_NUMBER,t.OS_MB,t.TOTAL_MB,t.FREE_MB,t.PATH from v$asm_disk t

where path like '%arch%';

NAME               GROUP_NUMBER      OS_MB

TOTAL_MB    FREE_MB PATH

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

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

ARCHDG_0000              1

102400     102400     102374 /dev/archdisk1

ARCHDG_0001              1

102400     102400     102375 /dev/archdisk2

ARCHDG_0002              1

102400     102400     102375 /dev/archdisk3

ARCHDG_0003              1

102400     102400     102375 /dev/archdisk4

ARCHDG_0004              1

102400     102400     102374 /dev/archdisk5

18 rows selected

SQL>

3查看对应的磁盘

计划把/dev/archdisk5卸载用于文件系统,查看对应的磁盘,设备号为19

bash-3.00# ls -lrt /dev/archdisk5

crw-rw----    1

grid     asmdba       23, 19 Apr 20 22:00 /dev/archdisk5

bash-3.00#

再看一下对应的磁盘,可以看到ASM使用了下面磁盘,设备号23,19对应的磁盘为/dev/rhdisk19

bash-3.00# ls -lrt /dev/rhdisk*

…….(省略部分磁盘)

crw-------    1 root     system       23, 19 Jun 06 2011  /dev/rhdisk19

crw-------    1

root     system       23, 20 Jun 06 2011  /dev/rhdisk20

crw-------    1

root     system       23, 21 Jun 06 2011  /dev/rhdisk21

crw-------    1

root     system       23, 22 Jun 06 2011  /dev/rhdisk22

crw-------    1

root     system       23, 23 Apr 22 10:19 /dev/rhdisk23

再次验证设备号,对应的磁盘为hdisk19

bash-3.00# ls -lrt |grep '23, 19'

crw-------    1

root     system       23, 19 Jun 06 2011  rhdisk19

brw-------    1

root     system       23, 19 Jun 06 2011  hdisk19

crw-rw----    1

grid     asmdba       23, 19 Apr 20 22:00 archdisk5

bash-3.00#

查看磁盘的对应情况,对应的磁盘为hdisk19

bash-3.00# lspv

……….(省略部分PV)

hdisk19

none                                None

hdisk20

00f6a21d6a03bb66

bkvg            active

hdisk21

00f6a21d6a03bbc9

bkvg            active

hdisk22

00f6a21d6a03bc2b

bkvg            active

hdisk23

00f6a21d2f863681

bkvg            active

4删除ASM磁盘

根据上面查询/dev/archdisk5对应的ASM里面的disk_name为ARCHDG_0004,这个LUN刚好100G左右,查看对应的diskgroup名称

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

where group_number=1;

NAME                     TOTAL_MB

FREE_MB

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

ARCHDG                 512000

511873

SQL>

bash-3.00# su - grid

grid@circdb1>bash

bash-3.00$ sqlplus "/as sysasm"

SQL*Plus: Release 11.2.0.2.0 Production on Mon Apr 22 11:12:32

2013

Copyright (c) 1982, 2010, Oracle.  All rights reserved.

Connected to:

Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 -

64bit Production

With the Real Application Clusters and Automatic Storage

Management options

SQL> ALTER DISKGROUP ARCHDG DROP DISK ARCHDG_0004;

Diskgroup altered.

SQL>

在操作过程中可以通过V$ASM_DISK.HEADER_STATUS查看状态,在数据平衡过程中可以查看V$ASM_OPERATION 可以查看进度

select HEADER_STATUS from V$ASM_DISK  where name='ARCHDG_0004';

select * from

V$ASM_OPERATION ;

下面为执行成功后的结果HEADER_STATUS的状态为FORMER,组和磁盘数都为0

SQL> select

t.GROUP_NUMBER,t.DISK_NUMBER,t.MOUNT_STATUS,t.HEADER_STATUS,t.PATH from

V$ASM_DISK t where path like '%archdisk5%' ;

GROUP_NUMBER DISK_NUMBER MOUNT_STATUS HEADER_STATUS PATH

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

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

0           0

CLOSED       FORMER        /dev/archdisk5

SQL>

5加入文件系统

删除hdisk19对应的索引节点,也就是/dev/archdisk5,这样可以解除asm过程对这个磁盘的锁定

bash-3.00# cd /dev/

bash-3.00# ls -lrt archdisk5

crw-rw----    1

grid     asmdba       23, 19 Apr 20 22:00 archdisk5

bash-3.00# rm archdisk5

bash-3.00# ls -lrt archdisk5

ls: 0653-341 The file archdisk5 does not exist.

bash-3.00#

把磁盘加入到文件系统中,注意这种系统级别的操作都是使用root

bash-3.00# smit extendvg

Add a Physical Volume to a Volume Group

Type or select values in entry fields.

Press Enter AFTER making all desired changes.

[Entry Fields]

Force the creation of a volume group?               no

+

* VOLUME GROUP name                                  [bkvg]                                                                      +

* PHYSICAL VOLUME names                              [hdisk19]

+

Command: running

stdout: yes           stderr: no

Before command completion, additional instructions may appear

below.

0516-1339 /usr/sbin/extendvg: Physical volume contains some

3rd party volume group.

0516-1397 /usr/sbin/extendvg: The physical volume hdisk19,

will not be added to

the volume group.

0516-792 /usr/sbin/extendvg: Unable to extend volume group.

根据上面报错,在网上看到的解决方案为使用dd清理磁盘信息

bash-3.00# dd if=/dev/zero/ f=/dev/rhdisk19  bs=1024 count=10

10+0 records in.

10+0 records out.

bash-3.00# smit extendvg

Add a Physical Volume to a Volume Group

Type or select values in entry fields.

Press Enter AFTER making all desired changes.

[Entry Fields]

Force the creation of a volume group?               no

+

* VOLUME GROUP name                                  [bkvg]

+

* PHYSICAL VOLUME names                              [hdisk19]

+

Command: running

stdout: yes           stderr: no

Before command completion, additional instructions may appear

below.

0516-1254 /usr/sbin/extendvg: Changing the PVID in the ODM.

0516-1397 /usr/sbin/extendvg: The physical volume hdisk19,

will not be added to

the volume group.

0516-792 /usr/sbin/extendvg: Unable to extend volume group.

执行上面操作后又报了另一个错,于是把数据库重启后再操作,这个时间发现成功了

COMMAND STATUS

Command: OK

stdout: yes           stderr: no

Before command completion, additional instructions may appear

below.

0516-1254 /usr/sbin/extendvg: Changing the PVID in the ODM.

下面显示磁盘空间已释放

bash-3.00# lsvg bkvg

VOLUME GROUP:

bkvg                     VG IDENTIFIER:  00f6a21d00004c00000001306a03bc53

VG STATE:

active                   PP

SIZE:        64 megabyte(s)

VG PERMISSION:

read/write               TOTAL

PPs:      7990 (511360 megabytes)

MAX LVs:

256                      FREE PPs:       69 (4416 megabytes)

LVs:

2                        USED

PPs:       7921 (506944 megabytes)

OPEN LVs:

2

QUORUM:         3 (Enabled)

TOTAL PVs:

5                        VG DESCRIPTORS:

5

STALE PVs:

0                        STALE

PPs:      0

ACTIVE PVs:

5                        AUTO

ON:        yes

MAX PPs per VG:

32768                    MAX

PVs:        1024

LTG size (Dynamic): 256 kilobyte(s)          AUTO SYNC:      no

HOT SPARE:

no                       BB

POLICY:      relocatable

PV RESTRICTION:     none

bash-3.00#

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值