Forgot your password?    
+ Reply to Thread
Results 1 to 1 of 1

Thread: asmcmd Usage with Examples

  1. #1
    Expert Oracle Administrator
    Join Date
    Oct 2011
    Location
    New Delhi, India
    Posts
    427

    asmcmd Usage with Examples

    ASMCMD is a utility that can be used to manage ASM (Automatic Storage Management) diskgroups. This utility uses familiar Unix-style filesystem commands to view and manage ASM files and directories.

    Here are the details for my setup :

    Connecting to asmcmd :
    =====================
    rac1-> ps -ef | grep pmon
    oracle 11454 1 0 Nov22 ? 00:01:05 asm_pmon_+ASM1
    oracle 16486 1 0 Nov22 ? 00:01:19 ora_pmon_devdb1
    oracle 18871 18649 0 08:12 pts/4 00:00:00 grep pmon

    rac1-> export ORACLE_SID=+ASM1

    rac1-> which asmcmd
    /u01/app/oracle/product/10.2.0/db_1/bin/asmcmd

    rac1-> asmcmd
    ASMCMD> exit
    rac1->

    The asmcmd utility also provides a useful "-p" option that will display the current path in the prompt. We can navigate through the structure using "cd", "ls" and "pwd" commands
    =====================


    rac1-> asmcmd -p
    ASMCMD [+] > pwd
    +
    ASMCMD [+] > ls -l
    State Type Rebal Unbal Name
    MOUNTED EXTERN N N DATA/
    MOUNTED EXTERN N N FLASH/
    ASMCMD [+] > cd DATA

    ASMCMD [+DATA] > pwd
    +DATA
    ASMCMD [+DATA] >


    To search for files having a particular pattern , we can use 'find'.
    ==============================================
    ASMCMD [+DATA] > pwd
    +DATA
    ASMCMD [+DATA] > find . system*
    +DATA/DEVDB/DATAFILE/SYSTEM.256.766522855
    +DATA/DEVDB/DATAFILE/SYSTEM.268.767732783
    +DATA/DEVDB/DATAFILE/SYSTEM.269.767732819
    ASMCMD [+DATA] >

    List all diskgroups using 'lsdg'
    ======================

    ASMCMD [+DATA] > lsdg
    State Type Rebal Unbal Sector Block AU Total_MB Free_MB Req_mir_free_MB Usable_file_MB Offline_disks Name
    MOUNTED EXTERN N N 512 4096 1048576 15236 13893 0 13893 0 DATA/
    MOUNTED EXTERN N N 512 4096 1048576 10236 9792 0 9792 0 FLASH/
    ASMCMD [+DATA] >


    To check disk utilization use 'du'
    ========================
    ASMCMD [+DATA] > du .
    Used_MB Mirror_used_MB
    1247 1247
    ASMCMD [+DATA] >


    For Getting help , use the 'help' command:
    =================================
    ASMCMD [+DATA] > help
    asmcmd [-p] [command]

    The environment variables ORACLE_HOME and ORACLE_SID determine the
    instance to which the program connects, and ASMCMD establishes a
    bequeath connection to it, in the same manner as a SQLPLUS / AS
    SYSDBA. The user must be a member of the SYSDBA group.

    Specifying the -p option allows the current directory to be displayed
    in the command prompt, like so:

    ASMCMD [+DATAFILE/ORCL/CONTROLFILE] >

    [command] specifies one of the following commands, along with its
    parameters.

    Type "help [command]" to get help on a specific ASMCMD command.

    commands:
    --------
    cd
    du
    find
    help
    ls
    lsct
    lsdg
    mkalias
    mkdir
    pwd
    rm
    rmalias


    To Get help on a specific command use 'help <command>'
    ============================================
    ASMCMD [+DATA] > help lsct
    lsct [-H] [group]

    List all clients and their attributes from V$ASM_CLIENT. If group is
    specified, then return only information on that group.

    The -H flag suppresses the column headers from the output.

    ASMCMD [+DATA] > lsct
    DB_Name Status Software_Version Compatible_version Instance_Name
    devdb CONNECTED 10.2.0.1.0 10.2.0.1.0 devdb1
    devdb CONNECTED 10.2.0.1.0 10.2.0.1.0 devdb1

    ..For a particular Disk Group:

    ASMCMD> lsct DATA
    DB_Name Status Software_Version Compatible_version Instance_Name
    devdb CONNECTED 10.2.0.1.0 10.2.0.1.0 devdb2
    ASMCMD>
    ASMCMD> lsct FLASH
    DB_Name Status Software_Version Compatible_version Instance_Name
    devdb CONNECTED 10.2.0.1.0 10.2.0.1.0 devdb2
    ASMCMD>


    To Remove a file (BE CAREFUL):
    ==========================
    ASMCMD [+DATA/DEVDB] > ls
    CONTROLFILE/
    DATAFILE/
    ONLINELOG/
    PARAMETERFILE/
    TEMPFILE/
    spfiledevdb.ora

    ASMCMD [+DATA/DEVDB] > rm spfiledevdb.ora
    ASMCMD [+DATA/DEVDB] > ls
    CONTROLFILE/
    DATAFILE/
    ONLINELOG/
    TEMPFILE/
    ASMCMD [+DATA/DEVDB] >

+ Reply to Thread

Similar Threads

  1. Oracle RAC 11gR2 ASMCMD Commands.
    By ajaychandi in forum RAC Installation, ASM Install , ASM Administration
    Replies: 0
    Last Post: 09-22-2012, 12:01 PM
  2. Autoconfig Usage in Oracle Apps 11i and R12
    By Hemant in forum AD Utilities , Autoconfig , FND Utilities
    Replies: 5
    Last Post: 02-23-2012, 09:37 PM
  3. adctrl Usage , Diagnosis and Resolution
    By pkumar in forum Oracle Apps Patching and Cloning, Installation , Migration,Upgrades
    Replies: 1
    Last Post: 01-14-2012, 11:23 AM
  4. Audit Setup and Fine Grained Auditing with Examples
    By shoaibansari in forum Core Database Administration and Monitoring
    Replies: 0
    Last Post: 01-09-2012, 03:55 PM
  5. SQL Query Hints examples and Syntax
    By Amit in forum Database Performance Management,Database Links,Materialized Views
    Replies: 0
    Last Post: 11-04-2011, 10:08 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

DBA Lounge (P) Ltd. deals in Oracle Technologies on Consulting, Resourcing, Corporate Training


Online and corporate training available on Oracle Database 11g, Oracle 11g Real Application Cluster (RAC), Oracle Applications 11i/R12, Oracle Fusion Middleware 11g, Oracle Identity Management-OIM, Oracle Internet Directory 11g-OID, Oracle Business Intelligence Enterprise Edition-OBIEE, Oracle Golden Gate, Oracle Access Management-OAM, Oracle Internet Directory-ODS, Oracle Identity Analytics Architecture-OIA Statistics