Saturday, June 02, 2007

ASM Cheatsheet

# Start/Stop ASM

srvctl stop asm -n linux1
srvctl start asm -n linux1

# Status of an ASM instance

srvctl status asm -n linux1
ASM instance +ASM1 is running on node linux1.

# Display the configuration for the ASM instance(s)

srvctl config asm -n linux1
+ASM1 /u01/app/oracle/product/10.2.0/db_1

# asmcmd commands

asmcmd -p
asmcmd lsdg
asmcmd ls ORADATA001

# Check asm status

crsstat |grep asm

# ASM SQL's
prompt asm diskgroups
prompt
SELECT group_number, name, total_mb,state, type FROM V$asm_diskgroup
/

prompt All ASM disk that belong to the 'ORCL_DATA1' disk group
prompt
SELECT path FROM v$asm_disk
WHERE group_number IN (select group_number from v$asm_diskgroup
where name = upper('&diskgroup');

# Create on ASM the root directory of the database

$ asmcmd
ASMCMD> cd datadg
ASMCMD> mkdir racdbtst
ASMCMD> ls
racdbtst/

# Directories to be created for Duplicating Database

oracle@lnx521> . oraenv
ORACLE_SID = [xxxx] ? +ASM1
oracle@lnx521> asmcmd
ASMCMD> cd oradata001
ASMCMD> mkdir gwyd
ASMCMD> cd gwyd
ASMCMD> mkdir CONTROLFILE DATAFILE ONLINELOG PARAMETERFILE TEMPFILE
ASMCMD>

# Create pfile from spfile

create pfile='/vmasmtest/BACKUP/ASM-SPFile' from spfile;