Query taking time in Oracle 10g

Hi,
Recently we had a database upgrade from 9.2.0.8 to 10.2.0.4. We use HP-UX B11.23 as OS.The problem is we have a query which used to take 3 mins in 9i database but it is not returning any output in 10g database after running for 8 hours after which we need to kill it . The query is ,
SELECT DPPB.CO_CD, DPPB.PRC_BOOK_CD,NVL(PB.CO_PRC_BOOK_CD,'NULL') ,
NVL(BP.BASE_PROD_CD,'NULL'),NVL(FG.FG_CD,'NULL'),DPPB.EFFTV_STRT_DT,
DPPB.EFFTV_END_DT,PRC_BOOK_AMT, PRC_LST_RPT_IND   ,
SYSDATE +  (RANK () OVER (PARTITION BY  PROD_PRC_BOOK_CD  ORDER BY DPPB.EFFTV_STRT_DT)/(24*60*60)) "RANK",
SYSDATE      FROM
DIM_PROD_PRC_BOOK DPPB,dim_prod  FG,dim_prod  BP,dim_prc_book  PB
WHERE
DPPB.BASE_PROD_OID =BP.BASE_PROD_OID and bp.end_date>sysdate and bp.be_id=bp.base_prod_oid AND
FG.FG_OID=DPPB.FG_OID and fg.end_date>sysdate and fg.be_id=fg.fg_oid
AND DPPB.PRC_BOOK_OID=PB.prc_book_oid and pb.end_date>sysdate and  pb.be_id=pb.PRC_BOOK_OID
AND DPPB.EFFTV_END_DT > ADD_MONTHS(TRUNC(SYSDATE), -15)
AND DPPB.CURR_IND='Y'
AND
PROD_PRC_BOOK_CD ||'-'||TO_CHAR(DPPB.END_DATE ,'DD-MM-YYYY hh24:mi:ss')
IN(
SELECT PROD_PRC_BOOK_CD ||'-'||TO_CHAR(MAX(DPPB.END_DATE ),'DD-MM-YYYY hh24:mi:ss')
FROM DIM_PROD_PRC_BOOK DPPB WHERE PROD_PRC_BOOK_CD IS NOT NULL GROUP BY PROD_PRC_BOOK_CD ,EFFTV_STRT_DT
)The explain plan of the query in 9i is,
            Operation     Object Name     Rows     Bytes     Cost     Object Node     In/Out     PStart     PStop
SELECT STATEMENT Optimizer Mode=CHOOSE          1             2964                                          
  WINDOW SORT          1       661       2964                                          
    HASH JOIN          1       661       2958                                          
      TABLE ACCESS BY INDEX ROWID     WHSUSR.DIM_PROD     1       73       1                                          
        NESTED LOOPS          1       355       290                                          
          NESTED LOOPS          1       282       289                                          
            HASH JOIN          164       32 K     284                                          
              TABLE ACCESS FULL     WHSUSR.DIM_PRC_BOOK     1       57       2                                          
              TABLE ACCESS FULL     WHSUSR.DIM_PROD_PRC_BOOK     6 K     957 K     281                                          
            TABLE ACCESS BY INDEX ROWID     WHSUSR.DIM_PROD     1       77       1                                          
              INDEX RANGE SCAN     WHSUSR.XN15_DIM_PROD     3             1                                          
          INDEX RANGE SCAN     WHSUSR.XN22_DIM_PROD     5             1                                          
      VIEW     SYS.VW_NSO_1     132 K     38 M     2665                                          
        SORT UNIQUE          132 K     6 M     2665                                          
          SORT GROUP BY          132 K     6 M     2665                                          
            TABLE ACCESS FULL     WHSUSR.DIM_PROD_PRC_BOOK     132 K     6 M     281                   And the explain plan of the query in 10g database is
Operation     Object Name     Rows     Bytes     Cost     Object Node     In/Out     PStart     PStop
SELECT STATEMENT Optimizer Mode=ALL_ROWS          4             1702                                          
  WINDOW SORT          4       1 K     1702                                          
    FILTER                                                                
      TABLE ACCESS BY INDEX ROWID     WHSUSR.DIM_PROD     1       73       1                                          
        NESTED LOOPS          1       339       899                                          
          NESTED LOOPS          14       3 K     898                                          
            HASH JOIN          2 K     428 K     805                                          
              TABLE ACCESS FULL     WHSUSR.DIM_PRC_BOOK     1       53       3                                          
              TABLE ACCESS FULL     WHSUSR.DIM_PROD_PRC_BOOK     93 K     12 M     801                                          
            TABLE ACCESS BY INDEX ROWID     WHSUSR.DIM_PROD     1       77       1                                          
              INDEX RANGE SCAN     WHSUSR.XN15_DIM_PROD     2             1                                          
          INDEX RANGE SCAN     WHSUSR.XN22_DIM_PROD     5             1                                          
      FILTER                                                                
        HASH GROUP BY          1 K     59 K     802                                          
          TABLE ACCESS FULL     WHSUSR.DIM_PROD_PRC_BOOK     117 K     5 M     794        Please help in identifying the problem and how to tune it.

user605926 wrote:
Thanks Sir for your immense help. I used the hint /*+ optimizer_features_enable('9.2.0.8') */ and the query took only 2 seconds. I am really delighted.
Sorry for not clicking the 'helpful' button earlier since honestly I did not know about the rules. Going forward I will not forget to do that.Don't apologise, it wasn't intended as a personal criticism - it's just a footnote I tend to use at present as a general reminder to everyone that feedback is useful.
I have one question. Do i have to use this hint for each and every query that is becoming a headache or is their any permanent solution to fix all the queries that used to run good on 9.2.0.8 database ? Please suggest.When doing an upgrade it is always valid (in the short term) to set the optimizer_features_enable parameter to the value of the database your moving from so that you can get the code improvements (or bug fixes) of the newer software without risking execution plan changes.
After that the ideal is to test software and identify generic cases where a change like an index definition, or some statistical information needs to be corrected for a particular reason in classes of queries. Eventually you get down to the point where you have a few awkward queries which the optimizer can't handle where you need hints. The optimizer_features_enable is very convenient here. In 10g, however, you could then capture the older plan and record is as an SQL Baseline against the unhinted query rather than permanently including hints.
Regards
Jonathan Lewis
http://jonathanlewis.wordpress.com
http://www.jlcomp.demon.co.uk
A general reminder about "Forum Etiquette / Reward Points": http://forums.oracle.com/forums/ann.jspa?annID=718
If you never mark your questions as answered people will eventually decide that it's not worth trying to answer you because they will never know whether or not their answer has been of any use, or whether you even bothered to read it.
It is also important to mark answers that you thought helpful - again it lets other people know that you appreciate their help, but it also acts as a pointer for other people when they are researching the same question, moreover it means that when you mark a bad or wrong answer as helpful someone may be prompted to tell you (and the rest of the forum) what's so bad or wrong about the answer you found helpful.

Similar Messages

  • Insert statement taking time on oracle 10g

    Hi,
    My procedure taking time in following statement while database upgrading from oracle 9i to oracle 10g.
    I m using oracle version 10.2.0.4.0.
    cust_item is matiralize view in procedure and it is refreshing in the procedure
    Index is dropping before inserting data into cust_item_tbl TABLE and after inserting data index is created.
    There are almost 6 lac records into MV which are going to insert into TABLE.
    In 9i below insert statement is taking 1 hr time to insert while in 10g it is taking 2.30 hrs.
    EXECUTE IMMEDIATE 'ALTER SESSION ENABLE PARALLEL QUERY';
    EXECUTE IMMEDIATE 'ALTER SESSION ENABLE PARALLEL DML';
    INSERT INTO /*+ APPEND PARALLEL */ cust_item_tbl  NOLOGGING
             (SELECT /*+ PARALLEL */
                     ctry_code, co_code, srce_loc_nbr, srce_loc_type_code,
                     cust_nbr, item_nbr, lu_eff_dt,
                     0, 0, 0, lu_end_dt,
                     bus_seg_code, 0, rt_nbr, 0, '', 0, '', SYSDATE, '', SYSDATE,
                     '', 0, ' ',
                                   case
                                 when cust_nbr in (select distinct cust_nbr from aml.log_t where CTRY_CODE = p_country_code and co_code = p_company_code)
                                 THEN
                                         case
                                            when trunc(sysdate) NOT BETWEEN trunc(lu_eff_dt) AND trunc(lu_end_dt)
                                            then NVL((select cases_per_pallet from cust_item c where c.ctry_code = a.ctry_code and c.co_code = a.co_code
                                                          and c.cust_nbr = a.cust_nbr and c.GTIN_CO_PREFX = a.GTIN_CO_PREFX and c.GTIN_ITEM_REF_NBR = a.GTIN_ITEM_REF_NBR
                                                          and c.GTIN_CK_DIGIT = a.GTIN_CK_DIGIT and trunc(sysdate) BETWEEN trunc(c.lu_eff_dt) AND trunc(c.lu_end_dt) and rownum = 1),
                                                          a.cases_per_pallet)
                                      else cases_per_pallet
                                  end
                          else cases_per_pallet
                     END cases_per_pallet,
                     cases_per_layer
                FROM cust_item a
               WHERE a.ctry_code = p_country_code ----varible passing by procedure
                 AND a.co_code = p_company_code   ----varible passing by procedure
                 AND a.ROWID =
                        (SELECT MAX (b.ROWID)
                           FROM cust_item b
                          WHERE b.ctry_code = a.ctry_code
                            AND b.co_code = a.co_code
                            AND b.ctry_code = p_country_code ----varible passing by procedure
                            AND b.co_code = p_company_code   ----varible passing by procedure
                            AND b.srce_loc_nbr = a.srce_loc_nbr
                            AND b.srce_loc_type_code = a.srce_loc_type_code
                            AND b.cust_nbr = a.cust_nbr
                            AND b.item_nbr = a.item_nbr
                            AND b.lu_eff_dt = a.lu_eff_dt));explain plan of oracle 10g
    Plan
    INSERT STATEMENT  CHOOSECost: 133,310  Bytes: 248  Cardinality: 1                      
         5 FILTER                 
              4 HASH GROUP BY  Cost: 133,310  Bytes: 248  Cardinality: 1            
                   3 HASH JOIN  Cost: 132,424  Bytes: 1,273,090,640  Cardinality: 5,133,430       
                        1 INDEX FAST FULL SCAN INDEX MFIPROCESS.INDX_TEMP_CUST_AUTH_PERF_MV Cost: 10,026  Bytes: 554,410,440  Cardinality: 5,133,430 
                        2 MAT_VIEW ACCESS FULL MAT_VIEW MFIPROCESS.TEMP_CUST_AUTH_PERF_MV Cost: 24,570  Bytes: 718,680,200  Cardinality: 5,133,430  can you please look into the issue?
    Thanks.

    According to the execution plan you posted parallelism is not taking place - no parallel operations listed
    Check the hint syntax. In particular, "PARALLEL" does not look right.
    Running queries in parallel can either help performance, hurt performance, or do nothing for performance. In your case a parallel index scan on MFIPROCESS.INDX_TEMP_CUST_AUTH_PERF_MV using the PARALLEL_INDEX hint and the PARALLEL hint specifying the table for MAT_VIEW MFIPROCESS.TEMP_CUST_AUTH_PERF_MV Cost might help, something like (untested)
    select /*+ PARALLEL_INDEX(INDX_TEMP_CST_AUTH_PERF_MV) PARALLEL(TEMP_CUST_AUTHPERF_MV) */Is query rewrite causing the MVs to be read? If so hinting the query will be tricky

  • Query can run in Oracle 10g but very slow in 11g

    Hi,
    We've just migrated to Oracle 11g and we noticed that some of our view are very slow (it takes seconds in 10g and takes 30 minutes in 11g), and the tables are using the local table.
    Do any of you face the same issue?
    This is our query:
    SELECT
    A.wellbore
    ,a.depth center
    ,d.MD maxbc
    ,d.XDELT xbc
    ,d.YDELT ybc
    ,e.MD minac
    ,e.XDELT xac
    ,e.YDELT yac
    from
    table_A d,table_A e, table_B a
    where a.wellbore = d.WELLBORE (+)
    and a.wellbore = e.WELLBORE(+)
    and d.MD = (select max(MD) from table_A b where b.MD < a.depth and
    d.wellBORE = b.wellBORE)
    and e.md = (select min(md) from table_A c where c.MD > a.depth and
    e.wellBORE = c.wellBORE);

    Thanks I will move to the correct one..
    Rafi,
    Build the Indexes and it is still slow. I am querying from a view from another database, which is in 10g instances.
    Moved: Query can run in Oracle 10g but very slow in 11g
    Edited by: 924400 on Apr 1, 2012 6:03 PM
    Edited by: 924400 on Apr 1, 2012 6:26 PM

  • Oracle 11g- Straing behaviour of query after importing from Oracle 10g

    Hi,
    I have a table in Oracle 10g as follows:
    Create Table xyz (col1 varchar2(50), col2 varchar2(50));
    With following Data
    Col1     Col2
    A     320
    A     110
    A     290
    A     380
    B     ABC
    B     256
    B     LMN
    I am running following Query
    select * from xyz
    Where Col1='A' and Col2=110
    It works fine. But when I export this table and import it in Oracle 11g. It says invlid identifier.
    But if I enclose 110 in single quotes. It works fine.
    Also If I recreate this table in Oracle 11g like
    Create table xyz1
    as select * from xyz;
    Now alos I am able to run this query smoothly.
    select * from xyz1
    Where Col1='A' and Col2=110
    What is wrong exporting this table from 10g to 11g.
    Any comments/suggestion??
    Aarbi

    The check in your where clause
    Col2=110Is comparing a string (Col2 is defined as a VARCHAR) with a numeric literal, so there will be an implicit conversion taking place from character to number. The query then fails due to the B LMN row when 'LMN' fails number conversion.
    I'm guessing there was there an index on the table in your 10g installation which would allow the query to be satisfied without checking the B ABC or B LMN rows but is not present or not used in the 11g installation so a full table scan results in an attempt to convert 'ABC' and 'LMN' to a number. Check the explain plans.
    Or it could even just be a difference in the order in which the two conditions in the where clause are evaulated between the two versions.
    The solution, as you have already found is to do a string comparision
    Col2='110'Edited by: Cyn on Dec 7, 2009 12:38 PM

  • Query taking time

    We have this query which is taking a long time to execute. From the explain plan what i found out is there is a full table scan going on W_GL_OTHER_F. Please help in identifying the problem area and solutions.
    The query is,
    select D1.c1 as c1,
         D1.c2 as c2,
         D1.c3 as c3,
         D1.c4 as c4,
         D1.c5 as c5,
         D1.c6 as c6,
         D1.c7 as c7,
         D1.c8 as c8
    from
         (select distinct D1.c2 as c1,
                   D1.c3 as c2,
                   D1.c4 as c3,
                   D1.c5 as c4,
                   D1.c6 as c5,
                   D1.c7 as c6,
                   D1.c8 as c7,
                   D1.c1 as c8,
                   D1.c5 as c9
              from
                   (select sum(case  when T324628.OTHER_DOC_AMT is null then 0 else T324628.OTHER_DOC_AMT end ) as c1,
                             T91397.GL_ACCOUNT_NUM as c2,
                             T149255.SEGMENT_VAL_CODE as c3,
                             T148908.SEGMENT_VAL_DESC as c4,
                             T148543.HIER4_CODE as c5,
                             T148543.HIER4_NAME as c6,
                             T91707.ACCT_DOC_NUM as c7,
                             T91707.X_LINE_DESCRIPTION as c8
                        from
                             W_GL_OTHER_F T91707 /* Fact_W_GL_OTHER_F */ ,
                             W_GL_ACCOUNT_D T91397 /* Dim_W_GL_ACCOUNT_D */ ,
                             W_STATUS_D T96094 /* Dim_W_STATUS_D_Generic */ ,
                             WC_GL_OTHER_F_MV T324628 /* Fact_WC_GL_OTHER_MV */ ,
                             W_GL_SEGMENT_D T149255 /* Dim_W_GL_SEGMENT_D_Segment1 */ ,
                             W_GL_SEGMENT_D T148937 /* Dim_W_GL_SEGMENT_D_Segment3 */ ,
                             W_HIERARCHY_D T148543 /* Dim_W_HIERARCHY_D_Segment3 */ ,
                             W_GL_SEGMENT_D T148908 /* Dim_W_GL_SEGMENT_D_Segment2 */
                        where  ( T91397.ROW_WID = T91707.GL_ACCOUNT_WID and T91707.DOC_STATUS_WID = T96094.ROW_WID and T96094.ROW_WID = T324628.DOC_STATUS_WID and T148543.HIER_CODE = T148937.SEGMENT_LOV_ID and T148543.HIER20_CODE = T148937.SEGMENT_VAL_CODE and T324628.DELETE_FLG = 'N' and T324628.X_CURRENCY_CODE = 'CAD' and T148543.HIER4_CODE <> '00000000000' and T91397.RECON_TYPE_CODE is not null and T91397.ROW_WID = T324628.GL_ACCOUNT_WID and T91397.ACCOUNT_SEG3_CODE = T148937.SEGMENT_VAL_CODE and T91397.ACCOUNT_SEG3_ATTRIB = T148937.SEGMENT_LOV_ID and T91397.ACCOUNT_SEG2_CODE = T148908.SEGMENT_VAL_CODE and T91397.ACCOUNT_SEG2_ATTRIB = T148908.SEGMENT_LOV_ID and T91397.ACCOUNT_SEG1_CODE = T149255.SEGMENT_VAL_CODE and T91397.ACCOUNT_SEG1_ATTRIB = T149255.SEGMENT_LOV_ID and (T96094.W_STATUS_CODE in ('POSTED', 'REVERSED')) and T91397.GL_ACCOUNT_NUM like '%98%' )
                        group by T91397.GL_ACCOUNT_NUM, T91707.ACCT_DOC_NUM, T91707.X_LINE_DESCRIPTION, T148543.HIER4_CODE, T148543.HIER4_NAME, T148908.SEGMENT_VAL_DESC, T149255.SEGMENT_VAL_CODE
                   ) D1
         ) D1
    order by c1, c2, c3, c4, c5, c6, c7The plan is,
    PLAN_TABLE_OUTPUT
    Plan hash value: 3196636288
    | Id  | Operation                             | Name                | Rows  | Bytes |TempSpc| Cost (%CPU)| Time     | Pstart| Psto
    |   0 | SELECT STATEMENT                      |                     |   810K|   306M|       |   266K  (1)| 01:20:03 |       |       |
    |   1 |  HASH GROUP BY                        |                     |   810K|   306M|   320M|   266K  (1)| 01:20:03 |       |       |
    |*  2 |   HASH JOIN                           |                     |   810K|   306M|    38M|   239K  (1)| 01:11:56 |       |       |
    |*  3 |    MAT_VIEW ACCESS FULL               | WC_GL_OTHER_F_MV    |  1137K|    40M|       |  9771   (2)| 00:0
    |*  4 |    HASH JOIN                          |                     |   531K|   189M|       |   222K  (1)| 01:06:38 |       |       |
    |   5 |     INLIST ITERATOR                   |                     |       |       |       |            |          |       |       |
    |*  6 |      INDEX RANGE SCAN                 | W_STATUS_D_U2       |     4 |    56 |       |     1   (0)| 00:00:01 |   
    |*  7 |     HASH JOIN                         |                     |   607K|   208M|  8704K|   222K  (1)| 01:06:38 |       |       |
    |*  8 |      HASH JOIN                        |                     | 40245 |  8214K|  2464K| 10843   (2)| 00:03:16 |       |       |
    |   9 |       VIEW                            | index$_join$_007    | 35148 |  2025K|       |   122  (32)| 00:00:03 |       |
    |* 10 |        HASH JOIN                      |                     |       |       |       |            |          |       |       |
    |* 11 |         HASH JOIN                     |                     |       |       |       |            |          |       |       |
    |* 12 |          HASH JOIN                    |                     |       |       |       |            |          |       |       |
    |  13 |           BITMAP CONVERSION TO ROWIDS |                     | 35148 |  2025K|       |     1   (0)| 00:00:01 |       |   
    |  14 |            BITMAP INDEX FULL SCAN     | W_HIERARCHY_D_M2    |       |       |       |            |          |       |     
    |  15 |           BITMAP CONVERSION TO ROWIDS |                     | 35148 |  2025K|       |    24   (0)| 00:00:01 |       |   
    |  16 |            BITMAP INDEX FULL SCAN     | W_HIERARCHY_D_M4    |       |       |       |            |          |       |     
    |  17 |          BITMAP CONVERSION TO ROWIDS  |                     | 35148 |  2025K|       |    24   (0)| 00:00:01 |       |   
    |* 18 |           BITMAP INDEX FULL SCAN      | X_W_HIERARCHY_D_M11 |       |       |       |            |          |       |     
    |  19 |         BITMAP CONVERSION TO ROWIDS   |                     | 35148 |  2025K|       |    33   (0)| 00:00:01 |       |   
    |  20 |          BITMAP INDEX FULL SCAN       | X_W_HIERARCHY_D_M12 |       |       |       |            |          |       |     
    |* 21 |       HASH JOIN                       |                     | 40246 |  5895K|  4096K| 10430   (2)| 00:03:08 |       |      
    |  22 |        VIEW                           | index$_join$_008    | 65417 |  3321K|       |   197  (14)| 00:00:04 |      
    |* 23 |         HASH JOIN                     |                     |       |       |       |            |          |       |       |
    |* 24 |          HASH JOIN                    |                     |       |       |       |            |          |       |       |
    |  25 |           BITMAP CONVERSION TO ROWIDS |                     | 65417 |  3321K|       |     3   (0)| 00:00:01 |       |   
    |  26 |            BITMAP INDEX FULL SCAN     | W_GL_SEGMENT_D_M1   |       |       |       |            |          |       |     
    |  27 |           BITMAP CONVERSION TO ROWIDS |                     | 65417 |  3321K|       |    66   (2)| 00:00:02 |       |   
    |  28 |            BITMAP INDEX FULL SCAN     | W_GL_SEGMENT_D_M2   |       |       |       |            |          |       |     
    |  29 |          BITMAP CONVERSION TO ROWIDS  |                     | 65417 |  3321K|       |   100   (1)| 00:00:02 |       |   
    |  30 |           BITMAP INDEX FULL SCAN      | W_GL_SEGMENT_D_M3   |       |       |       |            |          |       |     
    |* 31 |        HASH JOIN                      |                     | 40246 |  3851K|       |  9953   (1)| 00:03:00 |       |       |
    |  32 |         VIEW                          | index$_join$_006    | 65417 |  1149K|       |    82  (18)| 00:00:02 |       |      
    |* 33 |          HASH JOIN                    |                     |       |       |       |            |          |       |       |
    |  34 |           BITMAP CONVERSION TO ROWIDS |                     | 65417 |  1149K|       |     3   (0)| 00:00:01 |       |   
    |  35 |            BITMAP INDEX FULL SCAN     | W_GL_SEGMENT_D_M1   |       |       |       |            |          |       |     
    |  36 |           BITMAP CONVERSION TO ROWIDS |                     | 65417 |  1149K|       |    66   (2)| 00:00:02 |       |   
    |  37 |            BITMAP INDEX FULL SCAN     | W_GL_SEGMENT_D_M2   |       |       |       |            |          |       |     
    |* 38 |         HASH JOIN                     |                     | 40246 |  3144K|       |  9870   (1)| 00:02:58 |       |       |
    |  39 |          VIEW                         | index$_join$_005    | 65417 |  1149K|       |    82  (18)| 00:00:02 |       |     
    |* 40 |           HASH JOIN                   |                     |       |       |       |            |          |       |       |
    |  41 |            BITMAP CONVERSION TO ROWIDS|                     | 65417 |  1149K|       |     3   (0)| 00:00:01 |       |   
    |  42 |             BITMAP INDEX FULL SCAN    | W_GL_SEGMENT_D_M1   |       |       |       |            |          |       |     
    |  43 |            BITMAP CONVERSION TO ROWIDS|                     | 65417 |  1149K|       |    66   (2)| 00:00:02 |       |   
    |  44 |             BITMAP INDEX FULL SCAN    | W_GL_SEGMENT_D_M2   |       |       |       |            |          |       |     
    |* 45 |          TABLE ACCESS FULL            | W_GL_ACCOUNT_D      | 40246 |  2436K|       |  9788   (1)| 00:02:57
    |  46 |      PARTITION RANGE ALL              |                     |    11M|  4261M|       |   152K  (2)| 00:45:43 |     1 |1048
    |  47 |       TABLE ACCESS FULL               | W_GL_OTHER_F        |    11M|  4261M|       |   152K  (2)| 00:45:43
    Predicate Information (identified by operation id):
       2 - access("T96094"."ROW_WID"="T324628"."DOC_STATUS_WID" AND "T91397"."ROW_WID"="T324628"."GL_ACC
       3 - filter("T324628"."X_CURRENCY_CODE"='CAD' AND "T324628"."DELETE_FLG"='N')
       4 - access("T91707"."DOC_STATUS_WID"="T96094"."ROW_WID")
       6 - access("T96094"."W_STATUS_CODE"='POSTED' OR "T96094"."W_STATUS_CODE"='REVERSED')
       7 - access("T91397"."ROW_WID"="T91707"."GL_ACCOUNT_WID")
       8 - access("T148543"."HIER_CODE"="T148937"."SEGMENT_LOV_ID" AND "T148543"."HIER20_CODE"="T148937"
      10 - access(ROWID=ROWID)
      11 - access(ROWID=ROWID)
      12 - access(ROWID=ROWID)
      18 - filter("T148543"."HIER4_CODE"<>'00000000000')
      21 - access("T91397"."ACCOUNT_SEG2_CODE"="T148908"."SEGMENT_VAL_CODE" AND
                  "T91397"."ACCOUNT_SEG2_ATTRIB"="T148908"."SEGMENT_LOV_ID")
      23 - access(ROWID=ROWID)
      24 - access(ROWID=ROWID)
      31 - access("T91397"."ACCOUNT_SEG3_CODE"="T148937"."SEGMENT_VAL_CODE" AND
                  "T91397"."ACCOUNT_SEG3_ATTRIB"="T148937"."SEGMENT_LOV_ID")
      33 - access(ROWID=ROWID)
      38 - access("T91397"."ACCOUNT_SEG1_CODE"="T149255"."SEGMENT_VAL_CODE" AND
                  "T91397"."ACCOUNT_SEG1_ATTRIB"="T149255"."SEGMENT_LOV_ID")
      40 - access(ROWID=ROWID)
      45 - filter("T91397"."GL_ACCOUNT_NUM" LIKE '%98%' AND "T91397"."RECON_TYPE_CODE" IS NOT NULL)
    79 rows selected.

    user605926 wrote:
    We have this query which is taking a long time to execute. From the explain plan what i found out is there is a full table scan going on W_GL_OTHER_F. Please help in identifying the problem area and solutions.
    The plan is,
    PLAN_TABLE_OUTPUT
    Plan hash value: 3196636288
    | Id  | Operation                             | Name                | Rows  | Bytes |TempSpc| Cost (%CPU)| Time     | Pstart| Psto
    |   0 | SELECT STATEMENT                      |                     |   810K|   306M|       |   266K  (1)| 01:20:03 |       |       |
    |   1 |  HASH GROUP BY                        |                     |   810K|   306M|   320M|   266K  (1)| 01:20:03 |       |       |
    |*  2 |   HASH JOIN                           |                     |   810K|   306M|    38M|   239K  (1)| 01:11:56 |       |       |
    |*  3 |    MAT_VIEW ACCESS FULL               | WC_GL_OTHER_F_MV    |  1137K|    40M|       |  9771   (2)| 00:0
    |*  4 |    HASH JOIN                          |                     |   531K|   189M|       |   222K  (1)| 01:06:38 |       |       |
    |   5 |     INLIST ITERATOR                   |                     |       |       |       |            |          |       |       |
    |*  6 |      INDEX RANGE SCAN                 | W_STATUS_D_U2       |     4 |    56 |       |     1   (0)| 00:00:01 |   
    |*  7 |     HASH JOIN                         |                     |   607K|   208M|  8704K|   222K  (1)| 01:06:38 |       |       |
    |*  8 |      HASH JOIN                        |                     | 40245 |  8214K|  2464K| 10843   (2)| 00:03:16 |       |       |
    |   9 |       VIEW                            | index$_join$_007    | 35148 |  2025K|       |   122  (32)| 00:00:03 |       |
    |* 10 |        HASH JOIN                      |                     |       |       |       |            |          |       |       |
    |* 11 |         HASH JOIN                     |                     |       |       |       |            |          |       |       |
    |* 12 |          HASH JOIN                    |                     |       |       |       |            |          |       |       |
    |  13 |           BITMAP CONVERSION TO ROWIDS |                     | 35148 |  2025K|       |     1   (0)| 00:00:01 |       |   
    |  14 |            BITMAP INDEX FULL SCAN     | W_HIERARCHY_D_M2    |       |       |       |            |          |       |     
    |  15 |           BITMAP CONVERSION TO ROWIDS |                     | 35148 |  2025K|       |    24   (0)| 00:00:01 |       |   
    |  16 |            BITMAP INDEX FULL SCAN     | W_HIERARCHY_D_M4    |       |       |       |            |          |       |     
    |  17 |          BITMAP CONVERSION TO ROWIDS  |                     | 35148 |  2025K|       |    24   (0)| 00:00:01 |       |   
    |* 18 |           BITMAP INDEX FULL SCAN      | X_W_HIERARCHY_D_M11 |       |       |       |            |          |       |     
    |  19 |         BITMAP CONVERSION TO ROWIDS   |                     | 35148 |  2025K|       |    33   (0)| 00:00:01 |       |   
    |  20 |          BITMAP INDEX FULL SCAN       | X_W_HIERARCHY_D_M12 |       |       |       |            |          |       |     
    |* 21 |       HASH JOIN                       |                     | 40246 |  5895K|  4096K| 10430   (2)| 00:03:08 |       |      
    |  22 |        VIEW                           | index$_join$_008    | 65417 |  3321K|       |   197  (14)| 00:00:04 |      
    |* 23 |         HASH JOIN                     |                     |       |       |       |            |          |       |       |
    |* 24 |          HASH JOIN                    |                     |       |       |       |            |          |       |       |
    |  25 |           BITMAP CONVERSION TO ROWIDS |                     | 65417 |  3321K|       |     3   (0)| 00:00:01 |       |   
    |  26 |            BITMAP INDEX FULL SCAN     | W_GL_SEGMENT_D_M1   |       |       |       |            |          |       |     
    |  27 |           BITMAP CONVERSION TO ROWIDS |                     | 65417 |  3321K|       |    66   (2)| 00:00:02 |       |   
    |  28 |            BITMAP INDEX FULL SCAN     | W_GL_SEGMENT_D_M2   |       |       |       |            |          |       |     
    |  29 |          BITMAP CONVERSION TO ROWIDS  |                     | 65417 |  3321K|       |   100   (1)| 00:00:02 |       |   
    |  30 |           BITMAP INDEX FULL SCAN      | W_GL_SEGMENT_D_M3   |       |       |       |            |          |       |     
    |* 31 |        HASH JOIN                      |                     | 40246 |  3851K|       |  9953   (1)| 00:03:00 |       |       |
    |  32 |         VIEW                          | index$_join$_006    | 65417 |  1149K|       |    82  (18)| 00:00:02 |       |      
    |* 33 |          HASH JOIN                    |                     |       |       |       |            |          |       |       |
    |  34 |           BITMAP CONVERSION TO ROWIDS |                     | 65417 |  1149K|       |     3   (0)| 00:00:01 |       |   
    |  35 |            BITMAP INDEX FULL SCAN     | W_GL_SEGMENT_D_M1   |       |       |       |            |          |       |     
    |  36 |           BITMAP CONVERSION TO ROWIDS |                     | 65417 |  1149K|       |    66   (2)| 00:00:02 |       |   
    |  37 |            BITMAP INDEX FULL SCAN     | W_GL_SEGMENT_D_M2   |       |       |       |            |          |       |     
    |* 38 |         HASH JOIN                     |                     | 40246 |  3144K|       |  9870   (1)| 00:02:58 |       |       |
    |  39 |          VIEW                         | index$_join$_005    | 65417 |  1149K|       |    82  (18)| 00:00:02 |       |     
    |* 40 |           HASH JOIN                   |                     |       |       |       |            |          |       |       |
    |  41 |            BITMAP CONVERSION TO ROWIDS|                     | 65417 |  1149K|       |     3   (0)| 00:00:01 |       |   
    |  42 |             BITMAP INDEX FULL SCAN    | W_GL_SEGMENT_D_M1   |       |       |       |            |          |       |     
    |  43 |            BITMAP CONVERSION TO ROWIDS|                     | 65417 |  1149K|       |    66   (2)| 00:00:02 |       |   
    |  44 |             BITMAP INDEX FULL SCAN    | W_GL_SEGMENT_D_M2   |       |       |       |            |          |       |     
    |* 45 |          TABLE ACCESS FULL            | W_GL_ACCOUNT_D      | 40246 |  2436K|       |  9788   (1)| 00:02:57
    |  46 |      PARTITION RANGE ALL              |                     |    11M|  4261M|       |   152K  (2)| 00:45:43 |     1 |1048
    |  47 |       TABLE ACCESS FULL               | W_GL_OTHER_F        |    11M|  4261M|       |   152K  (2)| 00:45:43
    Predicate Information (identified by operation id):
    2 - access("T96094"."ROW_WID"="T324628"."DOC_STATUS_WID" AND "T91397"."ROW_WID"="T324628"."GL_ACC
    3 - filter("T324628"."X_CURRENCY_CODE"='CAD' AND "T324628"."DELETE_FLG"='N')
    4 - access("T91707"."DOC_STATUS_WID"="T96094"."ROW_WID")
    6 - access("T96094"."W_STATUS_CODE"='POSTED' OR "T96094"."W_STATUS_CODE"='REVERSED')
    7 - access("T91397"."ROW_WID"="T91707"."GL_ACCOUNT_WID")
    8 - access("T148543"."HIER_CODE"="T148937"."SEGMENT_LOV_ID" AND "T148543"."HIER20_CODE"="T148937"
    10 - access(ROWID=ROWID)
    11 - access(ROWID=ROWID)
    12 - access(ROWID=ROWID)
    18 - filter("T148543"."HIER4_CODE"<>'00000000000')
    21 - access("T91397"."ACCOUNT_SEG2_CODE"="T148908"."SEGMENT_VAL_CODE" AND
    "T91397"."ACCOUNT_SEG2_ATTRIB"="T148908"."SEGMENT_LOV_ID")
    23 - access(ROWID=ROWID)
    24 - access(ROWID=ROWID)
    31 - access("T91397"."ACCOUNT_SEG3_CODE"="T148937"."SEGMENT_VAL_CODE" AND
    "T91397"."ACCOUNT_SEG3_ATTRIB"="T148937"."SEGMENT_LOV_ID")
    33 - access(ROWID=ROWID)
    38 - access("T91397"."ACCOUNT_SEG1_CODE"="T149255"."SEGMENT_VAL_CODE" AND
    "T91397"."ACCOUNT_SEG1_ATTRIB"="T149255"."SEGMENT_LOV_ID")
    40 - access(ROWID=ROWID)
    45 - filter("T91397"."GL_ACCOUNT_NUM" LIKE '%98%' AND "T91397"."RECON_TYPE_CODE" IS NOT NULL)
    79 rows selected.
    You may want to have a look at <a href="HOW TO: Post a SQL statement tuning request - template posting">HOW TO: Post a SQL statement tuning request - template posting</a> to see what more details are needed in order for somebody to provide better answer.
    Based on what you have posted so far, you may want to share details of following questions (in addition to details in above link)
    1) How much time does the query currently take to execute? How much time do you expect it to take? Also, how are you measuring query execution time?
    2) Your plan suggests that the query is expected to return 810K rows. Is this figure close to actual number of records? What are you doing with this huge amount of data?

  • Select query taking time

    THe following query is taking time. Is there anyway better to write this query.
    SELECT PROGRAM_NAME_ID ,PROGRAM_NAME,sum(balance)"Unpaid Balance"
        FROM (
    SELECT DISTINCT
    PROGRAM_NAME_ID ,PROGRAM_NAME,
    t.billing_key billing_key,
    (TUFF_GENERIC_PKG.GET_TOTAL(t.billing_key,t.program_key)+
    nvl(PENALTY_INTEREST(t.billing_key,t.program_key,b.company_id,b.report_period ),0))
    -PAYMENT_AMOUNT(B.COMPANY_ID,T.PROGRAM_KEY,B.REPORT_PERIOD) Balance,
    Report_period,company_id
    FROM  BILLING B,
    PROG_SURCH T ,
    mv_program_dict P
    WHERE
    B.BILLING_KEY=T.BILLING_KEY
    AND  p.program_key= t.program_key(+)
    and company_id=:p3_hide_comp
    and b.SUBMIT_STATUS='S'
    union
    SELECT DISTINCT
    PROGRAM_NAME_ID ,PROGRAM_NAME,
    t.billing_key billing_key,
    (TUFF_GENERIC_PKG.GET_TOTAL(t.billing_key,t.program_key)+
    nvl(PENALTY_INTEREST(t.billing_key,t.program_key,b.company_id,b.report_period ),0))
    -PAYMENT_AMOUNT(B.COMPANY_ID,T.PROGRAM_KEY,B.REPORT_PERIOD) Balance,
    Report_period,company_id
    FROM  MV_BILLING B,
    MV_PROG_SURCH T ,
    mv_program_dict P
    WHERE
    B.BILLING_KEY=T.BILLING_KEY
    AND  p.program_key= t.program_key(+)
    and company_id=:p3_hide_comp
    order by report_period,program_name_id )
    where balance>=0
    GROUP BY PROGRAM_NAME_ID,PROGRAM_NAME
    ORDER BY PROGRAM_NAME_ID

    Hi,
    This is totally right.
    >
    Being one such call. The price for calling pl/sql functions in SQL can be quite high. I'd highly recommend you find a way to incorporate the pl/sql code into the SQL query.
    >
    but, try with this query. I hope would help you and return the rows you want.
    SELECT   program_name_id, program_name,
               SUM (  tuff_generic_pkg.get_total (billing_key, program_key)
                    + NVL (penalty_interest (billing_key,
                                             program_key,
                                             company_id,
                                             report_period
                           0
             - payment_amount (company_id, program_key, report_period) balance
        FROM (SELECT program_name_id, program_name, t.billing_key, t.program_key,
                     b.company_id, b.report_period
                FROM billing b, prog_surch t, mv_program_dict p
               WHERE b.billing_key = t.billing_key
                 AND p.program_key = t.program_key(+)
                 AND company_id = :p3_hide_comp
                 AND b.submit_status = 'S'
              UNION
              SELECT program_name_id, program_name, t.billing_key, t.program_key,
                     b.company_id, b.report_period report_period, company_id
                FROM mv_billing b, mv_prog_surch t, mv_program_dict p
               WHERE b.billing_key = t.billing_key
                 AND p.program_key = t.program_key(+)
                 AND company_id = :p3_hide_comp) sub
       WHERE   (  tuff_generic_pkg.get_total (billing_key, program_key)
                + NVL (penalty_interest (billing_key,
                                         program_key,
                                         company_id,
                                         report_period
                       0
             - payment_amount (company_id, program_key, report_period) >= 0
    GROUP BY program_name_id, program_nameObviosly I cannot testing.
    HTH -- johnxjean --

  • Caching configuration (Times Ten - Oracle 10g)

    Hi all,
    I have managed to setup Times Ten and get a cache group configured against a table in an oracle 10g instance.
    That all works so great. My question is how do I define a set of cache groups and get Times Ten to load them in automatically all together. So what I am saying, is I dont want to have to enter these cache group definitions in manually via ttisql command line (as I have done this time).
    Could someone please point me in the right direction with this? Also I would like to be able to set TT up such that the cache agent is automatically started. Is this possible?
    Thanks,
    Dan

    Hi Dan,
    In the same way that you can create cache groups through a ttIsql script you can also load them from a script using the LOAD CACHE GROUP and REFRESH CACHE GROUP commands.
    However, let's remember that TimesTen is a persistent database and so you should not need to re-create the cache groups nor re-load them just becasue you have stopped and started TimesTen. The cache group definitions and data will still be present as they are persistently stored. Also, if you have a READONLY or USERMANAGED cache group using AUTOREFRESH then the changes that occur in oracle are captured and refreshed to the cache group(s) automatically.
    As for starting the cache agent 9or the repagent0 automatically, this kind of depends on how you are managing the startup/shutdown of the cache datastore (i.e. what itss ramPolicy is). You can set the cachePolicy for the datastore using ttAdmin as follows:
    ttAdmin -cachePolicy always DSNname
    this tells TimesTen that the cache agent should always be running for this datastore. However, a side effect of this is that the datastore will allways be loaded in memory when the TimesTen instance is up (i.e. the TimesTen main daemon is running). If you want to be able to start and stop the datastore manually (or from a script) then you will likely be using a ramPolicy of manual and running some script to load/unload the datastore into/from memory. If so then just add the relevant ttadmin -cacheStart|-cacheStop commands to that script.
    Chris

  • Query taking long time in oracle 10g

    I have a query which runs in 1 minute in oracle 8 but it takes 2 hours in oracle 10. The query has couple of sub queries to select the max effective date as wee as current effective sequence. I checked the parameters and their values are as follows. I want to know whether any values can be increased to make it run faster. Also I did not find the parameter unnestsubquery, I think it should be set to FALSE but did not find the value when I did select * from v$parameter. Is it set to false value by default or should i explicitly declare it. Thanks
    Statistic Name Result
    processes 200
    sessions 225
    timed_statistics TRUE
    sga_target 335544320
    control_files /ora1db13/oradata/KVSU2P13/control01.ctl, /ora2db13/o
    db_block_size 8192
    compatible 10.2.0.1.0
    db_file_multiblock_read_count 4
    undo_management AUTO
    undo_tablespace ADP_UNDO
    db_domain
    service_names KVSU2P13, KVSU2P13_VSUP
    dispatchers (PROTOCOL=tcp)(DISPATCHERS=4)(CONNECTIONS=50)
    shared_servers 10
    max_shared_servers 20
    shared_server_sessions 150
    job_queue_processes 10
    background_dump_dest /udb01/app/oracle/admin/KVSU2P13/bdump
    user_dump_dest /udb01/app/oracle/admin/KVSU2P13/udump
    core_dump_dest /udb01/app/oracle/admin/KVSU2P13/cdump
    db_name KVSU2P13
    open_cursors 300
    optimizercost_based_transformation off
    alwayssemi_join off
    optimizer_index_cost_adj 10
    optimizer_index_caching 50
    pga_aggregate_target 25165824
    workarea_size_policy auto

    Please read these standard threads:
    How to post a tuning request:
    HOW TO: Post a SQL statement tuning request - template posting
    When your query takes too long:
    When your query takes too long ...

  • Query taking time to execute

    Hello,
    i have created one query based on inventory cube 0IC_C03. when i am executing the infocube based on a particular date i am able to see the output but when i am executing the query on the basis of that particular date given while executing the cube the query is taking long time to execute and throwing a message of time limit exceed.
    could anyone suggest me why the query is showing such nessage along with resolution.
    Thanks,
    Kumkum
    Edited by: kumkum basu on Nov 29, 2010 2:33 PM

    Hi,
    There can be number of reason.
    What you can do is:-
    put the unwanted characteristics in Free Characteristics
    Remove unwanted cell reference
    Try using partitions in cubes
    Use aggregates for summarised data.
    f the above options doesnt work, then try pre-caching.This will definitely help!
    Use proper selections to get small subset of data.
    Goto RSRT>> type your query name>> Query properties>> select cache mode=4
    In addition to RSRT, ST05 (sql trace), SE30 (runtime analysis) and system statistics (ST03) may help you in identifying performance issues with a report.
    Thanks,.
    Saveen Kumar

  • Query taking time to load

    Hi:
    We are using a common component for generating query screens wherein we just have to pass a query number to the component which in turn return a list view of records.
    We have a particular Query which when executed through Toad or any SQL tool returns records within 4-5 seconds but the same one takes almost 3 minutes to load from Front End.
    What could be the possible reason for the page to take so much time to load.
    We are using WebSphere 6.0.2.17 server. Is there any settings to be done for statement cache size or for any connection timeout or is there anything to be done at Oracle side.
    Since the moment we change the query number to some simple query like select * from dual kind the screen loads instantly.
    P.S: The query takes almost 4-5 seconds to execute in backend through TOAD.
    Avadhoot Sawant

    So 45 or 47? Nevertheless ...
    This is hardly a heavy calculation, the savings will be dismal. Also anything numeric is very easy on CPU in general.
    But
    convert( numeric(8,5), (convert( numeric,T3.COl7) / 1000000))
    is not optimal.
    CONVERT( NUMERIC(8,5),300 / 1000000.00000 )
    Is
    Now it boils to how to make load faster: do it in parallel. Find how many sockets the machine have and split the table into as many chunks. Also profile to find out where it spends most of the time. I saw sometimes the network is not letting me thru so you
    may want to play with buffers, and packet sizes, for example if OLEDB used increase the packet size two times see if works faster, then x2 more and so forth.
    To help you further you need to tell more e.g. what is this source, destination, how you configured the load.
    Please understand that there is no Silver Bullet anywhere, or a blanket solution, and you need to tell me your desired load time. E.g. if you tell me it needs to load in 5 min I will give your ask a pass.
    Arthur
    MyBlog
    Twitter

  • Error While Querying DB Link from Oracle 10g to Postgres 8.2

    Hi,
    I have installed unixodbc 2.3.1, postgres odbc driver (psqlodbc-07.03) and dg4odbc 11.2
    On querying : select sysdate from dual@dblink_postgresql, the following error occurs:
    ORA-28500: connection from ORACLE to a non-Oracle system returned this message:
    [unixODBC][Driver Manager]Can't open lib '/oracle/psqlodbc/lib/libpsqlodbc.a' : file not found {01000}
    ORA-02063: preceding 2 lines from DBLINK_POSTGRES
    Similar error appears in the trace file as well.
    [unixODBC][Driver Manager]Can't open lib '/oracle/psqlodbc/lib/libpsqlodbc.a'
    $ isql -v postgresql postgres postgres@2012
    [01000][unixODBC][Driver Manager]Can't open lib '/oracle/psqlodbc/lib/libpsqlodbc.a' : file not found
    [ISQL]ERROR: Could not SQLConnect
    However the file is present in the location and has no permission related problems.
    $ pwd
    /oracle/psqlodbc/lib
    $ ls -lrt
    total 2952
    -rwxr-xr-x 1 oracle oinstall 663 Mar 25 15:28 psqlodbc.la
    -rw-r--r-- 1 oracle oinstall 731419 Mar 25 15:28 libpsqlodbc.a
    -rw-r--r-- 1 oracle oinstall 12215 Mar 25 22:11 win_md5.o
    -rw-r--r-- 1 oracle oinstall 18100 Mar 25 22:11 options.o
    -rw-r--r-- 1 oracle oinstall 13196 Mar 25 22:11 misc.o
    -rw-r--r-- 1 oracle oinstall 4234 Mar 25 22:11 lobj.o
    -rw-r--r-- 1 oracle oinstall 122442 Mar 25 22:11 info.o
    -rw-r--r-- 1 oracle oinstall 26464 Mar 25 22:11 execute.o
    -rw-r--r-- 1 oracle oinstall 22070 Mar 25 22:11 environ.o
    -rw-r--r-- 1 oracle oinstall 8633 Mar 25 22:11 drvconn.o
    -rw-r--r-- 1 oracle oinstall 83758 Mar 25 22:11 convert.o
    -rw-r--r-- 1 oracle oinstall 62529 Mar 25 22:11 connection.o
    -rw-r--r-- 1 oracle oinstall 5685 Mar 25 22:11 columninfo.o
    -rw-r--r-- 1 oracle oinstall 19724 Mar 25 22:11 bind.o
    -rw-r--r-- 1 oracle oinstall 3768 Mar 25 22:11 tuplelist.o
    -rw-r--r-- 1 oracle oinstall 2816 Mar 25 22:11 tuple.o
    -rw-r--r-- 1 oracle oinstall 36770 Mar 25 22:11 statement.o
    -rw-r--r-- 1 oracle oinstall 10490 Mar 25 22:11 socket.o
    -rw-r--r-- 1 oracle oinstall 74140 Mar 25 22:11 results.o
    -rw-r--r-- 1 oracle oinstall 22686 Mar 25 22:11 qresult.o
    -rw-r--r-- 1 oracle oinstall 1977 Mar 25 22:11 psqlodbc.o
    -rw-r--r-- 1 oracle oinstall 25893 Mar 25 22:11 pgtypes.o
    -rw-r--r-- 1 oracle oinstall 706 Mar 25 22:11 pgapi30.o
    -rw-r--r-- 1 oracle oinstall 34071 Mar 25 22:11 parse.o
    -rw-r--r-- 1 oracle oinstall 706 Mar 25 22:11 odbcapi30.o
    -rw-r--r-- 1 oracle oinstall 41540 Mar 25 22:11 odbcapi.o
    -rw-r--r-- 1 oracle oinstall 11601 Mar 25 22:11 multibyte.o
    -rw-r--r-- 1 oracle oinstall 706 Mar 25 22:11 info30.o
    -rw-r--r-- 1 oracle oinstall 5972 Mar 25 22:11 gpps.o
    -rw-r--r-- 1 oracle oinstall 37546 Mar 25 22:11 dlg_specific.o
    My odbc.ini and init4dg4odbc looks like below:
    $ pg odbc.ini
    [postgresql]
    Description = Test to Postgres
    Driver = /oracle/psqlodbc/lib/libpsqlodbc.a
    Trace = Yes
    TraceFile = postgres.log
    Database = postgres
    Servername = TCLDSAPORTUAT
    UserName = postgres
    Password = postgres@2012
    Port = 5432
    Protocol = TCP
    ReadOnly = Yes
    RowVersioning = No
    ShowSystemTables = No
    ShowOidColumn = No
    FakeOidIndex = No
    $ pg initdg4odbc.ora
    # This is a sample agent init file that contains the HS parameters that are
    # needed for the Database Gateway for ODBC
    # HS init parameters
    HS_FDS_CONNECT_INFO = postgresql
    HS_FDS_TRACE_LEVEL = DEBUG
    HS_FDS_SHAREABLE_NAME = /oracle/unixodbc64/lib/libodbc.so
    # ODBC specific environment variables
    set ODBCINI=/oracle/unixodbc64/etc/odbc.ini
    # Environment variables required for the non-Oracle system
    #set <envvar>=<value>
    I found similar threads in the forum but could not find solution for this problem.
    Please help to resolve this issue.
    Thanks,
    Akanksha
    Edited by: 996208 on Mar 26, 2013 5:35 AM

    Hi Mike,
    I used the truss option for diagnosis, the output is really long and shows the same error at the end of execution:
    $truss isql -v postgresql postgres postgres@2012
    getuidx(4) = 207
    getuidx(2) = 207
    getuidx(1) = 207
    getgidx(4) = 203
    getgidx(2) = 203
    getgidx(1) = 203
    kload("/usr/lib/nls/loc/en_US__64", 17301632, "/oracle/unixodbc64/lib") = 648518346072918576
    getuidx(4) = 207
    getuidx(2) = 207
    getuidx(1) = 207
    getgidx(4) = 203
    getgidx(2) = 203
    getgidx(1) = 203
    kload("/usr/lib/nls/loc/en_US__64", 17301632, "/oracle/unixodbc64/lib") = 648518346072918576
    access("/usr/lib/nls/msg/en_US/execerr.cat", 0) = 0
    _getpid()                                       = 27262980
    kopen("/usr/lib/nls/msg/en_US/execerr.cat", O_RDONLY) = 3
    kioctl(3, 22528, 0x0000000000000000, 0x0000000000000000) Err#25 ENOTTY
    kfcntl(3, F_SETFD, 0x0000000000000001) = 0
    kioctl(3, 22528, 0x0000000000000000, 0x0000000000000000) Err#25 ENOTTY
    kread(3, "\0\001 ù\001\001 I S O 8".., 4096) = 4096
    lseek(3, 0, 1) = 4096
    lseek(3, 0, 1) = 4096
    lseek(3, 0, 1) = 4096
    _getpid()                                       = 27262980
    lseek(3, 0, 1) = 4096
    _getpid()                                       = 27262980
    lseek(3, 0, 1) = 4096
    _getpid()                                       = 27262980
    lseek(3, 0, 1) = 4096
    lseek(3, 4639, 0) = 4639
    kread(3, "\t 0 5 0 9 - 1 9 4 E x".., 4096) = 1686
    getuidx(4) = 207
    getuidx(2) = 207
    getuidx(1) = 207
    getgidx(4) = 203
    getgidx(2) = 203
    getgidx(1) = 203
    kload("/usr/lib/nls/loc/en_US__64", 17301632, "/oracle/unixodbc64/lib") = 648518346072918576
    getuidx(4) = 207
    getuidx(2) = 207
    getuidx(1) = 207
    getgidx(4) = 203
    getgidx(2) = 203
    getgidx(1) = 203
    kload("/usr/lib/nls/loc/en_US__64", 17301632, "/oracle/unixodbc64/lib") = 648518346072918576
    getuidx(4) = 207
    getuidx(2) = 207
    getuidx(1) = 207
    getgidx(4) = 203
    getgidx(2) = 203
    getgidx(1) = 203
    kload("/usr/lib/nls/loc/en_US__64", 17301632, "/oracle/unixodbc64/lib") = 648518346072918576
    getuidx(4) = 207
    getuidx(2) = 207
    getuidx(1) = 207
    getgidx(4) = 203
    getgidx(2) = 203
    getgidx(1) = 203
    kload("/usr/lib/nls/loc/en_US__64", 17301632, "/oracle/unixodbc64/lib") = 648518346072918576
    getuidx(4) = 207
    getuidx(2) = 207
    getuidx(1) = 207
    getgidx(4) = 203
    getgidx(2) = 203
    getgidx(1) = 203
    kload("/usr/lib/nls/loc/en_US__64", 17301632, "/oracle/unixodbc64/lib") = 648518346072918576
    getuidx(4) = 207
    getuidx(2) = 207
    getuidx(1) = 207
    getgidx(4) = 203
    getgidx(2) = 203
    getgidx(1) = 203
    kload("/usr/lib/nls/loc/en_US__64", 17301632, "/oracle/unixodbc64/lib") = 648518346072918576
    kioctl(1, 22528, 0x0000000000000000, 0x0000000000000000) = 0
    [01000][unixODBC][Driver Manager]Can't open lib '/oracle/psqlodbc/lib/psqlodbc.o' : file not found
    kwrite(1, " [ 0 1 0 0 0 ] [ u n i x".., 99)     = 99
    [ISQL]ERROR: Could not SQLConnect
    kwrite(2, " [ I S Q L ] E R R O R :".., 34) = 34
    kfcntl(1, F_GETFL, 0x0000000010DF0051) = 67110914
    kfcntl(2, F_GETFL, 0x0000000010DF0051) = 67110914
    _exit(1)
    Do I need to install postgres software also?
    While installing postgres odbc driver in /oracle/psqlodbc only two folders were created viz. lib and share
    In lib folder two files were created viz. psqlodbc.la and libpsqlodbc.a
    And everybody on the net seems to refer psqlodbc.so in the "Driver = " parameter
    Today, I extracted the libpsqlodbc.a by using ar -X 64 -xv libpsqlodbc.a again, still no file with .so has been created.
    $ ls -lrt
    total 2952
    -rwxr-xr-x 1 oracle oinstall 663 Mar 25 15:28 psqlodbc.la
    -rwxr-xr-x 1 oracle oinstall 731419 Mar 28 13:51 libpsqlodbc.a
    -rw-r--r-- 1 oracle oinstall 12215 Apr 01 13:50 win_md5.o
    -rw-r--r-- 1 oracle oinstall 3768 Apr 01 13:50 tuplelist.o
    -rw-r--r-- 1 oracle oinstall 2816 Apr 01 13:50 tuple.o
    -rw-r--r-- 1 oracle oinstall 36770 Apr 01 13:50 statement.o
    -rw-r--r-- 1 oracle oinstall 10490 Apr 01 13:50 socket.o
    -rw-r--r-- 1 oracle oinstall 74140 Apr 01 13:50 results.o
    -rw-r--r-- 1 oracle oinstall 22686 Apr 01 13:50 qresult.o
    -rw-r--r-- 1 oracle oinstall 1977 Apr 01 13:50 psqlodbc.o
    -rw-r--r-- 1 oracle oinstall 25893 Apr 01 13:50 pgtypes.o
    -rw-r--r-- 1 oracle oinstall 706 Apr 01 13:50 pgapi30.o
    -rw-r--r-- 1 oracle oinstall 34071 Apr 01 13:50 parse.o
    -rw-r--r-- 1 oracle oinstall 18100 Apr 01 13:50 options.o
    -rw-r--r-- 1 oracle oinstall 706 Apr 01 13:50 odbcapi30.o
    -rw-r--r-- 1 oracle oinstall 41540 Apr 01 13:50 odbcapi.o
    -rw-r--r-- 1 oracle oinstall 11601 Apr 01 13:50 multibyte.o
    -rw-r--r-- 1 oracle oinstall 13196 Apr 01 13:50 misc.o
    -rw-r--r-- 1 oracle oinstall 4234 Apr 01 13:50 lobj.o
    -rw-r--r-- 1 oracle oinstall 706 Apr 01 13:50 info30.o
    -rw-r--r-- 1 oracle oinstall 122442 Apr 01 13:50 info.o
    -rw-r--r-- 1 oracle oinstall 5972 Apr 01 13:50 gpps.o
    -rw-r--r-- 1 oracle oinstall 26464 Apr 01 13:50 execute.o
    -rw-r--r-- 1 oracle oinstall 22070 Apr 01 13:50 environ.o
    -rw-r--r-- 1 oracle oinstall 8633 Apr 01 13:50 drvconn.o
    -rw-r--r-- 1 oracle oinstall 37546 Apr 01 13:50 dlg_specific.o
    -rw-r--r-- 1 oracle oinstall 83758 Apr 01 13:50 convert.o
    -rw-r--r-- 1 oracle oinstall 62529 Apr 01 13:50 connection.o
    -rw-r--r-- 1 oracle oinstall 5685 Apr 01 13:50 columninfo.o
    -rw-r--r-- 1 oracle oinstall 19724 Apr 01 13:50 bind.o
    Thanks,
    Akanksha

  • Query taking time when MVIEW is used!!!

    Dear All,
    Whenever i try and execute a query involving Materialized View(MVIEW), more often i have seen that if the query takes *5hrs* to execute and MVIEW refresh is every *2hrs*, it'll throw error as "error -- precedeing line from ...".
    I just wanted to confirm if there will be a problem in conditions where query execution is overlapping the then next MVIEW refresh???
    ** Sorry could not provide the exact error

    So what do you think what ORACLE is doing? Giving you the "latest" update? Of course not, you have read consistency,so as soon as the data changed, your query reads from UNDO. Is the MV a "fast" or "complete" refresh? If its "fast" if should not matter too much, depending on the amount of updates. But I bet it's "complete".
    How long does the refresh go? That should be < 2h right? So your query will not get substantial slower when using the source of the MV directly.
    5h is massive. I bet that can be done better. If not (wanna bet ? ;-) ) how long does the query take without MV refresh (for a test)? Then you can put the MV data in a temp table and use that for a start.
    And get your error handler right.
    -- andy

  • Count query taking time

    I have a query -->select c1,c2,c3 from table1 . This query takes only few milliseconds. But when I take count from the same query i.e. when I execute select count(c1,c2,c3) from table1 then it takes a very long time (about 1 min). The table1 contains about 25000 rows. Please help to improve performance of Count query.

    Satej wrote:
    I have a query -->select c1,c2,c3 from table1 . This query takes only few milliseconds. But when I take count from the same query i.e. when I execute select count(c1,c2,c3) from table1 then it takes a very long time (about 1 min).Classic misperception of Toad, SQL Navigator and similar tool users. All these tools fetch just first result screen and show time it took to fetch just that and not the time to fetch all rows. And in order to count you need to fetch all rows.l That is why select count(*) takes longer. But 1 min for 25000 rows is a bit long. Check execution plan to see what is going on.
    SY.

  • Query regarding OTG for Oracle 10g

    Hi,
    We need the OTG patch name for Oracle 10.2.0.5 to connect to DB2 database urgently. Please help asap.
    Regards,
    Rajiv.

    Patches come from https://support.oracle.com

  • Procedure execution time difference in Oacle 9i and Oracle 10g

    Hi,
    My procedure is taking time on
    Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 is 14 min.
    same procedure is taking time on oracle Release 9.2.0.1.0 is 1 min.
    1) Data is same in both environment.
    2) Number of records are same 485 rows for cursor select statement.
    3)Please guide me how to reduce the time in oracle 10g for procedure?
    i have checked the explain plan for that cursor query it is different in both enviroment.
    so i have analysis that procedure is taking time on cursor fetch into statement in oracle 10g.
    example:-
    create or replace procedure myproc
    CURSOR cur_list
    IS select num
    from tbl
    where exist(select.......
    EXECUTE IMMEDIATE 'ALTER SESSION SET SQL_TRACE = TRUE';
    EXECUTE IMMEDIATE 'ALTER SESSION SET TIMED_STATISTICS = TRUE';
    OPEN cur_list;
    LOOP
    FETCH cur_list INTO cur_list; -----My procedure is taking time in this statement only for some list number. there are 485 list number.
    end loop;
    TRACE file for oracle 10g is look like this:-
    call count cpu elapsed disk query current rows
    Parse 1 0.00 0.00 0 0 0 0
    Execute 1 0.37 0.46 0 2 0 0
    Fetch 486 747.07 730.14 1340 56500700 0 485
    total 488 747.45 730.60 1340 56500702 0 485
    ORACLE 9i EXPLAIN PLAN FOR cursor query:-
    Plan
    SELECT STATEMENT CHOOSECost: 2 Bytes: 144 Cardinality: 12                                         
         18 INDEX RANGE SCAN UNIQUE LISL.LISL_LIST_PK Cost: 2 Bytes: 144 Cardinality: 12                                    
              17 UNION-ALL                               
                   2 FILTER                          
                        1 TABLE ACCESS FULL SLD.P Cost: 12 Bytes: 36 Cardinality: 1                     
                   16 NESTED LOOPS Cost: 171 Bytes: 141 Cardinality: 1                          
                        11 NESTED LOOPS Cost: 169 Bytes: 94 Cardinality: 1                     
                             8 NESTED LOOPS Cost: 168 Bytes: 78 Cardinality: 1                
                                  6 NESTED LOOPS Cost: 168 Bytes: 62 Cardinality: 1           
                                       4 TABLE ACCESS BY INDEX ROWID SLD.L Cost: 168 Bytes: 49 Cardinality: 1      
                                            3 INDEX RANGE SCAN UNIQUE SLD.PK_L Cost: 162 Cardinality: 9
                                       5 INDEX UNIQUE SCAN UNIQUE SLD.SYS_C0025717 Bytes: 45,760 Cardinality: 3,520      
                                  7 INDEX UNIQUE SCAN UNIQUE SLD.PRP Bytes: 63,904 Cardinality: 3,994           
                             10 TABLE ACCESS BY INDEX ROWID SLD.P Cost: 1 Bytes: 10,480 Cardinality: 655                
                                  9 INDEX UNIQUE SCAN UNIQUE SLD.PK_P Cardinality: 9           
                        15 TABLE ACCESS BY INDEX ROWID SLD.GRP_E Cost: 2 Bytes: 9,447 Cardinality: 201                     
                             14 INDEX UNIQUE SCAN UNIQUE SLD.PRP_E Cost: 1 Cardinality: 29                
                                  13 TABLE ACCESS BY INDEX ROWID SLD.E Cost: 2 Bytes: 16 Cardinality: 1           
                                       12 INDEX UNIQUE SCAN UNIQUE SLD.SYS_C0025717 Cost: 1 Cardinality: 14,078      
    ORACLE 10G EXPLAIN PLAN FOR cursor query:-                                   
         SELECT STATEMENT ALL_ROWSCost: 206,103 Bytes: 12 Cardinality: 1                                         
         18 FILTER                                    
              1 INDEX FAST FULL SCAN INDEX (UNIQUE) LISL.LISL_LIST_PK Cost: 2 Bytes: 8,232 Cardinality: 686                               
              17 UNION-ALL                               
                   3 FILTER                          
                        2 TABLE ACCESS FULL TABLE SLD.P Cost: 26 Bytes: 72 Cardinality: 2                     
                   16 NESTED LOOPS Cost: 574 Bytes: 157 Cardinality: 1                          
                        14 NESTED LOOPS Cost: 574 Bytes: 141 Cardinality: 1                     
                             12 NESTED LOOPS Cost: 574 Bytes: 128 Cardinality: 1                
                                  9 NESTED LOOPS Cost: 573 Bytes: 112 Cardinality: 1           
                                       6 HASH JOIN RIGHT SEMI Cost: 563 Bytes: 315 Cardinality: 5      
                                            4 TABLE ACCESS FULL TABLE SLD.E Cost: 80 Bytes: 223,120 Cardinality: 13,945
                                            5 TABLE ACCESS FULL TABLE SLD.GRP_E Cost: 481 Bytes: 3,238,582 Cardinality: 68,906
                                       8 TABLE ACCESS BY INDEX ROWID TABLE SLD.L Cost: 2 Bytes: 49 Cardinality: 1      
                                            7 INDEX UNIQUE SCAN INDEX (UNIQUE) SLD.PK_L Cost: 1 Cardinality: 1
                                  11 TABLE ACCESS BY INDEX ROWID TABLE SLD.P Cost: 1 Bytes: 16 Cardinality: 1           
                                       10 INDEX UNIQUE SCAN INDEX (UNIQUE) SLD.PK_P Cost: 0 Cardinality: 1      
                             13 INDEX UNIQUE SCAN INDEX (UNIQUE) SLD.SYS_C0011870 Cost: 0 Bytes: 13 Cardinality: 1                
                        15 INDEX UNIQUE SCAN INDEX (UNIQUE) SLD.PRP Cost: 0 Bytes: 16 Cardinality: 1      
    so Please guide me how to reduce the time in oracle 10g for procedure?
    1) Is this envrionment setting parameter?
    2) I have to tune the query? but which is executing fine on oracle 9i?
    so how to decrease the execution time?
    Thanks in advance.

    SELECT l_nr
    FROM x.ls b
    WHERE b.cd = '01'
    AND b.co_code = '001'
    AND EXISTS (
    SELECT T_L
    FROM g.C
    WHERE C_cd = '01'
    AND C_co_code = '001'
    AND C_flg = 'A'
    AND C_eff_dt <= sysdate
    AND C_end_dt >=
    sysdate
    AND C_type_code <> 1
    AND C_type_code <> 1
    AND targt_ls_type = 'C'
    AND T_L <> 9999
    AND T_L = b.l_nr
    UNION ALL
    SELECT l.T_L
    FROM g.C C,
    g.ep_e B,
    g.ep ep,
    g.e A,
    g.lk_in l
    WHERE l.cd = '01'
    AND l.co_code = '001'
    AND l.cd = C.C_cd
    AND l.co_code = C.C_co_code
    AND l.C_nbr = C.C_nbr
    AND l.targt_ls_type = 'C'
    AND lk_in_eff_dt <=
    sysdate
    AND lk_in_end_dt >=
    ( sysdate
    + 1
    AND ( (logic_delte_flg = '0')
    OR ( logic_delte_flg IN ('1', '3')
    AND lk_in_eff_dt <> lk_in_end_dt
    AND l.cd = ep.C_cd
    AND l.co_code = ep.C_co_code
    AND l.C_nbr = ep.C_nbr
    AND l.ep_nbr = ep.ep_nbr
    AND l.cd = A.e_cd
    AND l.co_code = A.e_co_code
    AND l.e_nbr = A.e_nbr
    AND l.cd = B.cd
    AND l.co_code = B.co_code
    AND l.C_nbr = B.C_nbr
    AND l.ep_nbr = B.ep_nbr
    AND l.e_nbr = B.e_nbr
    AND l.ep_e_rev_nbr = B.ep_e_rev_nbr
    AND B.flg = 'A'
    AND EXISTS (
    SELECT A.e_nbr
    FROM g.e A
    WHERE A.e_cd = B.cd
    AND A.e_co_code = B.co_code
    AND A.e_nbr = B.e_nbr
    AND A.e_type_code ^= 8)
    AND C_type_code <> 10
    AND C.C_type_code <> 13
    AND l.T_L = b.l_nr)
    --yes index is same                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

Maybe you are looking for

  • How To Preserve Spaces in Oracle Soa

    Good afternoon ! I have a problem , I'm trying to do an UPDATE on a column in a particular table from my database . However , this column is of type CHAR ( 13 ) , and as I try to perform the UPDATE , it returns me an error stating that the Primary Ke

  • Can't Import DV-NTSC Clips!

    IDVD5: When clicking on the Media tab in iDVD, there are two particular DV-NTSC clips that I can't get to show up. There are plenty of other such clips on the same drive that show up with no problem. I've even tried dragging these two clips directly

  • Updating Sequence based on type

    I have a table with below structure and it has 1000's of rows. Producttype Sequencenumber 1 2 3 1 2 3 4 5 I want to update sequencenumber column of all rows so that the sequence number starts from 1....n for each producttype. I dont want Stored Procs

  • Can tags be changed to labels in maverick?

    I understand the advantages of Tags but is it possible to have the best of both worlds and somehow activate "labels" to allow a key document to be highlighted as it used to be pssible under earlier systems? I often have open a folder with multiple fi

  • Zipped folders containing InDesign files

    Hi, I'm providing advertising material (ads in InDesign) on a FTP server ; the folders containing layouts and links are compressed in .zip. Some users can't open the .indd files, it seems they got corrupted, either while the FTP transfer or the zippi