zoukankan      html  css  js  c++  java
  • oracle计算容量的方式

    //查看表和所属表空间

    SELECT TABLE_NAME,TABLESPACE_NAME FROM USER_TABLES

    ------------------------------------------------------------------------------------------------------------------------------------

    //查看表占用的大小,其中AAA为数据库块db_block_size的大小(一般为8192)

    select owner,table_name,
    NUM_ROWS,
    BLOCKS*AAA/1024/1024 "Size M",
    EMPTY_BLOCKS,
    LAST_ANALYZED
    from dba_tables
    where table_name = 'CARBASE'

    --------------------------------------------------------------------------------------------------------------------------------------

    //查看表空间大小和剩余大小 根据dba_data_files和dba_free_space统计表空间大小和表空间剩余大小

    1、统计增加表空见两种方式的数据文件大小总值,也就是统计表空间总大小。(数据文件有两种方式,一种是设置自增大小,一种是不设置自增大小)

    WITH TABLESPACE_TOTAL AS
    (
    SELECT tablespace_name,sum(MAXBYTES) TOTAL FROM DBA_DATA_FILES T
    WHERE T.TABLESPACE_NAME NOT IN ('USERS','SYSAUX','UNDOTBS1','SYSTEM','UNDOTBS2')
    AND T.AUTOEXTENSIBLE='YES' group by tablespace_name
    UNION ALL
    SELECT tablespace_name,sum(bytes) TOTAL FROM DBA_DATA_FILES T
    WHERE T.TABLESPACE_NAME NOT IN ('USERS','SYSAUX','UNDOTBS1','SYSTEM','UNDOTBS2')
    AND T.AUTOEXTENSIBLE='NO' group by tablespace_name
    )
    SELECT TABLESPACE_NAME,SUM(TOTAL) TOTAL FROM TABLESPACE_TOTAL GROUP BY TABLESPACE_NAME

    2、表空间已使用的大小(可以看出dba_free_space表是dba_data_files表的各个数据文件bytes列已经真正使用后剩余大小)

    select tablespace_name,FILE_ID,bytes/1024/1024 from dba_free_space
    where tablespace_name NOT IN ('USERS','SYSAUX','UNDOTBS1','SYSTEM','UNDOTBS2')

    3、统计大小

    SELECT A.TABLESPACE_NAME,B.TOTAL/1024/1024||'M',(B.TOTAL-A.USE)/1024/1024||'M' FREE FROM
    (
    select c.tablespace_name,(c.p_use-d.p_free) as use from
    (
    select tablespace_name,sum(bytes) as p_use from dba_data_files
    where tablespace_name NOT IN ('USERS','SYSAUX','UNDOTBS1','SYSTEM','UNDOTBS2')
    group by tablespace_name
    ) C,
    (
    select tablespace_name,sum(bytes) as  p_free from dba_free_space
    where tablespace_name NOT IN ('USERS','SYSAUX','UNDOTBS1','SYSTEM','UNDOTBS2')
    group by tablespace_name
    ) D
    where C.tablespace_name=D.tablespace_name
    ) A ,
    (
    WITH TABLESPACE_TOTAL AS
    (
    SELECT tablespace_name,sum(MAXBYTES) TOTAL FROM DBA_DATA_FILES T
     WHERE T.TABLESPACE_NAME NOT IN ('USERS','SYSAUX','UNDOTBS1','SYSTEM','UNDOTBS2')
    AND T.AUTOEXTENSIBLE='YES' group by tablespace_name
    UNION ALL
    SELECT tablespace_name,sum(bytes) TOTAL FROM DBA_DATA_FILES T
    WHERE T.TABLESPACE_NAME NOT IN ('USERS','SYSAUX','UNDOTBS1','SYSTEM','UNDOTBS2')
    AND T.AUTOEXTENSIBLE='NO' group by tablespace_name
    )
    SELECT TABLESPACE_NAME,SUM(TOTAL) TOTAL FROM TABLESPACE_TOTAL GROUP BY TABLESPACE_NAME
    ) B
    WHERE A.TABLESPACE_NAME=B.TABLESPACE_NAME

    --------------------------------------------------------------------------------------------------------------------------------------

    来自收点资料买框架
  • 相关阅读:
    基于策略梯度的强化学习论文调研
    Soft Actor-Critic: Off-Policy Maximum Entropy Deep Reinforcement Learning with a Stochastic Actor
    固定随机种子比较强化学习算法
    Action and learning shape the activity of neuronal circuits in the visual cortex
    大脑中的记忆机制
    A Simple Neural Attentive Meta-Learner
    【Error】Creating Server TCP listening socket *:6379: bind: No such file or directory
    Redis安装配置
    MySQL中文入库问题
    Nginx启动/重启失败
  • 原文地址:https://www.cnblogs.com/xin932134334/p/5282569.html
Copyright © 2011-2022 走看看