在线精品99_中国九九盗摄偷拍偷看_91免费版在线观看_91.app_91高清视频在线_99热最新网站

如何编写Oracle查询表空间的每日增长量和历史情况统计的脚本

103次阅读
没有评论

共计 4573 个字符,预计需要花费 12 分钟才能阅读完成。

如何编写 Oracle 查询表空间的每日增长量和历史情况统计的脚本,很多新手对此不是很清楚,为了帮助大家解决这个难题,下面丸趣 TV 小编将为大家详细讲解,有这方面需求的人可以来学习下,希望你能有所收获。

今天主要总结一下 Oracle 表空间每日增长和历史情况统计的一些脚本,仅供参考。

11g 统计表空间的每日增长量

SELECT a.snap_id, c.tablespace_name ts_name, to_char(to_date(a.rtime,  mm/dd/yyyy hh34:mi:ss),  yyyy-mm-dd hh34:mi ) rtime, round(a.tablespace_size * c.block_size / 1024 / 1024, 2) ts_size_mb, round(a.tablespace_usedsize * c.block_size / 1024 / 1024, 2) ts_used_mb, round((a.tablespace_size - a.tablespace_usedsize) * c.block_size / 1024 / 1024, 2) ts_free_mb, round(a.tablespace_usedsize / a.tablespace_size * 100, 2) pct_used FROM dba_hist_tbspc_space_usage a, (SELECT tablespace_id, substr(rtime, 1, 10) rtime, max(snap_id) snap_id FROM dba_hist_tbspc_space_usage nb group by tablespace_id, substr(rtime, 1, 10)) b, dba_tablespaces c, v$tablespace d where a.snap_id = b.snap_id and a.tablespace_id = b.tablespace_id and a.tablespace_id = d.TS# and d.NAME = c.tablespace_name and to_date(a.rtime,  mm/dd/yyyy hh34:mi:ss)  = sysdate - 30 order by a.tablespace_id, to_date(a.rtime,  mm/dd/yyyy hh34:mi:ss) desc;

12c 统计表空间的每日增长量

SELECT a.snap_id, a.con_id, e.name pdbname, c.tablespace_name ts_name, to_char(to_date(a.rtime,  mm/dd/yyyy hh34:mi:ss),  yyyy-mm-dd hh34:mi ) rtime, round(a.tablespace_size * c.block_size / 1024 / 1024, 2) ts_size_mb, round(a.tablespace_usedsize * c.block_size / 1024 / 1024, 2) ts_used_mb, round((a.tablespace_size - a.tablespace_usedsize) * c.block_size / 1024 / 1024, 2) ts_free_mb, round(a.tablespace_usedsize / a.tablespace_size * 100, 2) pct_used FROM cdb_hist_tbspc_space_usage a, (SELECT tablespace_id, nb.con_id, substr(rtime, 1, 10) rtime, max(snap_id) snap_id FROM dba_hist_tbspc_space_usage nb group by tablespace_id, nb.con_id,substr(rtime, 1, 10)) b, cdb_tablespaces c, v$tablespace d, V$CONTAINERS e where a.snap_id = b.snap_id and a.tablespace_id = b.tablespace_id and a.con_id=b.con_id and a.con_id=c.con_id and a.con_id=d.con_id and a.con_id=e.con_id and a.tablespace_id=d.TS# and d.NAME=c.tablespace_name and to_date(a.rtime,  mm/dd/yyyy hh34:mi:ss)  =sysdate-30 order by a.CON_ID,a.tablespace_id,to_date(a.rtime,  mm/dd/yyyy hh34:mi:ss) desc;

估算 oracle 数据库,数据库对象历史增长情况

最近七天数据库的增长情况,这个只是一个估算值。

select sum(space_used_total) / 1024 / 1024 / 1024  last 7 days db increase - G  from dba_hist_seg_stat s, dba_hist_seg_stat_obj o, dba_hist_snapshot sn where s.obj# = o.obj# and ssn.snap_id = s.snap_id and begin_interval_time   sysdate - 8 order by begin_interval_time

查看数据库历史增长情况

此处是通过计算数据库所有表空间的历史增长情况来计算数据库历史情况。

不含 undo 和 temp:

with tmp as ( select rtime,sum(tablespace_usedsize_kb) tablespace_usedsize_kb, sum(tablespace_size_kb) tablespace_size_kb from (select rtime, e.tablespace_id, (e.tablespace_usedsize)*(f.block_size)/1024 tablespace_usedsize_kb, (e.tablespace_size)*(f.block_size)/1024 tablespace_size_kb from dba_hist_tbspc_space_usage e, dba_tablespaces f, v$tablespace g where e.tablespace_id = g.TS# and f.tablespace_name = g.NAME and f.contents not in (TEMPORARY , UNDO)) group by rtime) select tmp.rtime, tablespace_usedsize_kb, tablespace_size_kb,(tablespace_usedsize_kb - LAG(tablespace_usedsize_kb, 1, NULL) OVER(ORDER BY tmp.rtime)) AS DIFF_KB from tmp, (select max(rtime) rtime from tmp group by substr(rtime, 1, 10)) t2 where t2.rtime = tmp.rtime;

含 undo 和 temp:

with tmp as ( select min(rtime) rtime, sum(tablespace_usedsize_kb) tablespace_usedsize_kb, sum(tablespace_size_kb) tablespace_size_kb from (select rtime, e.tablespace_id, (e.tablespace_usedsize) * (f.block_size) / 1024 tablespace_usedsize_kb, (e.tablespace_size) * (f.block_size) / 1024 tablespace_size_kb from dba_hist_tbspc_space_usage e, dba_tablespaces f, v$tablespace g where e.tablespace_id = g.TS# and f.tablespace_name = g.NAME) group by rtime) select tmp.rtime, tablespace_usedsize_kb, tablespace_size_kb, (tablespace_usedsize_kb-LAG(tablespace_usedsize_kb, 1, NULL) OVER(ORDER BY tmp.rtime)) AS DIFF_KB from tmp, (select min(rtime) rtime from tmp group by substr(rtime, 1, 10)) t2 where t2.rtime = tmp.rtime

列出相关段对象在 快照时间内的使用空间的历史变化信息

select obj.owner, obj.object_name, to_char(sn.BEGIN_INTERVAL_TIME,  RRRR-MON-DD) start_day, sum(a.db_block_changes_delta) block_increase from dba_hist_seg_stat a, dba_hist_snapshot sn, dba_objects obj where sn.snap_id = a.snap_id and obj.object_id = a.obj# and obj.owner not in (SYS ,  SYSTEM) and end_interval_time between to_timestamp(01-OCT-2019 ,  DD-MON-RRRR) and to_timestamp(09-OCT-2019 ,  DD-MON-RRRR) group by obj.owner, obj.object_name, to_char(sn.BEGIN_INTERVAL_TIME,  RRRR-MON-DD) order by obj.owner, obj.object_name;

看完上述内容是否对您有帮助呢?如果还想对相关知识有进一步的了解或阅读更多相关文章,请关注丸趣 TV 行业资讯频道,感谢您对丸趣 TV 的支持。

正文完
 
丸趣
版权声明:本站原创文章,由 丸趣 2023-07-18发表,共计4573字。
转载说明:除特殊说明外本站除技术相关以外文章皆由网络搜集发布,转载请注明出处。
评论(没有评论)
主站蜘蛛池模板: 国产尤物视频在线 | 在线欧美69v免费观看视频 | 2020韩国三级理论在线观看 | 91网在线 | 亚洲精品播放 | 日韩成人在线影院 | 国内外成人免费视频 | 无码少妇精品一区二区免费动态 | 男女扒开双腿猛进入免费看污 | 婷婷综合久久中文字幕蜜桃三电影 | 久播影院免费理论片成年看 | 麻豆国产96在线 | 中国 | 亚洲精品乱码久久久久久自慰 | 又粗又粗又黄又硬又深色的 | 裸身美女无遮挡永久免费视频 | 极品粉嫩嫩模大尺度无码 | 青青成线在人线免费啪 | 国产成人av一区二区三区 | 国产精品资源手机在线播放 | 日韩免费视频网站 | 曰曰操 | 国产成人99久久亚洲综合精品 | 国产欧美性成人精品午夜 | 国产精品亚洲片在线观看不卡 | 日韩精品乱码av一区二区 | 少妇被多人c夜夜爽爽av | 国产在线精品一区二区三区不卡 | 97成人在线观看 | 国产蜜臀av在线一区尤物 | 一区不卡 | 激情总合网 | 国产成人综合亚洲欧美天堂 | 一区亚洲 | 亚洲欧洲∨国产一区二区三区 | 国产免费啪视频观看网站 | 免费一区二区三区视频狠狠 | 国产精品va在线播放我和闺蜜 | 国产精品99r8在线观看 | 日韩美女一级视频 | 亚洲欧美激情综合首页 | 在线观看av网站永久 |