ASM Operations

ASM Operations

1. Instance name
select instance_name from v$instance;

2. Create disk group

create diskgroup +DATA normal redundancy
2 failgroup f1 disk '/dev/raw/raw5' name disk5
3 failgroup f2 disk '/dev/raw/raw6' name disk6;
4 failgroup f2 disk '/dev/raw/raw6' name disk7;
Note: force is used if disk has been in a previous diskgroup, external redundancy uses third party mirroring i.e SAN

3. Add disks to a group alter diskgroup +DATA add disk

'/dev/raw/raw7' name disk7;
/dev/raw/raw8' name disk8;

4. Remove disks from a group

alter diskgroup diskgrpA drop disk disk6;

5. Remove disk group

drop diskgroup diskgrpA including contents

6. Resizing disk group

alter diskgroup diskgrpA resize disk 'disk3' size 500M;

7. Undo remove disk group

alter database diskgrpA undrop disks;

8. Display diskgroup info
select name, group_number, name, type, state, total_mb, free_mb from v$asm_diskgroup;
select group_number, disk_number, name, failgroup, create_date, path, total_mb from v$asm_disk;
select group_number, operation, state, power, actual, sofar, est_work, est_rate, est_minutes from v$asm_operation;

9. Rebalance a diskgroup
(after disk failure and disk has been replaced)
alter diskgroup diskgrpA rebalance power 8;
Note: to speed up rebalancing increase the level upto 11, remember that this will also decrease performance, you can also use the wait parameter this will hold the commandline until it is finished.

10. Dismount or mount a diskgroup
alter diskgroup diskgrpA dismount;
alter diskgroup diskgrpA mount;

11. Check a diskgroups integrity
alter diskgroup diskgrpA check all;

12. Diskgroup Directory
alter diskgroup diskgrpA add directory '+diskgrpA/dir1'
Note: this is required if you use aliases when creating databse files
i.e '+diskgrpA/dir/control_file1'

13. Adding and drop aliases

alter diskgroup diskgrpA add alias '+diskgrpA/dir/second.dbf' for '+diskgrpB/datafile/table.763.1';
alter diskgroup diskgrpA drop alias '+diskgrpA/dir/second.dbf'

14. Drop files from a diskgroup
alter diskgroup diskgrpA drop file '+diskgrpA/payroll/payroll.dbf';

15. Using ASM Disks
Examples of using ASM disks
create tablespace test datafile ‘+diskgrpA’ size 100m;
alter tablespace test add datafile ‘+diskgrpA’ size 100m;
alter database add logfile group 4 ‘+dg_log1’,’+dg_log2’ size 100m;
alter system set log_archive_dest_1=’location=+dg_arch1’;
alter system set db_recovery_file_dest=’+dg_flash’;

16. Display performance.
select path, reads, writes, read_time, write_time,
read_time/decode(reads,0,1,reads) "AVGRDTIME",
write_time/decode(writes,0,1,writes) "AVGWRTIME"
from v$asm_disk_stat;

1 comment:

Sridevi Koduru said...

Sridevi Koduru (Senior Oracle Apps Trainer
LinkedIn profile -
Please Contact for One to One Online Training on Oracle Apps Technical, Financials, SCM, Oracle Manufacturing, OAF, ADF, SQL, PL/SQL, D2K at | +91 - 9581017828.