一次解除安裝ASM磁碟的操作日誌

達芬奇的夢發表於2018-02-06

 

由於需要重建Stream,匯出使用的是expdp,源庫版本為10.2.0.1(目標庫11.2.0.2),10gexpdpCOMPRESSION效果不好,匯出來的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_nameARCHDG_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#

 

 

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/31444259/viewspace-2150909/,如需轉載,請註明出處,否則將追究法律責任。

相關文章