• oracle表空间处理


    oracle表空间处理

    --查询表空间使用情况
    SELECT Upper(F.TABLESPACE_NAME)         "表空间名",
           D.TOT_GROOTTE_MB                 "表空间大小(M)",
           D.TOT_GROOTTE_MB - F.TOTAL_BYTES "已使用空间(M)",
           To_char(Round(( D.TOT_GROOTTE_MB - F.TOTAL_BYTES ) / D.TOT_GROOTTE_MB * 100, 2), '990.99')
           || '%'                           "使用比",
           F.TOTAL_BYTES                    "空闲空间(M)",
           F.MAX_BYTES                      "最大块(M)"
    FROM   (SELECT TABLESPACE_NAME,
                   Round(Sum(BYTES) / ( 1024 * 1024 ), 2) TOTAL_BYTES,
                   Round(Max(BYTES) / ( 1024 * 1024 ), 2) MAX_BYTES
            FROM   SYS.DBA_FREE_SPACE
            GROUP  BY TABLESPACE_NAME) F,
           (SELECT DD.TABLESPACE_NAME,
                   Round(Sum(DD.BYTES) / ( 1024 * 1024 ), 2) TOT_GROOTTE_MB
            FROM   SYS.DBA_DATA_FILES DD
            GROUP  BY DD.TABLESPACE_NAME) D
    WHERE  D.TABLESPACE_NAME = F.TABLESPACE_NAME
    ORDER  BY 1;
    
    select b.file_id  文件ID,
      b.tablespace_name  表空间,
      b.file_name     物理文件名,
      b.bytes       总字节数,
      (b.bytes-sum(nvl(a.bytes,0)))   已使用,
      sum(nvl(a.bytes,0))        剩余,
      sum(nvl(a.bytes,0))/(b.bytes)*100 剩余百分比
      from dba_free_space a,dba_data_files b
      where a.file_id=b.file_id
      group by b.tablespace_name,b.file_name,b.file_id,b.bytes
      order by b.tablespace_name;
    
    SELECT *
      FROM (SELECT SEGMENT_NAME, SUM(BYTES) / 1024 / 1024 MB
              FROM DBA_SEGMENTS
             WHERE TABLESPACE_NAME = 'SYSTEM'
             GROUP BY SEGMENT_NAME
             ORDER BY 2 DESC)
     WHERE ROWNUM < 10;
     
     select * from dba_data_files where TABLESPACE_NAME LIKE '%ZF%';
     alter tablespace zf add datafile '/u01/oracle/oradata/zf03.dbf' size 20480M autoextend off;
     
     alter tablespace SYSAUX add datafile '/u01/oracle/oradata/sysaux02.dbf' size 4096M autoextend off;
    
    
  • 相关阅读:
    8086汇编学习小记王爽汇编语言实验12
    8086汇编学习小记王爽汇编语言课程设计1
    activeMQ 持久化配置 kevin
    snmpwalk kevin
    tcp benchmark kevin
    apache camel 条件路由 kevin
    netty 并发访问测试配置 kevin
    snmp常见操作 kevin
    转发:RocketMQ与kafka的对比 kevin
    centos jdk 下载 kevin
  • 原文地址:https://www.cnblogs.com/khtt/p/15238824.html
Copyright © 2020-2023  润新知