oracle實用sql(8)--segment show space
點選(此處)摺疊或開啟
-
declare
-
--輸入段資訊
-
p_owner varchar2(255):='SCOTT';
-
p_seg_name varchar2(255):='T_TEST01';
-
p_type varchar2(255):='TABLE';
-
p_partition varchar2(255);
-
-
v_free_blocks number;
-
-
v_total_blocks number;
-
v_total_bytes number;
-
v_unused_blocks number;
-
v_unused_bytes number;
-
v_last_used_ext_file_id number;
-
v_last_used_ext_block_id number;
-
v_last_used_block number;
-
-
v_segment_space_mgmt varchar2(255);
-
-
v_unformatted_blocks number;
-
v_unformatted_bytes number;
-
v_fs1_blocks number;
-
v_fs1_bytes number;
-
v_fs2_blocks number;
-
v_fs2_bytes number;
-
v_fs3_blocks number;
-
v_fs3_bytes number;
-
v_fs4_blocks number;
-
v_fs4_bytes number;
-
v_full_blocks number;
-
v_full_bytes number;
-
begin
-
--判斷是段空間管理是auto還是manual
-
select ts.segment_space_management into v_segment_space_mgmt
-
from dba_segments seg,dba_tablespaces ts
-
where seg.tablespace_name=ts.tablespace_name
-
and seg.segment_name=p_seg_name
-
and seg.owner=p_owner
-
and (p_partition is null or seg.partition_name=p_partition);
-
-
if v_segment_space_mgmt='AUTO' then
-
--dbms_space.space_usage
-
dbms_space.space_usage(segment_owner =>p_owner,
-
segment_name =>p_seg_name,
-
segment_type =>p_type,
-
unformatted_blocks =>v_unformatted_blocks,
-
unformatted_bytes =>v_unformatted_bytes,
-
fs1_blocks => v_fs1_blocks,
-
fs1_bytes => v_fs1_bytes,
-
fs2_blocks => v_fs2_blocks,
-
fs2_bytes => v_fs2_bytes,
-
fs3_blocks => v_fs3_blocks,
-
fs3_bytes => v_fs3_bytes,
-
fs4_blocks => v_fs4_blocks,
-
fs4_bytes => v_fs4_bytes,
-
full_blocks =>v_full_blocks,
-
full_bytes =>v_full_bytes,
-
partition_name =>p_partition
-
);
-
dbms_output.put_line('unformatted_blocks :'||v_unformatted_blocks);
-
dbms_output.put_line('fs1_blocks (0-25):'|| v_fs1_blocks);
-
dbms_output.put_line('fs2_blocks (25-50):'|| v_fs2_blocks);
-
dbms_output.put_line('fs3_blocks (50-75):'|| v_fs3_blocks);
-
dbms_output.put_line('fs4_blocks (75-100):'|| v_fs4_blocks);
-
dbms_output.put_line('full_blocks :'||v_full_blocks);
-
else
-
--dbms_space.free_blocks
-
dbms_space.free_blocks(segment_owner =>p_owner,
-
segment_name =>p_seg_name,
-
segment_type =>p_type,
-
freelist_group_id =>0,
-
free_blks =>v_free_blocks,
-
partition_name =>p_partition
-
);
-
dbms_output.put_line('free_blks:'||v_free_blocks);
-
end if;
-
--dbms_space.unused_space
-
dbms_space.unused_space(segment_owner =>p_owner,
-
segment_name =>p_seg_name,
-
segment_type =>p_type,
-
total_blocks =>v_total_blocks,
-
total_bytes =>v_total_bytes,
-
unused_blocks =>v_unused_blocks,
-
unused_bytes =>v_unused_bytes,
-
last_used_extent_file_id =>v_last_used_ext_file_id,
-
last_used_extent_block_id =>v_last_used_ext_block_id,
-
last_used_block =>v_last_used_block,
-
partition_name =>p_partition
-
);
-
dbms_output.put_line('total_blocks :'||v_total_blocks);
-
dbms_output.put_line('total_bytes :'||v_total_bytes);
-
dbms_output.put_line('unused_blocks :'||v_unused_blocks);
-
dbms_output.put_line('unused_bytes :'||v_unused_bytes);
-
dbms_output.put_line('last_used_extent_file_id :'||v_last_used_ext_file_id);
-
dbms_output.put_line('last_used_extent_block_id :'||v_last_used_ext_block_id);
-
dbms_output.put_line('last_used_block :'||v_last_used_block);
- end;
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/28539951/viewspace-2116162/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- show_space.sqlSQL
- 【PL/SQL】show_spaceSQL
- Oracle-Segment space managementOracle
- oracle實用sql(2)--segment advisorOracleSQL
- 【PL/SQL】TOM 的 show_space()SQL
- 好用的show_space.sql指令碼SQL指令碼
- oracle segment space management and extent management幾則Oracle
- 【Oracle】-【show_space和show_space_asm】-執行儲存過程報錯OracleASM儲存過程
- show_space pl/lsqlSQL
- SHOW_SPACE指令碼指令碼
- SHOW_SPACE 指令碼指令碼
- SQL查詢table或index異常增長問題 - space_usage (show_space)SQLIndex
- Oracle檢視物件空間使用情況show_spaceOracle物件
- SHOW_SPACE儲存過程儲存過程
- show_space函式原始碼函式原始碼
- show_space 查詢表資料塊碎片問題 - show_space 結果解釋 7
- 關於SHOW_SPACE()工具的用法
- Oracle10g New Feature --12. ASSM ( Automatic Segment Space Management )OracleSSM
- 【實驗】【Tom】show_space儲存過程的使用演示儲存過程
- 關於SHOW_SPACE()工具的用法(轉)
- Oracle Undo SegmentOracle
- Show_HWM.sqlSQL
- TOM大神編寫的show_space函式程式碼函式
- oracle儲存管理之 segment和space管理(server.102 b14231)OracleServer
- [zt] dmt、lmt、mssm, assm (SEGMENT SPACE MANAGEMENT AUTO) 的一點總結SSM
- [Oracle Script] Rollback Segment UsageOracle
- Oracle Segment AdvisorOracle
- oracle實用sql(6)--tablespace/datafile resizeOracleSQL
- oracle實用sql(3)--sql tuning advisorOracleSQL
- Oracle DBMS_SPACEOracle
- 【實驗】【SQL_TRACE】使用sql_trace功能獲得show parameter的sql語句SQL
- ORACLE LOB SEGMENT常規管理Oracle
- How to Shrink Undo Segment In Oracle DatabaseOracleDatabase
- oracle addm segment tuningOracle
- oracle實用sql(5)--session相關資訊OracleSQLSession
- oracle實用sql(4)--undo advisorOracleSQL
- print_table,show_space,stat等,一些常用工具
- Oracle - ORA-30036: unable to extend segment by 8 in undo tablespace 'UNDOTBS1'Oracle