In the Oracle RAC environment, use the grid account to execute
Run asmcmd to enter asm command mode, such as:
[grid@oradb-node1 ~]$ asmcmd
ASMCMD>
ASMCMD> du //Display all disk space occupied by ASM files in the specified ASM directory
ASMCMD> ls -ls //List the contents of the ASM directory and its attributes, disk space occupation
ASMCMD> pwd //View the current path
ASMCMD> cd ../DATA //Switch directory
ASMCMD> lsct //List the information of the current ASM client
ASMCMD> lsdg //List all diskgroups and their attributes
ASMCMD> lsof //List data file information
ASMCMD> lsdsk//List disk information
ASMCMD> rm -f *.dbf //delete all current files with extension .dbf
ASMCMD> rm -fr orcldemo //delete the current orcldemo directory
The root path of ASM disk is "+", not "/", the following is the demonstration operation:
ASMCMD> cd datadg/demo
ASMCMD> pwd
+datadg/demo //The current path is +datadg/gd
ASMCMD> cd + //Switch to ASM disk root path
ASMCMD> pwd
+ //The current path is the root path +
You can also operate without entering the ASM command mode, such as:
[grid@oradb-node1 ~]$ asmcmd ls -ls //View ASM disk usage
To use the graphical interface, you can use the ASM helper command: asmca
[grid@oradb-node1 ~]$ sqlplus / as sysasm
--View disk group information
SQL> select name,state,type,total_mb ,free_mb from v$asm_diskgroup;
--View disk information
SQL> select group_number,path,state,total_mb,free_mb from v$asm_disk;
--View disk I/O information, datadg is the disk group name
[grid@oradb-node1 ~]$ asmcmd lsdsk --statistics -G datadg
Or briefly display reads and writes, including ASM disk list
[grid@oradb-node1 ~]$ asmcmd iostat -G datadg
Add the ASM disk disk08_test to the ASM disk group datadg, and the disk path is ORCL:DATA3_TEST
(This disk name needs to be established at the operating system level /etc/init.d/oracleasm createdisk DATA3_TEST /dev/mapper/mpathx)
SQL> alter diskgroup datadg add disk 'ORCL:DATA3_TEST' name disk08_test;
Delete ASM disk disk08_test from ASM disk group datadg
SQL> alter diskgroup datadg drop disk disk08_test;