zoukankan      html  css  js  c++  java
  • 数据库每日空间增量

    -- |----------------------------------------------------------------------------|
    -- | DATABASE : Oracle                                                          |
    -- | FILE     : show_database_increase.sql                                      |
    -- | CLASS    : Database Administration                                         |
    -- | PURPOSE  : This script is listed in the relevant paragraph database        |
    -- | history of the use of space in a snapshot of time change information       |
    -- | This information is not contain undo and temp tablespace                   |
    -- | NOTE     :                                                                 |
    -- +----------------------------------------------------------------------------+

    SET TERMOUT OFF;
    COLUMN current_instance NEW_VALUE current_instance NOPRINT;
    SELECT rpad(instance_name, 17) current_instance FROM v$instance;
    COLUMN USER NEW_VALUE user_name NOPRINT;
    SELECT USER FROM DUAL;
    SET TERMOUT ON;

    PROMPT
    PROMPT +------------------------------------------------------------------------+
    PROMPT | Report   : show_database_increase                                      |
    PROMPT | Instance : &current_instance                                           |
    PROMPT | USER     : &user_name                                                  |
    PROMPT +------------------------------------------------------------------------+


    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
            ORDER BY rtime
            /
  • 相关阅读:
    JavaEE 7学习笔记
    RX232串口发送
    以8位并行数据为例确定crc-32的一般矩阵表示形式
    nios ii 13 主程序的函数可以用Open Declaration 查看,但是编译的时候却说 undefined reference to 。。。这是为什么?
    做uart 实验时,run configure 只能选择jtag_uart 而没有uart
    在做nios ii uart232 实验时出现undefined reference to `fclose'等错误。
    修改quartus 配置rom时memory很小的问题。
    关于VGA显示实验的问题
    Microsoft Visual Studio 2013 已停止工作的解决方法
    独家原创,拖拽任意控件移动任意目标,拖拽控件移动整个窗体
  • 原文地址:https://www.cnblogs.com/laverne/p/12674668.html
Copyright © 2011-2022 走看看