TEMP tablespace getting full while inserting a CLOB in Trigger

We have a Oracle 10g (10.2.0.4.0) DB on a Solaris 9 box which also runs our J2EE web-service application on Weblogic 8sp6 server.
We get around 220K web-service requests from upstream callers daily to insert data in the main table, say TABLE1, which has daily partitions on a date column. This table has around 21 columns out of which 1 is a CLOB column.
Now this table has an AFTER INSERT trigger which calls a package procedure to insert the same record into another table, say TABLE2.
From Java application insert statement in executed in below format using a weblogic jdbc connection pool :
INSERT INTO TABLE1(COLUMN1, COLUMN2, ........., CLOB_COLUMN,........, COLUMN21) VALUES (:1, :2, :3, :4, :5, :6, :7, :8, :9, :10, :11, :12, :13, :14, :15, :16, :17, :18, :19, :20);
Clob object is prepared in application using ojdbc14.jar.
We are observing a strange issue here. The TEMP tablespace utilization keeps on growing as more and more inserts are executed by application and after ~125K inserts the TEMP tablespace gets full and we start getting ORA-01652 error.
On further analysis we could see that there are only 7-10 session being maintained but as more and more inserts happen TEMP tablespace utilization goes on increasing for each of these sessions.
When we tried with inserting just few records and then watching the session details in v$session_wait then we could see that it is in INACTIVE state and waiting for the event ‘SQL*Net message from client’. This does not seem correct as the session has successfully inserted the data and committed the transaction and we can see the data in the tables as well.
The confusing thing here is when we modify the trigger to pass blank string('' ) instead of the CLOB column to TABLE2 then this issue does not occur. All 200K records are inserted properly and TEMP tablespace utilization also keep always below 1%.
Can you please help us in solving this issue. Is this related to any oracle issue?
Inside the package we have tried using DBMS_COPY statement to copy the CLOB column after insert but still same result.
Code for reference:
Trigger:
=====================================
CREATE OR REPLACE TRIGGER trg
AFTER INSERT OR UPDATE
ON TABLE1
REFERENCING NEW AS NEW OLD AS OLD
FOR EACH ROW
BEGIN
IF (:NEW.date_col > SYSDATE - 2)
THEN
IF (:NEW.cat IN (1001, 1002))
THEN
pkg.process_change
     (:NEW.COLUMN1,
          :NEW.COLUMN2,
          :NEW.CLOB_COLUMN,
FLAG
END IF;
END IF;
END;
=====================================
Package:
=====================================
procedure PKG.Process_change(
p_COLUMN1 number,
p_COLUMN2 varchar2,
p_CLOB_COLUMN clob,
flag boolean
) is
v_watermark pls_integer;
v_type varchar2(1);
begin
if (flag) then
v_type := 'U';
else
v_type := 'I';
end if;
select t_seq.nextval into v_watermark from dual;
insert into TABLE2(
COLUMN1 number,
COLUMN2 varchar2,
CLOB_COLUMN clob,
watermark,
dml_type
)values (
p_COLUMN1 number,
p_COLUMN2 varchar2,
p_CLOB_COLUMN clob,
v_watermark,
v_dml_type
end;
=====================================

My first thought on reading your post is that not only are you using a database version that is now so old it is in extended support and even then not even the most recent patchset for it.
The first thing I would do is move to 11gR2 and if you can't do that at least get to 10.2.0.5 and apply CLOB relevant patches as well.
Same goes for your operating system. Solaris 9 is ancient: So move to 10 which has vastly improved memory management.
To help you further it would be really valuable to know the table layout. For example is this a heap table or an IOT? Is it partitioned? Is this RAC? What size are the CLOBs? Are they stored in-line? Chunk size? etc.
This page should start you down the right road:
http://docs.oracle.com/cd/B19306_01/appdev.102/b14249/adlob_tables.htm#sthref204
But I am also wondering why you would use a trigger to, as you say, "insert the same record into another table." This description is a poster child for "bad design."

Similar Messages

  • Temp tablespace 98% full

    Hy
    My temp tablespace (1 GB) is 98% full.
    A.)How can I find out which user uses at a certain point of time in percent the tablespace.
    B.)Does a full temp tablespace lead to performance problems reduces the "reply velocity" of a database
    lutz
    null

    Lutz,
    a) By using the following query you can determine who are all the users who have created their objects in TEMP tablespace..
    SQL> SELECT OWNER, SEGMENT_NAME, SEGMENT_TYPE
    from dba_segments
    where tablespace_name like 'TEMP';
    Once u get the names of the objects u can move to the tablespace u want.
    b). According to me YES. Try to restart the database after moving the objects if any.. and this should give some space to u.
    There is a bug in 8.1.6 related to the use of TEMP tablespace while using the sort operations.. Check it if u r using 8.1.6
    Hope this helps,
    Shiva
    null

  • Temp tablespace 99%full

    What are the suggestion for temp tablespace, if its 99%full, should we keep adding space in it or it will use existing space?
    TABLESPACE TOTAL_MB USED_MB FREE_MB PCT_USED GRAPH (X=5%)
    TEMP 17,500.00 17,444.00 56.00 99.68 [XXXXXXXXXXXXXXXXXXX-]

    Hi,
    >>What are the suggestion for temp tablespace, if its 99%full, should we keep adding space in it or it will use existing space?
    I think that you don't need worry about, unless you're receiving some ORA- error about out of space in TEMP tablespace. You can see below an SQL output from a database used here in my company for development and tests purposes. The database is up uninterruptedly by 7 months and the space size for the TEMP tablespace have been configured to use 900 MB.
    LEGATTI@ORACLE10> SELECT tablespace_name, SUM(bytes_used), SUM(bytes_free)
      2  FROM   V$temp_space_header
      3  GROUP  BY tablespace_name;
    TABLESPACE_NAME                SUM(BYTES_USED) SUM(BYTES_FREE)
    TEMP                                 943718400               0Cheers
    Legatti

  • UNDO tablespace getting full

    My undo tablespace is getting full because of uncommited deletes performed by jdbc thin client sessions.
    How can I solve this problem permanently?
    Size of undo tablespace is 5.5GB
    I am facing an undo tablespace full issue
    Below are the sessions which maybe causing the problem.
    select s.sid,
    s.serial#,
    s.sql_id,
    s.prev_sql_id,
    s.SCHEMANAME ,
    s.OSUSER ,
    s.program,
    USED_UBLK,USED_UREC from v$session s, v$transaction t where s.taddr=t.addr order by USED_UREC;
    3909 30842 fgcp0qn1bqzx9 XLTDB5 xltwrk5 JDBC Thin Client 504 45257
    5133 53593 fgcp0qn1bqzx9 XLTDB5 xltwrk5 JDBC Thin Client 07 54482
    4525 35108 fgcp0qn1bqzx9 XLTDB10 xltwrk10 JDBC Thin Client 2381 192853
    4428 38484 fgcp0qn1bqzx9 XLTDB1 xltwrk1 JDBC Thin Client 8682 634540
    For this sql id :fgcp0qn1bqzx9 there are more than 14k executions per hour.
    Below is the query for this sql id:
    /* TJAPI_SubTrxTransient_deleteTrb1SubTrxTransient_0 */ DELETE FROM TRB1_SUB_TRX_TRANSIENT
    Some other details
    ++++++++++++
    Oravle version:11.1.0.7
    OS:SunOS
    ++++++++++++

    Perhaps an interesting link:
    http://oracledisect.blogspot.com/2008/05/who-is-using-your-undo-space.html
    Perhaps you can use Oracle Resource Manager, create a resource plan and switch sessions to a different consumer group once they reach a certain treshold.
    http://download.oracle.com/docs/cd/B28359_01/server.111/b28310/dbrm004.htm
    Btw are these distributed transactions?
    DBA commit other session's transaction?
    Edited by: Markus Waldorf on Sep 9, 2010 7:57 PM

  • Iam getting error while insert .

    HI every one , i getting error while doing insert data into backend table.the error is like this , could you clarify is it possible to change the lookup of sappd1db to other.
    Object not found in lookup of SAPPD1DB.

    Hi Eswar,
    go to J2EE perspective..expend ur Ejb project n now double click on persistent.xml file
    now in right pane first deselect switch off verification ,if its selectd..
    then select  No automatic locking..
    now in datasource name input field u can write ur new datasource sys ID..
    secondly..go to entity bean tab after doin this in same pane
    n expend entity bean
    nw check for ejb field's mapping for corressponding fields ..
    id it shows table is varified by d dictionary thn its fine else u map it wid correct fields..
    now save the changes..n delete ue old .jar file of ejb project n create new..now create new .ear file for application project aftr deleting old one...n deploy new1....
    hpe it hlps u...
    Regards,
    Khushboo

  • Getting Error While inserting a record in table PDSNR through Tcode PA30

    Hi Experts,
    Im doing a transaction in  TCode PA30 by entering a pernr and infty as 14 and wage type.
    My need is when im entering a particular wage type in PA30 with infotype 14 , for that particular wage type and infotype i need to assign a different cost centre. This requirement was doing now manually by changing the cost centre form EDIT - > Maintain Cost Assignment.
    But my Client Needs to do it automatically. by comparing the wage type and infotype the cost centre needs to get automatically updated.
    So i use the Enhancement EXIT_SAPFP50M_002 * INCLUDE ZXPADU02.* and wrote coding like below
    CASE innnn-infty.
    To check whether the record belong to pa0014
    If so,check the wage type for the updation
    If so update the values of cost center assignments in the table assob and asshe
    when '0014'.
    if innnn-subty eq '2211'.
    Select the last updated sequence number in the table pdsnr
    if sy-ucomm eq 'UPD' or sy-ucomm eq 'INS'.
    select single * from pa0001 into wa_0001 where pernr eq INNNN-pernr and
                                                   endda eq '99991231'.
      if sy-subrc = 0.
    call function 'ENQUEUE_EPPRELE'
    EXPORTING
       MODE_PREL            = 'E'
       MANDT                = SY-MANDT
       PERNR                = INNNN-pernr
       INFTY                = INNNN-INFTY
       SUBTY                = INNNN-SUBTY
    EXCEPTIONS
       FOREIGN_LOCK         = 1
       SYSTEM_FAILURE       = 2
       OTHERS               = 3
    if sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    endif.
    CLEAR : lv_pdsnr.
    select MAX( pdsnr ) from pdsnr into lv_pdsnr.
    lv_pdsnr = lv_pdsnr + 1.
        ls_assob-pdsnr = lv_pdsnr.
        ls_assob-pernr = INNNN-pernr.
        ls_assob-bukrs = wa_0001-bukrs. "'1001'.
        ls_assob-gsber = wa_0001-gsber. "'0001'.
        ls_assob-kokrs = wa_0001-kokrs. "'1000'.
        ls_assob-kostl = '1-1361'.
        ls_asshr-pdsnr = lv_pdsnr.
        ls_asshr-pernr = INNNN-pernr.
        ls_asshr-infty = innnn-infty.
        ls_asshr-subty = innnn-subty.
        ls_asshr-begda = sy-datum.
        ls_asshr-endda = '99991231'.
        ls_PDSNR-pdsnr = lv_pdsnr.
        ls_PDSNR-PDGRP = '5B'.
    insert into pdsnr values ls_pdsnr.
    insert into asshr values ls_asshr.
    insert into assob VALUES ls_assob.
    call function 'DEQUEUE_EPPRELE'
    EXPORTING
       MODE_PREL       = 'E'
       MANDT           = SY-MANDT
       PERNR           = INNNN-pernr
       INFTY           = INNNN-INFTY
       SUBTY           = INNNN-SUBTY.
        ENDIF.
    ENDIF.
    ENDIF.
    COMMIT WORK.
    ENDCASE.
    This is to update the three tables PDSNR, ASSOB,ASSHR.
    Its getting Updated correctly, But when i goto EDIT - > Maintain Cost Assignment to do some changes and while saving the data i get the following Error Message :
    You Cannot insert data in table : PDSNR.
    Message no. P2715
    Can Anyone please suggest me how to solve this issue.
    Thanks,
    Vijayan.R

    Hi. Were you able to fix the error?

  • Getting error while inserting xmldoc to a table

    I am getting following error .
    ERROR at line 2:
    ORA-06550: line 2, column 6:
    PLS-00103: Encountered the symbol "INSERTXML" when expecting one of the
    following:
    := . ( @ % ;
    The symbol ":=" was substituted for "INSERTXML" to continue.
    Here is my code below.
    CREATE TABLE empleados (empid NUMBER PRIMARY KEY,
    empname VARCHAR2(30),
    empjob VARCHAR2(30),
    empsal NUMBER);
    create or replace procedure InsertXML(xmlDoc IN VARCHAR2, tableName IN VARCHAR2) is
    insCtx DBMS_XMLSave.ctxType;
    rows number;
    begin
    insCtx := DBMS_XMLSave.newContext(tableName); -- get the context handle
    rows := DBMS_XMLSave.insertXML(insCtx,xmlDoc); -- this inserts the document
    dbms_output.put_line(to_char(rows) || ' rows inserted');
    DBMS_XMLSave.closeContext(insCtx); -- this closes the handle
    end;
    begin
    exec InsertXML('<?xml version="1.0"?><ROWSET><ROW num="1"><EMPID>10</EMPID><EMPNAME>Perry Smith
    </EMPNAME><EMPJOB>Manager</EMPJOB><EMPSAL>800</EMPSAL></ROW><ROW num="1"><EMPID>20</EMPID><EMPNAME>J
    ohn Calvach</EMPNAME><EMPJOB>Principal Support Consultant</EMPJOB><EMPSAL>900</EMPSAL></ROW><ROW num
    ="1"><EMPID>30</EMPID><EMPNAME>Louis Bald</EMPNAME><EMPJOB>Technical Specialist</EMPJOB><EMPSAL>400<
    /EMPSAL></ROW><ROW num="1"><EMPID>40</EMPID><EMPNAME>Anthony Flowers</EMPNAME><EMPJOB>Technical Team
    Leader</EMPJOB><EMPSAL>500</EMPSAL></ROW><ROW num="1"><EMPID>50</EMPID><EMPNAME>George Monk</EMPNAM
    E><EMPJOB>Support Consultant</EMPJOB><EMPSAL>200</EMPSAL></ROW></ROWSET>','empleados');
    end;

    I changed the name.But still I get that error.
    Thanks

  • Getting error while inserting a row in a table

    Hi,
    The following error occurs when one of my enduser is trying to enter record into a table
    <b>Error: Insertion of Infotype 1032 (return code 3) </b>
    There are no records in the table at all.. what could be the reason and why the error occurs?
    Thanks in advance
    Regards,
    Suresh

    Hello Suresh,
    in which table... did you get a dump?
    What is the ORA-error? Is a trace or an alert.log entry generated?
    Your information is insufficient to solve the problem
    Regards
    Stefan

  • Number gets rounded while inserting

    Hi,
    Help required
    query is as below :
    desc test_load
    Name Null? Type
    B VARCHAR2(10)
    select b,substr(b,1,length(b)-2)||'.'||substr(b,-2,2) amt from test_load;
    B AMT
    3232922618 32329226.18
    desc sql_amt
    Name Null? Type
    A NUMBER
    insert into sql_amt
    select substr(b,1,length(b)-2)||'.'||substr(b,-2,2) amt from test_load;
    select * from sql_amt;
    A
    32329226.2
    the above values rounded 32329226.2 it should be 32329226.18
    Pls let me know the Solution
    Thanks & Regards
    Vishal

    As Citrus pointed out, it's merely to do with how the data is displayed in the tool which retrieves it, not how the data is actually stored on the database.
    If your retrieval environment (SQL*Plus, Toad or whatever) is set to display numbers with a single decimal place then they will automatically round your numbers as they are retrieved. This doesn't mean that the data is stored wrongly on the database, just that you haven't specified the correct display format for your requirements in your tool.
    ;)

  • Tablespace getting full quite often [cannot extend tbs], need a script to add data files on reaching the threshold!!

    Good morning Techies,
    I have a OBIEE environment where developers work on continuous data loads and the tablespaces are filled up quite often throwing cannot extend.
    I have a request from the customer to generate some script or automatic adding up of datafiles.
    Can someone here help with the ways of automizing or easing this situation through some script where it ask the users for the path and DB file size etc and creates a datafile with the inputs.
    Or advise any other ways to handle the situation.
    Regards,
    RanG

    Oracle does not but you can write your own job to execute when you reach certain threshold. You can also do this in a GRID so whenever the metric threshold reached, it executes your procedure. Make sure you check your file system space before adding a datafile.
    With BIGFILE tablespace, you might need to change your backup policies.
    Check these link as well:
    tablespace - Can oracle tablesspaces automatically add smallfile datafiles? - Stack Overflow
    Can Oracle Create New Datafile Automatically?

  • SGEN and tablespaces getting full

    Hello gurus
    I'm running SGEN in a system that I've just installed, and I've noticed that the process of SGEN affects two tablespaces PSAPES620I and PSAPEL620D and I've to increase their sizes in 4Gb total (3gb to PSAPEL620D and 1gb PSAPES620I, is that a normal behavior of SGEN?
    Regards

    Hello,
    Yes. It is quite normal. Don't worry
    Thanks,
    Siva Kumar

  • Unusual Temp Tablespace Growth

    Hi ,
    We have noticed unsual temp tablespace growth when concurrent users are accessing OLAP cube through BI Bean crosstabs.
    On an average 3 to 4 GB temp tablespace is consumed for each new user. OLAP cube has 7 dimensions and 1.2 million records and is fully precalculated.
    This causes the system to fail as a result of temp tablespace getting full.
    Can somebody please let me know what can be the root causes?.
    Thanks in advance.
    Harry

    Hi there,
    It is not unusual for OLAP queries to make significant use of temp tablespace. 3-4GB doesn't sound unreasonable to me. The actual amount used depends on factors such as the type of activity and the number of users.
    There is a brief description of how OLAP uses temp tablespace here :- http://download.oracle.com/docs/cd/B28359_01/olap.111/b28124/admin.htm#sthref442
    Note the lower than standard setting 'EXTENT MANAGEMENT LOCAL UNIFORM SIZE 256K' - if you are not already using this setting then you may find that it lowers temp space usage as the default setting is usually 1024K or even 4096K
    I hope this helps
    Stuart

  • Temp tablespace full at startup

    Hi,
    my temp tablespace appears full at database startup. I know it is full because the collecting statistics process can not be executed since temp tablespace can not grow (autoextend off). I had to add another temp datafile to get the statistics but first one continues full after each restart.
    Is this any signal of malfunction?
    Thanks for all.
    Greetings.

    ok. I think all is understood.
    DBMS_STATS.GATHER_SCHEMA_STATS probably needed more disk than 1.5 GB (my old temp tablespace), so the result was
    ERROR en línea 1:
    ORA-01652: no se ha podido ampliar el segmento temporal con 128 en el
    tablespace TEMP
    ORA-06512: en "SYS.DBMS_STATS", línea 9136
    ORA-06512: en "SYS.DBMS_STATS", línea 9616
    ORA-06512: en "SYS.DBMS_STATS", línea 9800
    ORA-06512: en "SYS.DBMS_STATS", línea 9854
    ORA-06512: en "SYS.DBMS_STATS", línea 9831
    ORA-06512: en línea 1
    Then adding new datafile (1.5 GB more) process could finish. Database continues growing, process always had finished not yesterday: the day of needing full temp tablespace came.
    Tell me if I am wrong.
    Thanks a lot.

  • Set alert for tablespace in grid control when tablespace get 85% full.

    Hi,
    I want to set a tablespace alert in grid control when the tablespace in database get 85% full.
    We should get a alert through a grid control.
    Could you please let me know how to set a alert in grid control for tablsepace usage?
    Thanks,

    HI
    Thanks for the reply.
    I have set the alert the way you asked me do.
    However i am not getting an alert when the tablespace get full by 85%.
    I am not getting alert to our mail.
    Could you please let me know do we need to do anything else.
    I tried using through user defined sql metrics.
    The query which i am using is
    DECLARE
    Type v_filenames is table of dba_data_files.FILE_NAME%type
    index by pls_integer;
    filename v_filenames;
    type v_currsize is table of dba_data_files.BYTES%type
    index by pls_integer;
    currsize v_currsize;
    type v_maxsize is table of dba_data_files.MAXBYTES%type
    index by pls_integer;
    maxsize v_maxsize;
    mark75 number;
    mark500 number;
    n_maxsize number;
    i pls_integer default 1;
    total_files sys.dba_data_files.BYTES%type;
    SUM_BYTES sys.dba_data_files.BYTES%type;
    SUM_MAXBYTES sys.dba_data_files.MAXBYTES%type;
    BEGIN
    SELECT SUM(BYTES)/(1024*1024),SUM(MAXBYTES)/(1024*1024) INTO sum_bytes,SUM_MAXBYTES FROM DBA_DATA_FILES WHERE TABLESPACE_NAME='&&1';
    select SUM(bytes*4/3-maxbytes)/(1024*1024),500-SUM(MAXBYTES)/(1024*1024) into mark75,mark500 FROM DBA_DATA_FILES WHERE TABLESPACE_NAME='&&1';
    if mark75>=mark500 then
    n_maxsize:=mark75;
    else
    n_maxsize:=mark500;
    END IF;
    will the above query will work.
    I dont what condition to put in my case.
    I want to put this condition
    if mark75>=mark500 then
    n_maxsize:=mark75;
    however i am not using it in where clause.
    Thanks.

  • Temp tablespace - why so big?

    Temp tablespace (size 6gb) is twice the size of my data and index tablespace combined. I am running into space issues and am wondering is it possible to resize this tablespace and/or take some other action to prevent the temp tablespace getting so relatively large?
    Thanks in advance.

    The Temporary Tablespace holds only 1 Temporary Segment shared all by all user sessions. Each session takes one or more extents. When a session finishes its operation, it "releases" the extent it used for use by another session but the size of the Segment does NOT shrink.
    Therefore, the Segment would grow to the peak concurrent temporary extent usage -- eg at some point in time, if you had 4 very large queries running concurently taking up 8GB then the segment would have grown to 8GB. However, even if you never have such concurrent usage (for example the normal load is for 20 users concurrently taking up 500MB only !), the segment remains at 8GB.
    In some environments, the Temporary tablespace could grow during periodic (say Monthly Reporting) batch jobs after which it is dropped and recreated again.
    This segment is used not just for "SORT" operations. It is also used for HASH JOIN overflows to disk and also for SORT MERGE operations.
    You can monitor the size of the segment in V$SORT_SEGMENT. You can monitor users currently using it in V$SORT_USAGE or V$TEMPSEG_USAGE.
    Hemant K Chitale
    http://hemantoracledba.blogpsot.com

Maybe you are looking for