Skip to Main Content

Breadcrumb

Question and Answer

Connor McDonald

Thanks for the question, Raud.

Asked: May 26, 2017 - 6:46 am UTC

Last updated: May 29, 2017 - 2:20 am UTC

Version: PL/SQL Release 11.2.0.1.0 - Production

Viewed 1000+ times

You Asked

Hi Tom,

Here is my query to check the temporary lob.

select sum(cache_lobs) sum_cache_lobs from v$temporary_lobs;

SUM_CACHE_LOBS
--------------
0

This is my simple standalone function with return type clob

CREATE OR REPLACE FUNCTION SAMP_FUN
RETURN CLOB
IS
BEGIN
RETURN 'TESTCLOB';
END;
/

1. when I run this function in sql developer the cache lob increased by 1.

select sum(cache_lobs) sum_cache_lobs from v$temporary_lobs;

SUM_CACHE_LOBS
--------------
1

It got cleared when I did disconnect and reconnect the connection.

2. when I run the same function in sql* plus the cache lob is not increased.

3. We have an application that uses connection pool . It calls oracle methods returning clob.
The cache_lobs are not cleared until I do the application restart(the same behavior as it was in sql developer).
Any input to clear the cache lobs in the application without doing application restart would be very helpful

and Connor said...

Take a look at this link for the right way to create, handle and then free temporary lobs.

https://asktom.oracle.com/pls/asktom/f%3Fp%3D100:11:0::::P11_QUESTION_ID:2957424542334

I'm reaching out to the SQL Dev product manager for his thoughts on lob management in there, because in SQL Dev if I do this:

select * from v$temporary_lobs;
variable c clob
exec :c := SAMP_FUN;
select * from v$temporary_lobs;

my temporary lob count grows unabated

Is this answer out of date? If it is, please let us know via a Comment

More to Explore

CLOB/BLOB/etc

Complete documentation on Securefiles and Large Objects here