A continuación se detallan algunas sentencias importantes:
Como primer paso indispensable es conectarse a la instancia +ASM.
bash-3.2$ . oraenv ORACLE_SID = [orcl] ? +ASM The Oracle base remains unchanged with value /u01/app/oracle bash-3.2$ sqlplus / as sysasm SQL*Plus: Release 11.2.0.3.0 Production on Wed Jul 30 17:12:10 2014 Copyright (c) 1982, 2011, Oracle. All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production With the Automatic Storage Management option1. Script para visualizar los Disk Groups
SQL> select group_number, name, state, type, total_mb, free_mb from v$asm_diskgroup; GROUP_NUMBER NAME STATE TYPE TOTAL_MB FREE_MB ------------ -------------------- ----------- ------ ---------- ---------- 1 DATA MOUNTED EXTERN 20394 20332 2 FRA MOUNTED EXTERN 20442 10281 3 REDO1 MOUNTED EXTERN 5100 5041 4 REDO2 MOUNTED EXTERN 5100 50412. Script para visualizar los Disks
column PATH format a20 column NAME format a20 SQL> select GROUP_NUMBER, PATH, NAME, TOTAL_MB, FREE_MB from v$asm_disk; GROUP_NUMBER PATH NAME TOTAL_MB FREE_MB ------------ -------------------- -------------------- ---------- ---------- 0 /dev/rdsk/c1t0d0s0 0 0 1 /dev/rdsk/c1t1d0s0 DATA_0000 10189 10158 1 /dev/rdsk/c1t2d0s0 DATA_0001 10205 10174 2 /dev/rdsk/c1t3d0s0 FRA_0000 20442 10281 3 /dev/rdsk/c1t4d0s0 REDO1_0000 5100 5041 4 /dev/rdsk/c1t5d0s0 REDO2_0000 5100 5041 6 rows selected.3. Script para visualizar los Disk Groups con sus correspondientes discos, y también los discos candidatos
column PATH format a20 column NAME format a20 set line 150 SQL> select dg.NAME, d.NAME, d.PATH, d.TOTAL_MB, d.FREE_MB from v$asm_disk d, v$asm_diskgroup dg where dg.group_number=d.group_number; NAME NAME PATH TOTAL_MB FREE_MB -------------------- -------------------- -------------------- ---------- ---------- DATA DATA_0000 /dev/rdsk/c1t1d0s0 10189 10158 DATA DATA_0001 /dev/rdsk/c1t2d0s0 10205 10174 FRA FRA_0000 /dev/rdsk/c1t3d0s0 20442 10281 REDO1 REDO1_0000 /dev/rdsk/c1t4d0s0 5100 5041 REDO2 REDO2_0000 /dev/rdsk/c1t5d0s0 5100 5041O alternativamente usar el siguiente script:
column disk_path format a20 column disk_name format a20 column diskgroup_name format a20 set line 150 SELECT NVL(a.name, '[CANDIDATO]') diskgroup_name , b.path disk_path , b.name disk_name , b.free_mb , B.total_mb FROM v$asm_diskgroup a RIGHT OUTER JOIN v$asm_disk b USING (group_number) ORDER BY a.name; DISKGROUP_NAME DISK_PATH DISK_NAME FREE_MB TOTAL_MB -------------------- -------------------- -------------------- ---------- ---------- DATA /dev/rdsk/c1t2d0s0 DATA_0001 10179 10205 DATA /dev/rdsk/c1t1d0s0 DATA_0000 10163 10189 FRA /dev/rdsk/c1t3d0s0 FRA_0000 20392 20442 REDO1 /dev/rdsk/c1t4d0s0 REDO1_0000 5050 5100 REDO2 /dev/rdsk/c1t5d0s0 REDO2_0000 5050 5100 [CANDIDATO] /dev/rdsk/c1t0d0s0 0 0 6 rows selected.4. Crear un Disk Group con un disco
CREATE DISKGROUP PRUEBA EXTERNAL REDUNDANCY DISK '/dev/rdsk/c1t3d0s0';5. Adicionar Disco a un Disk Group
ALTER DISKGROUP DATA ADD DISK '/dev/rdsk/c1t2d0s0';6. Montar un Disk Group
ALTER DISKGROUP DATA MOUNT;7. Borrar Disco de un Disk Group
ALTER DISKGROUP DATA DROP DISK DATA_0001;8. Desmontar un Disk Group
ALTER DISKGROUP DATA DISMOUNT;9. Borrar un Disk Group
DROP DISKGROUP DATA;10. Borrar un Disk Group y sus contenidos
DROP DISKGROUP DATA including contents;Paulo Ticona :)
Fuentes:
http://docs.oracle.com/cd/E11882_01/server.112/e18951/asmdiskgrps.htm#OSTMG10040
Oracle® Automatic Storage Management Administrator's Guide, 11g Release 2 (11.2), E18951-03