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. 【Java面试题】49 垃圾回收的优点和原理。并考虑2种回收机制。

    1.Java语言最显著的特点就是引入了垃圾回收机制,它使java程序员在编写程序时不再考虑内存管理的问题. 2.由于有这个垃圾回收机制,java中的对象不再有“作用域”的概念,只有引用的对象才有“作用 ...

  2. ThinkPHP重写规则优化URL及Rewrite规则详细说明

    示例如下: http://www.topstack.cn/Article/detail/id/198.html 优化为 http://www.topstack.cn/article-198.html ...

  3. Python 爬虫批量下载美剧 from 人人影视 HR-HDTV

    本人比較喜欢看美剧.尤其喜欢人人影视上HR-HDTV 的 1024 分辨率的高清双字美剧,这里写了一个脚本来批量获得指定美剧的全部 HR-HDTV 的 ed2k下载链接.并依照先后顺序写入到文本文件, ...

  4. ScSR超分辨率的效果

  5. golang包管理

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

  6. System.Func<>与System.Action<>

    使用并行编程可以同时操作多个委托,在介绍并行编程前先简单介绍一下两个泛型委托System.Func<>与System.Action<>. Func<>是一个能接受多 ...

  7. Java输入输出流(2)

    6. Java.IO流类库 1. io流的四个基本类 java.io包中包括了流式I/O所须要的全部类. 在java.io包中有四个基本类:InputStream.OutputStream及Reade ...

  8. laravel Eloquent 模型(也就是我本时说的Model)

    laravel的 Eloquent 模型其实就是我们平时说的MVC里Model,只是换了个名字而已~ 1)Eloquent 是啥? Eloquent 本质就一个查询构建器(laravel里叫查询构建器 ...

  9. shell基础篇(四)算术运算

    ---内容来源于http://www.jb51.net/article/31232.htm shell中的赋值和操作默认都是字符串处理,1.错误方法举例 a) var=1+1 echo $var 输出 ...

  10. docker学习-docker核心技术

    镜像:集装箱     ---build 仓库:超级码头  ----ship 容器:运行程序的地方    ----run docker运行一个程序的过程:去仓库把镜像拉到本地,然后用一条命令把镜像运行起 ...