asm如何添加和删除磁盘

这篇文章将为大家详细讲解有关asm如何添加和删除磁盘,小编觉得挺实用的,因此分享给大家做个参考,希望大家阅读完这篇文章后可以有所收获。

专注于为中小企业提供做网站、成都做网站服务,电脑端+手机端+微信端的三站合一,更高效的管理,为中小企业龙口免费做网站提供优质的服务。我们立足成都,凝聚了一批互联网行业人才,有力地推动了1000+企业的稳健成长,帮助中小企业通过网站建设实现规模扩充和转变。

OS:solaris

oracle: 10G R2和11G R2

11G添加删除磁盘

##磁盘变更属组和权限

-bash-3.2# bash format.sh | awk -F. '{if(($1>=1)&&($1<=15)) print $0}' | awk '{print "chown grid:asmadmin /dev/rdsk/"$2"s6"}'

chown grid:asmadmin /dev/rdsk/c9t50060E8012612D00d0s6

chown grid:asmadmin /dev/rdsk/c9t50060E8012612D00d1s6

chown grid:asmadmin /dev/rdsk/c9t50060E8012612D00d2s6

chown grid:asmadmin /dev/rdsk/c9t50060E8012612D00d3s6

chown grid:asmadmin /dev/rdsk/c9t50060E8012612D00d4s6

chown grid:asmadmin /dev/rdsk/c9t50060E8012612D00d5s6

chown grid:asmadmin /dev/rdsk/c9t50060E8012612D00d6s6

chown grid:asmadmin /dev/rdsk/c9t50060E8012612D00d7s6

chown grid:asmadmin /dev/rdsk/c9t50060E8012612D00d8s6

chown grid:asmadmin /dev/rdsk/c9t50060E8012612D00d9s6

chown grid:asmadmin /dev/rdsk/c9t50060E8012612D00d10s6

chown grid:asmadmin /dev/rdsk/c9t50060E8012612D00d11s6

chown grid:asmadmin /dev/rdsk/c9t50060E8012612D00d12s6

chown grid:asmadmin /dev/rdsk/c9t50060E8012612D00d13s6

chown grid:asmadmin /dev/rdsk/c9t50060E8012612D00d14s6

-bash-3.2# bash format.sh | awk -F. '{if(($1>=1)&&($1<=15)) print $0}' | awk '{print "chmod 660 /dev/rdsk/"$2"s6"}'

chmod 660 /dev/rdsk/c9t50060E8012612D00d0s6

chmod 660 /dev/rdsk/c9t50060E8012612D00d1s6

chmod 660 /dev/rdsk/c9t50060E8012612D00d2s6

chmod 660 /dev/rdsk/c9t50060E8012612D00d3s6

chmod 660 /dev/rdsk/c9t50060E8012612D00d4s6

chmod 660 /dev/rdsk/c9t50060E8012612D00d5s6

chmod 660 /dev/rdsk/c9t50060E8012612D00d6s6

chmod 660 /dev/rdsk/c9t50060E8012612D00d7s6

chmod 660 /dev/rdsk/c9t50060E8012612D00d8s6

chmod 660 /dev/rdsk/c9t50060E8012612D00d9s6

chmod 660 /dev/rdsk/c9t50060E8012612D00d10s6

chmod 660 /dev/rdsk/c9t50060E8012612D00d11s6

chmod 660 /dev/rdsk/c9t50060E8012612D00d12s6

chmod 660 /dev/rdsk/c9t50060E8012612D00d13s6

chmod 660 /dev/rdsk/c9t50060E8012612D00d14s6

##查看当前的磁盘组和磁盘信息

SQL> set linesize 300

SQL> set pages 1000

SQL> col name for a15

SQL> col path for a60

SQL> select adg.name,adg.TOTAL_MB group_TOTAL_MB,adg.free_mb group_free_mb,ad.path,ad.TOTAL_MB disk_totle_mb,ad.free_mb disk_free_mb from v$asm_diskgroup adg,v$asm_disk ad where adg.GROUP_NUMBER=ad.GROUP_NUMBER;

NAME            GROUP_TOTAL_MB GROUP_FREE_MB PATH                                                         DISK_TOTLE_MB DISK_FREE_MB

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

ARCH_DG01              1095562        923066 /dev/rdsk/c9t50060E80103511A0d10s6                                  547781       461538

ARCH_DG01              1095562        923066 /dev/rdsk/c9t50060E80103511A0d0s6                                   547781       461528

DATA_DG01              6573372       2940641 /dev/rdsk/c9t50060E80103511A0d14s6                                  547781       245046

DATA_DG01              6573372       2940641 /dev/rdsk/c9t50060E80103511A0d1s6                                   547781       245050

DATA_DG01              6573372       2940641 /dev/rdsk/c9t50060E80103511A0d2s6                                   547781       245050

DATA_DG01              6573372       2940641 /dev/rdsk/c9t50060E80103511A0d3s6                                   547781       245048

DATA_DG01              6573372       2940641 /dev/rdsk/c9t50060E80103511A0d4s6                                   547781       245061

DATA_DG01              6573372       2940641 /dev/rdsk/c9t50060E80103511A0d5s6                                   547781       245066

DATA_DG01              6573372       2940641 /dev/rdsk/c9t50060E80103511A0d6s6                                   547781       245047

DATA_DG01              6573372       2940641 /dev/rdsk/c9t50060E80103511A0d7s6                                   547781       245051

DATA_DG01              6573372       2940641 /dev/rdsk/c9t50060E80103511A0d8s6                                   547781       245066

DATA_DG01              6573372       2940641 /dev/rdsk/c9t50060E80103511A0d12s6                                  547781       245055

DATA_DG01              6573372       2940641 /dev/rdsk/c9t50060E80103511A0d11s6                                  547781       245053

DATA_DG01              6573372       2940641 /dev/rdsk/c9t50060E80103511A0d13s6                                  547781       245048

FLASH_DG01              547781        547725 /dev/rdsk/c9t50060E80103511A0d9s6                                   547781       547725

15 rows selected.

##形成添加磁盘语句

-bash-3.2# bash format.sh | awk -F. '{if(($1>=1)&&($1<=15)) print $0}' | awk '{print "alter diskgroup  add disk ""'\''""/dev/rdsk/"$2"s6""'\''"";"}'

alter diskgroup  add disk '/dev/rdsk/c9t50060E8012612D00d0s6';

alter diskgroup  add disk '/dev/rdsk/c9t50060E8012612D00d1s6';

alter diskgroup  add disk '/dev/rdsk/c9t50060E8012612D00d2s6';

alter diskgroup  add disk '/dev/rdsk/c9t50060E8012612D00d3s6';

alter diskgroup  add disk '/dev/rdsk/c9t50060E8012612D00d4s6';

alter diskgroup  add disk '/dev/rdsk/c9t50060E8012612D00d5s6';

alter diskgroup  add disk '/dev/rdsk/c9t50060E8012612D00d6s6';

alter diskgroup  add disk '/dev/rdsk/c9t50060E8012612D00d7s6';

alter diskgroup  add disk '/dev/rdsk/c9t50060E8012612D00d8s6';

alter diskgroup  add disk '/dev/rdsk/c9t50060E8012612D00d9s6';

alter diskgroup  add disk '/dev/rdsk/c9t50060E8012612D00d10s6';

alter diskgroup  add disk '/dev/rdsk/c9t50060E8012612D00d11s6';

alter diskgroup  add disk '/dev/rdsk/c9t50060E8012612D00d12s6';

alter diskgroup  add disk '/dev/rdsk/c9t50060E8012612D00d13s6';

alter diskgroup  add disk '/dev/rdsk/c9t50060E8012612D00d14s6';

##添加磁盘

oracle@cdb0cmsmcc01:~ $> su - grid

oracle@cdb0cmsmcc01:~ $> sqlplus /nolog

SQL*Plus: Release 11.2.0.3.0 Production on Mon Jan 22 10:25:08 2018

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

SQL> conn / as sysasm

SQL>  alter diskgroup ARCH_DG01 add disk '/dev/rdsk/c9t50060E8012612D00d0s6','/dev/rdsk/c9t50060E8012612D00d1s6';

SQL>  alter diskgroup DATA_DG01 add disk

'/dev/rdsk/c9t50060E8012612D00d2s6','/dev/rdsk/c9t50060E8012612D00d3s6',

'/dev/rdsk/c9t50060E8012612D00d4s6','/dev/rdsk/c9t50060E8012612D00d5s6',

'/dev/rdsk/c9t50060E8012612D00d6s6','/dev/rdsk/c9t50060E8012612D00d7s6',

'/dev/rdsk/c9t50060E8012612D00d8s6','/dev/rdsk/c9t50060E8012612D00d9s6',

'/dev/rdsk/c9t50060E8012612D00d10s6','/dev/rdsk/c9t50060E8012612D00d11s6',

'/dev/rdsk/c9t50060E8012612D00d12s6','/dev/rdsk/c9t50060E8012612D00d13s6';

SQL>  alter diskgroup FLASH_DG01 add disk '/dev/rdsk/c9t50060E8012612D00d14s6';

##删除磁盘

oracle@cdb0cmsmcc01:~ $> su - grid

oracle@cdb0cmsmcc01:~ $> sqlplus /nolog

SQL*Plus: Release 11.2.0.3.0 Production on Mon Jan 22 10:25:08 2018

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

SQL> conn / as sysasm

SQL> alter diskgroup ARCH_DG01 drop disk 'ARCH_DG01_0000','ARCH_DG01_0001';

Diskgroup altered.

SQL> select * from v$asm_operation;

GROUP_NUMBER OPERA STAT      POWER     ACTUAL      SOFAR   EST_WORK   EST_RATE EST_MINUTES ERROR_CODE

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

           1 REBAL RUN           1          1      19757      52986       6331           5

        

SQL> alter diskgroup DATA_DG01 drop disk

  2     'DATA_DG01_0000',

  3     'DATA_DG01_0001',

  4     'DATA_DG01_0002',

  5     'DATA_DG01_0003',

  6     'DATA_DG01_0004',

  7     'DATA_DG01_0005',

  8     'DATA_DG01_0006',

  9     'DATA_DG01_0007',

10     'DATA_DG01_0008',

11     'DATA_DG01_0009',

12     'DATA_DG01_0010',

13     'DATA_DG01_0011' rebalance power 6;

    

SQL> select * from v$asm_operation;

GROUP_NUMBER OPERA STAT      POWER     ACTUAL      SOFAR   EST_WORK   EST_RATE EST_MINUTES ERROR_CODE

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

           2 REBAL RUN           6          6       1483    1790755       3137         504

           


10G添加删除磁盘

##变更属组和权限

-bash-3.2# bash format.sh | awk -F. '{if(($1>=3)&&($1<=26)) print $0}' | awk '{print "chown grid:asmadmin /dev/rdsk/"$2"s6"}'

chown oracle:oinstall /dev/rdsk/c12t50060E8012612D00d0s6

chown oracle:oinstall /dev/rdsk/c12t50060E8012612D00d1s6

chown oracle:oinstall /dev/rdsk/c12t50060E8012612D00d2s6

chown oracle:oinstall /dev/rdsk/c12t50060E8012612D00d3s6

chown oracle:oinstall /dev/rdsk/c12t50060E8012612D00d4s6

chown oracle:oinstall /dev/rdsk/c12t50060E8012612D00d5s6

chown oracle:oinstall /dev/rdsk/c12t50060E8012612D00d6s6

chown oracle:oinstall /dev/rdsk/c12t50060E8012612D00d7s6

chown oracle:oinstall /dev/rdsk/c12t50060E8012612D00d8s6

chown oracle:oinstall /dev/rdsk/c12t50060E8012612D00d9s6

chown oracle:oinstall /dev/rdsk/c12t50060E8012612D00d10s6

chown oracle:oinstall /dev/rdsk/c12t50060E8012612D00d11s6

chown oracle:oinstall /dev/rdsk/c12t50060E8012612D00d12s6

chown oracle:oinstall /dev/rdsk/c12t50060E8012612D00d13s6

chown oracle:oinstall /dev/rdsk/c12t50060E8012612D00d14s6

chown oracle:oinstall /dev/rdsk/c12t50060E8012612D00d15s6

chown oracle:oinstall /dev/rdsk/c12t50060E8012612D00d16s6

chown oracle:oinstall /dev/rdsk/c12t50060E8012612D00d17s6

chown oracle:oinstall /dev/rdsk/c12t50060E8012612D00d18s6

chown oracle:oinstall /dev/rdsk/c12t50060E8012612D00d19s6

chown oracle:oinstall /dev/rdsk/c12t50060E8012612D00d20s6

chown oracle:oinstall /dev/rdsk/c12t50060E8012612D00d21s6

chown oracle:oinstall /dev/rdsk/c12t50060E8012612D00d22s6

chown oracle:oinstall /dev/rdsk/c12t50060E8012612D00d23s6

-bash-3.2# bash format.sh | awk -F. '{if(($1>=3)&&($1<=26)) print $0}' | awk '{print "chmod 640 /dev/rdsk/"$2"s6"}'

chmod 640 /dev/rdsk/c12t50060E8012612D00d0s6

chmod 640 /dev/rdsk/c12t50060E8012612D00d1s6

chmod 640 /dev/rdsk/c12t50060E8012612D00d2s6

chmod 640 /dev/rdsk/c12t50060E8012612D00d3s6

chmod 640 /dev/rdsk/c12t50060E8012612D00d4s6

chmod 640 /dev/rdsk/c12t50060E8012612D00d5s6

chmod 640 /dev/rdsk/c12t50060E8012612D00d6s6

chmod 640 /dev/rdsk/c12t50060E8012612D00d7s6

chmod 640 /dev/rdsk/c12t50060E8012612D00d8s6

chmod 640 /dev/rdsk/c12t50060E8012612D00d9s6

chmod 640 /dev/rdsk/c12t50060E8012612D00d10s6

chmod 640 /dev/rdsk/c12t50060E8012612D00d11s6

chmod 640 /dev/rdsk/c12t50060E8012612D00d12s6

chmod 640 /dev/rdsk/c12t50060E8012612D00d13s6

chmod 640 /dev/rdsk/c12t50060E8012612D00d14s6

chmod 640 /dev/rdsk/c12t50060E8012612D00d15s6

chmod 640 /dev/rdsk/c12t50060E8012612D00d16s6

chmod 640 /dev/rdsk/c12t50060E8012612D00d17s6

chmod 640 /dev/rdsk/c12t50060E8012612D00d18s6

chmod 640 /dev/rdsk/c12t50060E8012612D00d19s6

chmod 640 /dev/rdsk/c12t50060E8012612D00d20s6

chmod 640 /dev/rdsk/c12t50060E8012612D00d21s6

chmod 640 /dev/rdsk/c12t50060E8012612D00d22s6

chmod 640 /dev/rdsk/c12t50060E8012612D00d23s6

##查看当前磁盘组和磁盘信息

set linesize 300

set pages 1000

col name for a15

col path for a60

select adg.name,adg.TOTAL_MB group_TOTAL_MB,adg.free_mb group_free_mb,ad.path,ad.TOTAL_MB disk_totle_mb,ad.free_mb disk_free_mb from v$asm_diskgroup adg,v$asm_disk ad where adg.GROUP_NUMBER=ad.GROUP_NUMBER;

NAME            GROUP_TOTAL_MB GROUP_FREE_MB PATH                                                         DISK_TOTLE_MB DISK_FREE_MB

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

ARCH_DG01              2191124       1863341 /dev/rdsk/c12t50060E80103511A0d21s6                                 547781            0

ARCH_DG01              2191124       1863341 /dev/rdsk/c12t50060E80103511A0d19s6                                 547781            0

ARCH_DG01              2191124       1863341 /dev/rdsk/c12t50060E80103511A0d20s6                                 547781            0

ARCH_DG01              2191124       1863341 /dev/rdsk/c12t50060E80103511A0d18s6                                 547781            0

DATA_DG01              4930029        946612 /dev/rdsk/c12t50060E80103511A0d1s6                                  547781            0

DATA_DG01              4930029        946612 /dev/rdsk/c12t50060E80103511A0d6s6                                  547781            0

DATA_DG01              4930029        946612 /dev/rdsk/c12t50060E80103511A0d7s6                                  547781            0

DATA_DG01              4930029        946612 /dev/rdsk/c12t50060E80103511A0d22s6                                 547781            0

DATA_DG01              4930029        946612 /dev/rdsk/c12t50060E80103511A0d2s6                                  547781            0

DATA_DG01              4930029        946612 /dev/rdsk/c12t50060E80103511A0d3s6                                  547781            0

DATA_DG01              4930029        946612 /dev/rdsk/c12t50060E80103511A0d4s6                                  547781            0

DATA_DG01              4930029        946612 /dev/rdsk/c12t50060E80103511A0d5s6                                  547781            0

DATA_DG01              4930029        946612 /dev/rdsk/c12t50060E80103511A0d0s6                                  547781            0

DATA_DG02              4930029        952264 /dev/rdsk/c12t50060E80103511A0d23s6                                 547781            0

DATA_DG02              4930029        952264 /dev/rdsk/c12t50060E80103511A0d9s6                                  547781            0

DATA_DG02              4930029        952264 /dev/rdsk/c12t50060E80103511A0d8s6                                  547781            0

DATA_DG02              4930029        952264 /dev/rdsk/c12t50060E80103511A0d15s6                                 547781            0

DATA_DG02              4930029        952264 /dev/rdsk/c12t50060E80103511A0d14s6                                 547781            0

DATA_DG02              4930029        952264 /dev/rdsk/c12t50060E80103511A0d13s6                                 547781            0

DATA_DG02              4930029        952264 /dev/rdsk/c12t50060E80103511A0d12s6                                 547781            0

DATA_DG02              4930029        952264 /dev/rdsk/c12t50060E80103511A0d11s6                                 547781            0

DATA_DG02              4930029        952264 /dev/rdsk/c12t50060E80103511A0d10s6                                 547781            0

FLASH_DG01             1095562        273752 /dev/rdsk/c12t50060E80103511A0d16s6                                 547781            0

FLASH_DG01             1095562        273752 /dev/rdsk/c12t50060E80103511A0d17s6                                 547781            0

##添加磁盘

oracle@ofs0accmcc01:~ $> export ORACLE_SID=+ASM

oracle@ofs0accmcc01:~ $> sqlplus /nolog

SQL*Plus: Release 10.2.0.4.0 - Production on Mon Jan 22 10:59:38 2018

Copyright (c) 1982, 2007, Oracle.  All Rights Reserved.

SQL> conn / as sysdba

Connected.

SQL> show parameter name

NAME                                 TYPE        VALUE

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

db_file_name_convert                 string

db_name                              string

db_unique_name                       string      +ASM

global_names                         boolean     FALSE

instance_name                        string      +ASM

lock_name_space                      string

log_file_name_convert                string

service_names

SQL>  alter diskgroup ARCH_DG01 add disk '/dev/rdsk/c12t50060E8012612D00d0s6','/dev/rdsk/c12t50060E8012612D00d1s6','/dev/rdsk/c12t50060E8012612D00d2s6','/dev/rdsk/c12t50060E8012612D00d3s6';

SQL> alter diskgroup DATA_DG01 add disk

'/dev/rdsk/c12t50060E8012612D00d4s6','/dev/rdsk/c12t50060E8012612D00d5s6',

'/dev/rdsk/c12t50060E8012612D00d6s6','/dev/rdsk/c12t50060E8012612D00d7s6',

'/dev/rdsk/c12t50060E8012612D00d8s6','/dev/rdsk/c12t50060E8012612D00d9s6',

'/dev/rdsk/c12t50060E8012612D00d10s6','/dev/rdsk/c12t50060E8012612D00d11s6',

'/dev/rdsk/c12t50060E8012612D00d12s6';

SQL>  alter diskgroup DATA_DG02 add disk

'/dev/rdsk/c12t50060E8012612D00d13s6','/dev/rdsk/c12t50060E8012612D00d14s6',

'/dev/rdsk/c12t50060E8012612D00d15s6','/dev/rdsk/c12t50060E8012612D00d16s6',

'/dev/rdsk/c12t50060E8012612D00d17s6','/dev/rdsk/c12t50060E8012612D00d18s6',

'/dev/rdsk/c12t50060E8012612D00d19s6','/dev/rdsk/c12t50060E8012612D00d20s6',

'/dev/rdsk/c12t50060E8012612D00d21s6';

SQL>  alter diskgroup FLASH_DG01 add disk '/dev/rdsk/c12t50060E8012612D00d22s6','/dev/rdsk/c12t50060E8012612D00d23s6’;

##删除磁盘

oracle@ofs0accmcc01:~/admin/BEIMCCE/bdump $> export ORACLE_SID=+ASM

oracle@ofs0accmcc01:~ $> sqlplus /nolog

SQL*Plus: Release 10.2.0.4.0 - Production on Mon Jan 22 10:59:38 2018

Copyright (c) 1982, 2007, Oracle.  All Rights Reserved.

SQL> conn / as sysdba

Connected.

SQL> show parameter name

NAME                                 TYPE        VALUE

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

db_file_name_convert                 string

db_name                              string

db_unique_name                       string      +ASM

global_names                         boolean     FALSE

instance_name                        string      +ASM

lock_name_space                      string

log_file_name_convert                string

service_names                        string      +ASM

SQL> alter diskgroup ARCH_DG01 drop disk

  2     'ARCH_DG01_0000',

  3     'ARCH_DG01_0001',

  4     'ARCH_DG01_0002',

  5     'ARCH_DG01_0003' rebalance power 6;

Diskgroup altered.

SQL> set linesize 300

SQL> select * from v$asm_operation;

GROUP_NUMBER OPERA STAT      POWER     ACTUAL      SOFAR   EST_WORK   EST_RATE EST_MINUTES

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

           1 REBAL RUN           6          6       3471     127806       4633          26

SQL> alter diskgroup DATA_DG01 drop disk

  2     'DATA_DG01_0000',

  3     'DATA_DG01_0001',

  4     'DATA_DG01_0002',

  5     'DATA_DG01_0003',

  6     'DATA_DG01_0004',

  7     'DATA_DG01_0005',

  8     'DATA_DG01_0006',

  9     'DATA_DG01_0007',

10     'DATA_DG01_0008' rebalance power 6;

Diskgroup altered.

SQL> alter diskgroup DATA_DG02 drop disk

  2     'DATA_DG02_0000',

  3     'DATA_DG02_0001',

  4     'DATA_DG02_0002',

  5     'DATA_DG02_0003',

  6     'DATA_DG02_0004',

  7     'DATA_DG02_0005',

  8     'DATA_DG02_0006',

  9     'DATA_DG02_0007',

10     'DATA_DG02_0008' rebalance power 6;

Diskgroup altered.

SQL> select * from v$asm_operation;

GROUP_NUMBER OPERA STAT      POWER     ACTUAL      SOFAR   EST_WORK   EST_RATE EST_MINUTES

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

           2 REBAL RUN           6          6     144286    1995242       4154         445

           3 REBAL WAIT          6          0          0          0          0         445

SQL> alter diskgroup FLASH_DG01 drop disk 'FLASH_DG01_0000','FLASH_DG01_0001' rebalance power 6;

Diskgroup altered.

SQL> select * from v$asm_operation;

GROUP_NUMBER OPERA STAT      POWER     ACTUAL      SOFAR   EST_WORK   EST_RATE EST_MINUTES

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

           4 REBAL RUN           6          6        271     405529       2539         159

关于“asm如何添加和删除磁盘”这篇文章就分享到这里了,希望以上内容可以对大家有一定的帮助,使各位可以学到更多知识,如果觉得文章不错,请把它分享出去让更多的人看到。


分享名称:asm如何添加和删除磁盘
文章出自:http://hbruida.cn/article/peieej.html