viernes, 7 de junio de 2013

system



 ALTER TABLESPACE SYSTEM
    ADD DATAFILE '/tary.../system_02.dbf' SIZE 488281k
      AUTOEXTEND ON
      NEXT 10240K;
COMMIT;




 SELECT a.tablespace_name,
       b.size_MB,
       a.free_MB,
       Trunc((a.free_MB/b.size_MB) * 100) "FREE_%"
FROM   (SELECT tablespace_name,
               Trunc(Sum(bytes)/1024/1024) free_MB
        FROM   dba_free_space
        GROUP BY tablespace_name) a,
       (SELECT tablespace_name,
               Trunc(Sum(bytes)/1024/1024) size_MB
        FROM   dba_data_files
        GROUP BY tablespace_name) b
WHERE  a.tablespace_name = b.tablespace_name
order by 4
/

 SELECT * FROM DBA_DATA_FILES  ORDER BY TABLESPACE_NAME,FILE_ID ;



SELECT df.tablespace_name TABLESPACE, df.total_space TOTAL_SPACE,
fs.free_space FREE_SPACE, df.total_space_mb TOTAL_SPACE_MB,
(df.total_space_mb - fs.free_space_mb) USED_SPACE_MB,
fs.free_space_mb FREE_SPACE_MB,
ROUND(100 * (fs.free_space / df.total_space),2) PCT_FREE
FROM (SELECT tablespace_name, SUM (bytes) TOTAL_SPACE,
      ROUND( SUM (bytes) / 1048576) TOTAL_SPACE_MB
      FROM dba_data_files
      GROUP BY tablespace_name) df,
     (SELECT tablespace_name, SUM (bytes) FREE_SPACE,
       ROUND( SUM (bytes) / 1048576) FREE_SPACE_MB
       FROM dba_free_space
       GROUP BY tablespace_name) fs
WHERE df.tablespace_name = fs.tablespace_name(+)
ORDER BY fs.tablespace_name;


with segs as (select owner, segment_type, segment_name, partition_name, ceil(bytes/1024/1024) mb
--SELECT *
from dba_segments where tablespace_name = 'SYSTEM'
order by 5 desc)
select * from segs where rownum <= 10;


select (select sum(bytes)/1024/1024  from dba_data_files where tablespace_name = 'SYSTEM') MB,
(select sum(bytes)/1024/1024 from dba_segments where tablespace_name = 'SYSTEM') MB_USED,
(select sum(bytes)/1024/1024 from dba_free_space where tablespace_name = 'SYSTEM') MB_FREE
from dual;



alter database datafile '/tary.../system_02.dbf' RESIZE 1G;
  ----    1G;
COMMIT;


 SELECT * FROM DBA_DATA_FILES  ORDER BY TABLESPACE_NAME,FILE_ID ;

No hay comentarios: