Using REPLACE on CLOB causes increase in CACHE_LOBS...

I have a requirement to use the built in REPLACE function on a CLOB variable as part of a larger PL/SQL process. I'm using Oracle 11g R2 and the function works OK, in that it does the replace as required, but as the procedure runs (there are around 2.5 millions records to process), it slows down badly - as in:
first 20,000 records: ~12 minutes
second 20,000 records: ~24 minutes
third 20,000 records: ~37 minutes
fourth 20,000 records: ~52 minutes
etc...
Checking V$TEMPORARY_LOBS during operation shows that the value for CACHE_LOBS increases with every row processed - my assumption is that this implies that memory associated with LOBS (CLOBS in this case) is not getting released once it has been used...?
Stepping through the code using PL/SQL debugger reveals that the value for CACHE_LOBS increases by 2 for every call to the REPLACE function. The function calls are along the lines of:
[code]
clobRTFText         CLOB;
dbms_lob.createtemporary(clobRTFText, TRUE, dbms_lob.call);
clobRTFText := REPLACE(clobRTFText, '<CR>', '\par ');  <== Causes CACHE_LOBS to increase by 2
dbms_lob.freetemporary(clobRTFText);
[/code]
It's as though the third line of code above is creating further CLOB variables on the fly. Is that because there is some kind of implicit type conversion occurring due to the REPLACE function expecting a VARCHAR2 parameter? I've tried using dbms_lob.copy instead of REPLACE, but it actually was worse (CACHE_LOBS went up quicker).
I've gone through the PL/SQL Semantics for LOBs section of the Oracle documentation - it mentions the way CLOB and VARCHAR2 variables can be used in built-in functions but I can't find anything about doing so potentially causing extra memory usage.
Does anyone have any ideas why this is happening or how I could do it (i.e. use REPLACE with a CLOB) without it failing to releasing memory (assuming that is indeed what is happening)?
Thanks

Sorry, I should have mentioned in the original post above...the call to dbms_lob.freetemporary does not cause the value of CACHE_LOBS to drop.

Similar Messages

  • IMac 27" (mid 2010): Will replacing the HD cause fan problems?

    Hi,
    I have an iMac 27" (mid 2010). My HD is broken, and I'd like to replace it. I've already installed an SSD, so replacing the HD shouldn't be much of a problem.
    However I've read that replacing the HD causes the fan to spin up all the time. Some sites say this started one generation later, but some remain unspecific or say that this problem affects all iMacs. Before I replace my HD, I'd like to know what to expect.
    So my question is: in my 2010 iMac, can I replace the HD without causing fan problems (provided I put the temp plug in the right place )?
    Best regards,
    F

    OWC is mistaken. I don't know why they keep saying that. (I'm not even certain the OWC blog linked above related to using the same make drive on the late 2009s was ever correct. I had a long phone conversation with an upper level WD tech some time ago who said that the originals were special ordered by Apple.) Those drives have Apple proprietary firmware which puts the temp sensor output to the jumper block, and you cannot just replace with a drive of the same manufacturer. A non-Apple WD drive will not have that connection at the jumper block.
    Two possibilities: Get an external stick-on temp sensor that will work with your model or use SSD Fan Control.
    http://exirion.net/ssdfanctrl/
    If I'm mistaken and you do get it to work directly with a replacement WD drive I will be pleasantly surprised, since I have a Late 2009 which will need a new drive sooner or later. Please post back with your results.

  • Excessive use of recovery slider causes banding.

    Has anyone else noticed this, the situation is subject back lit (form window with white blinds) with fill flash. Using the exposure slider to increase exposure and the recovery slider near maximum to take back down the blinds causes blocks of solid white to appear in parts of the translucent blind in images exported. This occurs in Tiff both 16 & 8 bit as well as Jpgs. It's also a problem on 2 systems PPC G5 and MBP. It does not show on the viewer or full screen mode when editing but appears in the output files.
    Reducing the Recovery to 3/4 seems to make it disappear. It caused me some problems yesterday when outputting some tiffs and required some rework to get things right. JFYI

    Top 1/3rd in portrait or last 1/3 L to R in landscape produces a band of more solid white. Obviously a problem and now I'm more cautious seeing as you have the same problem. Granted by judicious amounts of slider applied it causes no problem but there is no indication of where or when this will appear, on screen gives no indication, it only seems to appear in printing or output.

  • Need help in using replace function with special characters

    I have a column in a table where the data can contain ascii code for special characters such as an apostrophe.
    The data looks like this:
    CREEK&#39;S LANE
    ie for a street named CREEK'S LANE.
    I want to replace the ascii representation with the apostrophe and have the returned data show up as: CREEK's LANE
    When I try the query below I get prompted for substitution variable value.
    I don't seem to be able to find the right syntax to make this query work.
    SELECT REPLACE (street_name, '&#39;', '''')
    FROM
    streets WHERE street_id = 1
    Does anybody know how to do this?
    Any help would be much appreciated.
    Thanks.
    George

    george91 wrote:
    I have a column in a table where the data can contain ascii code for special characters such as an apostrophe.
    The data looks like this:
    CREEK'S LANE
    ie for a street named CREEK'S LANE.
    I want to replace the ascii representation with the apostrophe and have the returned data show up as: CREEK's LANE
    When I try the query below I get prompted for substitution variable value.
    I don't seem to be able to find the right syntax to make this query work.
    SELECT REPLACE (street_name, ''', '''')
    FROM
    streets WHERE street_id = 1
    Does anybody know how to do this?
    Any help would be much appreciated.
    Thanks.
    GeorgeHa! The codes you specified rendered in the HTML, but showed properly when I listed your original posting above. I didn't understand what you meant initially because the 5-character string represenation got rendered as the quote that you said you weren't able to get - a display problem.
    You're getting prompted for the substituon variable because of the ampersand; you appear to be doing this in SQL*PLUS. The first thing I would try is to SET DEFINE OFF when using the ampersands to see if that works. If That doesn't work check the docs to delmit the ampersand (I think its a backslash before it but can't remember offhand). Another, harder option might be to use the TRANSLATE function replacing the literal character instead of using REPLACE (though replacing a quote will be a little tricky). If you're on 10g also consider using the advanced quoting
    Good luck!
    Edited by: riedelme on May 22, 2009 12:45 PM

  • Formula variable using Replacement path not working

    Dear All,
    I am using a query to calculate YTD values in the report. I am using a formula variable to calculate the number of months. Formula is
    Month To - Month From+1
    When I am giving the range from 001 to 006 for period in th evariable screen,
    I am gettung Month To as 6 and Month From as 6 with total no . of months as 1.
    I think Month From is not being caculated properly. I created another formul variable using Replacement path, for characteristic Posting period, replace with a Key and dimension ID as number with out any offset.
    Still not working.
    Any suggestions.
    Thanks and Regards,
    Srini
    Edited by: Srinivas on Apr 24, 2008 11:13 AM

    Hello,
    I have seen this document already. It is slightly different from what I am trying to do here than what the post shows. How ever,  I did everything right, atleast seems to be and don´t know why I am not getting the From value from the posting period selected. To value variable is coming right.
    Any more sugegstions.?
    Thanks and Regards,
    Srini

  • Hi Thanks for 4.0. It runs much faster on my Mac, however, it no longer works to zoom in all of my web pages. I use to be able to use my finger pad to increase the size of all of all pages. Thanks again.

    Hi Thanks for 4.0. It runs much faster on my Mac, however, it no longer works to zoom in all of my web pages. I use to be able to use my finger pad to increase the size of all of all pages.
    Thanks again.
    PS Are you working on a version for the iPad and iPhone with Add Blocker? That would be great!

    Here are some zoom add-ons which might provide a workaround:
    [https://addons.mozilla.org/en-US/firefox/search/?q=image+zoom&cat=all&x=0&y=0 Image Zoom]
    As regards your question about iPad and iPhone, you'd be better off posting that question here: [https://forums.mozilla.org/addons/ Mozilla Add-ons Forum]
    P.S. ''Apologies for not responding earlier''.

  • I used to be able to increase the size font of the persons name sending me an email or text message.  I have an iphone 5 and can no longer do that.  Help!

    I used to be able to increase the size font of the persons name sending me an email or text message.  I have an iphone 5 and can no longer do that.  Help!

    Just the name? Don't ever recall that being a feature. However, for Mail and Messages (and a few other apps): Settings app > General > Text Size

  • Can I use Replace function in a decode??

    Hello,
    I am trying to use replace function inside a Decode Function,
    Here is how I am doing it:
    select
    SUBSTR (
    DECODE (
    IH.DRVD_ALT_MAIL_ADDR_PRIM_FLAG,
    'N',
    REPLACE (
    ih.subs_addr_1
    || ' '
    || ih.subs_addr_2
    || ' '
    || ih.subs_city
    || ','
    || ih.subs_state_code
    || ' '
    || ih.subs_zip_code,
    'Y',
    REPLACE (
    IH.PRINT_ALT_MAIL_ADDR_LINE_1
    || ' '
    || IH.PRINT_ALT_MAIL_ADDR_LINE_2
    || ' '
    || IH.PRINT_ALT_MAIL_ADDR_LINE_3
    || ' '
    || IH.PRINT_ALT_MAIL_ADDR_LINE_4
    || ' '
    || IH.PRINT_ALT_MAIL_ADDR_LINE_5
    || ' '
    || IH.PRINT_ALT_MAIL_ADDR_LINE_6,
    ) 1,
    50
    address from x
    Can anyone please tell me what am I doing wrong here, It always gives me an error about missing a right parenthesis.
    Thanks in advance.

    Hi Jimmy,
    Looks like you are missing the first comma in the SUBSTR function
    SELECT SUBSTR (
             DECODE (
               ih.drvd_alt_mail_addr_prim_flag,
               'N', REPLACE (
                         ih.subs_addr_1
                      || ' '
                      || ih.subs_addr_2
                      || ' '
                      || ih.subs_city
                      || ','
                      || ih.subs_state_code
                      || ' '
                      || ih.subs_zip_code,
               'Y', REPLACE (
                         ih.print_alt_mail_addr_line_1
                      || ' '
                      || ih.print_alt_mail_addr_line_2
                      || ' '
                      || ih.print_alt_mail_addr_line_3
                      || ' '
                      || ih.print_alt_mail_addr_line_4
                      || ' '
                      || ih.print_alt_mail_addr_line_5
                      || ' '
                      || ih.print_alt_mail_addr_line_6,
             ), -- HERE
             1,
             50
             address
    FROM   xRegards
    Peter

  • Using Replace Pages in accessible PDF's

    Hi - Brand new to this forum.  Hoping someone can help... I have an existing tagged and accessible PDF - needed content update, so did that in Word, created a new tagged and accessible PDF, and used Replace pages to insert the new pages into the existing PDF.  Acrobat Help says when you replace pages in a PDF, Acrobat adds the tags from the incoming pages to the end of the tag tree... and keeps the tags for the replaced pages.   That didn't happen - the tags from the incoming pages are not there and, in fact, the tags that were in the existing PDF are not there anymore either - now it just says "Warning, empty page".   Any ideas?

    Hi kvd,
    I guess my nomenclature may be presumptive. All I should have said is that the most appropriate method I have discovered for retaining tagging and all other accessibility functionality has been the Combine command. Replace Pages sometimes works and most of the time (lately) is doesn’t. My experience with Insert Pages has not been consistently successful either.
    What you mean by a workflow I don’t fully understand. Do you mean an automated action? Unless you consistently use the same page numbers in every document, I don't know how you could automate it. Also, I have not been able to find specific process treatment about combining tagged PDFs. This has been a result of testing and experimentation.
    Let me know if you have any other questions.

  • Doubt in using replace statement

    Hi all,
       I have a requirement where user will enter more than 1 label no in a screen, which will be populated internally in a table by SAP with ## for every ENTER button pressed by the user. the internal table populated by SAP will be having values like this. 11111111111##22222222222##3333333333
    I need to separate the values from ## and move it to another internal table. I used replace statement to replace ##. But its not working.  I dont know what could be the problem. Can any one suggest me in doing this.
    POINTS PROMISED
    Regards,
    Buvana

    You will need to use the replace, but you need to be searching for cl_abap_char_utilities=>CR_LF in the REPLACE statement, the ## is an internal representation of the CR_LF,  so use 
    replace  cl_abap_char_utilities=>CR_LF  with .....
    Regards,
    RIch Heilman

  • Problem while using oracle.sql.CLOB

    Hello,
    I was trying to use oracle.sql.CLOB to update CLOB types in database. I was able to successfully run the update when I use the connection obtained from normal DriverManager.getConnection method. But have issues when I use a datasource lookup, Am using Websphere as my JDBC provider environ.
    The exception I get during the execution of this line is
    oracle.sql.CLOB newClob = oracle.sql.CLOB.createTemporary((java.sql.Connection)conn, false, oracle.sql.CLOB.DURATION_CALL);
    java.lang.ClassCastException: com.ibm.ws.rsadapter.jdbc.WSJdbcConnection
    as my connection is obtained by DataSource.getConnection() method.
    Is this a documented limitation of Oracle SQL CLOB class or is there a way I can tweak the code to work.
    Am using a oracle 9i thin driver
    Thanks
    Message was edited by:
    caniknow

    With the new Oracle drivers there is no need to do it that complicated.
    Finally Oracle has implemented the standard JDBC calls, and inserting a CLOB is really easy now:
    String clobContent  = populateClobData(); // whatever...
    stmt = con.prepareStatement("INSERT INTO clob_table (id, clob_col) VALUES (?,?)";
    stmt.setInt(1, 42);
    Reader r = new StringReader(clobContent);
    stmt.setCharacterStream(2, r, clobContent.length());
    stmt.executeUpdate();
    con.commit();This works with UPDATE as well. If you need to deal with BLOBs simply use setBinaryStream().
    Reading is done using getCharacterStream() or getBinaryStream()
    This actually works across all (or at leas all major) database systems

  • Using 'replace' in Oracle

    Hi All,
    I am trying to use replace to replace a string with some tags as shown below:
    replace('ADAFETG3B-D0LA,ADAFETG3B-D0WA ', ',' , '</PartName><PartName>')
    but in the output it replaces the < with '&ltsemicolon' and > with '&gtsemicolon'
    Is there any other way to include < and > within strings and have them get displayed as is??
    Thanks for your help in advance.
    -Avantika

    Actually I am simply generating valid XML, so that no conversion of special characters like < or > take place. The output of the statement is as follows:
    X                                                                              
    <StartMaterials>                                                               
      <SMat>                                                                       
        <PartName>partname1</PartName>                                             
        <Alternates>                                                               
          <PartName>my first part</PartName>                                       
          <PartName>my second part</PartName>                                      
        </Alternates>                                                              
        <Qty>50</Qty>                                                              
      </SMat>                                                                      
      <SMat>                                                                       
        <PartName>partname2</PartName>                                             
        <Alternates>                                                               
          <PartName>my first part - my second part</PartName>                      
        </Alternates>                                                              
        <Qty>150</Qty>                                                             
      </SMat>                                                                      
    </StartMaterials> 

  • Bulk Replacements using Replace function in oracle 8i

    Hi All,
    Iam using oracle 8i version and i need to use Replace function for bulf replacements i mean i need to replace around 250 rows. So please anyone suggest me how to proceed
    on this request as iam using oracle 8i version.
    Thanks!
    Srini

    Write one update statement.
    The where condition is the filter what rows need to be touched.
    The SET condition will do the data change. For example it could use the REPLACE function if that is what it is needed.
    One single update statement over 20 rows would mean the task is done in BULK. 20 single updates that each handle one row would mean it is row by row = slow by slow processing.

  • Help needed using REPLACE function

    Post Author: Domo
    CA Forum: Formula
    I need to swap out HTML special characters for their corresponding symbols.
    The text field in question obviously contains many number codes, e.g. &#39; for an apostrophe (') and I would like to write a formula which replaces these for it's corresponding text character.
    How would I go about this? I know how to use replace for single entries, e.g. Replace(, "&#39;", "'"); but how do I apply this to multiple entries?
    I have been using Crystal syntax for other formulas in the report (not sure if Basic and Crystal can be used?).

    Post Author: Domo
    CA Forum: Formula
    Yeah it seems using a combination of Basic and Crystal syntax is possible in CR9.
    I simply created the following formula in the end:
    dim strInputstrInput = {TEXT.STRING}formula = replace(replace(replace(replace(replace(replace(replace(replace(replace(strinput, "<P>", "")," ", " "), "&#39;", "'"), "</P>", ""), "&#58;", ":"), "<BR>", CHR(13)), "&#60;", "<"), "&#62;", ">"), "&#34;", "''")
    Looks a little messy but it works!

  • Create a formula variable using replacement path for current date

    Hi All,
    I created a formula variable using replacement path for current date.
    But when i used this variable am getting an error message saying .
    " This Variable cannot be used in this query".
    Could you please let me know the reason?
    Thanks,
    Zehra

    Hi All,
    Thanks for all your help...
    I just found a solution via the below link
    in Bex Formula variabel, Current calander day(sap exit) missing.
    Here he is trying to use the existing formula variable.
    My doubt here is, Even i could not find this varaible in BEX formula variable, But could see this in BI Content path as mentioned in the above link.  DO i have to transport this varaible , or i simply can activate it in production?
    I just could find this in BI Content but not in MetaData Repository.
    Thanks,
    Zehra

Maybe you are looking for