Oracle表变化趋势追踪记录
#DBA_HIST_SEG_STAT可以看出对象的使用趋势,构造如下SQL查询出每个时间段内数据库对象的增长量,其中DB_BLOCK_CHANGES_DELTA为块个数
select c.SNAP_ID,
to_char(c.END_INTERVAL_TIME, 'yyyy-mm-dd') SNAP_TIME,
a.OWNER,
a.OBJECT_NAME,
a.OBJECT_TYPE,
b.DB_BLOCK_CHANGES_DELTA
from dba_objects a,
(select SNAP_ID, obj#, DB_BLOCK_CHANGES_DELTA
from DBA_HIST_SEG_STAT
where DB_BLOCK_CHANGES_DELTA > 20000
order by snap_id desc, DB_BLOCK_CHANGES_DELTA desc) b,
DBA_HIST_SNAPSHOT c
where a.object_id = b.obj#
and object_type = 'TABLE'
and b.SNAP_ID = c.SNAP_ID
order by DB_BLOCK_CHANGES_DELTA #下面的SQL查询出某个时间段内,数据库对象的变化大小,单位以换算成GB
select a.OBJECT_NAME,
to_char(c.END_INTERVAL_TIME, 'yyyy-mm-dd') SNAP_TIME,
sum(b.DB_BLOCK_CHANGES_DELTA) / 1024 / 1024 GB
from dba_objects a,
(select
SNAP_ID, obj#, DB_BLOCK_CHANGES_DELTA
from DBA_HIST_SEG_STAT
where DB_BLOCK_CHANGES_DELTA > 20000
order by snap_id desc, DB_BLOCK_CHANGES_DELTA desc) b,
DBA_HIST_SNAPSHOT c
where a.object_id = b.obj#
and object_type = 'TABLE'
and b.SNAP_ID = c.SNAP_ID
group by a.OBJECT_NAME, c.END_INTERVAL_TIME
order by GB
简单介绍下DBA_HIST_SEG_STAT 。DBA_HIST_SEG_STAT视图内记录了数据库实例启动以来段的变化信息,该视图的数据来自于v$segstat Column Datatype NULL Description SNAP_ID NUMBER Unique snapshot ID
DBID NUMBER Database ID for the snapshot
INSTANCE_NUMBER NUMBER Instance number for the snapshot
TS# NUMBER Tablespace number
OBJ# NUMBER Dictionary object number
DATAOBJ# NUMBER Data object number
LOGICAL_READS_TOTAL NUMBER Cumulative value for logical reads
LOGICAL_READS_DELTA NUMBER Delta value for logical reads
BUFFER_BUSY_WAITS_TOTAL NUMBER Cumulative value for buffer busy waits
BUFFER_BUSY_WAITS_DELTA NUMBER Delta value for buffer busy waits
DB_BLOCK_CHANGES_TOTAL NUMBER Cumulative value for db block changes
DB_BLOCK_CHANGES_DELTA NUMBER Delta value for db block changes
PHYSICAL_READS_TOTAL NUMBER Cumulative value for physical reads
PHYSICAL_READS_DELTA NUMBER Delta value for physical reads
PHYSICAL_WRITES_TOTAL NUMBER Cumulative value for physical writes
PHYSICAL_WRITES_DELTA NUMBER Delta value for physical writes
PHYSICAL_READS_DIRECT_TOTAL NUMBER Cumulative value for physical reads direct
PHYSICAL_READS_DIRECT_DELTA NUMBER Delta value for physical reads direct
PHYSICAL_WRITES_DIRECT_TOTAL NUMBER Cumulative value for physical writes direct
PHYSICAL_WRITES_DIRECT_DELTA NUMBER Delta value for physical writes direct
ITL_WAITS_TOTAL NUMBER Cumulative value for ITL waits
ITL_WAITS_DELTA NUMBER Delta value for ITL waits
ROW_LOCK_WAITS_TOTAL NUMBER Cumulative value for row lock waits
ROW_LOCK_WAITS_DELTA NUMBER Delta value for row lock waits
GC_CR_BLOCKS_SERVED_TOTAL NUMBER Cumulative value for global cache CR blocks served
GC_CR_BLOCKS_SERVED_DELTA NUMBER Delta value for global cache CR blocks served
GC_CU_BLOCKS_SERVED_TOTAL NUMBER Cumulative value for global cache current blocks served
GC_CU_BLOCKS_SERVED_DELTA NUMBER Delta value for global cache current blocks served
GC_BUFFER_BUSY_TOTAL NUMBER Cumulative value for global cache buffer busy
GC_BUFFER_BUSY_DELTA NUMBER Delta value for global cache buffer busy
GC_CR_BLOCKS_RECEIVED_TOTAL NUMBER Cumulative value for global cache CR blocks received
GC_CR_BLOCKS_RECEIVED_DELTA NUMBER Delta value for global cache CR blocks received
GC_CU_BLOCKS_RECEIVED_TOTAL NUMBER Cumulative value for global cache current blocks received
GC_CU_BLOCKS_RECEIVED_DELTA NUMBER Delta value for global cache current blocks received
SPACE_USED_TOTAL NUMBER Cumulative value for space used
SPACE_USED_DELTA NUMBER Delta value for space used
SPACE_ALLOCATED_TOTAL NUMBER Cumulative value for space allocated
SPACE_ALLOCATED_DELTA NUMBER Delta value for space allocated
TABLE_SCANS_TOTAL NUMBER Cumulative value for table scans
TABLE_SCANS_DELTA NUMBER Delta value for table scans
Oracle表变化趋势追踪记录的更多相关文章
- 查看Oracle表中的指定记录在数据文件中的位置
查看Oracle表中的指定记录位置select rowid,user_id from sshr.xx_user where user_id=3010586 select rowid, db ...
- Oracle使用游标删除所有用户数据表中的所有记录脚本
应用场景:因为数据库中的数据涉及机密信息,希望一次性能删除掉所有数据,只保留数据表结构,供新项目开发程序用 测试结果:经查询已删除所有数据 存在问题:数据表如果存在外键的话下面脚本可能执行不成功,请自 ...
- 老技术记录-C#+SqlServer使用SqlDependency监听数据库表变化
开发环境: .net / C# (.net core理论上也可以) 数据库:MS SQL Server 2005 以上 (我用的sqlserver2012) 功能:SqlDependency提供了一种 ...
- 追踪记录每笔业务操作数据改变的利器——SQLCDC
对于大部分企业应用来用,有一个基本的功能必不可少,那就是Audit Trail或者Audit Log,中文翻译为追踪检查.审核检查或者审核记录.我们采用Audit Trail记录每一笔业务操作的基本信 ...
- Oracle表空间管理
oracle表空间相关常用命令小结: 1.ALTER DATABASE SET DEFAULT BIGFILE TABLESPACE; //修改表空间数据文件类型 2.ALT ...
- 【转】Oracle 表空间与数据文件
--============================== --Oracle 表空间与数据文件 --============================== /* 一.概念 表空间:是一个或 ...
- 在MySQL中使用init-connect与binlog来实现用户操作追踪记录
在MySQL中使用init-connect与binlog来实现用户操作追踪记录 分类: MySQL 前言: 测试环境莫名其妙有几条重要数据被删除了,由于在binlog里面只看到是公用账号删除的,无法查 ...
- oracle 表查询(2)
使用逻辑操作符号 问题:查询工资高于500 或者是岗位为MANAGER 的雇员,同时还要满足他们的姓名首字母为大写的J? or job = 'MANAGER') and ename LIKE 'J%' ...
- Oracle 表空间与数据文件
-============================== --Oracle 表空间与数据文件 --============================== /* 一.概念 表空间:是一个或多 ...
随机推荐
- Oracle 10046 event详解-转载
0046事件概述Oracle的10046事件,可以跟踪应用程序所执行的SQL语句,并且得到其解析次数.执行次数,CPU使用时间等信息.这对我们分析.定位数据库性能问题是非常有用的. 10046 eve ...
- T4 assembly
In a T4 template the executing assembly is not yours but one from the T4 engine. To access types fro ...
- flexgrid的应用
第一.导入必须的CSS与JS: <link rel="stylesheet" type="text/css" href="css/flexigr ...
- 利用sql批量删除表,存储过程
利用sql批量删除表,存储过程. 最近用godaddy的空间,由于系统里面的表多,一个个的删除很麻烦,就网上搜集了一下解决方法. 给大家分享一下: 1.批量删除存储过程 declare @procNa ...
- Android Studio 实用插件整理
首先说一下安装方法: 上图片: 首先点击Android stuido 菜单 File->Settings 进入上图界面: 区域1:你当前已经安装了的插件 区域3:在线安装 区域2:其实和区域3是 ...
- Adobe AIR and Flex - 实现堆栈容器
1.需求描述: 在对云平台的监控中,我们经常需要在一张图上可视化的描述集群下的物理机所虚拟的虚拟机使用情况,以及超卖情况.那么传统的chart图就不满足我们的需求了,那么要实现这样一个定制化的char ...
- 【LeetCode】3.Longest Substring Without Repeating Characters 最长无重复子串
题目: Given a string, find the length of the longest substring without repeating characters. Examples: ...
- Unable to load type System.Data.Entity.DynamicProxiesXXXXXrequired for deserialization.
Memcache实例的Get方法时抛出了异常“Unable to load type System.Data.Entity.DynamicProxies.AdInfoItems_19CD09C8E46 ...
- 如何利用百度地图JSAPI画带箭头的线?
百度地图JSAPI提供两种绘制多折线的方式,一种是已知多折线经纬度坐标串通过AddOverlay接口进行添加:另一种是通过在地图上鼠标单击进行绘制(鼠标绘制工具条库).目前这两种方式只能绘制多折线,并 ...
- cordova android ios
一 . cordova android 中js 调用JAVA 方法: 二 . cordova ios --->js 调用object (一); 三 .cordova ios --->OC ...