十条ASM命令,让你对Oracle数据库中ASM情况了如指掌

frank0 2019-05-28

概述

之所以写这篇文章因为平时用的RAC数据库中ASM的一些命令总记不住,所以就对ASM这块做了一些总结,主要分成10个命令,常见的一些ASM命令基本都包括了,大家一起看看吧~


1、查看ASM使用情况

SQL>select group_number,name,total_mb,free_mb from v$asm_diskgroup;

十条ASM命令,让你对Oracle数据库中ASM情况了如指掌

2、查看磁盘路径

SQL> col path for a50
SQL> select group_number,name, path from v$asm_disk_stat;

十条ASM命令,让你对Oracle数据库中ASM情况了如指掌

3、查看磁盘组信息

SQL> select state,name,type,total_mb, free_mb from v$asm_diskgroup_stat;

磁盘组状态为Mounted说明磁盘组状态正常;

磁盘组的total_mb,free_mb为非0说明可以读取磁盘信息,获取磁盘大小。

十条ASM命令,让你对Oracle数据库中ASM情况了如指掌

4、查看磁盘组操作

select * from v$asm_operation;

十条ASM命令,让你对Oracle数据库中ASM情况了如指掌

如果有信息说明正在加盘或者减盘。

5、查看磁盘组属性

查询V$ASM_ATTRIBUTE视图查看磁盘组属性

SQL>col diskgroup for a30
SQL>col name for a50
SQL>col value for a30
SQL>col read_only for a30
SQL> SELECT dg.name AS diskgroup,SUBSTR(a.name,1,18) AS name,SUBSTR(a.value,1,24) AS value, read_only FROM V$ASM_DISKGROUP_STAT dg,V$ASM_ATTRIBUTE a WHERE dg.name = 'RFDATA' AND dg.group_number = a.group_number;

十条ASM命令,让你对Oracle数据库中ASM情况了如指掌

6、查看磁盘组兼容属性

SQL> col name for a30
SQL> col COMPATIBILITY for a30
SQL> col DATABASE_COMPATIBILITY for a30
SQL> SELECT name,COMPATIBILITY,DATABASE_COMPATIBILITY FROM V$ASM_DISKGROUP_STAT;

十条ASM命令,让你对Oracle数据库中ASM情况了如指掌

7、查看磁盘状态

SQL> col ASMDISK for a30
SQL> col MOUNT_STATUS for a30
SQL> col HEADER_STATUS for a30
SQL> col state for a20
SQL> col DISKGROUP for a30
SQL> SELECT SUBSTR(d.name,1,16) AS asmdisk,d.mount_status,HEADER_STATUS, d.state, dg.name AS diskgroup FROM V$ASM_DISKGROUP_STAT dg, V$ASM_DISK_STAT d WHERE dg.group_number = d.group_number;

十条ASM命令,让你对Oracle数据库中ASM情况了如指掌

8、查看磁盘客户端信息

SQL> col INSTANCE for a30
SQL> col dbname for a20
SQL> col SOFTWARE for a30
SQL> col COMPATIBLE for a30
SQL> SELECT dg.name AS diskgroup,SUBSTR(c.instance_name,1,12) AS instance, SUBSTR(c.db_name,1,12) AS dbname,SUBSTR(c.SOFTWARE_VERSION,1,12) AS software, SUBSTR(c.COMPATIBLE_VERSION,1,12) AS compatible FROM V$ASM_DISKGROUP_STAT dg, V$ASM_CLIENT c WHERE dg.group_number=c.group_number;

十条ASM命令,让你对Oracle数据库中ASM情况了如指掌

9、查看磁盘访问控制用户信息

SQL> SELECT dg.name AS diskgroup, u.group_number,u.user_number, u.os_id, u.os_name FROM V$ASM_DISKGROUP_STAT dg, V$ASM_USER u WHERE dg.group_number = u.group_number AND dg.name ='RFDATA';

十条ASM命令,让你对Oracle数据库中ASM情况了如指掌

10、查看智能数据分布信息

SQL> SELECT dg.name AS diskgroup, f.file_number, f.primary_region,f.mirror_region, f.hot_reads,f.hot_writes, f.cold_reads, f.cold_writes FROM V$ASM_DISKGROUP_STAT dg, V$ASM_FILE f WHERE dg.group_number = f.group_number and dg.name ='RFDATA';

十条ASM命令,让你对Oracle数据库中ASM情况了如指掌


后面会分享更多devops和DBA方面的内容,感兴趣的朋友可以关注下!

十条ASM命令,让你对Oracle数据库中ASM情况了如指掌

相关推荐