SQL Query takes 7 hours after upgrade to 10g

the following query executes in under a minute in 9i, however once upgraded to 10g it takes 7 hours. The query is designed to select the data row with the max date value for the selected criteria (there are multiple rows that match the below criteria with different dates)
I have tested in a lower environment the setting of "_optimizer_cost_based_transformation"=off and this corrects the problem. I do not feel comfortable setting this parameter session or system wide to provide a solution
We are running Oracle 10gR2 on Solaris
select "INSTN_ID_N",
"MEAS_D",
"FEED_TYPE_C",
"FREQ_C",
"STAT_LVL_C",
"TS_D",
"IX_INSTN_ID_C",
"ENTI_TYPE_C",
"CNTXT_ID_C",
"CNTXT_C",
"IX_CNTXT_ID_C",
"VND_C",
"PRCS_C",
"USR_ID_C",
"STAT_C",
"OVRD_RSN_C",
"LD_DT_D",
"UPD_USR_C",
"UPD_TS_D",
"INS_USR_C",
"INS_TS_D",
"DEL_FLG_C"
from IDA.V_INSTANCE_STATUS M
where
TS_D =
select max (TS_D) from IDA.V_INSTANCE_STATUS
where
INSTN_ID_N = M.INSTN_ID_N AND
MEAS_D = M.MEAS_D AND
FEED_TYPE_C = M.FEED_TYPE_C AND
FREQ_C = M.FREQ_C AND
STAT_LVL_C = M.STAT_LVL_C AND
IX_INSTN_ID_C = M.IX_INSTN_ID_C
)

user638113 wrote:
the following query executes in under a minute in 9i, however once upgraded to 10g it takes 7 hours. The query is designed to select the data row with the max date value for the selected criteria (there are multiple rows that match the below criteria with different dates)
I have tested in a lower environment the setting of "_optimizer_cost_based_transformation"=off and this corrects the problem. I do not feel comfortable setting this parameter session or system wide to provide a solutionIf you're sure that the "lower" environment reproduces the same issue, and not due to some other differences (different statistics, parameters etc.), then you could share the two different execution plans generated via DBMS_XPLAN.DISPLAY having the cost based transformations turned on and off. Make sure you use the \ tags before and after the plan output to format it in fixed font. You can use the "Quote" button in the message editor to see how to use the tag.
Furthermore a optimizer trace (10053) might reveal why the cost based transformations lead to such an result.
Regards,
Randolf
Oracle related stuff blog:
http://oracle-randolf.blogspot.com/
SQLTools++ for Oracle (Open source Oracle GUI for Windows):
http://www.sqltools-plusplus.org:7676/
http://sourceforge.net/projects/sqlt-pp/                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

Similar Messages

  • Size of SQL query before execution and after execution

    hi all
    I need help on how can i find out the size of SQL query before execution and after execution in java
    The query can be any query select / insert / update
    Can anyone help me if any system tables help to find out the required size i mentioned
    Urgent help is required
    Thanking in advance

    I need the size in terms of bytes
    like the rquirement is stated as below
    select ................: 10 B , return 250 B
    so i need size before and after execution in terms of bytes

  • Zimbra login is very slow - SQL query takes 35+ seconds

    Hi,
    my Zimbra login process remains very slow, 35-40 seconds with only a single user using it. I have Beehive set up as directory synchronized, with about 6500 users in it. However, I and a couple of colleagues the only ones making any use of it for testing. With just one person logging in, the following SQL query takes about 35 seconds to execute:
    SELECT /*+ LEADING(rf rf_pp) USE_NL(rf_pp) INDEX_ASC(@rf_connect_by rf@rf_connect_by (ws_real_folders.parent_eid ws_real_folders.eid)) */ RF.ENTERPRISE_ID AS
    ENTERPRISE_ID, RF.SITE_ID AS SITE_ID, RF.ENTITY_TYPE AS ENTITY_TYPE, RF.EID AS EID, RF.LOCK_ID AS LOCK_ID, RF.CACHE_ID AS CACHE_ID, RF.CACHE_TS AS
    CACHE_TS, RF.CACHE_SQ AS CACHE_SQ, FLOOR(RF.SECURE_CHECK/10) AS ACCESS_TYPES, RF.PARENT_ENTITY_TYPE AS PARENT_ENTITY_TYPE, RF.PARENT_EID AS
    PARENT_EID, RF.NAME AS NAME, RF.OWNER_ENTITY_TYPE AS OWNER_ENTITY_TYPE, RF.OWNER_EID AS OWNER_EID, RF.CREATED_ON AS CREATED_ON,
    RF.CREATOR_ENTITY_TYPE AS CREATOR_ENTITY_TYPE, RF.CREATOR_EID AS CREATOR_EID, RF.MODIFIEDON AS MODIFIED_ON, RF.MODIFIED_BY_ENTITY_TYPE AS
    MODIFIED_BY_ENTITY_TYPE, RF.MODIFIED_BY_EID AS MODIFIED_BY_EID, RF.VISIBILITY AS VISIBILITY, CASE WHEN (BITAND(:B13 , :B12 ) = :B12 ) THEN CAST(MULTISET(
    SELECT METADATA_CEN
    FROM OCS_ENTITY_METADATA_CENS_2_V META
    WHERE META.ENTITY_EID = RF.EID ) AS OCS_COLLAB_ID_TBL_T) ELSE CAST(NULL AS OCS_COLLAB_ID_TBL_T) END AS METADATA_CENS, CASE WHEN
    RF_PP.LAST_ACCESSED IS NULL THEN 'N' WHEN RF.MODIFIEDON > RF_PP.LAST_ACCESSED THEN 'U' ELSE NVL(RF_PP.RELATIVE_STATUS, 'N') END AS CHANGE_STATUS,
    RF.PROPERTIES AS PROPERTIES_CLOB, RF_PP.PROPERTIES AS VIEWERPROPERTIES_CLOB, RF.DESCRIPTION AS DESCRIPTION
    FROM (
    SELECT /*+ QB_NAME(rf_connect_by) no_connect_by_cost_based */ RF.ENTERPRISE_ID ENTERPRISE_ID, :B4 SITE_ID, :B3 ENTITY_TYPE, RF.EID EID, RF.LOCK_ID LOCK_ID,
    RF.ORA_ROWSCN CACHE_ID, RF.CACHE_TS CACHE_TS, RF.CACHE_SQ CACHE_SQ, RF.PARENT_TYPE PARENT_ENTITY_TYPE, RF.PARENT_EID PARENT_EID, RF.NAME
    NAME, RF.OWNER_TYPE OWNER_ENTITY_TYPE, RF.OWNER_EID OWNER_EID, RF.CREATED_ON CREATED_ON, RF.CREATOR_TYPE CREATOR_ENTITY_TYPE,
    RF.CREATOR_EID CREATOR_EID, RF.MODIFIED_ON MODIFIEDON, RF.MODIFIED_BY_TYPE MODIFIED_BY_ENTITY_TYPE, RF.MODIFIED_BY_EID MODIFIED_BY_EID,
    RF.VISIBILITY VISIBILITY, RF.PROPERTIES PROPERTIES, RF.DESCRIPTION DESCRIPTION, RF.IS_HIDDEN IS_HIDDEN, LEVEL LEVEL_NUM, COALESCE (
    (SELECT :B10 * 10 + 1
    FROM AC_ENTITIES AEI
    WHERE RF.EID = AEI.EID AND ( 1 = DECODE(AEI.SENSITIVITY_EID, :B9 , 1, 0) AND 1 = DECODE(AEI.OWNER_EID, :B8 , 1, 0) AND 1 = DECODE(AEI.AT_READ, :B7 , 1, 0) AND 1 =
    DECODE(AEI.AT_DISCOVER, :B6 , 1, 0) AND 1 = DECODE(AEI.LOCAL_ACL_ID, :B5 , 1, 0) ) ) ,
    (SELECT ACV.ACCESS_TYPES * 10 + ACV.IS_ALLOWED
    FROM AC_CHECK_ONE_OF_V ACV
    WHERE ACV.EID = RF.EID ) ) SECURE_CHECK
    FROM WS_REAL_FOLDERS RF
    WHERE RF.IS_HIDDEN = :B2 START WITH RF.PARENT_EID = :B1 CONNECT BY PRIOR RF.EID = RF.PARENT_EID ) RF, WS_RF_PRVT_PROPERTIES RF_PP
    WHERE RF.EID = RF_PP.EID (+) AND :B11 = RF_PP.VIEWER_EID (+) AND 1 = BITAND(RF.SECURE_CHECK, 1) ORDER BY RF.LEVEL_NUMIt has ID atrvjdrmz2v6d in Enterprise Manager, and I've tried tuning it with the SQL tuning advisor in EM. I did the statistics gathering mentioned in another thread yesterday, to see if that helped - doesn't seem liked it. I'm running Database 11.1.0.6 and Beehive 1.5.1 in the build from the day it released.
    Any hints? I'll post this to MetaLink as well, unless someone has some immediate idea what's wrong :-)

    No speedup, the 35-40 seconds is for normal logins - and it's very consistent, at least if the database is otherwise idle. Immediately logging out and back in gives me the same wait, and the same query shows up in the Enterprise Manager interface.
    It seems it might be related to Workspaces - from EM:
    "PL/SQL Source (Line Number)          BEE_CODE.WS_REAL_FOLDER_PKG (2998)"

  • What happens if it takes some hours after the phone alerts that it has been charged?

    What happens if it takes some hours after the phone alerts that it has been charged?
    I mean is it harmful for the phone to be pluged into the outlet for some hours after the battery percentage has been 100%?

    roohollahtaherifard wrote:
    I mean is it harmful for the phone to be pluged into the outlet for some hours after the battery percentage has been 100%?
    No. You cannot Over-charge.
    About iPhone Batteries  =  http://www.apple.com/batteries/iphone.html

  • Select after upgrade 9i - 10g runs slowly thousand times - urgent

    I have select which runs around one second on Oracle 9. After upgrade to 10g this select runs more than two hours. I compute statistics on all tables, all columns and all indexes. This select consist from two parts - every part run on oracle 10g around 0.5 second but together more than 2 hours. When I rewrite it using WITH clausule, it runs 2 second. But I don't want to rewrite selects .. I want to find why it runs slow on 10g.
    Below are original and rewrited select with their execution plans.
    Any idea or recomendation?
    Select:
    SELECT * FROM (
    SELECT DISTINCT from_fix_ident ident, from_ident_icao icao
         , latitude1 latitude, longitude1 longitude, from_fix_fea_pk src
         , -1 mslink
      FROM l_sky_airway, l_dgn_airway
    WHERE l_sky_airway.mslink=l_dgn_airway.mslink
    UNION ALL
    SELECT DISTINCT to_fix_ident ident, to_ident_icao icao
         , latitude2 latitude, longitude2 longitude, to_fix_fea_pk src
         , -2 mslink
      FROM l_sky_airway, l_dgn_airway
    WHERE l_sky_airway.mslink=l_dgn_airway.mslink
    UNION ALL
    SELECT ident, icao, latitude, longitude, 5 src, mslink FROM l_sky_navaid
    UNION ALL
    SELECT ident, icao, latitude, longitude, 6 src, mslink FROM l_sky_waypoint)
    WHERE ident||';'||icao||';'||src IN (
    SELECT ident||';'||icao||';'||src FROM (
    SELECT from_fix_ident ident
         , from_ident_icao icao
         , latitude1 latitude
         , longitude1 longitude
         , from_fix_fea_pk src
      FROM l_sky_airway, l_dgn_airway
    WHERE l_sky_airway.mslink = l_dgn_airway.mslink
    UNION ALL
    SELECT to_fix_ident ident
         , to_ident_icao icao
         , latitude2 latitude
         , longitude2 longitude
         , to_fix_fea_pk src
      FROM l_sky_airway, l_dgn_airway
    WHERE l_sky_airway.mslink = l_dgn_airway.mslink
    MINUS
    SELECT ident
         , icao
         , latitude
         , longitude
         , 5 src
      FROM l_sky_navaid
    MINUS
    SELECT ident
         , icao
         , latitude
         , longitude
         , 6 src
      FROM l_sky_waypoint
    ORDER BY ident, icao, src, mslink, latitude, longitude;Execution plan:
    Plan
    SELECT STATEMENT  ALL_ROWSCost: 2 003  Bytes: 1 572 402 240  Cardinality: 24 568 785                                               
         29 SORT ORDER BY  Cost: 2 003  Bytes: 1 572 402 240  Cardinality: 24 568 785                                          
              28 FILTER                                     
                   12 VIEW EUS. Cost: 825  Bytes: 3 522 880  Cardinality: 55 045                                
                        11 UNION-ALL                           
                             4 HASH UNIQUE  Cost: 398  Bytes: 981 948  Cardinality: 22 317                      
                                  3 HASH JOIN  Cost: 142  Bytes: 981 948  Cardinality: 22 317                 
                                       1 TABLE ACCESS FULL TABLE EUS.L_SKY_AIRWAY Cost: 85  Bytes: 290 121  Cardinality: 22 317            
                                       2 TABLE ACCESS FULL TABLE EUS.L_DGN_AIRWAY Cost: 56  Bytes: 691 827  Cardinality: 22 317            
                             8 HASH UNIQUE  Cost: 398  Bytes: 981 948  Cardinality: 22 317                      
                                  7 HASH JOIN  Cost: 143  Bytes: 981 948  Cardinality: 22 317                 
                                       5 TABLE ACCESS FULL TABLE EUS.L_SKY_AIRWAY Cost: 85  Bytes: 290 121  Cardinality: 22 317            
                                       6 TABLE ACCESS FULL TABLE EUS.L_DGN_AIRWAY Cost: 56  Bytes: 691 827  Cardinality: 22 317            
                             9 TABLE ACCESS FULL TABLE EUS.L_SKY_NAVAID Cost: 6  Bytes: 57 225  Cardinality: 1 635                      
                             10 TABLE ACCESS FULL TABLE EUS.L_SKY_WAYPOINT Cost: 22  Bytes: 324 712  Cardinality: 8 776                      
                   27 VIEW EUS. Cost: 325  Bytes: 12 042  Cardinality: 446                                
                        26 MINUS                           
                             23 MINUS                      
                                  20 SORT UNIQUE  Cost: 325  Bytes: 23 128  Cardinality: 446                 
                                       19 UNION-ALL            
                                            15 HASH JOIN  Cost: 145  Bytes: 9 812  Cardinality: 223       
                                                 13 TABLE ACCESS FULL TABLE EUS.L_SKY_AIRWAY Cost: 89  Bytes: 2 899  Cardinality: 223 
                                                 14 TABLE ACCESS FULL TABLE EUS.L_DGN_AIRWAY Cost: 56  Bytes: 691 827  Cardinality: 22 317 
                                            18 HASH JOIN  Cost: 146  Bytes: 9 812  Cardinality: 223       
                                                 16 TABLE ACCESS FULL TABLE EUS.L_SKY_AIRWAY Cost: 89  Bytes: 2 899  Cardinality: 223 
                                                 17 TABLE ACCESS FULL TABLE EUS.L_DGN_AIRWAY Cost: 56  Bytes: 691 827  Cardinality: 22 317 
                                  22 SORT UNIQUE  Bytes: 512  Cardinality: 16                 
                                       21 TABLE ACCESS FULL TABLE EUS.L_SKY_NAVAID Cost: 6  Bytes: 512  Cardinality: 16            
                             25 SORT UNIQUE  Bytes: 2 992  Cardinality: 88                      
                                  24 TABLE ACCESS FULL TABLE EUS.L_SKY_WAYPOINT Cost: 24  Bytes: 2 992  Cardinality: 88                 Rewrited select which run fast:
    WITH inselect AS
         (SELECT ident || ';' || icao || ';' || src
            FROM (SELECT from_fix_ident ident, from_ident_icao icao,
                         latitude1 latitude, longitude1 longitude,
                         from_fix_fea_pk src
                    FROM l_sky_airway, l_dgn_airway
                   WHERE l_sky_airway.mslink = l_dgn_airway.mslink
                  UNION ALL
                  SELECT to_fix_ident ident, to_ident_icao icao,
                         latitude2 latitude, longitude2 longitude,
                         to_fix_fea_pk src
                    FROM l_sky_airway, l_dgn_airway
                   WHERE l_sky_airway.mslink = l_dgn_airway.mslink
                  MINUS
                  SELECT ident, icao, latitude, longitude, 5 src
                    FROM l_sky_navaid
                  MINUS
                  SELECT ident, icao, latitude, longitude, 6 src
                    FROM l_sky_waypoint)),
         mainselect AS
         (SELECT DISTINCT from_fix_ident ident, from_ident_icao icao,
                          latitude1 latitude, longitude1 longitude,
                          from_fix_fea_pk src, -1 mslink
                     FROM l_sky_airway, l_dgn_airway
                    WHERE l_sky_airway.mslink = l_dgn_airway.mslink
          UNION ALL
          SELECT DISTINCT to_fix_ident ident, to_ident_icao icao,
                          latitude2 latitude, longitude2 longitude,
                          to_fix_fea_pk src, -2 mslink
                     FROM l_sky_airway, l_dgn_airway
                    WHERE l_sky_airway.mslink = l_dgn_airway.mslink
          UNION ALL
          SELECT ident, icao, latitude, longitude, 5 src, mslink
            FROM l_sky_navaid
          UNION ALL
          SELECT ident, icao, latitude, longitude, 6 src, mslink
            FROM l_sky_waypoint)
    SELECT   *
        FROM mainselect
       WHERE ident || ';' || icao || ';' || src IN (SELECT *
                                                      FROM inselect)
    ORDER BY ident, icao, src, mslink, latitude, longitude;
    Plan
    SELECT STATEMENT  ALL_ROWSCost: 550 336  Bytes: 2 383 172 145  Cardinality: 24 568 785                                             
        31 SORT ORDER BY  Cost: 550 336  Bytes: 2 383 172 145  Cardinality: 24 568 785                                         
            30 HASH JOIN  Cost: 2 647  Bytes: 2 383 172 145  Cardinality: 24 568 785                                     
                17 VIEW VIEW SYS.VW_NSO_1 Cost: 1 173  Bytes: 1 472 922  Cardinality: 44 634                                 
                    16 HASH UNIQUE  Cost: 1 173  Bytes: 1 205 118  Cardinality: 44 634                             
                        15 VIEW EUS. Cost: 828  Bytes: 1 205 118  Cardinality: 44 634                         
                            14 MINUS                     
                                11 MINUS                 
                                    8 SORT UNIQUE  Cost: 828  Bytes: 2 314 600  Cardinality: 44 634             
                                        7 UNION-ALL         
                                            3 HASH JOIN  Cost: 142  Bytes: 981 948  Cardinality: 22 317     
                                                1 TABLE ACCESS FULL TABLE EUS.L_SKY_AIRWAY Cost: 85  Bytes: 290 121  Cardinality: 22 317 
                                                2 TABLE ACCESS FULL TABLE EUS.L_DGN_AIRWAY Cost: 56  Bytes: 691 827  Cardinality: 22 317 
                                            6 HASH JOIN  Cost: 143  Bytes: 981 948  Cardinality: 22 317     
                                                4 TABLE ACCESS FULL TABLE EUS.L_SKY_AIRWAY Cost: 85  Bytes: 290 121  Cardinality: 22 317 
                                                5 TABLE ACCESS FULL TABLE EUS.L_DGN_AIRWAY Cost: 56  Bytes: 691 827  Cardinality: 22 317 
                                    10 SORT UNIQUE  Bytes: 52 320  Cardinality: 1 635             
                                        9 TABLE ACCESS FULL TABLE EUS.L_SKY_NAVAID Cost: 6  Bytes: 52 320  Cardinality: 1 635         
                                13 SORT UNIQUE  Bytes: 298 384  Cardinality: 8 776                 
                                    12 TABLE ACCESS FULL TABLE EUS.L_SKY_WAYPOINT Cost: 22  Bytes: 298 384  Cardinality: 8 776             
                29 VIEW EUS. Cost: 825  Bytes: 3 522 880  Cardinality: 55 045                                 
                    28 UNION-ALL                             
                        21 HASH UNIQUE  Cost: 398  Bytes: 981 948  Cardinality: 22 317                         
                            20 HASH JOIN  Cost: 142  Bytes: 981 948  Cardinality: 22 317                     
                                18 TABLE ACCESS FULL TABLE EUS.L_SKY_AIRWAY Cost: 85  Bytes: 290 121  Cardinality: 22 317                 
                                19 TABLE ACCESS FULL TABLE EUS.L_DGN_AIRWAY Cost: 56  Bytes: 691 827  Cardinality: 22 317                 
                        25 HASH UNIQUE  Cost: 398  Bytes: 981 948  Cardinality: 22 317                         
                            24 HASH JOIN  Cost: 143  Bytes: 981 948  Cardinality: 22 317                     
                                22 TABLE ACCESS FULL TABLE EUS.L_SKY_AIRWAY Cost: 85  Bytes: 290 121  Cardinality: 22 317                 
                                23 TABLE ACCESS FULL TABLE EUS.L_DGN_AIRWAY Cost: 56  Bytes: 691 827  Cardinality: 22 317                 
                        26 TABLE ACCESS FULL TABLE EUS.L_SKY_NAVAID Cost: 6  Bytes: 57 225  Cardinality: 1 635                         
                        27 TABLE ACCESS FULL TABLE EUS.L_SKY_WAYPOINT Cost: 22  Bytes: 324 712  Cardinality: 8 776                          Reformated
    Message was edited by:
    Vlada
    Message was edited by:
    Vlada

    Vlada,
    could you please post an properly formatted explain plan output using DBMS_XPLAN.DISPLAY including the "Predicate Information" section below the plan to provide more details regarding your statement. Please use the \[code\] and \[code\] tags to enhance readability of the output provided:
    In SQL*Plus:
    SET LINESIZE 130
    EXPLAIN PLAN FOR <your statement>;
    SELECT * FROM TABLE(DBMS_XPLAN.DISPLAY);In order to get a better understanding where your statement spends the time you might want to turn on SQL trace as described here:
    [When your query takes too long|http://forums.oracle.com/forums/thread.jspa?threadID=501834]
    and post the "tkprof" output here, too.
    Could you also provide the information which version of 10g you're currently using? (4-digit version number). Note that 10g introduced a couple of significant changes including CPU costing enabled by default and a different default setting of DBMS_STATS regarding column histograms.
    So you might want to re-gather the statistics using the method_opt parameter of the DBMS_STATS.GATHER__STATS procedures explicitly defined as "FOR ALL COLUMNS SIZE 1" to mimic the 9i behaviour.
    You also might want to try the "OPTIMIZER_FEATURES_ENABLE" session setting set to "9.2.0" in order to find out if any of the new optimizer features could be causing the issue if re-gathering the statistics as suggested above doesn't make a difference.
    Do you know if the tables/indexes in your 9i database also had reasonable statistics?
    Regards,
    Randolf
    Oracle related stuff blog:
    http://oracle-randolf.blogspot.com/
    SQLTools++ for Oracle:
    http://www.sqltools-plusplus.org:7676/
    http://sourceforge.net/projects/sqlt-pp/
    Edited by: Randolf Geist on Sep 8, 2008 9:32 AM
    Added some specific suggestions

  • Problem with Java Application after upgrade to 10g

    after upgrading to 10g if I enable coloumn of varchar255 to load into memory of my middleware orm following error is thrown,
    javax.servlet.jsp.JspException     at jsp.viewsinglerecord.throwError(_viewsinglerecord.java:31)     [SRC:/jsp/standardinclude.jsp:84]     at jsp.viewsinglerecord._jspService(_viewsinglerecord.java:1185)     [SRC:/jsp/displaymultiplerecords.jsp:461]     at com.orionserver[Oracle Application Server Containers for J2EE 10g (10.1.2.3.0)].http.OrionHttpJspPage.service(OrionHttpJspPage.java:56)     at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:356)     at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:498)     at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:402)     at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)     at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.3.0)].server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:835)     at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.3.0)].server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:341)     at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.3.0)].server.http.ServletRequestDispatcher.forward(ServletRequestDispatcher.java:230)     at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.3.0)].server.http.GetParametersRequestDispatcher.forward(GetParametersRequestDispatcher.java:257)     at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1069)     at org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:455)     at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:279)     at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)     at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)     at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)     at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)     at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.3.0)].server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:835)     at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.3.0)].server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:341)     at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.3.0)].server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:816)     at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.3.0)].server.http.AJPRequestHandler.run(AJPRequestHandler.java:231)     at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.3.0)].server.http.AJPRequestHandler.run(AJPRequestHandler.java:136)     at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.3.0)].util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:192)     at java.lang.Thread.run(Thread.java:534)
    Any lights on this issue ?

    after upgrading to 10g if I enable coloumn of varchar255 to load into memory of my middleware orm following error is thrown,
    javax.servlet.jsp.JspException     at jsp.viewsinglerecord.throwError(_viewsinglerecord.java:31)     [SRC:/jsp/standardinclude.jsp:84]     at jsp.viewsinglerecord._jspService(_viewsinglerecord.java:1185)     [SRC:/jsp/displaymultiplerecords.jsp:461]     at com.orionserver[Oracle Application Server Containers for J2EE 10g (10.1.2.3.0)].http.OrionHttpJspPage.service(OrionHttpJspPage.java:56)     at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:356)     at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:498)     at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:402)     at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)     at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.3.0)].server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:835)     at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.3.0)].server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:341)     at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.3.0)].server.http.ServletRequestDispatcher.forward(ServletRequestDispatcher.java:230)     at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.3.0)].server.http.GetParametersRequestDispatcher.forward(GetParametersRequestDispatcher.java:257)     at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1069)     at org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:455)     at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:279)     at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)     at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)     at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)     at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)     at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.3.0)].server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:835)     at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.3.0)].server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:341)     at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.3.0)].server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:816)     at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.3.0)].server.http.AJPRequestHandler.run(AJPRequestHandler.java:231)     at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.3.0)].server.http.AJPRequestHandler.run(AJPRequestHandler.java:136)     at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.3.0)].util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:192)     at java.lang.Thread.run(Thread.java:534)
    Any lights on this issue ?

  • "The query was cancelled" error after upgrade from 10.1.3.3.3 to 10.1.3.4.2

    Hi,
    I was using OBIEE 10.1.3.3.3 /. After upgrading to 10.1.3.4.2 , the queries are not running ( long running queries alone) as expected. and so all the campaigns iwh tlong running queries are cancelled and the error message is seen in the xml log in Marketing jobs management.
    We have upgraded the OBIEE version from 10.1.3.3.3 to 10.1.3.4.2 yesterday after which the connectivites have been checked with SQLPLUS and they are working fine. But when the campaign has been loaded, the Analytics have received the request for the segment query and after longer run, the task has been cancelled with the error message "The Query was cancelled as mentioned below in the Job Stats
    <jobStats>
    <jobID>2</jobID>
    <jobType>WriteListFiles</jobType>
    <jobUser>userid</jobUser>
    <jobState>Error</jobState>
    <jobTotalMilliSec>1h 41m 21s 160ms</jobTotalMilliSec>
    <jobStartedTime>2012-03-22T08:06:13Z</jobStartedTime>
    <jobFinishedTime>2012-03-22T09:47:34Z</jobFinishedTime>
    <jobIsCancelling>N</jobIsCancelling>
    - <exception>
    <message>Job request of type "WriteListFiles" failed.</message>
    - <exception>
    <message>Error executing the list generation SQL.</message>
    - <exception>
    <message>Error in executing cursor for WorkNode (Id:0)</message>
    - <exception>
    <message>The query was cancelled.</message>
    </exception>
    </exception>
    </exception>
    </exception>
    </jobStats>
    Please let us know the suggestions
    So far, the unaccessedtimingrunoutminutes tag has been tried to set 50 under ODBC tag in instanceconfig.xml. and the defaulttimeoutminutes has been tried to set to 150 in the same instanceconfig.xml.
    along with that the rpd changes are done. For all the users apart from the Administrator, the timeout has been changedfrom 10 minutes to 150 minutes. But still that way is not working.
    The segments was fired with the Administrator login. So , if the timeout for admin login can be set, i assume that the problem might be solved. Please let us know ur suggestions here too.
    If that is the case, when we open rpd , only for Administrator user and group, the Permissions button is disabled. So i want to know how to change for Admin user settings in rpd..
    Please advice us on the same.
    Regards,
    Madasamy M.
    Edited by: Madasamy Murugaboobathi on Mar 26, 2012 1:40 PM

    The issue has been resolved by setting the following parameters
    <UnaccessedRunningTimeoutMinutes>120</UnaccessedRunningTimeoutMinutes>
    <DefaultTimeoutMinutes>120</DefaultTimeoutMinutes>
    <ClientSessionExpireMinutes>120</ClientSessionExpireMinutes>
    <ConnectionExpireMinutes>120</ConnectionExpireMinutes>
    <UIDefaultTimeoutMinutes>1440</UIDefaultTimeoutMinutes>

  • Query takes 14 hours to complete - kindly help

    I'm using Oracle9207 32bit on windows server 2003.
    I executed the following query and it takes 14 hours to complete. I don't understand why it takes too long, the database is in archivelog mode and it is not running any other queries. I even specified nologging and the parallel option. And before performing the operation I even "alter table move..." the incmsg table.
    The incmsg table contains around 70Million rows.
    create table "ECI"."outactions_temp" tablespace USERS nologging parallel as select * FROM "ECI"."outactions" WHERE "ECI"."outactions"."incmsgserno" IN (select "ECI"."incmsg"."serno" from "ECI"."incmsg" where "ECI"."incmsg"."applicationserno" = 2 and "ECI"."incmsg"."timestamp" between to_date('01-MAY-2007', 'DD Mon YYYY') and to_date('21-SEP-2007', 'DD Mon YYYY'));
    The execution plan is as follows:
    SQL> select plan_table_output from table(dbms_xplan.display('PLAN_TABLE',null,'ALL'));
    | Id | Operation | Name | Rows | Bytes | Cost | TQ |IN-OUT| PQ Distrib |
    | 0 | CREATE TABLE STATEMENT | | 993 | 2050K| 8322 | | | |
    | 1 | LOAD AS SELECT | | | | | 30,01 | P->S | QC (RAND) |
    | 2 | TABLE ACCESS BY INDEX ROWID | outactions | 1 | 2080 | 3 | 30,01 | PCWC | |
    | 3 | NESTED LOOPS | | 993 | 2050K| 8322 | 30,01 | PCWP | |
    | 4 | TABLE ACCESS BY INDEX ROWID| incmsg | 993 | 34755 | 5343 | 30,00 | S->P | RND-ROBIN |
    | 5 | INDEX RANGE SCAN | IX_INCMSG_TSTAMP | 178K| | 334 | | | |
    | 6 | INDEX RANGE SCAN | IX104_1 | 1 | | 2 | 30,01 | PCWP | |
    PX Slave SQL Information (identified by operation id):
    1 - CREATE TABLE "ECI".:Q630001 TABLESPACE "USERS" NOLOGGING AS SELECT C0,C1,C2,C3,C4,C5,C6,C7 FROM (SELECT
    /*+ ORDERED NO_EXPAND USE_NL(A2) INDEX(A2 "IX104_1") */ A2."serno" C0,A2."source" C1,A2."incmsgserno"
    C2,A2."strategyserno" C3,A2."testrunserno" C4,A2."timestamp" C5,A2."xml_actions" C6,A2."status" C7 FROM :Q630000
    A1,"ECI"."outactions" A2 WHERE A2."incmsgserno"=A1.C1)
    23 rows selected.

    I executed the query without the create table statement and the following is the explain plan. I'm still reading thru FAQ on how to format the explain plan.
    PLAN_TABLE_OUTPUT
    | Id | Operation | Name | Rows | Bytes | Cost
    | TQ |IN-OUT| PQ Distrib |
    | 0 | SELECT STATEMENT | | 993 | 2050K| 832
    PLAN_TABLE_OUTPUT
    2 | | | |
    | 1 | TABLE ACCESS BY INDEX ROWID | outactions | 1 | 2080 |
    3 | 33,01 | PCWC | |
    | 2 | NESTED LOOPS | | 993 | 2050K| 832
    2 | 33,01 | P->S | QC (RAND) |
    | 3 | TABLE ACCESS BY INDEX ROWID| incmsg | 993 | 34755 | 534
    3 | 33,00 | S->P | RND-ROBIN |
    PLAN_TABLE_OUTPUT
    | 4 | INDEX RANGE SCAN | IX_INCMSG_TSTAMP | 178K| | 33
    4 | | | |
    | 5 | INDEX RANGE SCAN | IX104_1 | 1 | |
    2 | 33,01 | PCWP | |
    PX Slave SQL Information (identified by operation id):
    PLAN_TABLE_OUTPUT
    2 - SELECT /*+ ORDERED NO_EXPAND USE_NL(A2) INDEX(A2 "IX104_1") */
    A1.C0,A1.C1,A1.C2,A2.ROWID,A2."serno",A2."source",A2."incmsgserno"
    ,A2."strategyserno",A2."testrunserno",A2."time
    stamp",A2."xml_actions",A2."status" FROM :Q633000 A1,"ECI"."outact
    ions" A2 WHERE A2."incmsgserno"=A1.C1
    PLAN_TABLE_OUTPUT
    Note: cpu costing is off, PLAN_TABLE' is old version
    21 rows selected.
    SQL> spool off;

  • Domain index query takes 12 hours to execute

    Hi Friends,
    My query which uses domain index takes 12 hours to execute. Can you please help me tuning this query?
    select /*+ NO_UNNEST ORDERED index_ffs(Term idx_recanon_term_ysm1) parallel_index(Term, idx_recanon_term_ysm1, 8) */ term.rowid
    from cmpgn.recanon_search_terms,cmpgn.recanon_term_ysm Term
    where cmpgn.recanon_search_terms.search_type=3 and
    contains(Term.RAW_TERM_TEXT,cmpgn.recanon_search_terms.search_text) > 0 and
    Term.pod_id=11
    Thanks in advance.
    Regards
    Bala

    First your driving table is recanon_search_terms to get the required search terms, then use them to query Oracle Text. What you are trying to do is to get a subset of table term first and than run every individual row of table term against the search terms. This approach will take a very long time.
    Not sure what you want to do, but it looks something I have been working on previously. As far I can see there is a table with controlled terms which are matched against other raw terms in a text document using Oracle Text. The issue is that you do a join in the contains clause without knowing the number of query expressions formed. It can be that 7 thousand individual queries run at once, than use indexes of the other predicates, do some sorting, etc. which would explain the long time needed. It will probably run out of memory causing all sorts of issues.
    As a quick fix try first following statement without hints.
    Tell us how many rows you get, the distinct counts for pod_id and search_type and how long it takes.
    CREATE TABLE test_table AS
    select term.pod_id pod_id, cmpgn.recanon_search_terms.search_type search_type, term_primary_key, ....
    from cmpgn.recanon_search_terms,cmpgn.recanon_term_ysm Term
    where contains(Term.RAW_TERM_TEXT,cmpgn.recanon_search_terms.search_text) > 0
    Create index test_idx on test_table(pod_id, search_type) and use test_table instead to get the results, just by providing pod_id and search_type without the join in the contains clause.
    SELECT ..
    FROM test_table
    WHERE pod_id = X
    AND search_type = Y
    Maybe this approach is sufficient for your purpose. For sure, it will give you instant results. In that case a materialized view instead of the table could work for maintenance reasons; I had some issues with materialized views for above scenario.
    However check very carefully the results. I would have some doubts that all rows in search_text form a valid query expression for Oracle Text. If search_text has just single tokens or phrases wrapping curly brackets around will probably resolve the issue.
    Think about to form one query expression through a function call instead of a table join inside the contains clause. Sometimes to run a set of individual queries are faster than one big query.
    select term.rowid --, form_query_exrpession(3) query_exrpession
    from cmpgn.recanon_term_ysm Term
    where contains(Term.RAW_TERM_TEXT, form_query_exrpession(3)) > 0
    The above function will form one valid Oracle Text query expression by using the table recanon_search_terms inside the function. This approach normally helps, at least in debugging and fine-tuning. Avoid using bind variables first in order to identify highly skewed distribution of search_type.
    The other performance issue is the additional predicate of pod_id = X, here the suggestion from radord works very well. If you want to get your hands dirty have a look at user_datastore in the Oracle Text documentation, this will give you all the freedom you want.

  • A query takes 7 hours to complete (0 rows rturned)

    Hi all,
    This query takes 7hours to complete since I migrated from 10g to 11g.
    SELECT /*+ gather_plan_statistics */ T.OWNER, T.TABLE_NAME
        FROM (  SELECT DISTINCT COFIR FROM DBAUSR_TT) U, VDBSTA S, DBA_TABLES T
       WHERE     S.COFIR = U.COFIR
             AND S.CTTAB = 'T'
             AND T.OWNER = S.COFIR
             AND T.TABLE_NAME = S.COTAB
             AND T.TEMPORARY = 'N'
             AND (T.LAST_ANALYZED IS NOT NULL
                  OR EXISTS
                        (SELECT 1
                           FROM DBA_TAB_STATISTICS A
                          WHERE     A.OWNER = T.OWNER
                                AND A.TABLE_NAME = T.TABLE_NAME
                                AND NVL (A.STATTYPE_LOCKED, '*') != 'ALL')
                  OR EXISTS
                        (SELECT 1
                           FROM DBA_INDEXES I
                          WHERE     I.TABLE_OWNER = T.OWNER
                                AND I.TABLE_NAME = T.TABLE_NAME
                                AND I.LAST_ANALYZED IS NOT NULL))
    ORDER BY 1, 2;
    SQL> select * from table(dbms_xplan.display_cursor(NULL,NULL,'last iostats'));
    PLAN_TABLE_OUTPUT
    SQL_ID  f3bzgtgudc0cd, child number 0
    SELECT /*+ gather_plan_statistics */ T.OWNER, T.TABLE_NAME     FROM (
    SELECT DISTINCT COFIR FROM DBAUSR_TT) U, VDBSTA S, DBA_TABLES T
    WHERE     S.COFIR = U.COFIR          AND S.CTTAB = 'T'          AND
    T.OWNER = S.COFIR          AND T.TABLE_NAME = S.COTAB          AND
    T.TEMPORARY = 'N'          AND (T.LAST_ANALYZED IS NOT NULL
      OR EXISTS                     (SELECT 1                        FROM
    DBA_TAB_STATISTICS A                       WHERE     A.OWNER = T.OWNER
                               AND A.TABLE_NAME = T.TABLE_NAME
                   AND NVL (A.STATTYPE_LOCKED, '*') != 'ALL')
    OR EXISTS                     (SELECT 1                        FROM
    DBA_INDEXES I                       WHERE     I.TABLE_OWNER = T.OWNER
                              AND I.TABLE_NAME = T.TABLE_NAME
                  AND I.LAST_ANALYZED IS NOT NULL)) ORDER BY 1, 2
    Plan hash value: 291652704
    | Id  | Operation                               | Name                      | Starts | E-Rows | A-Rows |   A-Time   | Buffers | Reads  |
    |   0 | SELECT STATEMENT                        |                           |      1 |        |      0 |00:07:55.28 |      73M|     54M|
    |   1 |  SORT ORDER BY                          |                           |      1 |      1 |      0 |00:07:55.28 |      73M|     54M|
    |*  2 |   FILTER                                |                           |      1 |        |      0 |00:07:55.28 |      73M|     54M|
    |   3 |    NESTED LOOPS OUTER                   |                           |      1 |      1 |   2726 |00:00:05.37 |   17301 |    766 |
    |   4 |     NESTED LOOPS OUTER                  |                           |      1 |      1 |   2726 |00:00:05.37 |   17298 |    766 |
    |   5 |      NESTED LOOPS OUTER                 |                           |      1 |      1 |   2726 |00:00:05.37 |   16604 |    756 |
    |   6 |       NESTED LOOPS OUTER                |                           |      1 |      1 |   2726 |00:00:05.37 |   16604 |    756 |
    |   7 |        NESTED LOOPS                     |                           |      1 |      1 |   2726 |00:00:05.37 |   12998 |    619 |
    |   8 |         NESTED LOOPS                    |                           |      1 |      1 |   2726 |00:00:05.37 |   10268 |    619 |
    |*  9 |          HASH JOIN                      |                           |      1 |      1 |   2726 |00:00:00.27 |    5329 |     11 |
    |* 10 |           HASH JOIN                     |                           |      1 |      4 |   5909 |00:00:00.18 |    5323 |      9 |
    |* 11 |            HASH JOIN                    |                           |      1 |    207 |   3296 |00:00:00.02 |    4152 |      0 |
    |  12 |             MERGE JOIN CARTESIAN        |                           |      1 |     10 |      4 |00:00:00.02 |       3 |      0 |
    |* 13 |              HASH JOIN                  |                           |      1 |      1 |      1 |00:00:00.02 |       0 |      0 |
    |* 14 |               FIXED TABLE FULL          | X$KSPPI                   |      1 |      1 |      1 |00:00:00.01 |       0 |      0 |
    |  15 |               FIXED TABLE FULL          | X$KSPPCV                  |      1 |    100 |   2044 |00:00:00.01 |       0 |      0 |
    |  16 |              BUFFER SORT                |                           |      1 |     10 |      4 |00:00:00.01 |       3 |      0 |
    |  17 |               VIEW                      |                           |      1 |     10 |      4 |00:00:00.01 |       3 |      0 |
    |  18 |                HASH UNIQUE              |                           |      1 |     10 |      4 |00:00:00.01 |       3 |      0 |
    |  19 |                 TABLE ACCESS FULL       | DBAUSR_TT                 |      1 |     10 |     10 |00:00:00.01 |       3 |      0 |
    |  20 |             VIEW                        | VDBSTA                    |      1 |   2065 |   3296 |00:00:00.01 |    4149 |      0 |
    |  21 |              UNION-ALL                  |                           |      1 |        |   3296 |00:00:00.01 |    4149 |      0 |
    |  22 |               NESTED LOOPS              |                           |      1 |   1433 |    187 |00:00:00.01 |    1617 |      0 |
    |  23 |                MERGE JOIN CARTESIAN     |                           |      1 |   1717 |   1740 |00:00:00.01 |      18 |      0 |
    |* 24 |                 TABLE ACCESS FULL       | USEUBX                    |      1 |      1 |      1 |00:00:00.01 |       3 |      0 |
    |  25 |                 BUFFER SORT             |                           |      1 |   1717 |   1740 |00:00:00.01 |      15 |      0 |
    |* 26 |                  TABLE ACCESS FULL      | STATAB                    |      1 |   1717 |   1740 |00:00:00.01 |      15 |      0 |
    |* 27 |                INDEX UNIQUE SCAN        | TABCOM1                   |   1740 |      1 |    187 |00:00:00.01 |    1599 |      0 |
    |  28 |               HASH UNIQUE               |                           |      1 |    610 |   3106 |00:00:00.02 |    2499 |      0 |
    |  29 |                NESTED LOOPS ANTI        |                           |      1 |   3294 |   3106 |00:00:00.01 |    2499 |      0 |
    |  30 |                 MERGE JOIN CARTESIAN    |                           |      1 |   3434 |   3480 |00:00:00.01 |      18 |      0 |
    |* 31 |                  TABLE ACCESS FULL      | USEUBX                    |      1 |      2 |      2 |00:00:00.01 |       3 |      0 |
    |  32 |                  BUFFER SORT            |                           |      2 |   1717 |   3480 |00:00:00.01 |      15 |      0 |
    |* 33 |                   TABLE ACCESS FULL     | STATAB                    |      1 |   1717 |   1740 |00:00:00.01 |      15 |      0 |
    |* 34 |                 INDEX UNIQUE SCAN       | TABCOM1                   |   2634 |     58 |    301 |00:00:00.01 |    2481 |      0 |
    |  35 |               HASH UNIQUE               |                           |      1 |     14 |      0 |00:00:00.01 |      15 |      0 |
    |  36 |                MERGE JOIN CARTESIAN     |                           |      1 |     14 |      0 |00:00:00.01 |      15 |      0 |
    |* 37 |                 TABLE ACCESS FULL       | STATAB                    |      1 |      5 |      0 |00:00:00.01 |      15 |      0 |
    |  38 |                 BUFFER SORT             |                           |      0 |      3 |      0 |00:00:00.01 |       0 |      0 |
    |* 39 |                  TABLE ACCESS FULL      | USEUBX                    |      0 |      3 |      0 |00:00:00.01 |       0 |      0 |
    |  40 |               HASH UNIQUE               |                           |      1 |      8 |      3 |00:00:00.01 |      18 |      0 |
    |  41 |                MERGE JOIN CARTESIAN     |                           |      1 |      8 |      3 |00:00:00.01 |      18 |      0 |
    |* 42 |                 TABLE ACCESS FULL       | USEUBX                    |      1 |      1 |      1 |00:00:00.01 |       3 |      0 |
    |  43 |                 BUFFER SORT             |                           |      1 |      8 |      3 |00:00:00.01 |      15 |      0 |
    |* 44 |                  TABLE ACCESS FULL      | STATAB                    |      1 |      8 |      3 |00:00:00.01 |      15 |      0 |
    |* 45 |            TABLE ACCESS FULL            | OBJ$                      |      1 |   1000 |  99107 |00:00:00.01 |    1171 |      9 |
    |  46 |           TABLE ACCESS FULL             | USER$                     |      1 |     76 |     76 |00:00:00.02 |       6 |      2 |
    |* 47 |          TABLE ACCESS CLUSTER           | TAB$                      |   2726 |      1 |   2726 |00:00:05.85 |    4939 |    608 |
    |* 48 |           INDEX UNIQUE SCAN             | I_OBJ#                    |   2726 |      1 |   2726 |00:00:00.23 |     577 |     19 |
    |  49 |         TABLE ACCESS CLUSTER            | TS$                       |   2726 |      1 |   2726 |00:00:00.01 |    2730 |      0 |
    |* 50 |          INDEX UNIQUE SCAN              | I_TS#                     |   2726 |      1 |   2726 |00:00:00.01 |       4 |      0 |
    |  51 |        TABLE ACCESS CLUSTER             | SEG$                      |   2726 |      1 |   2726 |00:00:01.37 |    3606 |    137 |
    |* 52 |         INDEX UNIQUE SCAN               | I_FILE#_BLOCK#            |   2726 |      1 |   2726 |00:00:00.51 |     880 |     52 |
    |* 53 |       INDEX RANGE SCAN                  | I_OBJ1                    |   2726 |      1 |      0 |00:00:00.01 |       0 |      0 |
    |* 54 |      INDEX RANGE SCAN                   | I_OBJ1                    |   2726 |      1 |   2719 |00:00:00.18 |     694 |     10 |
    |* 55 |     INDEX RANGE SCAN                    | I_USER2                   |   2726 |      1 |   2719 |00:00:00.01 |       3 |      0 |
    |  56 |    VIEW                                 | DBA_TAB_STATISTICS        |   2726 |     13 |      0 |07:24:59.23 |      73M|     54M|
    |  57 |     UNION-ALL                           |                           |   2726 |        |      0 |07:24:59.23 |      73M|     54M|
    |  58 |      NESTED LOOPS OUTER                 |                           |   2726 |      1 |      0 |00:00:00.18 |   19122 |      1 |
    |  59 |       NESTED LOOPS                      |                           |   2726 |      1 |      0 |00:00:00.18 |   19122 |      1 |
    |  60 |        NESTED LOOPS OUTER               |                           |   2726 |      1 |   2726 |00:00:00.04 |   11535 |      0 |
    |  61 |         NESTED LOOPS                    |                           |   2726 |      1 |   2726 |00:00:00.04 |   11534 |      0 |
    |  62 |          TABLE ACCESS BY INDEX ROWID    | USER$                     |   2726 |      1 |   2726 |00:00:00.04 |    5452 |      0 |
    |* 63 |           INDEX UNIQUE SCAN             | I_USER1                   |   2726 |      1 |   2726 |00:00:00.02 |    2726 |      0 |
    |* 64 |          INDEX RANGE SCAN               | I_OBJ2                    |   2726 |      1 |   2726 |00:00:00.01 |    6082 |      0 |
    |* 65 |         INDEX UNIQUE SCAN               | I_TAB_STATS$_OBJ#         |   2726 |      1 |      0 |00:00:00.01 |       1 |      0 |
    |* 66 |        TABLE ACCESS CLUSTER             | TAB$                      |   2726 |      1 |      0 |00:00:00.12 |    7587 |      1 |
    |* 67 |         INDEX UNIQUE SCAN               | I_OBJ#                    |   2726 |      1 |   2726 |00:00:00.02 |    3225 |      0 |
    |* 68 |       INDEX UNIQUE SCAN                 | I_MON_MODS_ALL$_OBJ       |      0 |      1 |      0 |00:00:00.01 |       0 |      0 |
    |  69 |      NESTED LOOPS OUTER                 |                           |   2726 |      1 |      0 |01:52:08.09 |      23M|     13M|
    |  70 |       NESTED LOOPS                      |                           |   2726 |      1 |      0 |01:52:08.09 |      23M|     13M|
    |  71 |        MERGE JOIN CARTESIAN             |                           |   2726 |   9067 |     32M|01:50:22.71 |      13M|     13M|
    |  72 |         NESTED LOOPS OUTER              |                           |   2726 |      1 |   2726 |00:00:00.02 |   11535 |      0 |
    |  73 |          NESTED LOOPS                   |                           |   2726 |      1 |   2726 |00:00:00.02 |   11534 |      0 |
    |  74 |           TABLE ACCESS BY INDEX ROWID   | USER$                     |   2726 |      1 |   2726 |00:00:00.01 |    5452 |      0 |
    |* 75 |            INDEX UNIQUE SCAN            | I_USER1                   |   2726 |      1 |   2726 |00:00:00.01 |    2726 |      0 |
    |* 76 |           INDEX RANGE SCAN              | I_OBJ2                    |   2726 |      1 |   2726 |00:00:00.02 |    6082 |      0 |
    |* 77 |          INDEX UNIQUE SCAN              | I_TAB_STATS$_OBJ#         |   2726 |      1 |      0 |00:00:00.01 |       1 |      0 |
    |  78 |         BUFFER SORT                     |                           |   2726 |  11909 |     32M|01:50:22.71 |      13M|     13M|
    |  79 |          TABLE ACCESS FULL              | TAB$                      |   2726 |  11909 |     32M|01:48:31.82 |      13M|     13M|
    |* 80 |        VIEW PUSHED PREDICATE            | TABPARTV$                 |     32M|      1 |      0 |00:01:23.69 |    9566K|      0 |
    |* 81 |         TABLE ACCESS BY INDEX ROWID     | TABPART$                  |     32M|      4 |    703K|00:01:10.17 |    9566K|      0 |
    |* 82 |          INDEX RANGE SCAN               | I_TABPART_BOPART$         |     32M|      4 |    703K|00:00:51.77 |    9210K|      0 |
    |* 83 |       INDEX UNIQUE SCAN                 | I_MON_MODS_ALL$_OBJ       |      0 |      1 |      0 |00:00:00.01 |       0 |      0 |
    |  84 |      NESTED LOOPS OUTER                 |                           |   2726 |      1 |      0 |01:53:02.61 |      23M|     13M|
    |  85 |       NESTED LOOPS                      |                           |   2726 |      1 |      0 |01:53:02.61 |      23M|     13M|
    |  86 |        MERGE JOIN CARTESIAN             |                           |   2726 |   9067 |     32M|01:51:19.21 |      13M|     13M|
    |  87 |         NESTED LOOPS                    |                           |   2726 |      1 |   2726 |00:00:00.21 |   11534 |      0 |
    |  88 |          TABLE ACCESS BY INDEX ROWID    | USER$                     |   2726 |      1 |   2726 |00:00:00.12 |    5452 |      0 |
    |* 89 |           INDEX UNIQUE SCAN             | I_USER1                   |   2726 |      1 |   2726 |00:00:00.02 |    2726 |      0 |
    |* 90 |          INDEX RANGE SCAN               | I_OBJ2                    |   2726 |      1 |   2726 |00:00:00.06 |    6082 |      0 |
    |  91 |         BUFFER SORT                     |                           |   2726 |  11909 |     32M|01:51:19.03 |      13M|     13M|
    |  92 |          TABLE ACCESS FULL              | TAB$                      |   2726 |  11909 |     32M|01:49:51.13 |      13M|     13M|
    |* 93 |        VIEW PUSHED PREDICATE            | TABPARTV$                 |     32M|      1 |      0 |00:01:23.47 |    9566K|      0 |
    |* 94 |         TABLE ACCESS BY INDEX ROWID     | TABPART$                  |     32M|      1 |      0 |00:01:10.51 |    9566K|      0 |
    |* 95 |          INDEX RANGE SCAN               | I_TABPART_BOPART$         |     32M|      4 |    703K|00:00:53.01 |    9210K|      0 |
    |* 96 |       INDEX UNIQUE SCAN                 | I_MON_MODS_ALL$_OBJ       |      0 |      1 |      0 |00:00:00.01 |       0 |      0 |
    |  97 |      NESTED LOOPS OUTER                 |                           |   2726 |      1 |      0 |01:49:37.09 |      13M|     13M|
    |  98 |       NESTED LOOPS                      |                           |   2726 |      1 |      0 |01:49:37.09 |      13M|     13M|
    |  99 |        NESTED LOOPS OUTER               |                           |   2726 |      1 |      0 |01:49:37.09 |      13M|     13M|
    | 100 |         NESTED LOOPS                    |                           |   2726 |      1 |      0 |01:49:37.09 |      13M|     13M|
    | 101 |          NESTED LOOPS                   |                           |   2726 |  11909 |     32M|01:47:05.13 |      13M|     13M|
    | 102 |           TABLE ACCESS BY INDEX ROWID   | USER$                     |   2726 |      1 |   2726 |00:00:00.08 |    5452 |      0 |
    |*103 |            INDEX UNIQUE SCAN            | I_USER1                   |   2726 |      1 |   2726 |00:00:00.04 |    2726 |      0 |
    | 104 |           TABLE ACCESS FULL             | TAB$                      |   2726 |  11909 |     32M|01:46:32.59 |      13M|     13M|
    |*105 |          VIEW PUSHED PREDICATE          | TABCOMPARTV$              |     32M|      1 |      0 |00:00:37.20 |       1 |      1 |
    | 106 |           TABLE ACCESS BY INDEX ROWID   | TABCOMPART$               |     32M|      1 |      0 |00:00:23.85 |       1 |      1 |
    |*107 |            INDEX RANGE SCAN             | I_TABCOMPART_BOPART$      |     32M|      1 |      0 |00:00:09.37 |       1 |      1 |
    |*108 |         INDEX UNIQUE SCAN               | I_MON_MODS_ALL$_OBJ       |      0 |      1 |      0 |00:00:00.01 |       0 |      0 |
    |*109 |        TABLE ACCESS BY INDEX ROWID      | OBJ$                      |      0 |      1 |      0 |00:00:00.01 |       0 |      0 |
    |*110 |         INDEX RANGE SCAN                | I_OBJ1                    |      0 |      1 |      0 |00:00:00.01 |       0 |      0 |
    |*111 |       INDEX UNIQUE SCAN                 | I_TAB_STATS$_OBJ#         |      0 |      1 |      0 |00:00:00.01 |       0 |      0 |
    | 112 |      NESTED LOOPS                       |                           |   2726 |        |      0 |01:50:32.64 |      13M|     13M|
    | 113 |       NESTED LOOPS                      |                           |   2726 |      1 |      0 |01:50:32.62 |      13M|     13M|
    | 114 |        NESTED LOOPS OUTER               |                           |   2726 |      1 |      0 |01:50:32.60 |      13M|     13M|
    | 115 |         NESTED LOOPS OUTER              |                           |   2726 |      1 |      0 |01:50:32.60 |      13M|     13M|
    | 116 |          NESTED LOOPS                   |                           |   2726 |      1 |      0 |01:50:32.58 |      13M|     13M|
    | 117 |           NESTED LOOPS                  |                           |   2726 |      1 |      0 |01:50:32.58 |      13M|     13M|
    | 118 |            NESTED LOOPS                 |                           |   2726 |      1 |      0 |01:50:32.58 |      13M|     13M|
    | 119 |             NESTED LOOPS                |                           |   2726 |  11909 |     32M|01:48:00.62 |      13M|     13M|
    | 120 |              TABLE ACCESS BY INDEX ROWID| USER$                     |   2726 |      1 |   2726 |00:00:00.04 |    5452 |      0 |
    |*121 |               INDEX UNIQUE SCAN         | I_USER1                   |   2726 |      1 |   2726 |00:00:00.02 |    2726 |      0 |
    | 122 |              TABLE ACCESS FULL          | TAB$                      |   2726 |  11909 |     32M|01:48:00.58 |      13M|     13M|
    |*123 |             VIEW PUSHED PREDICATE       | TABCOMPARTV$              |     32M|      1 |      0 |00:00:39.60 |       1 |      0 |
    | 124 |              TABLE ACCESS BY INDEX ROWID| TABCOMPART$               |     32M|      1 |      0 |00:00:26.27 |       1 |      0 |
    |*125 |               INDEX RANGE SCAN          | I_TABCOMPART_BOPART$      |     32M|      1 |      0 |00:00:09.80 |       1 |      0 |
    | 126 |            VIEW PUSHED PREDICATE        | TABSUBPARTV$              |      0 |      1 |      0 |00:00:00.01 |       0 |      0 |
    |*127 |             TABLE ACCESS BY INDEX ROWID | TABSUBPART$               |      0 |      1 |      0 |00:00:00.01 |       0 |      0 |
    |*128 |              INDEX RANGE SCAN           | I_TABSUBPART_POBJSUBPART$ |      0 |      1 |      0 |00:00:00.01 |       0 |      0 |
    |*129 |           INDEX RANGE SCAN              | I_OBJ1                    |      0 |      1 |      0 |00:00:00.01 |       0 |      0 |
    |*130 |          INDEX UNIQUE SCAN              | I_TAB_STATS$_OBJ#         |      0 |      1 |      0 |00:00:00.01 |       0 |      0 |
    |*131 |         INDEX UNIQUE SCAN               | I_MON_MODS_ALL$_OBJ       |      0 |      1 |      0 |00:00:00.01 |       0 |      0 |
    |*132 |        INDEX RANGE SCAN                 | I_OBJ1                    |      0 |      1 |      0 |00:00:00.01 |       0 |      0 |
    |*133 |       TABLE ACCESS BY INDEX ROWID       | OBJ$                      |      0 |      1 |      0 |00:00:00.01 |       0 |      0 |
    |*134 |      FILTER                             |                           |   2726 |        |      0 |00:00:00.02 |       0 |      0 |
    |*135 |       FILTER                            |                           |      0 |        |      0 |00:00:00.01 |       0 |      0 |
    |*136 |        HASH JOIN OUTER                  |                           |      0 |      8 |      0 |00:00:00.01 |       0 |      0 |
    | 137 |         NESTED LOOPS OUTER              |                           |      0 |      8 |      0 |00:00:00.01 |       0 |      0 |
    |*138 |          FIXED TABLE FULL               | X$KQFTA                   |      0 |      8 |      0 |00:00:00.01 |       0 |      0 |
    |*139 |          INDEX UNIQUE SCAN              | I_TAB_STATS$_OBJ#         |      0 |      1 |      0 |00:00:00.01 |       0 |      0 |
    | 140 |         TABLE ACCESS FULL               | FIXED_OBJ$                |      0 |    783 |      0 |00:00:00.01 |       0 |      0 |
    | 141 |    NESTED LOOPS                         |                           |   2726 |      1 |      0 |00:00:00.70 |   19121 |      4 |
    | 142 |     NESTED LOOPS                        |                           |   2726 |      1 |      0 |00:00:00.68 |   19121 |      4 |
    | 143 |      NESTED LOOPS OUTER                 |                           |   2726 |      1 |      0 |00:00:00.68 |   19121 |      4 |
    | 144 |       NESTED LOOPS OUTER                |                           |   2726 |      1 |      0 |00:00:00.68 |   19121 |      4 |
    | 145 |        NESTED LOOPS OUTER               |                           |   2726 |      1 |      0 |00:00:00.64 |   19121 |      4 |
    | 146 |         NESTED LOOPS OUTER              |                           |   2726 |      1 |      0 |00:00:00.64 |   19121 |      4 |
    | 147 |          NESTED LOOPS                   |                           |   2726 |      1 |      0 |00:00:00.64 |   19121 |      4 |
    | 148 |           NESTED LOOPS                  |                           |   2726 |      1 |   2726 |00:00:00.25 |   11534 |      0 |
    | 149 |            TABLE ACCESS BY INDEX ROWID  | USER$                     |   2726 |      1 |   2726 |00:00:00.16 |    5452 |      0 |
    |*150 |             INDEX UNIQUE SCAN           | I_USER1                   |   2726 |      1 |   2726 |00:00:00.04 |    2726 |      0 |
    |*151 |            INDEX RANGE SCAN             | I_OBJ2                    |   2726 |      1 |   2726 |00:00:00.08 |    6082 |      0 |
    |*152 |           TABLE ACCESS CLUSTER          | IND$                      |   2726 |      1 |      0 |00:00:00.39 |    7587 |      4 |
    |*153 |            INDEX UNIQUE SCAN            | I_OBJ#                    |   2726 |      1 |   2726 |00:00:00.02 |    3225 |      0 |
    | 154 |          TABLE ACCESS CLUSTER           | TS$                       |      0 |      1 |      0 |00:00:00.01 |       0 |      0 |
    |*155 |           INDEX UNIQUE SCAN             | I_TS#                     |      0 |      1 |      0 |00:00:00.01 |       0 |      0 |
    | 156 |         TABLE ACCESS CLUSTER            | SEG$                      |      0 |      1 |      0 |00:00:00.01 |       0 |      0 |
    |*157 |          INDEX UNIQUE SCAN              | I_FILE#_BLOCK#            |      0 |      1 |      0 |00:00:00.01 |       0 |      0 |
    |*158 |        INDEX RANGE SCAN                 | I_OBJ1                    |      0 |      1 |      0 |00:00:00.01 |       0 |      0 |
    |*159 |       INDEX RANGE SCAN                  | I_USER2                   |      0 |      1 |      0 |00:00:00.01 |       0 |      0 |
    |*160 |      TABLE ACCESS BY INDEX ROWID        | OBJ$                      |      0 |      1 |      0 |00:00:00.01 |       0 |      0 |
    |*161 |       INDEX RANGE SCAN                  | I_OBJ1                    |      0 |      1 |      0 |00:00:00.01 |       0 |      0 |
    |*162 |     INDEX RANGE SCAN                    | I_USER2                   |      0 |      1 |      0 |00:00:00.01 |       0 |      0 |
    Predicate Information (identified by operation id):
       2 - filter(("T"."ANALYZETIME" IS NOT NULL OR  IS NOT NULL OR  IS NOT NULL))
       9 - access("U"."NAME"="S"."COFIR" AND "O"."OWNER#"="U"."USER#")
      10 - access("O"."NAME"="S"."COTAB")
      11 - access("S"."COFIR"="U"."COFIR")
      13 - access("KSPPI"."INDX"="KSPPCV"."INDX")
      14 - filter("KSPPI"."KSPPINM"='_dml_monitoring_enabled')
      24 - filter("U"."TYUSR"='C')
      26 - filter(("S"."CTTAB"='T' AND "S"."TYUSR" IS NULL))
      27 - access("T"."COOBJ"="S"."COTAB")
      31 - filter("U"."TYUSR"='U')
      33 - filter(("S"."CTTAB"='T' AND "S"."TYUSR" IS NULL))
      34 - access("S"."COTAB"="T"."COOBJ")
      37 - filter(("S"."TYUSR"='G' AND "S"."CTTAB"='T'))
      39 - filter(("U"."TYUSR"='U' OR "U"."TYUSR"='X'))
      42 - filter("U"."TYUSR"='X')
      44 - filter(("S"."CTTAB"='T' AND "S"."TYUSR"='X'))
      45 - filter((DECODE(BITAND("O"."FLAGS",2),0,'N',2,'Y','N')='N' AND BITAND("O"."FLAGS",128)=0))
      47 - filter(BITAND("T"."PROPERTY",1)=0)
      48 - access("O"."OBJ#"="T"."OBJ#")
      50 - access("T"."TS#"="TS"."TS#")
      52 - access("T"."TS#"="S"."TS#" AND "T"."FILE#"="S"."FILE#" AND "T"."BLOCK#"="S"."BLOCK#")
      53 - access("T"."BOBJ#"="CO"."OBJ#")
      54 - access("T"."DATAOBJ#"="CX"."OBJ#")
      55 - access("CX"."OWNER#"="CU"."USER#")
      63 - access("U"."NAME"=:B1)
      64 - access("O"."OWNER#"="U"."USER#" AND "O"."NAME"=:B1 AND "O"."NAMESPACE"=1 AND "O"."REMOTEOWNER" IS NULL AND
                  "O"."LINKNAME" IS NULL AND "O"."SUBNAME" IS NULL)
           filter(("O"."SUBNAME" IS NULL AND "O"."REMOTEOWNER" IS NULL AND "O"."LINKNAME" IS NULL))
      65 - access("O"."OBJ#"="TS"."OBJ#")
      66 - filter((NVL(DECODE(BITAND("T"."TRIGFLAG",67108864)+BITAND("T"."TRIGFLAG",134217728),0,NULL,67108864,'DATA',134217728,'CAC
                  HE','ALL'),'*')<>'ALL' AND BITAND("T"."PROPERTY",1)=0))
      67 - access("O"."OBJ#"="T"."OBJ#")
      68 - access("T"."OBJ#"="M"."OBJ#")
      75 - access("U"."NAME"=:B1)
      76 - access("O"."OWNER#"="U"."USER#" AND "O"."NAME"=:B1 AND "O"."NAMESPACE"=1 AND "O"."REMOTEOWNER" IS NULL ANDsome information about the database:
      2  ;
    BANNER
    Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - Production
    PL/SQL Release 11.1.0.7.0 - Production
    CORE    11.1.0.7.0      Production
    TNS for 32-bit Windows: Version 11.1.0.7.0 - Production
    NLSRTL Version 11.1.0.7.0 - Production
    SQL> sho parameter optimizer
    NAME                                 TYPE        VALUE
    optimizer_capture_sql_plan_baselines boolean     FALSE
    optimizer_dynamic_sampling           integer     2
    optimizer_features_enable            string      11.1.0.7
    optimizer_index_caching              integer     0
    optimizer_index_cost_adj             integer     100
    optimizer_mode                       string      ALL_ROWS
    optimizer_secure_view_merging        boolean     TRUE
    optimizer_use_invisible_indexes      boolean     FALSE
    optimizer_use_pending_statistics     boolean     FALSE
    optimizer_use_sql_plan_baselines     boolean     TRUEthe issue seems to be on the view DBA_TAB_STATISTICS and in particular on this operation:
    | 122 |              TABLE ACCESS FULL          | TAB$                      |   2726 |  11909 |     32M|01:48:00.58 |      13M|     13M|How can I tune this query ?
    Thanks for helping

    Well, if you've ever looked at the source for DBA_TAB_STATISTICS you will understand why it's not a great candidate to query frequently, like in an exists look up :)
    This takes up a little more code, but i'd wager it finishes a bit sooner.
    SELECT
      /*+ gather_plan_statistics */
      T.OWNER,
      T.TABLE_NAME
    FROM
      ( SELECT DISTINCT COFIR
      FROM DBAUSR_TT
      ) U,
      VDBSTA S,
      DBA_TABLES T
    WHERE S.COFIR         = U.COFIR
    AND S.CTTAB           = 'T'
    AND T.OWNER           = S.COFIR
    AND T.TABLE_NAME      = S.COTAB
    AND T.TEMPORARY       = 'N'
    AND
        T.LAST_ANALYZED IS NOT NULL
    OR EXISTS
        SELECT 1
        FROM DBA_INDEXES I
        WHERE I.TABLE_OWNER  = T.OWNER
        AND I.TABLE_NAME     = T.TABLE_NAME
        AND I.LAST_ANALYZED IS NOT NULL
    UNION
    SELECT
      T.OWNER,
      T.TABLE_NAME
    FROM
      ( SELECT DISTINCT COFIR FROM DBAUSR_TT
      ) U,
      VDBSTA S,
      DBA_TABLES T,
      DBA_TAB_STATISTICS A
    WHERE S.COFIR                     = U.COFIR
    AND S.CTTAB                       = 'T'
    AND T.OWNER                       = S.COFIR
    AND T.TABLE_NAME                  = S.COTAB
    AND T.TEMPORARY                   = 'N'
    --added predicate
    AND T.LAST_ANALYZED IS NULL
    AND A.OWNER                       = T.OWNER
    AND A.TABLE_NAME                  = T.TABLE_NAME
    AND NVL (A.STATTYPE_LOCKED, '*') != 'ALL')
    ORDER BY 1, 2;

  • Weird query problem after upgrade to 10g

    After upgrading from 9i to 10g I've noticed that one query slowed down drastically (from 100[ms] to 30[s])
    SELECT ... FROM first_table LEFT OUTER JOIN second_table ON ...
    WHERE first_table.number_column = '453' ...
    What's weird is the redundant apostrophes around number in WHERE clause. The same query without those apostrophes executes in 100[ms].
    I know it doesn't make any sense to put numbers inside apostrophes but it results from the application structure. Since I can't change the application I need the way to improve this query from the database level.
    I tested this query with other databases (9i and 10g) and there is no differences whether the number is in apostrophes or not.
    What does it depend on?
    Any ideas how to speed-up this query?
    Thanks in advance
    Kunta

    Hi Gerard,
    When the query window comes from a table Oracle always recommends:
    1) Use the /*+ ordered */ hint
    2) Put the table the quiery window comes from (geometry-2 in the query) first in the from clause
    However, your query is also written very strange. Do you know about SDO_WITHIN_DISTANCE? Or are you trying to do SDO_ANYINTERACT (since the distance is 0)?
    So I would write the query you have as:
    SELECT s.ROWNUM
    from NOMINATIONS O, COUNTIES s
    where sdo_relate(S.GEOM,o.geom, 'querytype=WINDOW mask=anyinteract')='TRUE';
    or in Oracle10g:
    SELECT s.ROWNUM
    from NOMINATIONS O, COUNTIES s
    where sdo_anyinteract(S.GEOM,o.geom)='TRUE';

  • Excel ADODB Sql Query Execution taking hours when manipulate excel tables

    Hello All 
    I have 28000 records with 8 column in an sheet. When I convert the sheet into ADODB database and copy to new
    excel using below code it is executing in less than a min
    Set Tables_conn_obj = New ADODB.Connection
    Tables_conn_str = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & Table_Filename & ";Extended Properties=""Excel 12.0;ReadOnly=False;HDR = Yes;IMEX=1"""
    Tables_conn_obj.Open Tables_conn_str
    First_Temp_sqlqry = "Select * INTO [Excel 12.0;DATABASE=C:\Prod Validation\Database\Second Acat Table.xlsb].[Sheet1] Table [first - Table$];" Tables_conn_obj.Execute First_Temp_sqlqry
    But when I change the query to manipulate one column in current table based on another table in the same excel
    and try to copy the results in another excel, it is taking more than one hour.. why it is taking this much time when both the query results returns the same number of rows and column. I almost spend one week and still not able to resolve this issue.
    Even I tried copyfromrecordset, getrows(), getstring(), Looping each recordset fields options all of them taking
    same amount of time. Why there is huge difference in execution time.
    Important note: Without into statement even below query is executing in few seconds.
    select ( ''''''manipulating first column based on other table data''''''''''''''
    iif(
    [Second - Table$].[Policy Agent] = (select max([ACAT$].[new_Agent_number]) from [ACAT$] where [ACAT$].[new_Agent_number] = [Second - Table$].[Policy Agent] and [ACAT$].[ACAT_EffectiveDate] = ( select MAX([ACAT$].[ACAT_EffectiveDate] ) from [ACAT$] where [ACAT$].[new_Agent_number] = [Second - Table$].[Policy Agent]and [ACAT$].[ACAT_EffectiveDate] > '2014-10-01') ) , (select max([ACAT$].[Old_Agent_number]) from [ACAT$] where [ACAT$].[new_Agent_number] = [Second - Table$].[Policy Agent] and [ACAT$].[ACAT_EffectiveDate] = ( select MAX([ACAT$].[ACAT_EffectiveDate] ) from [ACAT$] where [ACAT$].[new_Agent_number] = [Second - Table$].[Policy Agent]and [ACAT$].[ACAT_EffectiveDate] > '2014-10-01')) ,
    iif( [Second - Table$].[Policy Agent] = (select max([ACAT$].[Old_Agent_number]) from [ACAT$] where [ACAT$].[Old_Agent_number] = [Second - Table$].[Policy Agent] and [ACAT$].[ACAT_EffectiveDate] = ( select MAX([ACAT$].[ACAT_EffectiveDate] ) from [ACAT$]where [ACA T$].[Old_Agent_number] = [Second - Table$].[Policy Agent]and [ACAT$].[ACAT_EffectiveDate] <= '2014-10-01') ), (select max([ACAT$].[new_Agent_number]) from [ACAT$] where [ACAT$].[Old_Agent_number] = [Second - Table$].[Policy Agent] and [ACAT$].[ACAT_EffectiveDate] = ( select MAX([ACAT$].[ACAT_EffectiveDate] ) from [ACAT$] where [ACAT$].[Old_Agent_number] = [Second - Table$].[Policy Agent]and [ACAT$].[ACAT_EffectiveDate] <= '2014-10-01')) ,
    [Second - Table$].[Policy Agent] ))) as [Policy Agent],
    ''''''summing up all other columns''''''''''''''
    (iif(isnull(sum([Second - Table$].[Auto BW-Line Of Business Detail])),0,sum([Second - Table$].[Auto BW-Line Of Business Detail]))) as [Auto BW-Line Of Business Detail],(iif(isnull(sum([Second - Table$].[Auto Farmers])),0,sum([Second - Table$].[Auto Farmers]))) as [Auto Farmers],(iif(isnull(sum([Second - Table$].[MCA])),0,sum([Second - Table$].[MCA]))) as [MCA],(iif(isnull(sum([Second - Table$].[CEA])),0,sum([Second - Table$].[CEA]))) as [CEA],(iif(isnull(sum([Second - Table$].[Commercial P&C])),0,sum([Second - Table$].[Commercial P&C]))) as [Commercial P&C],(iif(isnull(sum([Second - Table$].[Comm WC])),0,sum([Second - Table$].[Comm WC]))) as [Comm WC],(iif(isnull(sum([Second - Table$].[Fire Farmers])),0,sum([Second - Table$].[Fire Farmers]))) as [Fire Farmers],(iif(isnull(sum([Second - Table$].[Flood])),0,sum([Second - Table$].[Flood]))) as [Flood],(iif(isnull(sum([Second - Table$].[Kraft Lake])),0,sum([Second - Table$].[Kraft Lake]))) as [Kraft Lake],(iif(isnull(sum([Second - Table$].[Life])),0,sum([Second - Table$].[Life]))) as [Life],(iif(isnull(sum([Second - Table$].[Foremost])),0,sum([Second - Table$].[Foremost]))) as [Foremost],(iif(isnull(sum([Second - Table$].[Umbrella])),0,sum([Second - Table$].[Umbrella]))) as [Umbrella],(iif(isnull(sum([Second - Table$].[MCNA])),0,sum([Second - Table$].[MCNA]))) as [MCNA]
    INTO [Excel 12.0;DATABASE=C:\Prod Validation\Database\Second Acat Table.xlsb].[Sheet1]
    from [Second - Table$] group by [Second - Table$].[Policy Agent] ;

    Hi Fei,
      Thank you so much for the reply post. I just executed the same above SQL without INTO Statement and assigned the SQL result to ADODB recordset as below. If the time difference is due to the SQL query then below statements also should execute for hours
    right, but it gets executed in seconds. But to copy the recordset to excel again it is taking hours. I tried copyfromrecordset,
    getrows(), getstring(), Looping each recordset fields options and all of them taking same amount of time. Please let me know there is delay in time for this much small data
    Even I tried to typecast all columns to double, string in SQL and still the execution time  is not reduced. 
    First_Temp_Recordset.Open sql_qry, Tables_conn_obj, adOpenStatic, adLockOptimistic ''' OR SET First_Temp_Recordset = Tables_conn_obj.Execute sql_qry

  • Excel ADODB Sql Query Execution taking hours when manipulate excel tables why?

    I have 28000 records with 8 column in an sheet. When I convert the sheet into ADODB database and copy to new excel using below code it is executing in less than a min
    Set Tables_conn_obj = New ADODB.Connection Tables_conn_str = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & Table_Filename & ";Extended Properties=""Excel 12.0;ReadOnly=False;HDR = Yes;IMEX=1""" Tables_conn_obj.Open
    Tables_conn_str First_Temp_sqlqry = "Select * INTO [Excel 12.0;DATABASE=C:\Prod Validation\Database\Second Acat Table.xlsb].[Sheet1] Table [first - Table$];" Tables_conn_obj.Execute First_Temp_sqlqry
    But when I change the query to manipulate one column in current table based on another table in the same excel and try to copy the results in another excel, it is taking more than one hour.. why it is taking this much time when both the query results returns
    the same number of rows and column. I almost spend one week and still not able to resolve this issue.
    Even I tried copyfromrecordset, getrows(), getstring(), Looping each recordset fields options all of them taking same amount of time. Appreciate any inputs...
    select ( ''''''manipulating first column based on other table data''''''''''''''
    iif( [Second - Table$].[Policy Agent] = (select max([ACAT$].[new_Agent_number]) from [ACAT$] where [ACAT$].[new_Agent_number] = [Second - Table$].[Policy Agent] and [ACAT$].[ACAT_EffectiveDate] = ( select MAX([ACAT$].[ACAT_EffectiveDate] ) from [ACAT$] where
    [ACAT$].[new_Agent_number] = [Second - Table$].[Policy Agent]and [ACAT$].[ACAT_EffectiveDate] > '2014-10-01') ) , (select max([ACAT$].[Old_Agent_number]) from [ACAT$] where [ACAT$].[new_Agent_number] = [Second - Table$].[Policy Agent] and [ACAT$].[ACAT_EffectiveDate]
    = ( select MAX([ACAT$].[ACAT_EffectiveDate] ) from [ACAT$] where [ACAT$].[new_Agent_number] = [Second - Table$].[Policy Agent]and [ACAT$].[ACAT_EffectiveDate] > '2014-10-01')) ,
    iif( [Second - Table$].[Policy Agent] = (select max([ACAT$].[Old_Agent_number]) from [ACAT$] where [ACAT$].[Old_Agent_number] = [Second - Table$].[Policy Agent] and [ACAT$].[ACAT_EffectiveDate] = ( select MAX([ACAT$].[ACAT_EffectiveDate] ) from [ACAT$]where
    [ACA T$].[Old_Agent_number] = [Second - Table$].[Policy Agent]and [ACAT$].[ACAT_EffectiveDate] <= '2014-10-01') ), (select max([ACAT$].[new_Agent_number]) from [ACAT$] where [ACAT$].[Old_Agent_number] = [Second - Table$].[Policy Agent] and [ACAT$].[ACAT_EffectiveDate]
    = ( select MAX([ACAT$].[ACAT_EffectiveDate] ) from [ACAT$] where [ACAT$].[Old_Agent_number] = [Second - Table$].[Policy Agent]and [ACAT$].[ACAT_EffectiveDate] <= '2014-10-01')) ,
    [Second - Table$].[Policy Agent] ))) as [Policy Agent],
    ''''''summing up all other columns''''''''''''''
    (iif(isnull(sum([Second - Table$].[Auto BW-Line Of Business Detail])),0,sum([Second - Table$].[Auto BW-Line Of Business Detail]))) as [Auto BW-Line Of Business Detail],(iif(isnull(sum([Second - Table$].[Auto Farmers])),0,sum([Second - Table$].[Auto Farmers])))
    as [Auto Farmers],(iif(isnull(sum([Second - Table$].[MCA])),0,sum([Second - Table$].[MCA]))) as [MCA],(iif(isnull(sum([Second - Table$].[CEA])),0,sum([Second - Table$].[CEA]))) as [CEA],(iif(isnull(sum([Second - Table$].[Commercial P&C])),0,sum([Second
    - Table$].[Commercial P&C]))) as [Commercial P&C],(iif(isnull(sum([Second - Table$].[Comm WC])),0,sum([Second - Table$].[Comm WC]))) as [Comm WC],(iif(isnull(sum([Second - Table$].[Fire Farmers])),0,sum([Second - Table$].[Fire Farmers]))) as [Fire
    Farmers],(iif(isnull(sum([Second - Table$].[Flood])),0,sum([Second - Table$].[Flood]))) as [Flood],(iif(isnull(sum([Second - Table$].[Kraft Lake])),0,sum([Second - Table$].[Kraft Lake]))) as [Kraft Lake],(iif(isnull(sum([Second - Table$].[Life])),0,sum([Second
    - Table$].[Life]))) as [Life],(iif(isnull(sum([Second - Table$].[Foremost])),0,sum([Second - Table$].[Foremost]))) as [Foremost],(iif(isnull(sum([Second - Table$].[Umbrella])),0,sum([Second - Table$].[Umbrella]))) as [Umbrella],(iif(isnull(sum([Second - Table$].[MCNA])),0,sum([Second
    - Table$].[MCNA]))) as [MCNA]
    INTO [Excel 12.0;DATABASE=C:\Prod Validation\Database\Second Acat Table.xlsb].[Sheet1]
    from [Second - Table$] group by [Second - Table$].[Policy Agent] ;

    Hi Fei,
      Thank you so much for the reply post. I just executed the same above SQL without INTO Statement and assigned the SQL result to ADODB recordset as below. If the time difference is due to the SQL query then below statements also should execute for hours
    right, but it gets executed in seconds. But to copy the recordset to excel again it is taking hours. I tried copyfromrecordset,
    getrows(), getstring(), Looping each recordset fields options and all of them taking same amount of time. Please let me know there is delay in time for this much small data
    Even I tried to typecast all columns to double, string in SQL and still the execution time  is not reduced. 
    First_Temp_Recordset.Open sql_qry, Tables_conn_obj, adOpenStatic, adLockOptimistic ''' OR SET First_Temp_Recordset = Tables_conn_obj.Execute sql_qry

  • After Upgrade OBI 10g to 11g:Odbc driver returned an error - SQLExecDirectW

    Hi all,
    for an OBI upgrade from 10g to 11g I used a RPD and Webcatalog based on a remote machine other than my local machine. Firstable I am making the tests on a Linux Virtual machine, which uses the Sample Lite version from Oracle.
    I made the following steps:
    1. I upgraded the RPD and Webcatalog. It worked without any errors.
    2. I set the static variable BI_EE_HOME via Administration Tool to the path in the Linux machine.
    --> Here I am not sure if the set path is correct. It begins with: \bi\ ...\instances\...\coreapplication_obis1 (... : I can't mention here the whole path name).
    --> When the OBI Server is installed in Windows, the mentioned static variable points to something like 'C:\<install folder>\...\coreapplication_obis1'
    --> Question: is the begin of my set path correct?. I set that pointing to the Linux OBI Server, because the OBI Server is installed on Linux.
    Problem:
    After login as the user in RPD: Administrator/<Password for my upgraded RPD> I can see the links in the Catalog and the Dashboards links. But I can not see any values, any Reports when going through the links.
    For example when trying to see a Dashboard with date 12.02.2011it happens:
    Odbc driver returned an error (SQLExecDirectW).
    Status: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] general error.
    [nQSError: 43113] Message returned from OBIS.
    [nQSError: 43119] Query Failed:
    [nQSError: 17001] Oracle Error code: 12154, message: ORA-12154: TNS:could not resolve the connect identifier specified
    at OCI call OCIServerAttach.
    [nQSError: 17014] Could not connect to Oracle database. (HY000)
    SQL Issued: SELECT "Dimension_-_My Dimension"."MyDimension" saw_0 FROM "Accounting (ACC)" WHERE "Dimension_-_My Dimension"."MyDimension" LIKE 'J%' ORDER BY saw_0
    I think its not retrieving the data from the remote database, because I don't have the data of the remote database in my local. I think the OBI Server still is pointing to the local virtual machine Oracle database.
    Can anybody tell me what happens here and how can I solve this problem?.
    I would appreciate any help....

    Hi gerardnico,
    I've tried many things and did as in your articles, but I don't have success with that.
    These are the things I did:
    1. I searched for the file tnsnames.ora in my Linux virtual machine. I could find it in many paths:
    /.../Oracle_BI1/network/admin/samples/tnsnames.ora
    /.../oracle/xe/app/oracle/product/10.2.0/server/hs/admin/tnsnames.ora.sample
    /.../oracle/xe/app/oracle/product/10.2.0/server/network/admin/tnsnames.ora
    /.../oracle/xe/app/oracle/product/10.2.0/server/network/admin/samples/tnsnames.ora
    /.../oracle/xe/app/oracle/product/10.2.0/server/network/admin/temp/tnsnames.ora
    /.../usr/lib/oracle/xe/app/oracle/product/10.2.0/server/network/admin
    in the last path I found the listener.ora as well.
    2. I took the tnsnames.ora from the last path, because the ORACLE_HOME points to /.../usr/lib/oracle/xe/app/oracle/product/10.2.0/server
    3. I edited the tnsnames.ora this way:
    # tnsnames.ora Network Configuration File:
    XE =
    (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = host_of_the_remote_machine)(PORT = 1521))
    (CONNECT_DATA =
    (SERVER = DEDICATED)
    (SERVICE_NAME = database_name_of_the_remote_machine)
    EXTPROC_CONNECTION_DATA =
    (DESCRIPTION =
    (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC_FOR_XE))
    (CONNECT_DATA =
    (SID = database_SID_of_the_remote_machine)
    (PRESENTATION = RO)
    4. I made a backup of the tnsnames.ora in path /.../Oracle_BI1/network/admin/samples/tnsnames.ora
    and copied the tnsnames.ora from /.../usr/lib/oracle/xe/app/oracle/product/10.2.0/server/network/admin to the Oracle_BI1 path
    5. I set the TNS_ADMIN to /.../usr/lib/oracle/xe/app/oracle/product/10.2.0/server/network/admin
    6. I restarted the BI Server
    No success in what I did. The error is still there.
    7. I've tried also: sqlplus database_user_remote_machine/database_password_remote_machine@database_SID_remote_machine
    I didn't get the connection:
    SQL*Plus: Release 10.2.0.1.0 - Production on Thu Jun 16 04:36:10 2011
    Copyright (c) 1982, 2005, Oracle. All rights reserved.
    ERROR:
    ORA-12154: TNS:could not resolve the connect identifier specified
    Enter user-name: database_user_remote_machine
    Enter password:
    ERROR:
    ORA-01034: ORACLE not available
    ORA-27101: shared memory realm does not exist
    Linux Error: 2: No such file or directory
    What am I doing wrong here?. I am still thinking that I need the import of the database.
    Additional SID=Service-Name=Database-name in the remote machine.

  • Strange Client Behavior after upgrading to 10g

    Hello Friends !!!!
    Here is my scenario:
    Oracle Database 10g 10.2.0.3
    Windows 2008 Server SP2
    After upgrading from oracle 9.2.0.1.0 and Windows 2003 Server I'm facing a strange behavior.
    Many times over the days some machines do not release some table resources even having their status "INACTIVE" and the wait event "SQL *Net message from client" and wait class "IDLE".
    Therefore, i got a lot of locked sessions, and users complaining..... until I kill them
    The client machine was as well switched to Oracle 10g client....
    Have you guys got any tips about this scenario?
    Tks for any advice.

    About the lock queue:
    1. blocking session has an exclusive table lock on VENDEDORES table; this is very rare in application because most of the time not needed: application code should try to avoid to take such kind of lock.
    2. blocked sessions request a row share table lock: it looks like that VENDEDORES table is a child table linked to some parent table with a foreign key constraint and that an index on the child table foreign key is missing (this kind of lock is requested if you DELETE from parent table or update parent table primary key).
    About the lock session: this is the blocking session that is waiting since 19 seconds on client: it is likely an application issue: you should try to investigate what the client (aservice.exe) is doing while holding an exclusive table lock.

Maybe you are looking for