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
|
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/28572479/viewspace-2150416/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/28572479/viewspace-2150416/