ITPub博客

首页 > Linux操作系统 > Linux操作系统 > 052-part5 -ASM

052-part5 -ASM

原创 Linux操作系统 作者:gaopengtttt 时间:2013-08-27 15:58:58 0 删除 编辑

1、ASM 3种关闭启动方式
-----使用SQLPLUS 连接到SYSASM直接SHUTDOWN IMMEDIATE,启动直接STARTUP即可
-----使用SRVCTL 命令
[grid@tasm ~]$ srvctl stop diskgroup -g ARCH
[grid@tasm ~]$ srvctl stop diskgroup -g DATA
[grid@tasm ~]$ srvctl stop asm -o immediate
启动使用srvctl start asm -o open 即可
-----使用ASMCMD命令
ASMCMD> shutdown -h
Unknown option: h
usage: shutdown [ --normal |--abort|--immediate ]
help:  help shutdown
ASMCMD> startup -h
Unknown option: h
usage: startup [--nomount] [--restrict] [ --pfile pfile ]
help:  help startup

2、
create diskgroup data normal redundancy
failgroup T1 disk
'/dev/raw/raw1' name d1     --force 可以删除以前的数据
failgroup T2 disk
'/dev/raw/raw2' name d2;

CREATE DISKGROUP   data2  External Redundancy DISK '/dev/raw/raw8'
       ATTRIBUTE 'compatible.asm' = '11.2', 'compatible.rdbms' = '11.1'
      
High Redundancy
-----------------
drop diskgroup data including contents;
-----删除磁盘组,如果磁盘组包含文件必须使用INCLUDING CONTENTS。
SQL> alter diskgroup data add disk
  2  '/dev/raw/raw8' name T3D ;

Diskgroup altered.
--------完成后进行平衡需要一定的时间

SQL> alter diskgroup data drop disk t3d;

Diskgroup altered.
--------完成后需要删除磁盘需要一定的时间把AU进行平衡,如果是普通冗余当你删除倒数第二个磁盘时会报错,因为最小2个失效组

SQL> select state,NAME,MODE_STATUS,FREE_MB,path,HEADER_STATUS from v$asm_disk;
 
STATE    NAME                           MODE_STATUS    FREE_MB PATH                                                                             HEADER_STATUS
-------- ------------------------------ ----------- ---------- -------------------------------------------------------------------------------- -------------
NORMAL   DATA_0000                      ONLINE             816 /dev/raw/raw5                                                                    MEMBER
NORMAL   DATA_0001                      ONLINE             815 /dev/raw/raw6                                                                    MEMBER
NORMAL   ARCH_0000                      ONLINE            2642 /dev/raw/raw7                                                                    MEMBER
DROPPING T3D                            ONLINE            2759 /dev/raw/raw8                                                                    MEMBER
这里状态为DROPPING在DROPPING期间即可进行UNDROP,但是一个删除完成就不可以了

SQL> alter diskgroup data undrop disks;

Diskgroup altered.
--------在还没有删除完成前可以进行回退操作
SQL> select state,NAME,MODE_STATUS,FREE_MB,path,HEADER_STATUS from v$asm_disk;
 
STATE    NAME                           MODE_STATUS    FREE_MB PATH                                                                             HEADER_STATUS
-------- ------------------------------ ----------- ---------- -------------------------------------------------------------------------------- -------------
NORMAL   DATA_0000                      ONLINE             761 /dev/raw/raw5                                                                    MEMBER
NORMAL   DATA_0001                      ONLINE             761 /dev/raw/raw6                                                                    MEMBER
NORMAL   ARCH_0000                      ONLINE            2642 /dev/raw/raw7                                                                    MEMBER
NORMAL                                  ONLINE               0 /dev/raw/raw8                                                                    FORMER
 删除完成后,状态变为NORMAL,HEADER状态变为FROMER,表示曾经使用过,
 
 
 3、兼容性
compatible.asm 管理者版本,管理ASM diskgroup的实例必须大于等于这个设置
compatible.rdbms 使用者版本,使用ASM diskgroup 的实例必须大于等于这个设置
而compatible.asm必须大于等于compatible.rdbms ,否则报错如下:

 SQL> CREATE DISKGROUP data2 DISK '/dev/raw/raw8'
  2         ATTRIBUTE 'compatible.asm' = '11.1', 'compatible.rdbms' = '11.2';
CREATE DISKGROUP data2 DISK '/dev/raw/raw8'
*
ERROR at line 1:
ORA-15018: diskgroup cannot be created
ORA-15234: target RDBMS compatibility (11.2.0.0.0) exceeds ASM compatibility
(11.1.0.0.0)

(SQL> CREATE DISKGROUP data2 DISK '/dev/raw/raw8'
  2         ATTRIBUTE 'compatible.asm' = '11.2', 'compatible.rdbms' = '11.1';
CREATE DISKGROUP data2 DISK '/dev/raw/raw8'
*
ERROR at line 1:
ORA-15018: diskgroup cannot be created
ORA-15072: command requires at least 2 regular failure groups, discovered only
1

SQL> CREATE DISKGROUP   data2  External Redundancy DISK '/dev/raw/raw8'
  2         ATTRIBUTE 'compatible.asm' = '11.2', 'compatible.rdbms' = '11.1';

Diskgroup created.

SQL> select * from v$asm_diskgroup;
 
GROUP_NUMBER NAME                           SECTOR_SIZE BLOCK_SIZE ALLOCATION_UNIT_SIZE STATE       TYPE     TOTAL_MB    FREE_MB HOT_USED_MB COLD_USED_MB REQUIRED_MIRROR_FREE_MB USABLE_FILE_MB OFFLINE_DISKS COMPATIBILITY                                                DATABASE_COMPATIBILITY                                       VOTING_FILES
------------ ------------------------------ ----------- ---------- -------------------- ----------- ------ ---------- ---------- ----------- ------------ ----------------------- -------------- ------------- ------------------------------------------------------------ ------------------------------------------------------------ ------------
           1 ARCH                                   512       4096              1048576 CONNECTED   EXTERN       2870       2642           0          228                       0           2642             0 11.2.0.0.0                                                   10.1.0.0.0                                                   N
           2 DATA                                   512       4096              1048576 CONNECTED   NORMAL       5740       1502           0         4238                       0            751             0 11.2.0.0.0                                                   11.2.0.0.0                                                   N
           3 DATA2                                  512       4096              1048576 MOUNTED     EXTERN       2870       2818           0           52                       0           2818             0 11.2.0.0.0                                                   11.1.0.0.0                                                   N
 
4、查看属性
SQL> SELECT dg.name AS diskgroup, t.name, t.stripe, t.redundancy, t.primary_region, t.mirror_region
  2         FROM V$ASM_DISKGROUP dg, V$ASM_TEMPLATE t
  3         WHERE dg.group_number = t.group_number and dg.name = 'DATA' ORDER BY t.name;
 
DISKGROUP                      NAME                           STRIPE REDUNDANCY PRIMARY_REGION MIRROR_REGION
------------------------------ ------------------------------ ------ ---------- -------------- -------------
DATA                           ARCHIVELOG                     COARSE MIRROR     COLD           COLD
DATA                           ASMPARAMETERFILE               COARSE MIRROR     COLD           COLD
DATA                           AUTOBACKUP                     COARSE MIRROR     COLD           COLD
DATA                           BACKUPSET                      COARSE MIRROR     COLD           COLD
DATA                           CHANGETRACKING                 COARSE MIRROR     COLD           COLD
DATA                           CONTROLFILE                    FINE   HIGH       COLD           COLD
DATA                           DATAFILE                       COARSE MIRROR     COLD           COLD
DATA                           DATAGUARDCONFIG                COARSE MIRROR     COLD           COLD
DATA                           DUMPSET                        COARSE MIRROR     COLD           COLD
DATA                           FLASHBACK                      COARSE MIRROR     COLD           COLD
DATA                           FLASHFILE                      COARSE MIRROR     COLD           COLD
DATA                           OCRFILE                        COARSE MIRROR     COLD           COLD
DATA                           ONLINELOG                      COARSE MIRROR     COLD           COLD
DATA                           PARAMETERFILE                  COARSE MIRROR     COLD           COLD
DATA                           TEMPFILE                       COARSE MIRROR     COLD           COLD
DATA                           XTRANSPORT                     COARSE MIRROR     COLD           COLD

SQL> SELECT dg.name AS diskgroup, SUBSTR(a.name,1,18) AS name,
  2       SUBSTR(a.value,1,24) AS value, read_only FROM V$ASM_DISKGROUP dg,
  3       V$ASM_ATTRIBUTE a WHERE dg.name = 'DATA'
  4       AND dg.group_number = a.group_number and a.NAME NOT LIKE 'template%';
 
DISKGROUP                      NAME                                                                             VALUE                                                                            READ_ONLY
------------------------------ -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- ---------
DATA                           disk_repair_time                                                                 3.6h                                                                             N
DATA                           au_size                                                                          1048576                                                                          Y
DATA                           sector_size                                                                      512                                                                              Y
DATA                           compatible.asm                                                                   11.2.0.0.0                                                                       N
DATA                           compatible.rdbms                                                                 11.2.0.0.0                                                                       N
DATA                           cell.smart_scan_ca                                                               FALSE                                                                            N
DATA                           access_control.ena                                                               FALSE                                                                            N
DATA                           access_control.uma                                                               066                                                                              N


alter diskgroup data offline disk DATA_0000 drop after  0.5m; 可以指定disk_repair_time的时间,本列30秒后删除DISK。

SQL> select * from v$asm_disk;
 
GROUP_NUMBER DISK_NUMBER COMPOUND_INDEX INCARNATION MOUNT_STATUS HEADER_STATUS MODE_STATUS STATE    REDUNDANCY LIBRARY                                                               OS_MB   TOTAL_MB    FREE_MB HOT_USED_MB COLD_USED_MB NAME                           FAILGROUP                      LABEL                           PATH                                                                             UDID                                                             PRODUCT                          CREATE_DATE MOUNT_DATE  REPAIR_TIMER      READS     WRITES  READ_ERRS WRITE_ERRS  READ_TIME WRITE_TIME BYTES_READ BYTES_WRITTEN PREFERRED_READ HASH_VALUE  HOT_READS HOT_WRITES HOT_BYTES_READ HOT_BYTES_WRITTEN COLD_READS COLD_WRITES COLD_BYTES_READ COLD_BYTES_WRITTEN VOTING_FILE SECTOR_SIZE FAILGROUP_TYPE
------------ ----------- -------------- ----------- ------------ ------------- ----------- -------- ---------- ---------------------------------------------------------------- ---------- ---------- ---------- ----------- ------------ ------------------------------ ------------------------------ ------------------------------- -------------------------------------------------------------------------------- ---------------------------------------------------------------- -------------------------------- ----------- ----------- ------------ ---------- ---------- ---------- ---------- ---------- ---------- ---------- ------------- -------------- ---------- ---------- ---------- -------------- ----------------- ---------- ----------- --------------- ------------------ ----------- ----------- --------------
           2           1       33554433  3940853700 CACHED       MEMBER        ONLINE      NORMAL   UNKNOWN    System                                                                 2870       2870        751           0         2119 DATA_0001                      DATA_0001                                                      /dev/raw/raw6                                                                                                                                                                      2013/8/13 2 2013/8/25 1            0      12399      15727          0          0 305.731401 384.269159 2402186240    2244893696 U               559735068          0          0              0                 0       9428        5562       141222912          155028480 N                   512 REGULAR
           1           0       16777216  3940853698 CACHED       MEMBER        ONLINE      NORMAL   UNKNOWN    System                                                                 2870       2870       2642           0          228 ARCH_0000                      ARCH_0000                                                      /dev/raw/raw7                                                                                                                                                                      2013/8/14 0 2013/8/25 1            0       8593      14440          0          0  37.040936  79.919776  136900608     163531776                 797869928          0          0              0                 0       8094        9978       132796416          145255424 N                   512 REGULAR
           2           0       33554432  3940853699 MISSING      UNKNOWN       OFFLINE     FORCING  UNKNOWN    System                                                                    0       2870        751           0         2119 _DROPPED_0000_DATA             DATA_0000                                                                                                                                                                                                                                         2013/8/13 2 2013/8/25 1            0                                                                                            U              1316795825                                                                                                                  N                     0 REGULAR
          
删除后NAME更名为_DROPPED_0000_DATA,状态均有变化,这里实际上是如果出现磁盘读写错误,ASM会自动的设置DISK为OFFLINE

SQL>  select state,NAME,MODE_STATUS,FREE_MB,path,HEADER_STATUS from v$asm_disk;
 
STATE    NAME                           MODE_STATUS    FREE_MB PATH                                                                             HEADER_STATUS
-------- ------------------------------ ----------- ---------- -------------------------------------------------------------------------------- -------------
NORMAL   DATA_0001                      ONLINE             751 /dev/raw/raw6                                                                    MEMBER
NORMAL   ARCH_0000                      ONLINE            2642 /dev/raw/raw7                                                                    MEMBER
FORCING  _DROPPED_0000_DATA             OFFLINE            751                                                                                  UNKNOWN
NORMAL                                  ONLINE               0 /dev/raw/raw8                                                                    FORMER
NORMAL                                  ONLINE               0 /dev/raw/raw5                                                                    MEMBER  ---这里是原始的磁盘

这种状态下没有办法恢复了,只有重新键入磁盘

SQL> alter diskgroup data add disk '/dev/raw/raw5' force;

Diskgroup altered.

SQL> r
  1*  select state,NAME,MODE_STATUS,FREE_MB,path,HEADER_STATUS,GROUP_NUMBER from v$asm_disk

STATE    NAME                           MODE_ST    FREE_MB PATH                                                                                                           HEADER_STATU GROUP_NUMBER
-------- ------------------------------ ------- ---------- ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ------------ ------------
NORMAL                                  ONLINE           0 /dev/raw/raw8                                                                                                  FORMER                   0
FORCING  _DROPPED_0000_DATA             OFFLINE       1108                                                                                                                UNKNOWN                  2
NORMAL   DATA_0001                      ONLINE         751 /dev/raw/raw6                                                                                                  MEMBER                   2
NORMAL   DATA_0002                      ONLINE        2511 /dev/raw/raw5                                                                                                  MEMBER                   2
NORMAL   ARCH_0000                      ONLINE        2642 /dev/raw/raw7                                                                                                  MEMBER                   1

DATA_0002 free_mb不断减少,_DROPPED_0000_DATA free_mb不断增多,实际上_DROPPED_0000_DATA并不是一块真实的盘而是一个占位而已表示曾经的DATA_0000磁盘出现了故障OFFLINE删除了,并且
如果需要新增盘的话,需要多少空间而已,当然这个特性只能在高冗余或者普通冗余有用,当你新加入盘后数据会从健康的盘同步到新的盘中,同步完成后会自动消失,因为磁盘组又恢复到正常状态,
及普通冗余有2个失效组,高冗余有3个失效组。
SQL> r
  1*  select state,NAME,MODE_STATUS,FREE_MB,path,HEADER_STATUS,GROUP_NUMBER from v$asm_disk

STATE    NAME                           MODE_ST    FREE_MB PATH                                                                                                           HEADER_STATU GROUP_NUMBER
-------- ------------------------------ ------- ---------- ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ------------ ------------
NORMAL                                  ONLINE           0 /dev/raw/raw8                                                                                                  FORMER                   0
NORMAL   DATA_0001                      ONLINE         751 /dev/raw/raw6                                                                                                  MEMBER                   2
NORMAL   DATA_0002                      ONLINE         751 /dev/raw/raw5                                                                                                  MEMBER                   2
NORMAL   ARCH_0000                      ONLINE        2642 /dev/raw/raw7                                                                                                  MEMBER                   1

最后恢复完成

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/7728585/viewspace-769375/,如需转载,请注明出处,否则将追究法律责任。

下一篇: LINUX LOG(多路径)
请登录后发表评论 登录
全部评论
wxh gp_22389860 <<深入理解MySQL主从原理专栏>> 发布 可加WX了解

注册时间:2008-10-13

  • 博文量
    693
  • 访问量
    2956200