TEMPORARY LOBS are not freed up automatically after PL/SQL block execution
Connected to Oracle Database 10g Enterprise Edition Release 10.2.0.2.0
Connected as test
SQL>
SQL> select se.username,se.sid,su.extents,su.blocks*to_number(rtrim(p.value)) as Space,tablespace,segtype,sql_text from v$sort_usage su,v$parameter p,v$session se,v$sql s
2 where p.name='db_block_size' and su.session_addr=se.saddr and s.hash_value=su.sqlhash and s.address=su.sqladdr order by se.username,se.sid;
USERNAME SID EXTENTS SPACE TABLESPACE SEGTYPE SQL_TEXT
------------------------------ ---------- ---------- ---------- ------------------------------- --------- --------------------------------------------------------------------------------
SQL> DECLARE
2 a clob;
3 BEGIN
4 dbms_lob.createtemporary(a, TRUE,dbms_lob.call);
5 dbms_lob.freetemporary(a);
6 END;
7
8 /
PL/SQL procedure successfully completed
SQL>
SQL> select se.username,se.sid,su.extents,su.blocks*to_number(rtrim(p.value)) as Space,tablespace,segtype,sql_text from v$sort_usage su,v$parameter p,v$session se,v$sql s
2 where p.name='db_block_size' and su.session_addr=se.saddr and s.hash_value=su.sqlhash and s.address=su.sqladdr order by se.username,se.sid;
USERNAME SID EXTENTS SPACE TABLESPACE SEGTYPE SQL_TEXT
------------------------------ ---------- ---------- ---------- ------------------------------- --------- --------------------------------------------------------------------------------
TEST 294 1 1048576 TEMP LOB_DATA begin :id := sys.dbms_transaction.local_transaction_id; end;
SQL> /
USERNAME SID EXTENTS SPACE TABLESPACE SEGTYPE SQL_TEXT
------------------------------ ---------- ---------- ---------- ------------------------------- --------- --------------------------------------------------------------------------------
TEST 294 1 1048576 TEMP LOB_DATA begin :id := sys.dbms_transaction.local_transaction_id; end;
SQL> /
USERNAME SID EXTENTS SPACE TABLESPACE SEGTYPE SQL_TEXT
------------------------------ ---------- ---------- ---------- ------------------------------- --------- --------------------------------------------------------------------------------
TEST 294 1 1048576 TEMP LOB_DATA begin :id := sys.dbms_transaction.local_transaction_id; end;
SQL> /
USERNAME SID EXTENTS SPACE TABLESPACE SEGTYPE SQL_TEXT
------------------------------ ---------- ---------- ---------- ------------------------------- --------- --------------------------------------------------------------------------------
TEST 294 1 1048576 TEMP LOB_DATA begin :id := sys.dbms_transaction.local_transaction_id; end;
關閉此SESSION ,重新進入
SQL> /
USERNAME SID EXTENTS SPACE TABLESPACE SEGTYPE SQL_TEXT
------------------------------ ---------- ---------- ---------- ------------------------------- --------- --------------------------------------------------------------------------------
SQL>
Problem
~~~~~~~
Temporary LOBS are not freed automatically after PL/SQL block execution.
Following the execution of the following PL/SQL block, the temporary LOBs are
not being freed up automatically.
SQL> DECLARE
2 a clob;
3 BEGIN
4 dbms_lob.createtemporary(a, TRUE,dbms_lob.call);
5 dbms_lob.freetemporary(a);
6 END;
7 /
PL/SQL procedure successfully completed.
This can be seen using the following select :-
SQL> select s.username, s.sid, u.tablespace, u.contents, u.segtype,
2 round(u.blocks*8192/1024/1024,2) MB
3 from v$session s, v$sort_usage u
4 where s.saddr = u.session_addr
5 and u.contents = 'TEMPORARY'
6 order by MB DESC ;
USERNAME SID TABLESPACE CONTENTS SEGTYPE MB
--------- ----- ----------- ---------- ------- ---
SK 9 TEMP TEMPORARY LOB_DATA 1
The above result shows still the temporary LOB is allocated.
Fix
~~~~
To workaround the problem, disconnect the database user session.
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/7318139/viewspace-982701/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Reblock after Credit block releasingBloC
- Parallel Execution of SQL StatementsParallelSQL
- siebel server 啟動時報Cleaning up previous execution of【轉】Server
- How to Clean Up After a Failed Oracle Clusterware (CRS) InstallationAIOracle
- 使用after create 建立trigger記錄procedure PL/SQL程式碼變更SQL
- PL/SQLSQL
- A temporary profile is loaded after you log on to a Windows Vista-based systemWindows
- 10g RAC: How to Clean Up After a Failed CRS InstallAI
- look up the sql_textSQL
- SQL&PL/SQL (轉)SQL
- PL/SQL 宣告SQL
- PL/SQL cursorSQL
- PL/SQL打包SQL
- PL/SQL DEVSQLdev
- Oracle PL/SQLOracleSQL
- corrupted block的一次處理和古舊版本的PL/SQL Developer問題BloCSQLDeveloper
- sql net message from|to client與sql execution countSQLclient
- 使用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