Learn the basic Oracle ASM Command in Oracle Database
Posted by Mir Sayeed Hassan on November 16th, 2022
Learn the basic command of Oracle ASM in Oracle Database
Login to the Oracle ASM Instance
[oracle@ractest1 ~]$ . oraenv ORACLE_SID = [+ASM1] ? +ASM1 The Oracle base remains unchanged with value /u02/app/oracle
ls – It displays the list of disk associated to single instance.
ASMCMD> ls DATA/
ls -g – It displays the list of disks from multiple instance ID(INST_ID).
ASMCMD> ls -g Inst_ID Name ---------------- 1 DATA/ 2 DATA/
Similary by using query GV$ASM_DISKGROUP_STAT view:
SQL> desc GV$ASM_DISKGROUP_STAT; Name Null? Type ------------------------------------------- INST_ID NUMBER GROUP_NUMBER NUMBER NAME VARCHAR2(30) SECTOR_SIZE NUMBER BLOCK_SIZE NUMBER ALLOCATION_UNIT_SIZE NUMBER STATE VARCHAR2(11) TYPE VARCHAR2(6) TOTAL_MB NUMBER FREE_MB NUMBER HOT_USED_MB NUMBER COLD_USED_MB NUMBER REQUIRED_MIRROR_FREE_MB NUMBER USABLE_FILE_MB NUMBER OFFLINE_DISKS NUMBER COMPATIBILITY VARCHAR2(60) DATABASE_COMPATIBILITY VARCHAR2(60) VOTING_FILES VARCHAR2(1)
lsdg – It display all disk groups and their attributes.
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 10236 2849 0 2849 0 Y DATA/
lsdg -g – It display all the disks from multiple nodes with attributes.
ASMCMD> lsdg -g Inst_ID State Type Rebal Sector Block AU Total_MB Free_MB Req_mir_free_MB Usable_file_MB Offline_disks Voting_files Name ---------------------------------------------------------------------------------------------------------------------------------------------------------- 1 MOUNTED EXTERN N 512 4096 1048576 10236 2849 0 2849 0 Y DATA/ 2 MOUNTED EXTERN N 512 4096 1048576 10236 2849 0 2849 0 Y DATA/
Similary bu using the query V$ASM_DISKGROUP view:
SQL> desc V$ASM_DISKGROUP; Name Null? Type ----------------------------------------- -------- ---------------------------- GROUP_NUMBER NUMBER NAME VARCHAR2(30) SECTOR_SIZE NUMBER BLOCK_SIZE NUMBER ALLOCATION_UNIT_SIZE NUMBER STATE VARCHAR2(11) TYPE VARCHAR2(6) TOTAL_MB NUMBER FREE_MB NUMBER HOT_USED_MB NUMBER COLD_USED_MB NUMBER REQUIRED_MIRROR_FREE_MB NUMBER USABLE_FILE_MB NUMBER OFFLINE_DISKS NUMBER COMPATIBILITY VARCHAR2(60) DATABASE_COMPATIBILITY VARCHAR2(60) VOTING_FILES VARCHAR2(1)
lsct – This command lists all clients and their attributes.
ASMCMD> lsct DB_Name Status Software_Version Compatible_version Instance_Name Disk_Group ------------------------------------------------------------------------------------------------------- +ASM CONNECTED 11.2.0.4.0 11.2.0.4.0 +ASM1 DATA orcl CONNECTED 11.2.0.4.0 11.2.0.4.0 rac11 DATA
Similary bu using the query level V$ASM_CLIENT:
SQL> desc V$ASM_CLIENT; Name Null? Type -------------------------------------------------------- GROUP_NUMBER NUMBER INSTANCE_NAME VARCHAR2(64) DB_NAME VARCHAR2(8) STATUS VARCHAR2(12) SOFTWARE_VERSION VARCHAR2(60) COMPATIBLE_VERSION VARCHAR2(60)
lsdsk – This command lists ASM-visible disks. Some of the Valid options for lsdsk are as follows:
ASMCMD> lsdsk Path ORCL:DATA
ASMCMD> lsdsk -g Inst_ID Path 1 ORCL:DATA 2 ORCL:DATA
ASMCMD> lsdsk -t Create_Date Mount_Date Repair_Timer Path ----------------------------------------- 17-MAY-22 14-NOV-22 0 ORCL:DATA
ASMCMD> lsdsk -p Group_Num Disk_Num Incarn Mount_Stat Header_Stat Mode_Stat State Path ----------------------------------------- -------- ---------------------------- 1 0 3916020557 CACHED MEMBER ONLINE NORMAL ORCL:DATA
ASMCMD> lsdsk -k Total_MB Free_MB OS_MB Name Failgroup Failgroup_Type Library Label UDID Product Redund Path ----------------------------------------- -------- ----------------------------------------------------------------------- -------- ---------------------- 10236 2849 10236 DATA DATA REGULAR ASM Library - Generic Linux, version 2.0.12 (KABI_V2) DATA UNKNOWN ORCL:DATA
pwd – This command will display the current working directory
ASMCMD> pwd +DATA/ORCL
cp – This command will copy the file from ASM to File System
ASMCMD> cp Current.260.1105029389 /tmp copying +DATA/ORCL/CONTROLFILE/Current.260.1105029389 -> /tmp/Current.260.1105029389
ls -lt – This command will display files along with current time
ASMCMD> ls -lt Type Redund Striped Time Sys Name ------------------------------------ -------- ---------------------------- CONTROLFILE UNPROT FINE NOV 16 15:00:00 Y Current.260.1105029389