1、监控表空间使用率

基表:dba_data_files、dba_free_space

脚本:

select a.tablespace_name,

round((a.maxbytes / 1024 / 1024 / 1024), 2) "sum G",

round((a.bytes / 1024 / 1024 / 1024), 2) "datafile G",

round(((a.bytes - b.bytes) / 1024 / 1024 / 1024), 2) "used G",

round(((a.maxbytes - a.bytes + b.bytes) / 1024 / 1024 / 1024), 2) "free G",

round(((a.bytes - b.bytes) / a.maxbytes) * 100, 2) "percent_used(%)"

from (select tablespace_name, sum(sumnow) bytes, sum(summax) maxbytes

from (select t1.tablespace_name,

sum(t1.bytes) sumnow,

sum(t1.maxbytes) summax

from dba_data_files t1

where t1.maxbytes <> 0

group by t1.tablespace_name

union all

select t2.tablespace_name,

sum(t2.bytes) sumnow,

sum(t2.bytes) summax

from dba_data_files t2

where t2.maxbytes = 0

group by t2.tablespace_name)

group by tablespace_name) a,

(select tablespace_name, sum(bytes) bytes

from dba_free_space

group by tablespace_name) b

where a.tablespace_name = b.tablespace_name

order by ((a.bytes - b.bytes) / a.maxbytes) desc;

2、创建表空间时指定最大值时查询表空间使用率脚本:

select a.tablespace_name,

round((a.maxbytes / 1024 / 1024 / 1024), 2) "sum G",

round((a.bytes / 1024 / 1024 / 1024), 2) "datafile G",

round(((a.bytes - b.bytes) / 1024 / 1024 / 1024), 2) "used G",

round(((a.maxbytes - a.bytes + b.bytes) / 1024 / 1024 / 1024), 2) "free G",

round(((a.bytes - b.bytes) / a.maxbytes) * 100, 2) "percent_used(%)"

from (select tablespace_name, sum(bytes) bytes, sum(maxbytes) maxbytes

from dba_data_files

where maxbytes != 0

group by tablespace_name) a,

(select tablespace_name, sum(bytes) bytes

from dba_free_space

group by tablespace_name) b

where a.tablespace_name = b.tablespace_name

order by ((a.bytes - b.bytes) / a.maxbytes) desc;

3、查看数据文件状态

select t.tablespace_name,

t.file_id,

t.file_name,

t.autoextensible,

ROUND(t.maxbytes / 1024 / 1024 / 1024, 2) || 'G' AS MAXBYTES,

ROUND(t.bytes / 1024 / 1024 / 1024, 2) || 'G' AS BYTES,

ROUND(t.user_bytes / 1024 / 1024 / 1024, 2) || 'G' AS USER_BYTES

from dba_data_files t;

Oracle管理监控之Oracle数据库存储空间监控的更多相关文章

  1. Oracle数据库的监控及数据维护

    目前Oracle数据库的管理,数据查询等都需要安装Oracle软件或安装Oracle Client等,远程访问都需要先登录到服务器等繁琐的操作.如果是开发团队,那么每个开发,测试,管理人员都要经历这个 ...

  2. Oracle管理监控之Oracle用户权限

    数据字典 1.动态数据字典是以v$xxx开始的数据字典,在数据库中约有150个左右,这些数据字典反映数据库动态运行状况,在不同时间查询会得到不同的结果. 2.DBA数据字典是以DBA_xxx表示,该数 ...

  3. Oracle【IT实验室】数据库备份与恢复之四:RMAN(备份与恢复管理器)

    RMAN是ORACLE提供的一个备份与恢复的工具,可以用来备份和还原数据库文件. 归档日志和控制文件.它也可以用来执行完全或不完全的数据库恢复. RMAN可以由命令行接口或者 OEM的 Backup ...

  4. Lepus监控之Oracle配置

    1.安装cx_Oracle a.官网下载客户端组件包 oracle-instantclient12.2-basic-12.2.0.1.0-1.x86_64.rpmoracle-instantclien ...

  5. 采用link方式解决zabbix对于备份监控和ORACLE日志监控由于路径不统一的问题

    #对于备份监控和ORACLE日志监控由于路径不统一,我们可以采用link的方式如:#ln -s 原路径 新路径(/zabbix/logs)#新路径统一放在/zabbix/logs下具体看模板指定. # ...

  6. 3. SQL Server数据库状态监控 - 可用空间

    原文:3. SQL Server数据库状态监控 - 可用空间 数据库用来存放数据,那么肯定需要存储空间,所以对磁盘空间的监视自然就很有必要了. 一. 磁盘可用空间 1. 操作系统命令或脚本.接口或工具 ...

  7. 2. SQL Server数据库状态监控 - 错误日志

    原文:2. SQL Server数据库状态监控 - 错误日志 无论是操作系统 (Unix 或者Windows),还是应用程序 (Web 服务,数据库系统等等) ,通常都有自身的日志机制,以便故障时追溯 ...

  8. oracle之二实例与数据库

    实例与数据库 1.Oracle 网络架构及应用环境 看PPT,Oracle结构的基本单元.术语 2.Oracle 体系结构    1)oracle server :database + instanc ...

  9. oracle 10g 学习之oracle管理(3)

    怎样将预先写好的sql脚本执行? select * from employees;→107条记录 利用 Oracle 企业管理器连接数据库服务器 点击打开以下界面: 此时已经连接成功了 用 Oracl ...

随机推荐

  1. erlang工具:Sublime Text的插件

    SublimErl  :https://github.com/ostinelli/SublimErl   (推荐,操作较简单)                                      ...

  2. mysql压力测试工具Mysqlslap

    mysql 性能测试工具:The MySQL Benchmark Suite(不支持多CPU而且不是压力工具) 压力测试工具: MySQL super-smack:需要找能连接外网的机器,能连接外网的 ...

  3. About {DynamicResource {x:Static SystemColors.ControlBrushKey}}

    from : http://blog.sina.com.cn/s/blog_749e42850100sahi.html 前提: <system:String x:Key="{Compo ...

  4. golang包管理

    https://studygolang.com/articles/8413 https://studygolang.com/articles/10523

  5. oracle最精简客户端(3个文件+1个path变量就搞定oracle客户端)

    oracle最精简客户端: network\admin\tnsnames.ora (自己新建)oci.dlloraocieill.dll 将oci.dll的路径加到path变量中就可以了 tnsnam ...

  6. mybatis由浅入深day01_3mybatis框架介绍

    3 mybatis框架 3.1 mybatis是什么? mybatis是一个持久层的框架,是apache下的顶级项目. mybatis托管到goole code下,再后来托管到github下(http ...

  7. swift - UIStepper的用法

    在网上查看学习资料的时候,看到有这个控件,所以就自己写了下,感觉在某些特定的地方用的还是挺方便的! 不过,个人感觉,局限性太大! 1.初始化(创建个label是为了让大家看到具体的数值) let st ...

  8. JavaScript 中的陷阱

    JavaScript 通过函数管理作用域.在函数内部声明的变量只在这个函数内部,函数外面不可用.另一方面,全局变量就是在任何函数外面声明的或是未声明直接简单使用的. “未声明直接简单使用”,指的是不用 ...

  9. 浏览器对js运行时间的限制

    浏览器对js的运行时间进行了限制 1.调用栈尺寸限制 目前大部分的主流浏览器的调用栈尺寸都在10000以上.超过这个尺寸就会报栈溢出的错误 2.长时间脚本限制 浏览器记录一个脚本的运行时间,一旦达到这 ...

  10. 静态资源的gzip

    1.项目中,接触到gzip.未压缩的文件和压缩后的文件的比例可能达到:3:1.所以,gzip是网络中文件高速传输的很好方法. 2.一般js.css.html文件都会在后端进行gzip.当浏览器请求这些 ...