more "space.sql"
select tablespace_name,
sum(blocks) as free_blk, trunc(sum(bytes)/(1024*1024)) AS FREE_M,
max(bytes)/(1024) as big_chunk_k, count(*) as num_chunks
from dba_free_space
group by tablespace_name ;
select AA.*, (AA."Allocation" - AA."Used" + BB."Free" ) "Free Size", BB."Free"
from
(select a.tablespace_name "TABLESPACE_NAME", sum(a.maxbytes)/1024/1024 "Allocation", sum(a.bytes)/1024/1024 "Used"
from dba_data_Files a
group by a.tablespace_name ) AA,
(select b.tablespace_name, sum(b.bytes)/1024/1024 "Free"
from dba_free_space b
group by b.tablespace_name ) BB
where AA.TABLESPACE_NAME = BB.TABLESPACE_NAME(+) ;
select a.tablespace_name , a.bytes - b.bytes "FREE(M)"
from
( select tablespace_name, sum(maxbytes)/1024/1024 bytes from dba_data_files group by tablespace_name ) a,
( select tablespace_name, sum(bytes)/1024/1024 bytes from dba_segments group by tablespace_name) b
where a.tablespace_name = b.tablespace_name;
select a.tablespace_name , a.bytes - b.bytes "FREE(M)"
from
( select tablespace_name, sum(maxbytes)/1024/1024 bytes from dba_data_files group by tablespace_name ) a,
( select tablespace_name, sum(bytes)/1024/1024 bytes from dba_extents group by tablespace_name) b
where a.tablespace_name = b.tablespace_name;
more "rbs_usage.sql"
col today format a20 new_value curr_time
col today noprint
select to_char(sysdate,'YYYY/MM/DD HH24:MI:SS') today from dual ;
prompt =========================================================
prompt == rollback segment storage and status ==
prompt => DAte : [ &CURR_TIME ]
prompt =========================================================
set linesize 120
col rb_seg for a10
col status for a10
col tbs_nm for a10
col ini_kb for 9,999,999
col nxt_kb for 9,999,999
col tot_kb for 9,999,999
col ext for 999
col xt for 99
select a.segment_name as rb_seg,
a.status, c.xacts as xt,
b.initial_extent/1024 as ini_kb,
b.next_extent/1024 as nxt_kb,
b.extents as ext,
b.bytes/1024 as tot_kb,
a.tablespace_name as tbs_nm
from dba_rollback_segs a, dba_segments b, v$rollstat c
where a.owner = b.owner
and a.segment_name = b.segment_name
and a.segment_id = c.usn
order by a.segment_name ;
sys@ARTDOM>begin
dbms_utility.analyze_schema('SCOTT','ESTIMATE',NULL,5);
end ;
/
PL/SQL procedure successfully completed.
select e.owner, e.segment_type, e.segment_name, count(*) as nr_extents,
s.max_extents, to_char(sum(e.bytes)/(1024*1024),'999,999.90') AS MB
from dba_extents e, dba_segments
where e.segment_name = s.segment_name
group by e.owner, e.segment_type, e.segment_name, s.max_extents
having count(*) > 10 or ( s.max_extents - COUNT(*) ) < 20 )
order by count(*) desc ;
SELECT A.TABLE_NAME, A.NEXT_EXTENT, A.TABLESPACE_NAME
FROM ALL_TABLES A,
( SELECT TABLESPACE_NAME, MAX(BYTES) AS BIG_CHUNK
FROM DBA_FREE_SPACE
GROUP BY TABLESPACE_NAME ) F
WHERE F.TABLESPACE_NAME = A.TABLESPACE_NAME
AND A.NEXT_EXTENT > F.BIG_CHUNK ;
ALTER TABLE <owner>.table STORAGE ( MAXEXTENTS UNLIMITED);
more "check_next.sql"
select segment_name, segment_type, dt.tablespace_name, ds.next_extent
from dba_tablespaces dt, dba_segments ds
where dt.tablespace_name = ds.tablespace_name
and dt.next_extent != ds.next_extent
and ds.owner ='&OWNER';
more "check_pk_exist.sql"
select table_name from all_tables where owner='&OWNER'
minus
select table_name from all_constraints where owner='&&OWNER'
and constraint_type ='P';
- 강좌 URL : http://www.gurubee.net/lecture/4172
- 구루비 강좌는 개인의 학습용으로만 사용 할 수 있으며, 다른 웹 페이지에 게재할 경우에는 출처를 꼭 밝혀 주시면 고맙겠습니다.~^^
- 구루비 강좌는 서비스 제공을 위한 목적이나, 학원 홍보, 수익을 얻기 위한 용도로 사용 할 수 없습니다.