zoukankan      html  css  js  c++  java
  • 查看Oracle表空间使用情况与增大表空间

    1,查看表空间使用情况

    SELECT D.TABLESPACE_NAME,
    SPACE || 'M' "SUM_SPACE(M)",
    BLOCKS "SUM_BLOCKS",
    SPACE - NVL (FREE_SPACE, 0) || 'M' "USED_SPACE(M)",
    ROUND ( (1 - NVL (FREE_SPACE, 0) / SPACE) * 100, 2) || '%'
    "USED_RATE(%)",
    FREE_SPACE || 'M' "FREE_SPACE(M)"
    FROM ( SELECT TABLESPACE_NAME,
    ROUND (SUM (BYTES) / (1024 * 1024), 2) SPACE,
    SUM (BLOCKS) BLOCKS
    FROM DBA_DATA_FILES
    GROUP BY TABLESPACE_NAME) D,
    ( SELECT TABLESPACE_NAME,
    ROUND (SUM (BYTES) / (1024 * 1024), 2) FREE_SPACE
    FROM DBA_FREE_SPACE
    GROUP BY TABLESPACE_NAME) F
    WHERE D.TABLESPACE_NAME = F.TABLESPACE_NAME(+)
    UNION ALL --如果有临时表空间
    SELECT D.TABLESPACE_NAME,
    SPACE || 'M' "SUM_SPACE(M)",
    BLOCKS SUM_BLOCKS,
    USED_SPACE || 'M' "USED_SPACE(M)",
    ROUND (NVL (USED_SPACE, 0) / SPACE * 100, 2) || '%' "USED_RATE(%)",
    NVL (FREE_SPACE, 0) || 'M' "FREE_SPACE(M)"
    FROM ( SELECT TABLESPACE_NAME,
    ROUND (SUM (BYTES) / (1024 * 1024), 2) SPACE,
    SUM (BLOCKS) BLOCKS
    FROM DBA_TEMP_FILES
    GROUP BY TABLESPACE_NAME) D,
    ( SELECT TABLESPACE_NAME,
    ROUND (SUM (BYTES_USED) / (1024 * 1024), 2) USED_SPACE,
    ROUND (SUM (BYTES_FREE) / (1024 * 1024), 2) FREE_SPACE
    FROM V$TEMP_SPACE_HEADER
    GROUP BY TABLESPACE_NAME) F
    WHERE D.TABLESPACE_NAME = F.TABLESPACE_NAME(+)
    ORDER BY 1;

    2,增大表空间

    增加表空间大小的四种方法
    Meathod1:给表空间增加数据文件
    ALTER TABLESPACE app_data ADD DATAFILE
    'D:ORACLEPRODUCT10.2.0ORADATAEDWTESTAPP03.DBF' SIZE 50M;

    Meathod2:新增数据文件,并且允许数据文件自动增长
    ALTER TABLESPACE app_data ADD DATAFILE
    'D:ORACLEPRODUCT10.2.0ORADATAEDWTESTAPP04.DBF' SIZE 50M
    AUTOEXTEND ON NEXT 5M MAXSIZE 100M;

    Meathod3:允许已存在的数据文件自动增长
    ALTER DATABASE DATAFILE 'D:ORACLEPRODUCT10.2.0ORADATAEDWTESTAPP03.DBF'
    AUTOEXTEND ON NEXT 5M MAXSIZE 100M;

    Meathod4:手工改变已存在数据文件的大小
    ALTER DATABASE DATAFILE 'D:ORACLEPRODUCT10.2.0ORADATAEDWTESTAPP02.DBF'
    RESIZE 100M;

  • 相关阅读:
    [转] egg(28)--mongoose使用聚合管道
    [转] mongoose的populate
    [转]express常用中间件
    [转] SuperAgent使用文档
    [转] node爬虫之gbk网页中文乱码解决方案
    [转] js日期对象Date对象方法 时间方法
    [转] Nodejs学习笔记(十四)— Mongoose介绍和入门
    [转] 深入理解vue 一些底层原理
    [转] Nginx之八 URL重写(rewrite)配置
    随笔
  • 原文地址:https://www.cnblogs.com/moonlight-zjb/p/3442323.html
Copyright © 2011-2022 走看看