Oracle 11g RAC – ASM : asmcmd

28 Sep

###########################################
Oracle 11g RAC – ASM : asmcmd
###########################################
1. mengaktifkan asmcmd, dengan mengaktifkan ORACLE_SID yang benar.
[oracle@node1 ~]$ ORACLE_SID=node1; export ORACLE_SID
[oracle@node1 ~]$ asmcmd
ASMCMD-08103: failed to connect to ASM; ASMCMD running in non-connected mode
ASMCMD> exit
[oracle@node1 ~]$ ORACLE_SID=+ASM1; export ORACLE_SID
[oracle@node1 ~]$ asmcmd
ASMCMD>
ASMCMD> exit
[oracle@node1 ~]$ asmcmd -v
asmcmd version 11.1.0.6.0

2. perintah – perintah di asmcmd (ASM Commands)
cd : Changes the current directory to the specified directory.
cp : Enables you to copy files between ASM disk groups on a local instance and remote instances.
du : Displays the total disk space occupied by ASM files in the specified ASM directory and all of its subdirectories, recursively.
exit : Exits ASMCMD.
find : Lists the paths of all occurrences of the specified name (with wildcards) under the specified directory.
help : Displays the syntax and description of ASMCMD commands.
ls : Lists the contents of an ASM directory, the attributes of the specified file, or the names and attributes of all disk groups.
lsct : Lists information about current ASM clients.
lsdg : Lists all disk groups and their attributes.
lsdsk : Lists disks visible to ASM.
md_backup : Creates a backup of all of the mounted disk groups.
md_restore : Restores disk groups from a backup.
mkalias : Creates an alias for system-generated filenames.
mkdir : Creates ASM directories.
pwd : Displays the path of the current ASM directory.
remap : Repairs a range of physical blocks on a disk.
rm : Deletes the specified ASM files or directories.
rmalias : Deletes the specified alias, retaining the file that the alias points to.

3. perintah dasar asmcmd yang sering digunakan
[oracle@node1 ~]$ asmcmd
ASMCMD> ls
DATA1/
DATA2/
DATA3/
DATA4/
ASMCMD> cd +DATA1/NODE
ASMCMD> pwd
+DATA1/NODE
ASMCMD> ls
AUTOBACKUP/
CONTROLFILE/
DATAFILE/
ONLINELOG/
PARAMETERFILE/
TEMPFILE/
spfilenode.ora
ASMCMD> exit
[oracle@node1 ~]$

4. menghitung kapasitas disk, dimana
Used_MB – This value does not include mirroring.
Mirror_used_MB – This value includes mirroring.
[oracle@node1 ~]$ asmcmd
ASMCMD> du +DATA1
Used_MB Mirror_used_MB
3829 3829
ASMCMD> du +DATA1/NODE/DATAFILE
Used_MB Mirror_used_MB
3135 3135
ASMCMD> du +DATA1/NODE/CONTROLFILE
Used_MB Mirror_used_MB
48 48

5. informasi asm lainnya
ASMCMD> lsct
DB_Name Status Software_Version Compatible_version Instance_Name Disk_Group
node CONNECTED 11.1.0.6.0 11.1.0.0.0 node1 DATA1
ASMCMD> lsdg
State Type Rebal Sector Block AU Total_MB Free_MB Req_mir_free_MB Usable_file_MB Offline_disks Name
MOUNTED EXTERN N 512 4096 1048576 51199 47276 0 47276 0 DATA1/
MOUNTED EXTERN N 512 4096 1048576 51199 51106 0 51106 0 DATA2/
MOUNTED EXTERN N 512 4096 1048576 51199 51106 0 51106 0 DATA3/
MOUNTED EXTERN N 512 4096 1048576 102398 102305 0 102305 0 DATA4/

ASMCMD> lsdsk
Path
/dev/oracleasm/disks/VOL1
/dev/oracleasm/disks/VOL2
/dev/oracleasm/disks/VOL3
/dev/oracleasm/disks/VOL_1
ASMCMD> exit

6. asmcmd tidak mengenal huruf besar / kecil
[oracle@node1 ~]$ asmcmd -p
ASMCMD [+] > ls -la
State Type Rebal Name
MOUNTED EXTERN N DATA1/
MOUNTED EXTERN N DATA2/
MOUNTED EXTERN N DATA3/
MOUNTED EXTERN N DATA4/
ASMCMD [+] > ls -la /data1/node/controlfile
Type Redund Striped Time Sys Name
CONTROLFILE UNPROT FINE SEP 27 09:00:00 Y none => Current.260.666184329
CONTROLFILE UNPROT FINE SEP 27 09:00:00 Y none => Current.261.666184329

ASMCMD [+] > exit

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: