【PL/SQL】show_space
SQL> create table objects as select * from dba_objects;
表已建立
SQL> @f:\sql\show_space
SQL> set serveroutput on
SQL> exec show_space('objects','auto');
Total Blocks............................1024
Total Bytes.............................8388608
Unused Blocks...........................8
Unused Bytes............................65536
Last Used Ext FileId....................1
Last Used Ext BlockId...................90377
Last Used Block.........................120
PL/SQL 過程已成功完成。
SQL> create index i_ojectid on objects(object_id);
索引已建立。
SQL> exec show_space('i_ojectid','auto','i');
Total Blocks............................256
Total Bytes.............................2097152
Unused Blocks...........................101
Unused Bytes............................827392
Last Used Ext FileId....................1
Last Used Ext BlockId...................90633
Last Used Block.........................27
PL/SQL 過程已成功完成。
SQL> analyze table objects compute statistics;
表已分析。
SQL> exec show_space('objects','auto','T','Y');
Total Blocks............................1024
Total Bytes.............................8388608
Unused Blocks...........................8
Unused Bytes............................65536
Last Used Ext FileId....................1
Last Used Ext BlockId...................90377
Last Used Block.........................120
BEGIN show_space('objects','auto','T','Y'); END;
*
第 1 行出現錯誤:
ORA-10614: Operation not allowed on this segment
ORA-06512: 在 "SYS.DBMS_SPACE", line 190
ORA-06512: 在 "SYS.SHOW_SPACE", line 92
ORA-06512: 在 line 1
SQL> select segment_space_management from dba_tablespaces
2 where tablespace_name=
3 (select tablespace_name from user_tables where table_name ='OBJECTS');
SEGMEN
------
MANUAL
SQL> grant execute on dbms_space to public;
授權成功。
SQL> create public synonym show_space for sys.show_space;
同義詞已建立。
SQL> grant execute on show_space to public;
授權成功。
SQL> conn scott/yang
已連線。
SQL> exec show_space('emp','auto');
PL/SQL 過程已成功完成。
SQL> set serveroutput on
SQL> exec show_space('emp','auto');
Total Blocks............................8
Total Bytes.............................65536
Unused Blocks...........................0
Unused Bytes............................0
Last Used Ext FileId....................4
Last Used Ext BlockId...................25
Last Used Block.........................8
PL/SQL 過程已成功完成。
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/22664653/viewspace-671596/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 【PL/SQL】TOM 的 show_space()SQL
- show_space pl/lsqlSQL
- PL/SQLSQL
- SQL&PL/SQL (轉)SQL
- PL/SQL 宣告SQL
- PL/SQL cursorSQL
- PL/SQL打包SQL
- PL/SQL DEVSQLdev
- 使用PL/Scope分析PL/SQL程式碼SQL
- PLSQL Language Reference-PL/SQL概覽-PL/SQL架構SQL架構
- [PL/SQL]10g PL/SQL學習筆記(一)SQL筆記
- [PL/SQL]10g PL/SQL學習筆記(二)SQL筆記
- [PL/SQL]10g PL/SQL學習筆記(三)SQL筆記
- PL/SQL 迴圈SQL
- PL/SQL 遊標SQL
- PL/SQL 運算子SQL
- PL/SQL 條件SQL
- pl/sql to_dateSQL
- PL/SQL 基礎SQL
- Oracle PL/SQL INDICESOracleSQL
- PL/SQl Developer使用SQLDeveloper
- pl/sql陣列SQL陣列
- pl/sql練習SQL
- oracle PL/SQL示例OracleSQL
- 淺談pl/sqlSQL
- PL/SQL 索引表SQL索引
- pl/sql 練習SQL
- [pl sql] where current ofSQL
- pl/sql功能特性SQL
- PL/SQL Developer 使用SQLDeveloper
- PL/SQL小結SQL
- steven's pl/sqlSQL
- PL/SQL入門SQL
- PL/SQL 設定SQL
- PLSQL Language Reference-PL/SQL概覽-PL/SQL的優點SQL
- Oracle PL/SQL編寫PL/SQL程式碼的注意事項OracleSQL
- ONLine SQL and PL/SQL FormatterSQLORM
- PL/SQL執行動態SQLSQL