ASM磁碟組刪除DISK操作

zhangsharp20發表於2017-01-17

ASM接觸了很長時間,從磁碟組中刪除磁碟的操作還是第一次。

 

 

沒想到這麼簡單的操作,由於不熟悉還碰到了兩個小問題。

[oracle@dbserver1 ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.2.0 Production on Tue Aug 9 10:08:06 2011

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 Partitioning, Automatic Storage Management, OLAP, Data Mining
and Real Application Testing options

SQL> set pages 100 lines 120
SQL> select group_number, name, state, type, total_mb, free_mb
  2  from v$asm_diskgroup;

GROUP_NUMBER NAME                           STATE       TYPE     TOTAL_MB    FREE_MB
------------ ------------------------------ ----------- ------ ---------- ----------
           1 DATA_AU1M                      CONNECTED   EXTERN    1953124       7430
           2 DATA_AU2M                      CONNECTED   EXTERN    1953124       7384
           3 DATA_AU4M                      CONNECTED   EXTERN    1953124       7304
           4 DATA                           CONNECTED   EXTERN    3906248    3898966

SQL> col path format a30
SQL> col name format a30
SQL> select disk_number, path, name, total_mb, free_mb
  2  from v$asm_disk
  3  where group_number = 4;

DISK_NUMBER PATH                      NAME                        TOTAL_MB    FREE_MB
----------- ------------------------- ------------------------- ---------- ----------
          1 /dev/asm-disk5            DATA_0001                    1953124    1949486
          0 /dev/asm-disk4            DATA_0000                    1953124    1949480

SQL> alter diskgroup data drop disk '/dev/asm-disk5';
alter diskgroup data drop disk '/dev/asm-disk5'
*
ERROR at line 1:
ORA-15000: command disallowed by current instance type

SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
With the Partitioning, Automatic Storage Management, OLAP, Data Mining
and Real Application Testing options

由於當前連線的是資料庫,顯然不能對ASM例項中的磁碟組進行操作,下面連線ASM例項:

[oracle@dbserver1 ~]$ su - grid
Password:
[grid@dbserver1 ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.2.0 Production on Tue Aug 9 10:12:39 2011

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 Automatic Storage Management option

SQL> set pages 100 lines 120
SQL> select instance_number, instance_name from v$instance;

INSTANCE_NUMBER INSTANCE_NAME
--------------- ----------------
              1 +ASM

SQL> alter diskgroup data drop disk '/dev/asm-disk5';
alter diskgroup data drop disk '/dev/asm-disk5'
*
ERROR at line 1:
ORA-15032: not all alterations performed
ORA-15260: permission denied on ASM disk group


SQL> alter diskgroup data drop disk data_0001;
alter diskgroup data drop disk data_0001
*
ERROR at line 1:
ORA-15032: not all alterations performed
ORA-15260: permission denied on ASM disk group

開始看到這個錯誤還確實疑惑了一下,怎麼可能沒有許可權。有在作業系統上檢查了磁碟的許可權,也沒有任何問題。

檢查Oracle文件的錯誤資訊後發現,由於習慣了適用sysdba來處理,忽略了當前是11gASM,應該用sysasm來登入:

SQL> conn / as sysasm
Connected.
SQL> alter diskgroup data drop disk data_0001;

Diskgroup altered.

SQL> select disk_number, state, name, total_mb, free_mb from v$asm_disk where group_number = 4;

DISK_NUMBER STATE    NAME                             TOTAL_MB    FREE_MB
----------- -------- ------------------------------ ---------- ----------
          1 DROPPING DATA_0001                         1953124    1950842
          0 NORMAL   DATA_0000                         1953124    1948124

SQL> select disk_number, state, name, total_mb, free_mb from v$asm_disk where group_number = 4;

DISK_NUMBER STATE    NAME                             TOTAL_MB    FREE_MB
----------- -------- ------------------------------ ---------- ----------
          1 DROPPING DATA_0001                         1953124    1951434
          0 NORMAL   DATA_0000                         1953124    1947532

SQL> select disk_number, state, name, total_mb, free_mb from v$asm_disk where group_number = 4;

DISK_NUMBER STATE    NAME                             TOTAL_MB    FREE_MB
----------- -------- ------------------------------ ---------- ----------
          1 DROPPING DATA_0001                         1953124    1952556
          0 NORMAL   DATA_0000                         1953124    1946410

SQL> select disk_number, state, name, total_mb, free_mb from v$asm_disk where group_number = 4;

DISK_NUMBER STATE    NAME                             TOTAL_MB    FREE_MB
----------- -------- ------------------------------ ---------- ----------
          1 DROPPING DATA_0001                         1953124    1953096
          0 NORMAL   DATA_0000                         1953124    1945870

SQL> select disk_number, state, name, total_mb, free_mb from v$asm_disk where group_number = 4;

DISK_NUMBER STATE    NAME                             TOTAL_MB    FREE_MB
----------- -------- ------------------------------ ---------- ----------
          0 NORMAL   DATA_0000                         1953124    1945854

SQL> select group_number, disk_number, path, name, state, total_mb, free_mb     
  2  from v$asm_disk
  3  where path = '/dev/asm-disk5';

GROUP_NUMBER DISK_NUMBER PATH            NAME       STATE      TOTAL_MB    FREE_MB
------------ ----------- --------------- ---------- -------- ---------- ----------
           0           1 /dev/asm-disk5             NORMAL            0          0

可以看到,雖然刪除操作執行完成,但是磁碟並沒有真正被刪掉,ASM在後臺嘗試將磁碟上的資料挪到其他可用磁碟中,這時磁碟的狀態為DROPPING

當後臺資料同步的操作完成,磁碟的組資訊被清除,磁碟恢復STATE狀態。這時這個磁碟就從ASM中被徹底刪除。

 

 

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

相關文章