Question on PL/SQL / Insert Performance

So I have a table (TABLEA) with one column that has approximately 420k records and a I have a second table (TABLEB) that stores data identified by a procedure.
I have a PL/SQL Package with the two procedures.
With the package I pass it two parameters (start and stop number).
execute id_pkg.mrs(0,10000);These numbers are used to capture information into a CURSOR like this.
I then have another procedure GET_CV that takes the value passed from emp_cur_mrs.ID and loops through each record to populate TABLEB. TABLEB is created with "NOLOGGING".
for empi_cur_mrs in
select id into v_tmpmrn from sourcemrns where id > startid  and id < endid)
loop
get_cv(empi_cur_mrs.id);
end loop;When I run this against my first 10k records it takes approximately 22 seconds to complete. As I move I continue to add more data when identifying the next 10k records (e.g. execute id_pkg.mrs(10000,20000) the performance begins to drop.
Here is the "insert" code that is stored within the GET_CV procedure.
insert /*+ APPEND */ into TABLEB(fullrec) values(v_fullrecord);Can anyone provide me with any ideas on why this could be happening?

Okay, this is a basic structure of what I pull and the end result of the GET_CV. I want to populate the end result into a table.
MEMBER_TBL (IDENTIFIES MEMBERS FROM ALL SOURCES; INTERNAL ID IS UNIQUE in MEMBER_TBL AND ID COULD BE SAME IN MULTIPLE SOURCES:
INTERNALID      SRCID       ID
10          100     1200
13          120     3543
14          140     1354
15          300     10980
MEMLINKED_TBL (IDENTIFIES WHICH MEMBERS ARE LINKED)
INTERNALID LINKID
10        10
13        10
14        10
15        12
MEMNAME_TBL  (NAMEID: 12=MEMBER NAME, 13=EMERGENCY CONTACT NAME, I ONLY WANT MEMBER NAME): A-active I-inactive
INTERNALID     NAMEID     NAME           STATUS          MODIFIED_KEY
10          12     SMITH,JOHN     A          222
10          12     SMIT,JON     I          099
10          13     JONES,JIM     A          222
13          12     SMITH,J          A          111
14          12     SMITH,JON     A          212
13          13     Thomas,Train     A          345The max number MODIFIED_KEY tells us the latest updated one (e.g. INTERNALID with Modified_key of 222 would be the latest for NAMEID=12)
MEMPHONE_TBL (PHONEID:11 IS HOMEPHONE AND 55=EMERGENCY PHONE)
INTERNALID     PHONEID      PHONE_AREA     PHONE_NUMBER     MODIFIED_KEY     STATUS
10          11          800          8889999          133123          A
10          11          800          8880000          000001          I
10          55          888          7729999          323431          A
13          11          888          7739999          123243          A
14          55          888          7769999          454534          AI pass the pl/sql or sql the SRCID and the ID, I then need to look at all the members linked to that one and get the lastest information.
For example, I pass it INTERNALID of '10',ID of '1200' and SRCID of '100' and expect to get back the LINKID from MEMLINKED_TBL, most recent NAME from MEMNAME_TBL and MEMPHONE_TBL.
I would get the following:
LINKID     NAME          HOMEPHONE
10     SMITH,JOHN     8008889999If I could pull this all together without passing in an "ID", that would be great. I could not figure out how without actually passing it the ID and SRCID.
Thanks for any guidance!

Similar Messages

  • Sql Loader Performance

    Hi
    i have some question about SQL Loader. i have to find answers but did not get from Google or Documentation. i want to know that is there any way to check whether Sql loader inserting records with Direct path or Conventional path. As we know there are restriction in Direct load. Direct-path inserts do not support all objects that conventional inserts do. Their functionality
    is restricted. If the database engine is not able to execute a direct-path insert, the operation is silently converted into a conventional insert. i have instruct Sql loader to insert using Direct=true and parallel as well. but it take 15 mint to loader 4 million record in table. i have observed its transfer rate is bit slow. i have oracle 11R2 on windows 2008 with 40GB RAM and SAN. how can i verify during execution either Sql loader load user Direct path or silently converted it conventional path. here is my sample control file. function used in control file will convert direct path to conventional?
    /c sqlldr userid='MSNV5Star/Aa123456@(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=srv01)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=orcl)))' control='C:\ControlFile.txt' log='C:\ Final Data.log' bad= 'C:\ Final Data.bad'  direct=true  PARALLEL=TRUE  skip=1 Errors=5000000
    LOAD DATA 
    INFILE 'C:\adeel loading\in\A06052010.txt'APPEND
    INTO TABLE GN_FILE_DATA_TABLE
    FIELDS TERMINATED BY "     " TRAILING NULLCOLS
    Operational_Date "to_date(:Operational_Date, 'YYYYMMDD')" ,
    Store_Code "TRIM(:Store_Code)" ,
    Txn_Void_Flag "TRIM(:Txn_Void_Flag)" ,
    Txn_Staff_Flag "TRIM(:Txn_Staff_Flag)" ,
    Txn_Aborted_Flag "TRIM(:Txn_Aborted_Flag)"     Edited by: Oracle Studnet on May 30, 2011 7:18 AM

    Pl do not post duplicates - sql Loader Performance
    Srini

  • Child node insert performance

    (Oracle Database 11g 11.1.0.6.0)
    I just ran a test to continually insert child XML nodes into an XML table and found performance slow. As the documentation states, the reason appears to be because the entire XML is being read into memory each time as a DOM before the insert.
    My question is whether there is a higher performing means of performing child node inserts?
    The test is as follows:
    i)     Create a non-schema based XML type table:
                        CREATE TABLE myTable1 (
                             id NUMBER,
                             XML_COLUMN XMLType
                        XMLTYPE COLUMN xml_document store as binary xml
    ii)     The table is initialized with one row of data:
         0, XMLTYPE('<trace-envelope>
                   <metadata>
                        <pid>12345</pid>
                        <date>2008-05-30</date>
                   </metadata>
              </trace-envelope>')
    iii)     Insert/append successive XML data using the following statement:
         UPDATE MyTable1 SET XML_COLUMN = APPENDCHILDXML(XML_COLUMN," +
              "'trace-envelope', XMLType('" + traceData + "'))";
         where 'traceData' is some new XML data for insertion. The view on the row then becomes (for example):
         0, XMLTYPE('<trace-envelope>
                   <metadata>
                        <pid>12345</pid>
                        <date>2008-05-30</date>
                   </metadata>
                   <EP>
                        <priceDate>
                             2008-05-30
                        </priceDate>
                   </EP>
              </trace-envelope>')
    iv)     Continue appending successive child nodes.

    The only thing I currently can think of is maybe a negative impact of updating / re-balancing the index tree during appending in the XMLType OR structure.
    SQL> select * from user_segments where segment_type like '%INDEX%'
      2  order by segment_type
      3  /
    SEGMENT_NAME                   PARTITION_NAME                 SEGMENT_TYPE       SEGMENT_SU TABLESPACE_NAME                    BYTES    BLOCKS   EXTENTS INITIAL_EXTENT NEXT_EXTENT MIN_EXTENTS MAX_EXTENTS  MAX_SIZE RETENTI MINRETENTION PCT_INCREASE FREELISTS FREELIST_GROUPS BUFFER_
    SYS_C004114                                                   INDEX              ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_C004115                                                   INDEX              ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_C004116                                                   INDEX              ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_C004117                                                   INDEX              ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_C004118                                                   INDEX              ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_C004120                                                   INDEX              ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_C004119                                                   INDEX              ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_IL0000060304C00004$$                                      LOBINDEX           ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_IL0000060304C00005$$                                      LOBINDEX           ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_IL0000060304C00011$$                                      LOBINDEX           ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_IL0000060304C00016$$                                      LOBINDEX           ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_IL0000060304C00025$$                                      LOBINDEX           ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_IL0000060324C00003$$                                      LOBINDEX           ASSM       USERS                             131072        16         2          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_IL0000060305C00004$$                                      LOBINDEX           ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_IL0000060328C00003$$                                      LOBINDEX           ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    15 rows selected.
    SQL> select * from user_segments
      2  /
    SEGMENT_NAME                   PARTITION_NAME                 SEGMENT_TYPE       SEGMENT_SU TABLESPACE_NAME                    BYTES    BLOCKS   EXTENTS INITIAL_EXTENT NEXT_EXTENT MIN_EXTENTS MAX_EXTENTS  MAX_SIZE RETENTI MINRETENTION PCT_INCREASE FREELISTS FREELIST_GROUPS BUFFER_
    ACTION_TABLE                                                  NESTED TABLE       ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_LOB0000060305C00004$$                                     LOBSEGMENT         ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_IL0000060305C00004$$                                      LOBINDEX           ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_C004114                                                   INDEX              ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    LINEITEM_TABLE                                                NESTED TABLE       ASSM       USERS                             131072        16         2          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_C004115                                                   INDEX              ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    PURCHASEORDER_OR                                              TABLE              ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_LOB0000060304C00004$$                                     LOBSEGMENT         ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_IL0000060304C00004$$                                      LOBINDEX           ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_LOB0000060304C00005$$                                     LOBSEGMENT         ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_IL0000060304C00005$$                                      LOBINDEX           ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_LOB0000060304C00011$$                                     LOBSEGMENT         ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_IL0000060304C00011$$                                      LOBINDEX           ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_LOB0000060304C00016$$                                     LOBSEGMENT         ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_IL0000060304C00016$$                                      LOBINDEX           ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_LOB0000060304C00025$$                                     LOBSEGMENT         ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_IL0000060304C00025$$                                      LOBINDEX           ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_C004116                                                   INDEX              ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_C004117                                                   INDEX              ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_C004118                                                   INDEX              ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    PURCHASEORDER_CLOB                                            TABLE              ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_LOB0000060324C00003$$                                     LOBSEGMENT         ASSM       USERS                           14680064      1792        29          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_IL0000060324C00003$$                                      LOBINDEX           ASSM       USERS                             131072        16         2          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_C004119                                                   INDEX              ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    PURCHASEORDER_CSX                                             TABLE              ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_LOB0000060328C00003$$                                     LOBSEGMENT         SECUREFILE USERS                             327680        40         4         106496                       1   2.147E+09 2.147E+09 DEFAULT            0                                        DEFAULT
    SYS_IL0000060328C00003$$                                      LOBINDEX           ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_C004120                                                   INDEX              ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    28 rows selected.
    SQL> select dbms_lob.getlength(t.xmldata)
      2         as "XMLDocSize"
      3  from   PURCHASEORDER_CLOB t;
    XMLDocSize
         73114
    1 row selected.
    SQL>
    SQL> select dbms_lob.getlength(t.object_value.getclobval())
      2         as "XMLDocSize"
      3  from   PURCHASEORDER_CSX t;
    XMLDocSize
         68682
    1 row selected.
    SQL>
    SQL> select dbms_lob.getlength(t.object_value.getclobval())
      2         as "XMLDocSize"
      3  from   PURCHASEORDER_OR t;
    XMLDocSize
         85342
    1 row selected.
    SQL>
    SQL> truncate table PURCHASEORDER_CLOB;
    Table truncated.
    SQL> truncate table PURCHASEORDER_CSX;
    Table truncated.
    SQL> truncate table PURCHASEORDER_OR;
    Table truncated.
    SQL> var DOCUMENT VARCHAR2(4000)
    SQL> --
    SQL> set define off
    SQL> --
    SQL> begin
      2    :DOCUMENT :=
      3  '<PurchaseOrder xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="PurchaseOrder.xsd">
      4     <Reference>AMCEWEN-20030409123336271PDT</Reference>
      5     <Actions>
      6             <Action>
      7                     <User>KPARTNER</User>
      8             </Action>
      9     </Actions>
    10     <Reject/>
    11     <Requestor>Allan D. McEwen</Requestor>
    12     <User>AMCEWEN</User>
    13     <CostCenter>S30</CostCenter>
    14     <ShippingInstructions>
    15             <name>Allan D. McEwen</name>
    16             <address>Oracle Plaza
    17  Twin Dolphin Drive
    18  Redwood Shores
    19  CA
    20  94065
    21  USA</address>
    22             <telephone>650 506 7700</telephone>
    23     </ShippingInstructions>
    24     <SpecialInstructions>Expidite</SpecialInstructions>
    25     <LineItems>
    26             <LineItem ItemNumber="1">
    27                     <Description>Traffic</Description>
    28                     <Part Id="696306038924" UnitPrice="39.95" Quantity="2"/>
    29             </LineItem>
    30             <LineItem ItemNumber="2">
    31                     <Description>General Idi Amin Dada</Description>
    32                     <Part Id="37429166529" UnitPrice="29.95" Quantity="3"/>
    33             </LineItem>
    34             <LineItem ItemNumber="3">
    35                     <Description>This is Spinal Tap</Description>
    36                     <Part Id="715515009126" UnitPrice="39.95" Quantity="3"/>
    37             </LineItem>
    38             <LineItem ItemNumber="4">
    39                     <Description>Great Expectations</Description>
    40                     <Part Id="37429128022" UnitPrice="39.95" Quantity="1"/>
    41             </LineItem>
    42             <LineItem ItemNumber="5">
    43                     <Description>The Unbearable Lightness Of Being</Description>
    44                     <Part Id="37429140222" UnitPrice="29.95" Quantity="2"/>
    45             </LineItem>
    46             <LineItem ItemNumber="6">
    47                     <Description>Blood of a Poet</Description>
    48                     <Part Id="37429147429" UnitPrice="0.0" Quantity="1"/>
    49             </LineItem>
    50             <LineItem ItemNumber="7">
    51                     <Description>Juliet of the Spirits</Description>
    52                     <Part Id="37429165829" UnitPrice="29.95" Quantity="4"/>
    53             </LineItem>
    54             <LineItem ItemNumber="8">
    55                     <Description>Insomnia</Description>
    56                     <Part Id="37429138229" UnitPrice="29.95" Quantity="4"/>
    57             </LineItem>
    58             <LineItem ItemNumber="9">
    59                     <Description>Picnic at Hanging Rock</Description>
    60                     <Part Id="37429126325" UnitPrice="29.95" Quantity="3"/>
    61             </LineItem>
    62             <LineItem ItemNumber="10">
    63                     <Description>W.C. Fields - Six Short Films</Description>
    64                     <Part Id="715515010726" UnitPrice="29.95" Quantity="4"/>
    65             </LineItem>
    66     </LineItems>
    67  </PurchaseOrder>';
    68  end;
    69  /
    PL/SQL procedure successfully completed.
    SQL>
    SQL> set timing on
    SQL>  --
    SQL> insert into PURCHASEORDER_OR values ( XMLType(:DOCUMENT))
      2  /
    1 row created.
    Elapsed: 00:00:00.06
    SQL>
    SQL> insert into PURCHASEORDER_CLOB values ( XMLType(:DOCUMENT))
      2   /
    1 row created.
    Elapsed: 00:00:00.01
    SQL>
    SQL> insert into PURCHASEORDER_CSX values ( XMLType(:DOCUMENT))
      2  /
    1 row created.
    Elapsed: 00:00:00.03
    SQL> commit;
    Commit complete.
    Elapsed: 00:00:00.01
    SQL> create or replace synonym PURCHASEORDER for PURCHASEORDER_OR
      2  /
    Synonym created.
    Elapsed: 00:00:00.03
    SQL> call appendLineItems(1001,2000)
      2  /
    Call completed.
    Elapsed: 00:00:04.78
    SQL> call appendLineItems(2001,3000)
      2  /
    Call completed.
    Elapsed: 00:00:09.39
    SQL> call appendLineItems(3001,4000)
      2  /
    Call completed.
    Elapsed: 00:00:13.93
    SQL> call appendLineItems(4001,5000)
      2  /
    Call completed.
    Elapsed: 00:00:18.70
    SQL> call appendLineItems(5001,6000)
      2  /
    Call completed.
    Elapsed: 00:00:23.65
    SQL> call appendLineItems(6001,7000)
      2  /
    Call completed.
    Elapsed: 00:00:28.18
    SQL> call appendLineItems(7001,8000)
      2  /
    Call completed.
    Elapsed: 00:00:32.98
    SQL> call appendLineItems(8001,9000)
      2  /
    Call completed.
    Elapsed: 00:00:37.78
    SQL> call appendLineItems(9001,10000)
      2  /
    Call completed.
    Elapsed: 00:00:43.03
    SQL> select * from user_segments where segment_type like '%INDEX%'
      2  order by segment_type;
    SEGMENT_NAME                   PARTITION_NAME                 SEGMENT_TYPE       SEGMENT_SU TABLESPACE_NAME                    BYTES    BLOCKS   EXTENTS INITIAL_EXTENT NEXT_EXTENT MIN_EXTENTS MAX_EXTENTS  MAX_SIZE RETENTI MINRETENTION PCT_INCREASE FREELISTS FREELIST_GROUPS BUFFER_
    SYS_C004114                                                   INDEX              ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_C004115                                                   INDEX              ASSM       USERS                             393216        48         6          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_C004116                                                   INDEX              ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_C004117                                                   INDEX              ASSM       USERS                             196608        24         3          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_C004118                                                   INDEX              ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_C004120                                                   INDEX              ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_C004119                                                   INDEX              ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_IL0000060304C00004$$                                      LOBINDEX           ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_IL0000060304C00005$$                                      LOBINDEX           ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_IL0000060304C00011$$                                      LOBINDEX           ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_IL0000060304C00016$$                                      LOBINDEX           ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_IL0000060304C00025$$                                      LOBINDEX           ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_IL0000060324C00003$$                                      LOBINDEX           ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_IL0000060305C00004$$                                      LOBINDEX           ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_IL0000060328C00003$$                                      LOBINDEX           ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    15 rows selected.
    Elapsed: 00:00:00.17
    SQL> select * from user_segments;
    SEGMENT_NAME                   PARTITION_NAME                 SEGMENT_TYPE       SEGMENT_SU TABLESPACE_NAME                    BYTES    BLOCKS   EXTENTS INITIAL_EXTENT NEXT_EXTENT MIN_EXTENTS MAX_EXTENTS  MAX_SIZE RETENTI MINRETENTION PCT_INCREASE FREELISTS FREELIST_GROUPS BUFFER_
    ACTION_TABLE                                                  NESTED TABLE       ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_LOB0000060305C00004$$                                     LOBSEGMENT         ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_IL0000060305C00004$$                                      LOBINDEX           ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_C004114                                                   INDEX              ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    LINEITEM_TABLE                                                NESTED TABLE       ASSM       USERS                             917504       112        14          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_C004115                                                   INDEX              ASSM       USERS                             393216        48         6          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    PURCHASEORDER_OR                                              TABLE              ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_LOB0000060304C00004$$                                     LOBSEGMENT         ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_IL0000060304C00004$$                                      LOBINDEX           ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_LOB0000060304C00005$$                                     LOBSEGMENT         ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_IL0000060304C00005$$                                      LOBINDEX           ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_LOB0000060304C00011$$                                     LOBSEGMENT         ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_IL0000060304C00011$$                                      LOBINDEX           ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_LOB0000060304C00016$$                                     LOBSEGMENT         ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_IL0000060304C00016$$                                      LOBINDEX           ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_LOB0000060304C00025$$                                     LOBSEGMENT         ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_IL0000060304C00025$$                                      LOBINDEX           ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_C004116                                                   INDEX              ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_C004117                                                   INDEX              ASSM       USERS                             196608        24         3          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_C004118                                                   INDEX              ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    PURCHASEORDER_CLOB                                            TABLE              ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_LOB0000060324C00003$$                                     LOBSEGMENT         ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_IL0000060324C00003$$                                      LOBINDEX           ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_C004119                                                   INDEX              ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    PURCHASEORDER_CSX                                             TABLE              ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_LOB0000060328C00003$$                                     LOBSEGMENT         SECUREFILE USERS                             131072        16         1         106496                       1   2.147E+09 2.147E+09 DEFAULT            0                                        DEFAULT
    SYS_IL0000060328C00003$$                                      LOBINDEX           ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_C004120                                                   INDEX              ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    28 rows selected.
    Elapsed: 00:00:00.17
    SQL> select index_name, table_name, blevel, LEAF_BLOCKS, DISTINCT_KEYS, AVG_LEAF_BLOCKS_PER_KEY, AVG_DATA_BLOCKS_PER_KEY
      2  from user_indexes
      3  ;
    INDEX_NAME                     TABLE_NAME                        BLEVEL LEAF_BLOCKS DISTINCT_KEYS AVG_LEAF_BLOCKS_PER_KEY AVG_DATA_BLOCKS_PER_KEY
    SYS_C004114                    ACTION_TABLE                           0           1             1                       1                       1
    SYS_IL0000060305C00004$$       ACTION_TABLE
    SYS_C004115                    LINEITEM_TABLE                         1           2           511                       1                       1
    SYS_C004119                    PURCHASEORDER_CLOB                     0           1             1                       1                       1
    SYS_IL0000060324C00003$$       PURCHASEORDER_CLOB
    SYS_C004120                    PURCHASEORDER_CSX                      0           1             1                       1                       1
    SYS_IL0000060328C00003$$       PURCHASEORDER_CSX
    SYS_C004116                    PURCHASEORDER_OR                       0           1             1                       1                       1
    SYS_IL0000060304C00025$$       PURCHASEORDER_OR
    SYS_IL0000060304C00016$$       PURCHASEORDER_OR
    SYS_IL0000060304C00011$$       PURCHASEORDER_OR
    SYS_IL0000060304C00005$$       PURCHASEORDER_OR
    SYS_IL0000060304C00004$$       PURCHASEORDER_OR
    SYS_C004117                    PURCHASEORDER_OR                       0           1             1                       1                       1
    SYS_C004118                    PURCHASEORDER_OR                       0           1             1                       1                       1
    15 rows selected.
    Elapsed: 00:00:00.15
    SQL> select dbms_lob.getlength(t.object_value.getclobval())
      2         as "XMLDocSize"
      3  from   PURCHASEORDER_OR t;
    XMLDocSize
       1505177
    1 row selected.
    Elapsed: 00:00:00.42
    SQL> set autotrace ON EXPLAIN
    SQL> select count(*) from PURCHASEORDER, XMLTABLE (
      2  '/PurchaseOrder/LineItems/LineItem' passing OBJECT_VALUE)
      3  /
    COUNT(*)
         9010
    1 row selected.
    Elapsed: 00:00:00.07
    Execution Plan
    Plan hash value: 3089669143
    | Id  | Operation           | Name             | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT    |                  |     1 |    53 |     9  (12)| 00:00:01 |
    |   1 |  SORT AGGREGATE     |                  |     1 |    53 |            |          |
    |*  2 |   HASH JOIN         |                  |   511 | 27083 |     9  (12)| 00:00:01 |
    |   3 |    TABLE ACCESS FULL| PURCHASEORDER_OR |     1 |    34 |     3   (0)| 00:00:01 |
    |*  4 |    TABLE ACCESS FULL| LINEITEM_TABLE   |   511 |  9709 |     5   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       2 - access("NESTED_TABLE_ID"="PURCHASEORDER"."SYS_NC0003200033$")
       4 - filter("SYS_NC_TYPEID$" IS NOT NULL)

  • Jdbc thin driver bulk binding slow insertion performance problem

    Hello All,
    We have a third party application reporting slow insertion performance, while I traced the session and found out most of elapsed time for one insert execution is sql*net more data from client, it appears bulk binding is being used here because one execution has 200 rows inserted. I am wondering whether this has something to do with their jdbc thin driver(10.1.0.2 version) and our database version 9205. Do you have any similar experience on this, what other possible directions should I explore?
    here is the trace report from 10046 event, I hide table name for privacy reason.
    Besides, I tested bulk binding in PL/SQL to insert 200 rows in one execution, no problem at all. Network folks confirm that network should not be an issue as well, ping time from app server to db server is sub milisecond and they are in the same data center.
    INSERT INTO ...
    values
    (:1, :2, :3, :4, :5, :6, :7, :8, :9, :10, :11, :12, :13, :14, :15, :16, :17,
    :18, :19, :20, :21, :22, :23, :24, :25, :26, :27, :28, :29, :30, :31, :32,
    :33, :34, :35, :36, :37, :38, :39, :40, :41, :42, :43, :44, :45)
    call count cpu elapsed disk query current rows
    Parse 1 0.00 0.00 0 0 0 0
    Execute 1 0.02 14.29 1 94 2565 200
    Fetch 0 0.00 0.00 0 0 0 0
    total 2 0.02 14.29 1 94 2565 200
    Misses in library cache during parse: 1
    Optimizer goal: CHOOSE
    Parsing user id: 25
    Elapsed times include waiting on following events:
    Event waited on Times Max. Wait Total Waited
    ---------------------------------------- Waited ---------- ------------
    SQL*Net more data from client 28 6.38 14.19
    db file sequential read 1 0.02 0.02
    SQL*Net message to client 1 0.00 0.00
    SQL*Net message from client 1 0.00 0.00
    ********************************************************************************

    I have exactly the same problem, I tried to find out what is going on, changed several JDBC Drivers on AIX, but no hope, I also have ran the process on my laptop which produced a better and faster performance.
    Therefore I made a special solution ( not practical) by creating flat files and defining the data as an external table, the oracle will read the data in those files as they were data inside a table, this gave me very fast insertion into the database, but still I am looking for an answer for your question here. Using Oracle on AIX machine is a normal business process followed by a lot of companies and there must be a solution for this.

  • Jdbc thin driver and bulk binding slow insertion performance

    Hello All,
    We have a third party application reporting slow insertion performance, while I traced the session and found out most of elapsed time for one insert execution is sql*net more data from client, it appears bulk binding is being used here because one execution has 200 rows inserted. I am wondering whether this has something to do with their jdbc thin driver(10.1.0.2 version) and our database version 9205. Do you have any similar experience on this, what other possible directions should I explore?
    here is the trace report from 10046 event, I hide table name for privacy reason.
    Besides, I tested bulk binding in PL/SQL to insert 200 rows in one execution, no problem at all. Network folks confirm that network should not be an issue as well, ping time from app server to db server is sub milisecond and they are in the same data center.
    INSERT INTO ...
    values
    (:1, :2, :3, :4, :5, :6, :7, :8, :9, :10, :11, :12, :13, :14, :15, :16, :17,
    :18, :19, :20, :21, :22, :23, :24, :25, :26, :27, :28, :29, :30, :31, :32,
    :33, :34, :35, :36, :37, :38, :39, :40, :41, :42, :43, :44, :45)
    call count cpu elapsed disk query current rows
    Parse 1 0.00 0.00 0 0 0 0
    Execute 1 0.02 14.29 1 94 2565 200
    Fetch 0 0.00 0.00 0 0 0 0
    total 2 0.02 14.29 1 94 2565 200
    Misses in library cache during parse: 1
    Optimizer goal: CHOOSE
    Parsing user id: 25
    Elapsed times include waiting on following events:
    Event waited on Times Max. Wait Total Waited
    ---------------------------------------- Waited ---------- ------------
    SQL*Net more data from client 28 6.38 14.19
    db file sequential read 1 0.02 0.02
    SQL*Net message to client 1 0.00 0.00
    SQL*Net message from client 1 0.00 0.00
    ********************************************************************************

    I have exactly the same problem, I tried to find out what is going on, changed several JDBC Drivers on AIX, but no hope, I also have ran the process on my laptop which produced a better and faster performance.
    Therefore I made a special solution ( not practical) by creating flat files and defining the data as an external table, the oracle will read the data in those files as they were data inside a table, this gave me very fast insertion into the database, but still I am looking for an answer for your question here. Using Oracle on AIX machine is a normal business process followed by a lot of companies and there must be a solution for this.

  • SQL query performance issues.

    Hi All,
    I worked on the query a month ago and the fix worked for me in test intance but failed in production. Following is the URL for the previous thread.
    SQL query performance issues.
    Following is the tkprof file.
    CURSOR_ID:76  LENGTH:2383  ADDRESS:f6b40ab0  HASH_VALUE:2459471753  OPTIMIZER_GOAL:ALL_ROWS  USER_ID:443 (APPS)
    insert into cos_temp(
    TRX_DATE, DEPT, PRODUCT_LINE, PART_NUMBER,
    CUSTOMER_NUMBER, QUANTITY_SOLD, ORDER_NUMBER,
    INVOICE_NUMBER, EXT_SALES, EXT_COS,
    GROSS_PROFIT, ACCT_DATE,
    SHIPMENT_TYPE,
    FROM_ORGANIZATION_ID,
    FROM_ORGANIZATION_CODE)
    select a.trx_date,
    g.segment5 dept,
    g.segment4 prd,
    m.segment1 part,
    d.customer_number customer,
    b.quantity_invoiced units,
    --       substr(a.sales_order,1,6) order#,
    substr(ltrim(b.interface_line_attribute1),1,10) order#,
    a.trx_number invoice,
    (b.quantity_invoiced * b.unit_selling_price) sales,
    (b.quantity_invoiced * nvl(price.operand,0)) cos,
    (b.quantity_invoiced * b.unit_selling_price) -
    (b.quantity_invoiced * nvl(price.operand,0)) profit,
    to_char(to_date('2010/02/28 00:00:00','yyyy/mm/dd HH24:MI:SS'),'DD-MON-RR') acct_date,
    'DRP',
    l.ship_from_org_id,
    p.organization_code
    from   ra_customers d,
    gl_code_combinations g,
    mtl_system_items m,
    ra_cust_trx_line_gl_dist c,
    ra_customer_trx_lines b,
    ra_customer_trx_all a,
    apps.oe_order_lines l,
    apps.HR_ORGANIZATION_INFORMATION i,
    apps.MTL_INTERCOMPANY_PARAMETERS inter,
    apps.HZ_CUST_SITE_USES_ALL site,
    apps.qp_list_lines_v price,
    apps.mtl_parameters p
    where a.trx_date between to_date('2010/02/01 00:00:00','yyyy/mm/dd HH24:MI:SS')
    and to_date('2010/02/28 00:00:00','yyyy/mm/dd HH24:MI:SS')+0.9999
    and   a.batch_source_id = 1001     -- Sales order shipped other OU
    and   a.complete_flag = 'Y'
    and   a.customer_trx_id = b.customer_trx_id
    and   b.customer_trx_line_id = c.customer_trx_line_id
    and   a.sold_to_customer_id = d.customer_id
    and   b.inventory_item_id = m.inventory_item_id
    and   m.organization_id
         = decode(substr(g.segment4,1,2),'01',5004,'03',5004,
         '02',5003,'00',5001,5002)
    and   nvl(m.item_type,'0') <> '111'
    and   c.code_combination_id = g.code_combination_id+0
    and   l.line_id = b.interface_line_attribute6
    and   i.organization_id = l.ship_from_org_id
    and   p.organization_id = l.ship_from_org_id
    and   i.org_information3 <> '5108'
    and   inter.ship_organization_id = i.org_information3
    and   inter.sell_organization_id = '5108'
    and   inter.customer_site_id = site.site_use_id
    and   site.price_list_id = price.list_header_id
    and   product_attr_value = to_char(m.inventory_item_id)
    call        count       cpu   elapsed         disk        query      current         rows    misses
    Parse           1      0.47      0.56           11          197            0            0         1
    Execute         1   3733.40   3739.40        34893    519962154           11          188         0
    total           2   3733.87   3739.97        34904    519962351           11          188         1
    |         Rows Row Source Operation
    | ------------ ---------------------------------------------------
    |          188 HASH JOIN (cr=519962149 pr=34889 pw=0 time=2607.35)
    |          741 .TABLE ACCESS BY INDEX ROWID QP_PRICING_ATTRIBUTES (cr=519939426 pr=34889 pw=0 time=2457.32)
    |    254644500 ..NESTED LOOPS (cr=519939265 pr=34777 pw=0 time=3819.67)
    |    254643758 ...NESTED LOOPS (cr=8921833 pr=29939 pw=0 time=1274.41)
    |          741 ....NESTED LOOPS (cr=50042 pr=7230 pw=0 time=11.37)
    |          741 .....NESTED LOOPS (cr=48558 pr=7229 pw=0 time=11.35)
    |          741 ......NESTED LOOPS (cr=47815 pr=7223 pw=0 time=11.32)
    |         3237 .......NESTED LOOPS (cr=41339 pr=7223 pw=0 time=12.42)
    |         3237 ........NESTED LOOPS (cr=38100 pr=7223 pw=0 time=12.39)
    |         3237 .........NESTED LOOPS (cr=28296 pr=7139 pw=0 time=12.29)
    |         1027 ..........NESTED LOOPS (cr=17656 pr=4471 pw=0 time=3.81)
    |         1027 ...........NESTED LOOPS (cr=13537 pr=4404 pw=0 time=3.30)
    |          486 ............NESTED LOOPS (cr=10873 pr=4240 pw=0 time=0.04)
    |          486 .............NESTED LOOPS (cr=10385 pr=4240 pw=0 time=0.03)
    |          486 ..............TABLE ACCESS BY INDEX ROWID RA_CUSTOMER_TRX_ALL (cr=9411 pr=4240 pw=0 time=0.02)
    |        75253 ...............INDEX RANGE SCAN RA_CUSTOMER_TRX_N5 (cr=403 pr=285 pw=0 time=0.38)
    |          486 ..............TABLE ACCESS BY INDEX ROWID HZ_CUST_ACCOUNTS (cr=974 pr=0 pw=0 time=0.01)
    |          486 ...............INDEX UNIQUE SCAN HZ_CUST_ACCOUNTS_U1 (cr=488 pr=0 pw=0 time=0.01)
    |          486 .............INDEX UNIQUE SCAN HZ_PARTIES_U1 (cr=488 pr=0 pw=0 time=0.01)
    |         1027 ............TABLE ACCESS BY INDEX ROWID RA_CUSTOMER_TRX_LINES_ALL (cr=2664 pr=164 pw=0 time=1.95)
    |         2063 .............INDEX RANGE SCAN RA_CUSTOMER_TRX_LINES_N2 (cr=1474 pr=28 pw=0 time=0.22)
    |         1027 ...........TABLE ACCESS BY INDEX ROWID RA_CUST_TRX_LINE_GL_DIST_ALL (cr=4119 pr=67 pw=0 time=0.54)
    |         1027 ............INDEX RANGE SCAN RA_CUST_TRX_LINE_GL_DIST_N1 (cr=3092 pr=31 pw=0 time=0.20)
    |         3237 ..........TABLE ACCESS BY INDEX ROWID MTL_SYSTEM_ITEMS_B (cr=10640 pr=2668 pw=0 time=15.35)
    |         3237 ...........INDEX RANGE SCAN MTL_SYSTEM_ITEMS_B_U1 (cr=2062 pr=40 pw=0 time=0.33)
    |         3237 .........TABLE ACCESS BY INDEX ROWID OE_ORDER_LINES_ALL (cr=9804 pr=84 pw=0 time=0.77)
    |         3237 ..........INDEX UNIQUE SCAN OE_ORDER_LINES_U1 (cr=6476 pr=47 pw=0 time=0.43)
    |         3237 ........TABLE ACCESS BY INDEX ROWID MTL_PARAMETERS (cr=3239 pr=0 pw=0 time=0.04)
    |         3237 .........INDEX UNIQUE SCAN MTL_PARAMETERS_U1 (cr=2 pr=0 pw=0 time=0.01)
    |          741 .......TABLE ACCESS BY INDEX ROWID HR_ORGANIZATION_INFORMATION (cr=6476 pr=0 pw=0 time=0.10)
    |         6474 ........INDEX RANGE SCAN HR_ORGANIZATION_INFORMATIO_FK2 (cr=3239 pr=0 pw=0 time=0.03)Please help.
    Regards
    Ashish

    |    254644500 ..NESTED LOOPS (cr=519939265 pr=34777 pw=0 time=3819.67)
    |    254643758 ...NESTED LOOPS (cr=8921833 pr=29939 pw=0 time=1274.41)There is no way the optimizer should choose to process that many rows using nested loops.
    Either the statistics are not up to date, the data values are skewed or you have some optimizer parameter set to none default to force index access.
    Please post explain plan and optimizer* parameter settings.

  • Jdbc sql insert to oracle DB.

    Dear All,
    I'm using the jdbc connector to insert data directly into an Oracle database table.  I've got the SQL insert command which XI has generated by using the logSQLStatement parameter and I've proved the statement is good by pasting it directly into Toad where it is executed perfectly.  However XI is throwing the following errors;-
    Unable to execute statement for table or stored procedure. 'SI_ORDER' (Structure 'STATEMENT') due to java.sql.SQLException: ORA-01858: a non-numeric character was found where a numeric was expected
    MP: exception caught with cause com.sap.aii.af.ra.ms.api.RecoverableException: Error processing request in sax parser: Error when executing statement for table/stored proc. 'SI_ORDER' (structure 'STATEMENT'): java.sql.SQLException: ORA-01858: a non-numeric character was found where a numeric was expected
    Does anyone know what might be the problem or even where I should start to troubleshoot this?
    Any help is much appreciated.
    Pete.

    Your question is how to load data from a text file into arrays?
    Start with a
    StreamReader to read the file one line at a time.  Then break each line into individual values, and add each value to a
    List<T>.  Then call .ToArray() on each list to set the value of each array-bound parameter.
    David
    David http://blogs.msdn.com/b/dbrowne/

  • Oltp insert performance

    Hi Experts ,
    1. could someone guide me on understanding what are things that impact insert performance in an oltp application with ~25 concurrent sessions doing 20 inserts/session  into  table X. ? (env- oracle 11g ,3 node RAC , ASSM tablespace , tables X is range partitioned )
    2. If any storage parameter is not property set then how to identify which one needs to be fixed?
    Note: current insert performance is : 0.02 sec/insert.

    Hi Garry,
    Thanks for your response.
    some more info regarding app : DB version  11.2.0.3 . Below is the awr info during peak load for 1 hr snap. any suggestions are helpful.
    Cache Sizes                       Begin        End
    ~~~~~~~~~~~                  ---------- ----------
                   Buffer Cache:    18,624M    18,624M  Std Block Size:         8K
               Shared Pool Size:     3,200M     3,200M      Log Buffer:    25,888K
    Load Profile              Per Second    Per Transaction   Per Exec   Per Call
    ~~~~~~~~~~~~         ---------------    --------------- ---------- ----------
          DB Time(s):                     4.9                0.0                 0.01       0.00    
           DB CPU(s):                0.5                     0.0                 0.00       0.00         
           Redo size:               585,778.7            2,339.6
       Logical reads:                24,046.6               96.0
       Block changes:            2,374.5                9.5
      Physical reads:            1,101.6                4.4
    Physical writes:              394.6                1.6
          User calls:                 2,086.6                8.3
              Parses:                9.5                     0.0
         Hard parses:                     0.5                     0.0
    W/A MB processed:                5.8                0.0
              Logons:                     0.6                     0.0
            Executes:                   877.7                     3.5
           Rollbacks:                   218.6                     0.9
        Transactions:              250.4
    Instance Efficiency Percentages (Target 100%)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                Buffer Nowait %:   99.99       Redo NoWait %:   99.99
                Buffer  Hit   %:   95.44    In-memory Sort %:  100.00
                Library Hit   %:   99.81        Soft Parse %:   95.16
             Execute to Parse %:   98.92         Latch Hit %:   99.89
    Parse CPU to Parse Elapsd %:   92.50     % Non-Parse CPU:   97.31
    Shared Pool Statistics        Begin    End
                 Memory Usage %:   75.36   74.73
        % SQL with executions>1:   90.63   90.41
      % Memory for SQL w/exec>1:   83.10   85.49
    Top 5 Timed Foreground Events
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Event                                 Waits               Time(s)   Avg(ms)     %DBtime       Wait Class    
    db file sequential read           3,686,200      15,658      4                  87.7            User I/O              
    DB CPU                                                      1,802                         10.1                             
    db file parallel read                19,646              189         10                 1.1            User I/O    
    gc current grant 2-way              842,079         145          0               .8                 Cluster
    gc current block 2-way              425,663         106           0               .6            Cluster

  • How to loop a sql insert?

    I have an ASP Survey that pulls questions from a sql
    database. The results table to store the answers is simple. It has
    a ResultID, QID, and Answer field.
    Since the survey is dynamically built, the number of
    questions in each survey is limitless. Thus my problem. How do I
    construct an insert sql statement to loop thru and add a value to
    the db for QID?

    There is a tutorial on www.charon.co.uk that may be of some
    use for you as
    it is written for asp
    Paul Whitham
    Certified Dreamweaver MX2004 Professional
    Adobe Community Expert - Dreamweaver
    Valleybiz Internet Design
    www.valleybiz.net
    "Lucky Kitty" <[email protected]> wrote in
    message
    news:f2f1tk$kvg$[email protected]..
    >I have an ASP Survey that pulls questions from a sql
    database. The results
    > table to store the answers is simple. It has a ResultID,
    QID, and Answer
    > field.
    >
    > Since the survey is dynamically built, the number of
    questions in each
    > survey
    > is limitless. Thus my problem. How do I construct an
    insert sql
    > statement to
    > loop thru and add a value to the db for QID?
    >

  • XMLTYPE insert performance

    I am experiencing performance problems when inserting a 30 MB XML file into an XMLTYPE field - under Oracle 11 with the schema I am using the minimum time I can achieve is around 9 minutes which is too long... can anyone comment on whether this performance is normal and possibly suggest how it could be improved while retaining the benefits of structured storage...thanks in advance for the help :)

    sorry for the late reply - I didn't notice that you had replied to my earlier post...
    To answer your questions in order:
    - I am using "structured" storage because I read ( in this article: [http://www.oracle.com/technology/pub/articles/jain-xmldb.html] ) that this would result in higher xquery performance.
    - the schema isn't very large but it is complex. ( as discussed in above article )
    I built my table by first registering the schema and then adding the xml elements to the table such that they would be stored in structured storage. i.e.
    --// Register schema /////////////////////////////////////////////////////////////
    begin
    dbms_xmlschema.registerSchema(
    schemaurl=>'fof_fob.xsd',
    schemadoc=>bfilename('XFOF_DIR','fof_fob.xsd'),
    local=>TRUE,
    gentypes=>TRUE,
    genbean=>FALSE,
    force=>FALSE,
    owner=>'FOF',
    csid=>nls_charset_id('AL32UTF8')
    end;
    COMMIT;
    and then created the table using ...
    --// Create the XCOMP table /////////////////////////////////////////////////////////////
    create table "XCOMP" (
         "type" varchar(128) not null,
         "id" int not null,
         "idstr1" varchar(50),
         "idstr2" varchar(50),
         "name" varchar(255),
         "rev" varchar(20) not null,
         "tstamp" varchar(30) not null,
         "xmlfob" xmltype)
    XMLTYPE "xmlfob" STORE AS OBJECT RELATIONAL
    XMLSCHEMA "fof_fob.xsd"
    ELEMENT "FOB";
    No indexing was specified for this table. Then I inserted the offending 30 MB xml file using (in c#, using ODP.NET under .NET 3.5):
    void test(string myName, XElement myXmlElem)
    OracleConnection connection = new OracleConnection();
    connection.Open();
    string statement = "INSERT INTO XCOMP ( \"name\", \"xmlfob\"") values( :1, :2 )";
    XDocument xDoc = new XDocument(new XDeclaration("1.0", "utf-8", "yes"), myXmlElem);
    OracleCommand insCmd = new OracleCommand(statement, connection);
    OracleXmlType xmlinfo = new OracleXmlType(connection, xDoc.CreateReader());
    insCmd.Parameters.Add(FofDbCmdInsert.Name, OracleDbType.Varchar2, 255);
    insCmd.Parameters.Add(FofDbCmdInsert.Xmldoc, OracleDbType.XmlType);
    insCmd.Parameters[0].Value = myName;
    insCmd.Parameters[1].Value = xmlinfo;
    insCmd.ExecuteNonQuery();
    connection.Close();
    It took around 9 minutes to execute the ExecuteNonQuery statement, usingOracle 11 standard edition running under Windows 2008-64 with 8 GB RAM and 2.5 MHZ single core ( of a quad-core running under VMWARE )
    I would much appreciate any suggestions that could speed up the insert performance here - as a temporary solution I chopped some of the information out of the XML document and store it seperately in another table, but this approach has the disadvantage that I using xqueries is a bit inflexible, although the performance is now in seconds rather than minutes...
    I can't see any reason why Oracle's shredding mechanism should be less efficient than manual shredding the information.
    Thanks in advance for any helpful hints you can provide!

  • SQL Insert Error Error in allocating a connection. Cause: No PasswordCreden

    Friends,
    While testing my connection in the Sun java Application Server , I get the following error .
    "SQL Insert Error Error in allocating a connection. Cause: No PasswordCredential found "
    Can somebody please guide ?
    regards
    Dhiraj

    If you are using Netbeans, then this link might help:
    http://forum.java.sun.com/thread.jspa?forumID=136&threadID=598423
    Otherwise, have you try this ?
    Verify your sun-ejb-jar.xml does not use default-resource-princinpal element:
    <res-ref-name>jdbc/pdisasdb</res-ref-name>
    <jndi-name>jdbc/pdisasdb</jndi-name>
    <default-resource-principal>
    <name>myname</name>
    <password>geheim</password>
    </default-resource-principal>
    </resource-ref>

  • SQL insert statement in java with Excel file

    Dear all,
    I wrote a program is as the follow:
    import java.io.*;
    import java.sql.*;
    public class handleExcel
         Connection con = null;
         Statement stmnt = null;
         public handleExcel()
              String excel = "C:\\EGS\\app_files\\info_update_form_exported_data.xls";
              try
                   Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
                   String str="jdbc:odbc:DRIVER=Microsoft Excel Driver (*.xls);DBQ=" + excel + ";";
         String sql = "insert into [Sheet1$] (Name, Age, Test1, Test2, Test3) values ('mary','16','aa','bb','vv')";
                   con = DriverManager.getConnection(str, "", "");
                   stmnt = con.createStatement();
                   stmnt.executeUpdate(sql);
              catch(Exception e)
                   System.out.println("con is error!!");
                   e.printStackTrace();
         public static void main(String[] args)
              handleExcel TestHpc = new handleExcel();
    But when I run it, the error is as the follow:
    java.sql.SQLException: [Microsoft][ODBC Excel Driver]
         at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6958)
         at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7115)
         at sun.jdbc.odbc.JdbcOdbc.SQLExecDirect(JdbcOdbc.java:3111)
         at sun.jdbc.odbc.JdbcOdbcStatement.execute(JdbcOdbcStatement.java:338)
         at sun.jdbc.odbc.JdbcOdbcStatement.executeUpdate(JdbcOdbcStatement.java:288)
         at hk.gov.edb.util.handleExcel.<init>(handleExcel.java:31)
         at hk.gov.edb.util.handleExcel.main(handleExcel.java:97)
    Please help me to solve this problem. Thank you so much for your help!
    Regards,
    kzyo

    Hi
    You can use the[b] jakarta POI api in order to read/write Excel file from java. Pure Java, no drivers nedeed.
    I tested and ok.
    Hope this helps

  • How to resolve ORA-00001 Error in SQL Insert?

    Hi all, I need your appreciated help.
    I make a plsql procedure that is inserting a row according cursor value, I'm having oracle error ORA-00001: unique constraint (constraint_name) violated.
    You may see this message if a duplicate entry exists at a different level: in RDBMS MySQL I have the syntax IGNORE to resolve this duplication error... and in Oracle ?
    Thanks for your time and hints.
    Miguelito

    user6317803 wrote:
    How to resolve ORA-00001 Error in SQL Insert?ORA-00001 means table has unique/primary key/index and you are trying to insert a row with key value that already exists in the table. I'll assume table COUNTRIES has primary key on COUNTRY_ID. Then change SQL to:
    SQL = "INSERT INTO COUNTRIES(COUNTRY_ID,COUNTRY_NAME,REGION_ID) SELECT 'BZ','BLZ',3 FROM DUAL WHERE NOT EXISTS(SELECT 1 FROM COUNTRIES WHERE COUNTRY_ID = 'BZ')"There is a good chance table COUNTRIES also has unique key/index on COUNTRY_NAME. If so use:
    SQL = "INSERT INTO COUNTRIES(COUNTRY_ID,COUNTRY_NAME,REGION_ID) SELECT 'BZ','BLZ',3 FROM DUAL WHERE NOT EXISTS(SELECT 1 FROM COUNTRIES WHERE COUNTRY_ID = 'BZ' OR COUNTRY_NAME = 'BLZ')"SY.

  • How to get sql server performance counters using query?

    Hai i want to see my sql server performance counters like, Full Scans/sec,  Buffer
    Cache Hit Ratio,  Database Transactions/sec, User
    Connections, Average Latch Wait Time (ms), Lock
    Waits/sec, Lock Timeouts/sec, Number
    of Deadlocks/sec, Total Server Memory, SQL
    Re-Compilations/sec, User Settable Query. If any one know how to get it by using query means, please help me.
    Thanks in advance

    Hello,
    Below is query created by Jonathan Kehayias for measuring Perfom counters using DMV sys.dm_os_performance_counter.
    You can download book from below link
    https://www.simple-talk.com/books/sql-books/troubleshooting-sql-server-a-guide-for-the-accidental-dba/
    DECLARE @CounterPrefix NVARCHAR(30)
    SET @CounterPrefix = CASE WHEN @@SERVICENAME = 'MSSQLSERVER'
    THEN 'SQLServer:'
    ELSE 'MSSQL$' + @@SERVICENAME + ':'
    END ;
    -- Capture the first counter set
    SELECT CAST(1 AS INT) AS collection_instance ,
    [OBJECT_NAME] ,
    counter_name ,
    instance_name ,
    cntr_value ,
    cntr_type ,
    CURRENT_TIMESTAMP AS collection_time
    INTO #perf_counters_init
    FROM sys.dm_os_performance_counters
    WHERE ( OBJECT_NAME = @CounterPrefix + 'Access Methods'
    AND counter_name = 'Full Scans/sec'
    OR ( OBJECT_NAME = @CounterPrefix + 'Access Methods'
    AND counter_name = 'Index Searches/sec'
    OR ( OBJECT_NAME = @CounterPrefix + 'Buffer Manager'
    AND counter_name = 'Lazy Writes/sec'
    OR ( OBJECT_NAME = @CounterPrefix + 'Buffer Manager'
    AND counter_name = 'Page life expectancy'
    OR ( OBJECT_NAME = @CounterPrefix + 'General Statistics'
    AND counter_name = 'Processes Blocked'
    OR ( OBJECT_NAME = @CounterPrefix + 'General Statistics'
    AND counter_name = 'User Connections'
    OR ( OBJECT_NAME = @CounterPrefix + 'Locks'
    AND counter_name = 'Lock Waits/sec'
    OR ( OBJECT_NAME = @CounterPrefix + 'Locks'
    AND counter_name = 'Lock Wait Time (ms)'
    OR ( OBJECT_NAME = @CounterPrefix + 'SQL Statistics'
    AND counter_name = 'SQL Re-Compilations/sec'
    OR ( OBJECT_NAME = @CounterPrefix + 'Memory Manager'
    AND counter_name = 'Memory Grants Pending'
    OR ( OBJECT_NAME = @CounterPrefix + 'SQL Statistics'
    AND counter_name = 'Batch Requests/sec'
    OR ( OBJECT_NAME = @CounterPrefix + 'SQL Statistics'
    AND counter_name = 'SQL Compilations/sec'
    -- Wait on Second between data collection
    WAITFOR DELAY '00:00:01'
    -- Capture the second counter set
    SELECT CAST(2 AS INT) AS collection_instance ,
    OBJECT_NAME ,
    counter_name ,
    instance_name ,
    cntr_value ,
    cntr_type ,
    CURRENT_TIMESTAMP AS collection_time
    INTO #perf_counters_second
    FROM sys.dm_os_performance_counters
    WHERE ( OBJECT_NAME = @CounterPrefix + 'Access Methods'
    AND counter_name = 'Full Scans/sec'
    OR ( OBJECT_NAME = @CounterPrefix + 'Access Methods'
    AND counter_name = 'Index Searches/sec'
    OR ( OBJECT_NAME = @CounterPrefix + 'Buffer Manager'
    AND counter_name = 'Lazy Writes/sec'
    OR ( OBJECT_NAME = @CounterPrefix + 'Buffer Manager'
    AND counter_name = 'Page life expectancy'
    OR ( OBJECT_NAME = @CounterPrefix + 'General Statistics'
    AND counter_name = 'Processes Blocked'
    OR ( OBJECT_NAME = @CounterPrefix + 'General Statistics'
    AND counter_name = 'User Connections'
    OR ( OBJECT_NAME = @CounterPrefix + 'Locks'
    AND counter_name = 'Lock Waits/sec'
    OR ( OBJECT_NAME = @CounterPrefix + 'Locks'
    AND counter_name = 'Lock Wait Time (ms)'
    OR ( OBJECT_NAME = @CounterPrefix + 'SQL Statistics'
    AND counter_name = 'SQL Re-Compilations/sec'
    OR ( OBJECT_NAME = @CounterPrefix + 'Memory Manager'
    AND counter_name = 'Memory Grants Pending'
    OR ( OBJECT_NAME = @CounterPrefix + 'SQL Statistics'
    AND counter_name = 'Batch Requests/sec'
    OR ( OBJECT_NAME = @CounterPrefix + 'SQL Statistics'
    AND counter_name = 'SQL Compilations/sec'
    -- Calculate the cumulative counter values
    SELECT i.OBJECT_NAME ,
    i.counter_name ,
    i.instance_name ,
    CASE WHEN i.cntr_type = 272696576
    THEN s.cntr_value - i.cntr_value
    WHEN i.cntr_type = 65792 THEN s.cntr_value
    END AS cntr_value
    FROM #perf_counters_init AS i
    JOIN #perf_counters_second AS s
    ON i.collection_instance + 1 = s.collection_instance
    AND i.OBJECT_NAME = s.OBJECT_NAME
    AND i.counter_name = s.counter_name
    AND i.instance_name = s.instance_name
    ORDER BY OBJECT_NAME
    -- Cleanup tables
    DROP TABLE #perf_counters_init
    DROP TABLE #perf_counters_second
    Please mark this reply as the answer or vote as helpful, as appropriate, to make it useful for other readers

  • Apostrophe in a String bombs a SQL insert

    I am having an issue with a Customer String parameter that is being used in a SQL INSERT. The customer name may from time to time have an apostrophe in it that causes our SQL INSERT to bomb on a missing comma error. I have tried to do this two separate ways:
    1)
    String query = "INSERT into CUSTOMER VALUES(" + account[0].custAcctNbr + ",'" + account[0].companyNm + "'," +
                   "'IN',null," + salesPerson[0].salespersonID + "," + "null,null,null,null,null," +
                   "null,null,null,null,null,null,null,null,null)";
    This works until an apostrophe is in the companyNm varaiable.
    2)
         PreparedStatement insertCustomer = bcc_conn_cust.prepareStatement(
         "INSERT into CUSTOMER VALUES(?,?,?,null,?,null,null,null,null,null,null,null,null,null,null,null,null,null,null");
         insertCustomer.setInt(1,Integer.parseInt(account[0].custAcctNbr));
         insertCustomer.setString(2,account[0].companyNm);
         insertCustomer.setString(3,"IN");
         insertCustomer.setInt(4,salesPerson[0].salespersonID);
         insertCustomer.executeUpdate();
    This also works when there is no apostrophe. However both bomb when it is present. Is there anyway to get around this, short of parsing a company name every single time we insert a new customer?

    Do you have any idea why this is not working? yes, whatever driver you are using isn't implementing this properly.
    variable I am using is a String variable, that has a
    value of Bates' Brownies. According to all I read, it
    seems I have used the Prepared Statement correctly but
    it is giving me that missing comma error. I would
    really rather not have to search every single company
    name as it is entered.well unless you can either find another driver or fix the one you've
    got i can't see what else you can do...
    here is some code to help you along with that.
    private String replaceQuotes(String toReplace){
      StringBuffer buff = new StringBuffer(toReplace);
      for(int i=0;i<buff.length();i++){
        if(buff.charAt(i)=='\''){
          buff.insert(i,'\'');
          i++;
      return buff.toString();

Maybe you are looking for