• 查看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;

  • 相关阅读:
    myeclipse中jpa的安装以及jpa reverse engining
    myeclipse显示db-brower
    jpa报错 Unable to acquire a connection from driver [null], user [null] and URL [null]
    sqlserver安装和踩坑经历
    idea注释模板
    可选链与空值合并
    Nokia5130不能上网
    血小板 live2d web使用
    什么值得买前端面试题 2019秋季
    便利蜂前端面试题 2019秋季
  • 原文地址:https://www.cnblogs.com/moonlight-zjb/p/3442323.html
Copyright © 2020-2023  润新知