Search This Blog

Saturday, September 22, 2012

Oracle RAC 11gR2 ASMCMD Commands.

Saving your ASM Spfile.


Check spfile location.

[root@rac1 bin]# su - grid
[grid@rac1 ~]$ echo $ORACLE_SID
+ASM1
[grid@rac1 ~]$ sqlplus / as sysasm

SQL*Plus: Release 11.2.0.1.0 Production on Sat Sep 22 00:46:33 2012

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


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Real Application Clusters and Automatic Storage Management options

SQL> show parameter spfile

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
spfile                               string      +CRS/rac-cluster/asmparameterf
                                                 ile/registry.253.792630659

spfile location can also be found using.

ASMCMD> spget
+CRS/rac-cluster/asmparameterfile/registry.253.792630659


Take backup of spfile using asmcmd to another diskgroup.

SQL> exit

[grid@rac1 ~]$ asmcmd
ASMCMD> spbackup +CRS/rac-cluster/asmparameterfile/registry.253.792630659    +FRA/spfileBackASM.bak


Check the backup

ASMCMD> cd +FRA
ASMCMD> ls
ASM/
DELL/
ORCL/
spfileBackASM.bak


Copy the file to operating system if you want to.

ASMCMD> cp spfileBackASM.bak /tmp/spfileBackASM.bak
copying +FRA/spfileBackASM.bak -> /tmp/spfileBackASM.bak



You can also directly copy the ASM spfile to other diskgroups or operating system.

ASMCMD> spcopy +CRS/rac-cluster/asmparameterfile/registry.253.792630659 /tmp/spfilecopyASM.ora




OTHER ASMCMD COMMANDS.

To list the clients that are connected through V$ASM_CLIENT view.

ASMCMD> lsct -g
Instance_ID  DB_Name  Status     Software_Version  Compatible_version  Instance_Name  Disk_Group
          1  +ASM     CONNECTED        11.2.0.1.0          11.2.0.1.0  +ASM1          CRS       
          1  +ASM     CONNECTED        11.2.0.1.0          11.2.0.1.0  +ASM1          DATA      
          1  +ASM     CONNECTED        11.2.0.1.0          11.2.0.1.0  +ASM1          FRA       
          2  +ASM     CONNECTED        11.2.0.1.0          11.2.0.1.0  +ASM2          CRS       
          2  +ASM     CONNECTED        11.2.0.1.0          11.2.0.1.0  +ASM2          DATA      
          1  dell     CONNECTED        11.2.0.1.0          11.2.0.0.0  dell1          DATA      
          1  dell     CONNECTED        11.2.0.1.0          11.2.0.0.0  dell1          FRA       
          2  dell     CONNECTED        11.2.0.1.0          11.2.0.0.0  dell2          DATA      
          2  dell     CONNECTED        11.2.0.1.0          11.2.0.0.0  dell2          FRA   


To check only a particular disk group.

ASMCMD> lsct -g CRS
Instance_ID  DB_Name  Status     Software_Version  Compatible_version  Instance_Name  Disk_Group
          1  +ASM     CONNECTED        11.2.0.1.0          11.2.0.1.0  +ASM1          CRS       
          2  +ASM     CONNECTED        11.2.0.1.0          11.2.0.1.0  +ASM2          CRS  


To list current ASM operations going on from V$ASM_OPERATION view.


ASMCMD> lsop
Group_Name  Dsk_Num  State  Power
FRA     REBAL    WAIT   5


To list users from ASM password file.


ASMCMD> lspwusr
Username sysdba sysoper sysasm 
     SYS   TRUE    TRUE   TRUE 
 ASMSNMP   TRUE   FALSE  FALSE 

To list disk group information through v$asm_diskgroup.


ASMCMD> lsdg
State    Type    Rebal  Sector  Block       AU  Total_MB  Free_MB  Req_mir_free_MB  Usable_file_MB  Offline_disks  Voting_files  Name
MOUNTED  NORMAL  N         512   4096  1048576      6141     5215              309            2453              0             N  CRS/
MOUNTED  NORMAL  N         512   4096  1048576     24568    17614                0            8807              0             N  DATA/
MOUNTED  NORMAL  N         512   4096  1048576     24568    20348                0           10174              0             N  FRA/



To list disk information through v$asm_disk. 


ASMCMD> lsdsk
Path
ORCL:VOL1
ORCL:VOL2
ORCL:VOL3
ORCL:VOL4
ORCL:VOL5
ORCL:VOL6
ORCL:VOL7


To Mount and Unmount Disk Groups.

ASMCMD> umount FRA
ASMCMD> lsdg
State    Type    Rebal  Sector  Block       AU  Total_MB  Free_MB  Req_mir_free_MB  Usable_file_MB  Offline_disks  Voting_files  Name
MOUNTED  NORMAL  N         512   4096  1048576      6141     5215              309            2453              0             N  CRS/
MOUNTED  NORMAL  N         512   4096  1048576     24568    17614                0            8807              0             N  DATA/
ASMCMD> mount FRA
ASMCMD> lsdg
State    Type    Rebal  Sector  Block       AU  Total_MB  Free_MB  Req_mir_free_MB  Usable_file_MB  Offline_disks  Voting_files  Name
MOUNTED  NORMAL  N         512   4096  1048576      6141     5215              309            2453              0             N  CRS/
MOUNTED  NORMAL  N         512   4096  1048576     24568    17614                0            8807              0             N  DATA/
MOUNTED  NORMAL  N         512   4096  1048576     24568    20344                0           10172              0             N  FRA/


 
To obtain I/O related information related to ASM Diskgroups every 2 secomds.

ASMCMD> iostat -et 2
Group_Name  Dsk_Name  Reads     Writes    Read_Err  Write_Err  Read_Time  Write_Time  
CRS         VOL1      98304     14336     0         0          .187       .055        
CRS         VOL2      61440     4096      0         0          .163       .013        
CRS         VOL7      124928    14336     0         0          .342       .023        
DATA        VOL3      43622400  11500544  0         0          40.484     5.051       
DATA        VOL4      82289152  11500544  0         0          64.281     5.521       
FRA         VOL5      57344     4096      0         0          .133       .009        
FRA         VOL6      61440     4096      0         0          .164       .015        

Only for a particular Disk group.

ASMCMD> iostat -et -G DATA 2
Group_Name  Dsk_Name  Reads     Writes    Read_Err  Write_Err  Read_Time  Write_Time  
DATA        VOL3      43622400  11500544  0         0          40.484     5.051       
DATA        VOL4      82289152  11500544  0         0          64.281     5.521       


ASMCMD File Copy Examples.


NOTE: while copying files you can't create files with name like OMF style,
File name should not contain the file number/incarnation.


[grid@rac1 ~]$ export ORACLE_SID=+ASM1

You can use -a option to login using "sysasm" or "sysdba". Default is sysasm if -a option is not used.

[grid@rac1 ~]$ asmcmd -a sysasm
ASMCMD>


Use MKDIR command to create "alpha" directory in +DATA & "beta" directory in +FRA.

ASMCMD> cd +DATA
ASMCMD> mkdir alpha
ASMCMD> cd +FRA
ASMCMD> mkdir beta


Copy file from one location to another in the same diskgroup.


ASMCMD> cd +data/orcl/datafile

ASMCMD> ls
EXAMPLE.264.823159661
SYSAUX.257.823159261
SYSTEM.256.823159249
UNDOTBS1.258.823159269
UNDOTBS2.265.823160343
USERS.259.823159269

ASMCMD> cp EXAMPLE.264.823159661 +data/alpha/example.bak
copying +data/orcl/datafile/EXAMPLE.264.823159661 -> +data/alpha/example.bak


Copy file from one diskgroup to another.

ASMCMD> cp EXAMPLE.264.823159661 +fra/beta/example.bak
copying +data/orcl/datafile/EXAMPLE.264.823159661 -> +fra/beta/example.bak

Copy files from ASM diskgroup to operating system.

ASMCMD> cp EXAMPLE.264.823159661 /tmp
copying +data/orcl/datafile/EXAMPLE.264.823159661 -> /tmp/EXAMPLE.264.823159661

Copy file from operating system to ASM diskgroup

ASMCMD> cp /tmp/EXAMPLE.264.823159661 +DATA/alpha/example111.bak
copying /tmp/EXAMPLE.264.823159661 -> +DATA/alpha/example111.bak




OTHER ASMCMD OPTIONS


To display asmcmd version:

For example:

$ asmcmd -v
asmcmd version 11.2.0.1.0


Show current directory path in asmcmd prompt


$ asmcmd -p
ASMCMD [+] > cd data
ASMCMD [+data] >



0 comments:

Post a Comment