Database 11g

Wednesday, March 16, 2016

ASMCMD IN ORACLE WINDOWS 2008 Server



>> ASMCMD  is a command line utility for managing files and directories in ASM diskgroups.

>> It offers Unix-style filesystem commands for managing ASM directories and files.
     Prior to Oracle 10gR2,ASM had to be administered via OEM or SQL statements while connected to a               special ASM instance.

>> ASMCMD cannot be used to create or drop diskgroups, or to add or drop disks in a disk group.
   These ASM administrative tasks must be accomplished via SQL commands.


Invoking ASMCMD


> The asmcmd utility is located in ORACLE_HOME/bin.


D:\app\oracle\product\11.2.0\dbhome_1\BIN> dir asmcmd.bat
 Volume in drive D has no label.
 Volume Serial Number is E2B9-6A23

 Directory of D:\app\oracle\product\11.2.0\dbhome_1\BIN

04/28/2010  09:20 PM             2,809   asmcmd.bat
               1 File(s)          2,809 bytes
               0 Dir(s)  48,266,641,408 bytes free

> We start asmcmd by setting ORACLE_SID to the ASM instance.


C:\Users\oracle>set ORACLE_HOME=D:\app\oracle\product\11.2.0\dbhome_1

C:\Users\oracle>set oracle_sid=+asm ( For Single Instance)

C:\Users\oracle>set oracle_sid=+ASM1  (For RAC use ASM1 ,ASM2 depends upon your node)

C:\Users\oracle>sqlplus / as sysasm

SQL*Plus: Release 11.2.0.3.0 Production on Wed Mar 16 13:52:59 2016

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


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

SQL> select instance_name from v$instance;

INSTANCE_NAME
----------------
+asm1

SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Real Application Clusters and Automatic Storage Management options

C:\Users\oracle>asmcmd
ASMCMD>

Some Examples for asmcmd :-

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       EXTERN      N         512     4096    1048576    511994     380349                 0                380349                 0             N         DATA/
MOUNTED       EXTERN      N         512     4096    1048576    102397     102002                 0                102002                 0             Y       OCRVOTE/
MOUNTED       EXTERN      N         512     4096    1048576    511997     496080                 0                496080                 0             N         RECO/


ASMCMD> ls
DATA/
OCRVOTE/
RECO/

ASMCMD> ls -l
State                        Type         Rebal       Name
MOUNTED             EXTERN        N          DATA/
MOUNTED             EXTERN        N         OCRVOTE/
MOUNTED             EXTERN        N         RECO/

ASMCMD> du
Used_MB      Mirror_used_MB
 147607              147607

ASMCMD> lsct

DB_Name           Status             Software_Version  Compatible_version  Instance_Name  Disk_Group

+ASM           CONNECTED        11.2.0.3.0               11.2.0.3.0                    +asm1               DATA
+ASM           CONNECTED        11.2.0.3.0               11.2.0.3.0                    +asm1            OCRVOTE
hrlive            CONNECTED        11.2.0.3.0               11.2.0.0.0                     hrlive1              DATA
hrlive            CONNECTED        11.2.0.3.0               11.2.0.0.0                     hrlive1              RECO
IECLIVE       CONNECTED        11.2.0.3.0               11.2.0.0.0                     ieclive1            DATA
IECLIVE       CONNECTED        11.2.0.3.0               11.2.0.0.0                     ieclive1            RECO


ASMCMD> lsdsk
Path
\\.\ORCLDISKDATA0
\\.\ORCLDISKDATA1
\\.\ORCLDISKOCRVOTE0
\\.\ORCLDISKRECO0


>> You can use the "?" or "help" command to display all asmcmd commands:


ASMCMD> ?

      Commands  :-
   

        md_backup, md_restore

        lsattr, setattr

        cd, cp, du, find, help, ls, lsct, lsdg, lsof, mkalias
        mkdir, pwd, rm, rmalias

        chdg, chkdg, dropdg, iostat, lsdsk, lsod, mkdg, mount
        offline, online, rebal, remap, umount

        dsget, dsset, lsop, shutdown, spbackup, spcopy, spget
        spmove, spset, startup

        chtmpl, lstmpl, mktmpl, rmtmpl

        chgrp, chmod, chown, groups, grpmod, lsgrp, lspwusr, lsusr
        mkgrp, mkusr, orapwusr, passwd, rmgrp, rmusr

        volcreate, voldelete, voldisable, volenable, volinfo
        volresize, volset, volstat


ASMCMD Commands With Description :-


cd                  :  Change directory
cp                  :  Copy file
du                  :  Disk space used by a directory and its subdirectories
exit                :  Exit the utility
find                :  Locate the path for all occurrences of the specified filename
help               :  Displays Command Assistance
ls                   :  List the contents of a directory
lsct                :  List info about ASM clients
lsdg               :  List all disk groups and their attributes
lsdsk              : List all physical disks visible to ASM
md_backup    : Create a backup of the mounted diskgroups
md_restore    :  Restore the diskgroups from a backup.
mkalias          :  Create an alias for a system generated filename.
mkdir             :  Create directory
PWD              :  Print Working Directory
remap            :   Repair a range of blocks on a disk
rm                  :  Remove the specified files or directories
rmalias           :  Remove specified alias


Happy Learning ...












No comments:

Post a Comment