Call now: 252-767-6166  
Oracle Training Oracle Support Development Oracle Apps

 
 Home
 E-mail Us
 Oracle Articles
New Oracle Articles


 Oracle Training
 Oracle Tips

 Oracle Forum
 Class Catalog


 Remote DBA
 Oracle Tuning
 Emergency 911
 RAC Support
 Apps Support
 Analysis
 Design
 Implementation
 Oracle Support


 SQL Tuning
 Security

 Oracle UNIX
 Oracle Linux
 Monitoring
 Remote s
upport
 Remote plans
 Remote
services
 Application Server

 Applications
 Oracle Forms
 Oracle Portal
 App Upgrades
 SQL Server
 Oracle Concepts
 Software Support

 Remote S
upport  
 Development  

 Implementation


 Consulting Staff
 Consulting Prices
 Help Wanted!

 


 Oracle Posters
 Oracle Books

 Oracle Scripts
 Ion
 Excel-DB  

Don Burleson Blog 


 

 

 


 

 

 

 

 

ASMCMD Tips

Oracle Database Tips by Donald BurlesonJune 29, 2015

Oracle 11g New Features Tips

With the version 10gR2, Oracle has introduced the ASM command line interface asmcmd. This makes it easy to find out how much space is left in the disk groups and which files are inside the ASM storage. It is not necessary to know what an Oracle ASM instance is and how to start an Oracle Container for Java (OC4J) in order to use the enterprise manager interface for ASM. All that needs to be in place is a shell with the proper environment ($ORACLE_SID and $ORACLE_HOME).

Also see ASM Template Tips.

Oracle 11g ships with an enhanced version of asmcmd.  There are a number of additional functionalities and new commands in 11g.  Here is a listing of the help function in asmcmd 11g:

[oracle@rhas4 ~]$ export ORACLE_SID=+ASM
[oracle@rhas4 ~]$ asmcmd
ASMCMD> help
...

        Type "help [command]" to get help on a specific ASMCMD command.
 
        commands:
        --------
        help
 
        cd
        cp
        du
        find
        ls
        lsct
        lsdg
        mkalias
        mkdir
        pwd
        rm
        rmalias 
        md_backup
        md_restore
        lsdsk
        remap

The lsdsk command can be used to display the disk paths for all ASM disks. It utilizes the dynamic performance view v$asm_disk respectively gv$asm_disk in a clustered environment if the ASM instance is up and running. If it is down, then asmcmd can only run in non-connected mode. In this case, lsdsk reads the headers of the ASM disks. This command comes in very handy for storage administrators. They can use it to obtain and maintain lists of disks used by ASM.

ASMCMD> lsdsk

Path
/dev/raw/raw1
/dev/raw/raw2
/dev/raw/raw3
/dev/raw/raw
[oracle@rhas4 ~]$ asmcmd

ASMCMD-08103: failed to connect to ASM; ASMCMD running in non-connected mode

ASMCMD> lsdsk

Path
/dev/raw/raw1
/dev/raw/raw2
/dev/raw/raw3
/dev/raw/raw4

The cp command can be used to copy files from one ASM diskgroup to another one regardless of whether it is a local disk group or one which is located remotely. The most interesting new commands are md_backup and md_restore. With these commands, the metadata of ASM disk groups can be dumped into a flat file and can use this backup to restore the metadata in case the diskgroup needs to be rebuilt even if a new diskgroup is created.

ASMCMD> help md_backup
        md_backup [-b <backup_file>]
                  [-g '<diskgroup_name>,<diskgroup_name>,...']

        Perform ASM metadata backup for disk groups.
        Back up into backup file disk group metadata information including
        fail groups, disks, attributes, aliases, and templates.
        -b Store information into <backup_file>. If not specified, it will
           be stored into the file ambr_backup_intermediate_file.
        -g Disk groups to backup. All diskgroups are backed up by default.

ASMCMD> help md_restore
        md_restore -b <backup_file> [-li]
                   [-t (full)|nodg|newdg] [-f <sql_script_file>]
                   [-g '<diskgroup_name>,<diskgroup_name>,...']
                   [-o '<old_diskgroup_name>:<new_diskgroup_name>,...'] 

        Perform ASM Metadata restore for disk groups.
        -b Read metadata information from <backup_file>.
        -l Print messages to a file (Not implemented).
        -i Ignore errors. Normally if md_restore encounters an error, it
           will stop. Specifying this flag ignores that.
        -t Specify diskgroup creation.
           full - create disk group and restore metadata.
           nodg - restore metadata only.
           newdg - create disk group with a different name and restore
                   metadata; -o is required.
        -f Write SQL commands to <sql_script_file> instead of executing them.
        -g Select the disk groups to be restored. If no disk groups defined,
           all of them will be restored.
        -o Rename disk group <old_diskgroup_name> to <new_diskgroup_name>.

ASMCMD> md_backup -b my_diskgroup_metadata.lst
Disk group to be backed up: DATA
Disk group to be backed up: FRA

The metadata contain information about the disk path, disk name, failure groups, attributes, templates and user created directory structure of disk groups. The following listing shows the exported metadata from the dumpfile which was created in the local directory with the name that is specified.

[oracle@rhas4 ~]$ cat my_diskgroup_metadata.lst
@diskgroup_set =  (
 {
  'ATTRINFO' => {
'AU_SIZE' => '1048576',
'DISK_REPAIR_TIME' => '3.6h',
'COMPATIBLE.ASM' => '11.1.0.0.0',
'COMPATIBLE.RDBMS' => '10.1.0.0.0'
},

'DISKSINFO' => {
'DATA_0001' => {
'DATA_0001' => {
'TOTAL_MB' => '2047',
'FAILGROUP' => 'DATA_0001',
'NAME' => 'DATA_0001',
'DGNAME' => 'DATA',
'PATH' => '/dev/raw/raw2'
}
},
'DATA_0000' => {
'DATA_0000' => {
'TOTAL_MB' => '2047',
'FAILGROUP' => 'DATA_0000',
'NAME' => 'DATA_0000',
'DGNAME' => 'DATA',
'PATH' => '/dev/raw/raw1'
}
}
},
'DGINFO' => {
'DGTORESTORE' => 0,
'DGCOMPAT' => '11.1.0.0.0',
'DGNAME' => 'DATA',
'DGDBCOMPAT' => '10.1.0.0.0',
'DGTYPE' => 'NORMAL',
'DGAUSZ' => '1048576'
},
'ALIASINFO' => {},
'TEMPLATEINFO' => {
'6' => {
'DGNAME' => 'DATA',
'STRIPE' => 'COARSE',
'TEMPNAME' => 'XTRANSPORT',
'REDUNDANCY' => 'MIRROR',
'SYSTEM' => 'Y'
},
'11' => {
'DGNAME' => 'DATA',
'STRIPE' => 'FINE',
'TEMPNAME' => 'ONLINELOG',
'REDUNDANCY' => 'MIRROR',
'SYSTEM' => 'Y'
},
'3' => {
'DGNAME' => 'DATA',
'STRIPE' => 'COARSE',
'TEMPNAME' => 'DATAGUARDCONFIG',
'REDUNDANCY' => 'MIRROR',
'SYSTEM' => 'Y'
},
'7' => {
'DGNAME' => 'DATA',
'STRIPE' => 'COARSE',
'TEMPNAME' => 'AUTOBACKUP',
'REDUNDANCY' => 'MIRROR',
'SYSTEM' => 'Y'
},
'9' => {
'DGNAME' => 'DATA',
'STRIPE' => 'COARSE',
'TEMPNAME' => 'TEMPFILE',
'REDUNDANCY' => 'MIRROR',
'SYSTEM' => 'Y'
},
'2' => {
'DGNAME' => 'DATA',
'STRIPE' => 'COARSE',
'TEMPNAME' => 'ASM_STALE',
'REDUNDANCY' => 'HIGH',
'SYSTEM' => 'Y'
},
'12' => {
'DGNAME' => 'DATA',
'STRIPE' => 'COARSE',
'TEMPNAME' => 'ARCHIVELOG',
'REDUNDANCY' => 'MIRROR',
'SYSTEM' => 'Y'
},
'8' => {
'DGNAME' => 'DATA',
'STRIPE' => 'COARSE',
'TEMPNAME' => 'BACKUPSET',
'REDUNDANCY' => 'MIRROR',
'SYSTEM' => 'Y'
},
'4' => {
'DGNAME' => 'DATA',
'STRIPE' => 'FINE',
'TEMPNAME' => 'FLASHBACK',
'REDUNDANCY' => 'MIRROR',
'SYSTEM' => 'Y'
},
'1' => {
'DGNAME' => 'DATA',
'STRIPE' => 'COARSE',
'TEMPNAME' => 'DUMPSET',
'REDUNDANCY' => 'MIRROR',
'SYSTEM' => 'Y'
},
'0' => {
'DGNAME' => 'DATA',
'STRIPE' => 'COARSE',
'TEMPNAME' =>'PARAMETERFILE',
'REDUNDANCY' => 'MIRROR',
'SYSTEM' => 'Y'
},
'10' => {
'DGNAME' => 'DATA',
'STRIPE' => 'COARSE',
'TEMPNAME' => 'DATAFILE',
'REDUNDANCY' => 'MIRROR',
'SYSTEM' => 'Y'
},
'13' => {
'DGNAME' => 'DATA',
'STRIPE' => 'FINE',
'TEMPNAME' => 'CONTROLFILE',
'REDUNDANCY' => 'HIGH',
'SYSTEM' => 'Y'
},
'5' => {
'DGNAME' => 'DATA',
'STRIPE' => 'COARSE',
'TEMPNAME'=> CHANGETRACKING',
'REDUNDANCY' => 'MIRROR',
'SYSTEM' => 'Y'
}
}
},    
{
'DISKSINFO' => {
'FAIL1' => {
'FRA_0001' => {
'TOTAL_MB' => '2047',
'FAILGROUP' => 'FAIL1',
'NAME' => 'FRA_0001',
'DGNAME' => 'FRA',
'PATH' => '/dev/raw/raw3'
}
},
'FAIL2' => {
'FRA_0000' => {
'TOTAL_MB' => '2047',
'FAILGROUP' => 'FAIL2',
'NAME' => 'FRA_0000',
'DGNAME' => 'FRA',
'PATH' => '/dev/raw/raw4'
}
}
},
'DGINFO' => {
'DGTORESTORE' => 0,
'DGCOMPAT' => '10.1.0.0.0',
'DGNAME' => 'FRA',
'DGDBCOMPAT' => '10.1.0.0.0',
'DGTYPE' => 'NORMAL',
'DGAUSZ' => '1048576'
},
'ALIASINFO' => {},
'TEMPLATEINFO' => {
'6' => {
'DGNAME' => 'FRA',
'STRIPE' => 'COARSE',
'TEMPNAME' => 'ASM_STALE',
'REDUNDANCY' => 'HIGH',
'SYSTEM' => 'Y'
},
'11' => {
'DGNAME' => 'FRA',
'STRIPE' => 'FINE',
'TEMPNAME' => 'CONTROLFILE',
 => 'HIGH',
'SYSTEM' => 'Y'
},
'3' => {
'DGNAME' => 'FRA',
'STRIPE' => 'COARSE',
'TEMPNAME' => 'CHANGETRACKING',
'REDUNDANCY' => 'MIRROR',
'SYSTEM' => 'Y'
},
'7' => {
'DGNAME' => 'FRA',
'STRIPE' => 'COARSE',
'TEMPNAME' => 'TEMPFILE',
'REDUNDANCY' => 'MIRROR',
'SYSTEM' => 'Y'
},
'9' => {
'DGNAME' => 'FRA',
'STRIPE' => 'FINE',
'TEMPNAME' => 'ONLINELOG',
'REDUNDANCY' => 'MIRROR',
'SYSTEM' => 'Y'
},
'2' => {
'DGNAME' => 'FRA',
'STRIPE' => 'FINE',
'TEMPNAME' => 'FLASHBACK',
'REDUNDANCY' => 'MIRROR',
'SYSTEM' => 'Y'
},
'12' => {
'DGNAME' => 'FRA',
'STRIPE' => 'COARSE',
'TEMPNAME' => 'DUMPSET',
'REDUNDANCY' => 'MIRROR',
'SYSTEM' => 'Y'
},
'8' => {
'DGNAME' => 'FRA',
STRIPE' => 'COARSE',
'TEMPNAME' => 'DATAFILE',
'REDUNDANCY' => 'MIRROR',
'SYSTEM' => 'Y'
},
'1' => {
'DGNAME' => 'FRA',
'STRIPE' => 'COARSE',
'TEMPNAME'=> 'DATAGUARDCONFIG',
'REDUNDANCY' => 'MIRROR',
'SYSTEM' => 'Y'
},
'4' => {
'DGNAME' => 'FRA',
'STRIPE' => 'COARSE',
'TEMPNAME' => 'XTRANSPORT',
'REDUNDANCY' => 'MIRROR',
'SYSTEM' => 'Y'
},
'0' => {
'DGNAME' => 'FRA',
'STRIPE' => 'COARSE',
'TEMPNAME' =>'PARAMETERFILE',
'REDUNDANCY' => 'MIRROR',
'SYSTEM' => 'Y'
},
'10' => {
'DGNAME' => 'FRA',
'STRIPE' => 'COARSE',
'TEMPNAME' => 'ARCHIVELOG',
'REDUNDANCY' => 'MIRROR',
'SYSTEM' => 'Y'
},
'13' => {
'DGNAME' => 'FRA',
'STRIPE' => 'COARSE',
'TEMPNAME' => 'BACKUPSET',
'REDUNDANCY' => 'MIRROR',
'SYSTEM' => 'Y'
},
'5' => {
'DGNAME' => 'FRA',
'STRIPE' => 'COARSE',
'TEMPNAME' => 'AUTOBACKUP',
'REDUNDANCY' => 'MIRROR',
'SYSTEM' => 'Y'
}
}
}
);

 

This is an excerpt from the new book Oracle 11g New Features: Expert Guide to the Important New Features by John Garmany, Steve Karam, Lutz Hartmann, V. J. Jain, Brian Carr.

You can buy it direct from the publisher for 30% off.

 

 
��  
 
 
Oracle Training at Sea
 
 
 
 
oracle dba poster
 

 
Follow us on Twitter 
 
Oracle performance tuning software 
 
Oracle Linux poster
 
 
 

 

Burleson is the American Team

Note: This Oracle documentation was created as a support and Oracle training reference for use by our DBA performance tuning consulting professionals.  Feel free to ask questions on our Oracle forum.

Verify experience! Anyone considering using the services of an Oracle support expert should independently investigate their credentials and experience, and not rely on advertisements and self-proclaimed expertise. All legitimate Oracle experts publish their Oracle qualifications.

Errata?  Oracle technology is changing and we strive to update our BC Oracle support information.  If you find an error or have a suggestion for improving our content, we would appreciate your feedback.  Just  e-mail:  

and include the URL for the page.


                    









Burleson Consulting

The Oracle of Database Support

Oracle Performance Tuning

Remote DBA Services


 

Copyright © 1996 -  2020

All rights reserved by Burleson

Oracle ® is the registered trademark of Oracle Corporation.