Query runs differently in 9i and 10g

I have a query that implictly does an order by in 9i and does not do the implicit order by in 10g. Nope, I dont have a "group by" clause in the query. Looking at the explain plan, the 9i version does a "SORT UNIQUE" and the 10g version does a "HASH UNIQUE" instead.
Query
select CTMR.CUSTOMER_ID,
     CTMR.PRIMARY_SITE_NO,
     CTMR.NAME,
     CTAC.TAX_ID STATE_TAX_ID,
     CTAC.FEDTAX_ID FED_TAX_ID,
     CTMR.COMMENT_TXT,
     CTAC.ACCT_TYPE ACCT_TYPE,
DECODE(TMXGBL.GET_FLAG('STRICT_CREDIT_LIMIT'), 'Y', DECODE(CTAC.CREDIT_LIMIT, 0, 'NOT ALLOWED', TO_CHAR(CTAC.CREDIT_LIMIT, 'FM999G999G990D00')),
                              'N', DECODE(CTAC.CREDIT_LIMIT, 0, 'UNLIMITED', TO_CHAR(CTAC.CREDIT_LIMIT, 'FM999G999G990D00')),
                              TO_CHAR(CTAC.CREDIT_LIMIT, 'FM999G999G990D00')) CREDIT_LMT,
     CTAC.PO_REQ_FL PO_REQ,
     CTMR.JOB_REQUIRED_FL JOB_CONT_REQ,
     (SELECT EMPLOYEE_ID
     FROM CUSTOMER_EMPLOYEE
     WHERE CUSTOMER_ID = CTMR.CUSTOMER_ID
     AND ROWNUM < 2) EMPLOYEE_ID
FROM TABLE_1_DUMMY CTMR, TABLE_2_DUMMY CTAC
WHERE CTMR.CUSTOMER_ID = CTAC.CUSTOMER_ID(+)
--AND CTMR.STATUS_CD = 'A'
AND CTMR.CUSTOMER_ID IN (SELECT CAV.CUSTOMER_ID
          FROM TABLE_DUMMY3 AN, TABLE_DUMMY4 AU, CUSTOMER_ATTRIBUTE_VALUE CA                                                       WHERE AN.NAME_TEXT = 'TERRITORY'
                                                            AND AU.FUNCTIONAL_AREA_CD = 'CUS'
                                                            AND AN.ATTRIBUTE_ID = AU.ATTRIBUTE_ID
                                                            AND CAV.ATTRIBUTE_ID = AN.ATTRIBUTE_ID
                                                            AND CAV.FUNCTNL_AREA_CD = 'CUS'
                                                            AND CAV.ATTRIBUTE_VALUE = '042401')
Question:
What clause in the query is making a HASH UNIQUE / SORT UNIQUE?
Besides using a ORDER BY in 10g, is there a different solution?

9i explain plan
SELECT STATEMENT, GOAL = CHOOSE               5     1     179
COUNT STOPKEY                         
INDEX RANGE SCAN     TMX17     CUSTOMER_EMPLOYEE_PK     2     1     18
NESTED LOOPS SEMI               5     1     179
NESTED LOOPS OUTER               4     1     173
NESTED LOOPS               4     1     128
VIEW     SYS     VW_NSO_1     3     1     9
SORT UNIQUE                    1     190
NESTED LOOPS               3     1     190
NESTED LOOPS               3     1     37
TABLE ACCESS BY INDEX ROWID     TMX17     ATTRIBUTE_NAME     3     1     27
INDEX UNIQUE SCAN     TMX17     ATTRIBUTE_NAME_UK     2     1     
INDEX UNIQUE SCAN     TMX17     ATTR_FUNCTIONAL_USAGE_PK     1     1     10
TABLE ACCESS BY INDEX ROWID     TMX17     CUSTOMER_ATTRIBUTE_VALUE     1     1     153
INDEX RANGE SCAN     TMX17     CUSTOMER_ATTRIBUTE_ATTR_IDX     1     1     
TABLE ACCESS BY INDEX ROWID     TMX17     CUSTOMER     1     1     119
INDEX UNIQUE SCAN     TMX17     CUSTOMER_PK     1     1     
TABLE ACCESS BY INDEX ROWID     TMX17     CUSTACCT     1     1     45
INDEX UNIQUE SCAN     TMX17     CUSTACCT_PK     1     1     
INDEX RANGE SCAN     TMX17     CUSPRICE_IDX1     2     2     12
10g explain plan
SELECT STATEMENT, GOAL = ALL_ROWS               537     1     401
COUNT STOPKEY                         
INDEX RANGE SCAN     TMX249     CUSTOMER_EMPLOYEE_PK     2     596     10132
NESTED LOOPS OUTER               537     1     401
NESTED LOOPS               536     1     356
VIEW     SYS     VW_NSO_1     534     19     171
HASH UNIQUE                    1     3895
NESTED LOOPS               534     19     3895
NESTED LOOPS               2     1     52
TABLE ACCESS BY INDEX ROWID     TMX249     ATTRIBUTE_NAME     2     1     35
INDEX UNIQUE SCAN     TMX249     ATTRIBUTE_NAME_UK     1     1     
INDEX UNIQUE SCAN     TMX249     ATTR_FUNCTIONAL_USAGE_PK     0     23     391
TABLE ACCESS FULL     TMX249     CUSTOMER_ATTRIBUTE_VALUE     532     19     2907
TABLE ACCESS BY INDEX ROWID     TMX249     CUSTOMER     1     1     347
INDEX UNIQUE SCAN     TMX249     CUSTOMER_PK     0     1     
TABLE ACCESS BY INDEX ROWID     TMX249     CUSTACCT     1     1     45
INDEX UNIQUE SCAN     TMX249     CUSTACCT_PK     0     1     
Noticed that the GOAL is "ALL_ROWS", and there is no hint to force this in the query, and is different from the Goal "Choose" in 9i

Similar Messages

  • Query result different with profit and loss statement

    Hi all,
    I run query Sum(JDT1.Debit - JDT1.Credit), and then compare the query result with the profit and loss statement, and there is different.
    The difference is about 0.01.
    At SAP, the Decimal places is set to 2.
    I already checked the data, and their amount in 2 decimal.
    Do anyone know such problem and what kind of query must I use so the result can be compared with the profit and loss statement ?
    Thx.

    Riny, 
    I am glad you found the issue
    Suda

  • Validation firing differently in 6i and 10g

    Can anyone point me to any documentation to explain the following difference in behaviour:
    Item A is enterable and has a WHEN-VALIDATE-ITEM which populates item B.
    Item B is not enterable but has a W-V-I which populates item C.
    In 6i c/s the trigger on item B fires when the cursor navigates past item B.
    In 10g web the trigger on item B does not fire until the record is validated.
    We have many forms to convert and hoped that they would not need individual scrutiny, so any unexplained change in functionality is a worry.
    I have seen documentation about a similar issue when 'defer required enforcement' is used, but this form has it set to no.

    I have not seen that situation, but I have seen other places where triggers ran in a different sequence, between C/S and Web.
    A big one we encountered (and resolved years back) was that a non-repeating timer set to expire in 0 milliseconds expires and runs imediately on the web, while in C/S it does not run until the current sequence of triggers completes execution. We had to universally change all 0-millisecond timers to expire in 20 milliseconds.
    I have found other situations, too, but they were pretty complex.
    In your situation, I would have included the "item-B populating C code" in the item A process which populates item B, since you are relying on the cursor movement immediately to item C. What if the user entered item A, then used the mouse to click someplace else? (I know... this advice doesn't help you convert C/S to web. Sorry.)

  • Interesting Performance problem..Query runs fast in TOAD and Reports 6i..

    Hi All,
    I have a query which runs with in 4 mins in Toad and also report 6i. But when ran through applications takes 3 to 4 hrs to complete normal.This report fetches huge amount of data will that be the reason for poor performance?? I am unable to figure that out. I was able to avoid full table scan on the tables used. But still have the problem.
    Any suggestions please.
    Thank you in advance.
    Prathima

    If you want to have a look at the query. This report gives a way to monitor the receipts entered for pay from receipt POs.
    SELECT
    hou.name "OPERATING_UNIT_NAME"
    ,glc.segment1 "UEC"
    ,glc.segment2 "DEPT"
    ,pov.vendor_name "VENDOR_NAME"
    ,msi.SEGMENT1 "ITEM_NUM"
    ,rcvs.receipt_num "RECEIPT_NUM"
    ,poh.segment1 "PO_NUMBER"
    ,pol.line_num "PO_LINE_NUM"
    ,por.RELEASE_NUM "RELEASE_NUMBER"
    ,poll.shipment_num "SHIPMENT_NUM"
    ,hrou.name "SHIP_TO_ORGANIZATION"
    ,trunc(rcv.transaction_date) "TRANSACTION_DATE"
    ,decode (transaction_type,'RECEIVE', 'ERS', 'RETURN TO VENDOR','RTS') "RECEIPT_TYPE"
    ,decode (rcv.transaction_type,'RECEIVE', 1, 'RETURN TO VENDOR', -1)* rcv.quantity "RECEIPT_QTY"
    ,rcv.po_unit_price "PO_UNIT_PRICE"
    ,decode (rcv.transaction_type,'RECEIVE', 1, 'RETURN TO VENDOR', -1)*rcv.quantity*po_unit_price "RECEIPT_AMOUNT"
    ,rcvs.packing_slip "PACKING_SLIP"
    ,poll.quantity "QUANTITY_ORDERED"
    ,poll.quantity_received "QUANTITY_RECEIVED"
    ,poll.quantity_accepted "QUANTITY_ACCEPTED"
    ,poll.quantity_rejected "QUANTITY_REJECTED"
    ,poll.quantity_billed "QUANTITY_BILLED"
    ,poll.quantity_cancelled "QUANTITY_CANCELLED"
    ,(poll.quantity_received - (poll.quantity - poll.quantity_cancelled)) "QUANTITY_OVER_RECEIVED"
    ,(poll.quantity_received - (poll.quantity - poll.quantity_cancelled))*po_unit_price "OVER_RECEIVED_AMOUNT"
    ,poh.currency_code "CURRENCY_CODE"
    ,perr.full_name "RECEIVER"
    ,perb.full_name "BUYER"
    FROM
    po.po_vendors pov
    ,po.po_headers_all poh
    ,po.po_lines_all pol
    ,po.po_line_locations_all poll
    ,po.po_distributions_all pod
    ,po.po_releases_all por
    ,hr.hr_all_organization_units hou
    ,hr.hr_all_organization_units hrou
    ,po.rcv_transactions rcv
    ,po.rcv_shipment_headers rcvs
    ,gl.gl_code_combinations glc
    ,hr.per_all_people_f perr
    ,hr.per_all_people_f perb
    ,inv.mtl_system_items_b msi
    where
    poh.org_id = hou.organization_id
    and pov.vendor_id (+) = poh.vendor_id
    and pod.po_header_id = poh.po_header_id
    and pod.po_line_id = pol.po_line_id
    and pod.line_location_id = poll.line_location_id
    and poll.po_header_id = poh.po_header_id
    and poll.po_line_id = pol.po_line_id
    and pol.po_header_id = poh.po_header_id
    and poh.pay_on_code like 'RECEIPT'
    and pod.po_header_id = rcv.po_header_id
    and pod.po_line_id = rcv.po_line_id
    and pod.po_release_id = rcv.po_release_id
    and pod.po_release_id = por.po_release_id
    and por.po_header_id = poh.po_header_id
    and hrou.organization_id = poll.ship_to_organization_id
    and pod.line_location_id = rcv.po_line_location_id
    and pod.po_distribution_id = rcv.po_distribution_id
    and rcv.transaction_type in ('RECEIVE','RETURN TO VENDOR')
    and rcv.shipment_header_id = rcvs.shipment_header_id (+)
    and pod.code_combination_id = glc.code_combination_id
    and rcvs.employee_id = perr.person_id
    and por.agent_id = perb.person_id (+)
    and perr.person_type_id = 1
    and perb.person_type_id = 1
    and msi.organization_id = 1 --poll.ship_to_organization_id
    and msi.inventory_item_id = pol.item_id
    and poh.type_lookup_code = 'BLANKET'
    and hou.organization_id = nvl(:p_operating_unit,hou.organization_id)
    and trunc(rcv.transaction_date) between :p_transaction_date_from and :p_transaction_date_to
    Message was edited by:
    Prathima

  • Query running in one env and failing in other due to ORA-01779

    Hello All,
    I am running a query in one environment and it runs fine and when I try to run into other environment then it gives me a
    ORA-01779: cannot modify a column which maps to a non key-preserved table
    I am not sure where I am doing wrong. What can be the possible reasons for that?
    Thanks
    Lee

    Did you look up the error in the Error Messages documentation ?
    01779, 00000, "cannot modify a column which maps to a non key-preserved table"
    // *Cause: An attempt was made to insert or update columns of a join view which
    //         map to a non-key-preserved table.
    // *Action: Modify the underlying base tables directly.Apparently, your "query" is a DML statement that is attempting to update a view that is a join of two tables.
    Hemant K Chitale

  • Java program runs differently on Windows and Linux

    Hi!
    I would like to run a java application (which is written and run on windows platform) on linux platform. I don't know wether it is possible or not, but I tired on the following way:
    I have made a small java application. It worked correctly on windows (I developed it on windows). I copied first only the class file (Start.class) to the linux machine (which has exactly the same JDK as windows machine). When I type the command:
    java Startit gives me the folloving error:
    Exception in thread "main" java.lang.ClassFormatError: Start (unrecognized class file version)
       at java.lang.VMClassLoader.defineClass(libgcj.so.7rh)
       at java.lang.ClassLoader.defineClass(libgcj.so.7rh)
       at java.security.SecureClassLoader.defineClass(libgcj.so.7rh)
       at java.net.URLClassLoader.findClass(libgcj.so.7rh)
       at gnu.gcj.runtime.SystemClassLoader.findClass(libgcj.so.7rh)
       at java.lang.ClassLoader.loadClass(libgcj.so.7rh)
       at java.lang.ClassLoader.loadClass(libgcj.so.7rh)
       at gnu.java.lang.MainThread.run(libgcj.so.7rh)After that I was trying to compile the source file on linux with the command:
    javac Start.javabut the compiler gave me an error in the source file.
    Is there any way to run the formerly written java application (on windows) on linux machine?
    Thanks

    When I type the command java-version I get the following:
    java version "1.4.2"
    gij (GNU libgcj) version 4.1.2 20080704 (Red Hat 4.1.2-46)
    Copyright (C) 2006 Free Software Foundation, Inc.
    This is free software; see the source for copying conditions.  There is NO
    warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.The JDK on linux and windows is the latest (I was download it today).
    How can I upgrade the jdk/jre on linux?
    Here is the compiler error:
    [root@Linux-oracle app]# javac DataMining.java
    1. ERROR in DataMining.java (at line 77)
            ArrayList<String> temp = new ArrayList<String>();
            ^^^^^^^^^
    The type ArrayList is not generic; it cannot be parameterized with arguments <String>
    2. ERROR in DataMining.java (at line 77)
            ArrayList<String> temp = new ArrayList<String>();
                      ^^^^^^
    Syntax error, parameterized types are only available if source level is 5.0
    3. ERROR in DataMining.java (at line 77)
            ArrayList<String> temp = new ArrayList<String>();
                                         ^^^^^^^^^
    The type ArrayList is not generic; it cannot be parameterized with arguments <String>
    4. ERROR in DataMining.java (at line 77)
            ArrayList<String> temp = new ArrayList<String>();
                                                   ^^^^^^
    Syntax error, parameterized types are only available if source level is 5.0
    5. WARNING in DataMining.java (at line 240)
            String youtube[][] = new String[20][5];
                   ^^^^^^^
    The local variable youtube is never read
    6. WARNING in DataMining.java (at line 267)
            int e;
                ^
    The local variable e is never read
    7. ERROR in DataMining.java (at line 329)
            for(int i=1;i<Video+1;i++)
                          ^^^^^^^
    The operator + is undefined for the argument type(s) Integer, int
    7 problems (5 errors, 2 warnings)

  • Script runs differently from ESTK and Scripts panel

    Recently I was reported about a problem with one of my scripts, that packages ID documents: a guy wrote me that when he runs it from ESTK, script works fine, but when run from Scripts panel — creates empty folders, does nothing more but generates an error (there's an error handler in the script that logs errors into a text file):
    Error: Invalid value for parameter 'versionComments' of event 'packageForPrint'. Expected String, but received TRUE.
    It's strange, because I don't use this optional parameter in the script.
    BTW, on my computers it works ok, both in ID and ESTK.
    Does anybody encountered this problem? Any ideas on why this happens?
    Kasyan

    He probably has his scriptPreferences version set to 5. To make your script foolproof, you should probably set the scriptPreferences yourself (and restore them when you are don to be nice...)
    BTW, kAppVersion = parseFloat(app.version) is a more readable form for getting the version number...
    Harbs

  • Select statement returns different results from 9i and 10g

    Hi all,
    Would appreciate if someone could help to solve this puzzle here:
    I have the exact the statements running on Oracle 9i and 10g, why do they return different results?
    Select unique(GroupDesc) , GroupSeq from Module where ModuleId in (Select ModuleId from User_Access where UserId='admin') and Status='A'
    In Oracle 9i:
    Both columns returned as follows...
    GroupDesc | GroupSeq
    In Oracle 10g:
    Only one column returned, the column with unique keyword was missing...
    GroupSeq
    Could anyone enlighten me?

    yes, the table structure... actually the CREATE TABLE statement...
    with some sample data (INSERT INTO)
    and the actual queries (both of them - copy-paste them from each separate environment)
    you can use tags around the statements this will format it to a fixed font - making it easier to read
    Edited by: Alex Nuijten on Feb 20, 2009 10:05 AM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • 9i and 10g Installation

    Have oracle 9ir2 installed first and I then installed 10g, but 10g DB can't start. Installation was succeessful. When I try to open the database I get the following errors
    Listener refused the connection with the following error: ORA-12500, TNS:listener failed to start a dedicated server process The Connection descriptor used by the client was: (DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=chiana.kymp.net)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=chiana)))
    Can someone tell me how to workaround this problem.

    Did the 10g database register with the listener? The fact that the error message says that no handler was found indicates to me that the client was able to connect to the listener. It might be that the listener is running but that the database can't register with it.
    See what services are running by running:
    lsnrctl service
    I expect that you will see that the 9i database has registered a handler, but that your 10g service either will not be there or there will not be a handler for it.
    It might be that you need to run the 10g version of the listener. I would expect it to be backward compatible with the 9i database. I think you are running a 9i listener and 10g db doesn't play nice with it -- I don't know that though.
    You could either make 10g your default listener, or set it up to run on a different port. But then you have the additional work of doing that and pointing the instances to it and such.
    Chris

  • Oracle 9i and 10g in one computer

    Could I install oracle 10g in computer where 9i is instaled. I want that both oracle is instal and test oracle 9i and 10g. Could I run oracle database 9i and 10g together and I use both of the database?
    Thanks for answer.
    Rafal Dmitrowski

    I would also suggest caution if you have a Windows server. While it is certainly possible to have both running, there are some issues with separate 9i and 10g homes on a Windows machine, things like the Oracle Home Selector doesn't work with 10g Oracle Homes. I wouldn't be overly concerned if you are dealing with development laptops, but I would make sure to do some testing before installing 10g on a production server with 9i already installed.
    Justin
    Distributed Database Consulting, Inc.
    http://www.ddbcinc.com/askDDBC

  • 9i and 10g in the same nodes

    Hi.
    I would like to know if it's possible to have two database in different versions (9i and 10g) in the same nodes.
    In this case, I suppose that I have to install the tow clusterware, one for 9i and another one for 10g, haven't I?
    Thanks!

    Hi,
    both your assumptions are correct.
    You can have a 9i RAC database and a 10g one both in the same cluster. However, you would need to have 10g Clusterware and another cluster software for the 9i RAC. On Linux and Windows Oracle would use the Oracle Cluster Manager (CM) for the 9i RAC, on all other platforms you would need to get a third party cluster software for the 9i RAC database, since the 10g Clusterware cannot serve as the underlying cluster software for the 9i RAC database. Nevertheless, the 10g Clusterware GSD would be used to manage the 9i RAC database in those combinations.
    Thanks.

  • Same query returns differenent result sets in oracle 9i and 10g

    Could anyone please clarify the issue i am having on a query. I have query that is returning around 2000 records in oracle db 9.2.0.8.0, at the same time with same data if run on 10.2.0.1.0 is returning only 12 records.
    what might be the reason for this descrepancy, is something in 9i is considered differently in 10g?
    Here is the query.
    SELECT
    0
    ,ot_req_head.rh_sys_id
    ,ot_req_head.rh_comp_code
    ,ot_req_head.rh_txn_code
    ,ot_req_head.rh_no
    ,ot_req_head.rh_appr_uid
    ,'Action to be taken' action
    ,ot_req_head.rh_appr_dt
    ,NULL AUTH_TO_UID
    ,NULL
    ,NULL
    ,NULL from_remarks
    ,NULL
    ,NULL
    ,'REQ'
    ,ot_req_head.rh_amd_no
    ,ot_req_head.rh_amd_dt
    ,ot_req_head.rh_cr_uid
    ,DECODE(ot_req_head.rh_charge_area_num,6,ot_req_head.rh_locn_code,1,ot_req_head.rh_charge_code,NULL)
    ,ot_req_head.rh_cr_dt
    ,NULL
    FROM
    orioni.om_txn_setup,
    orioni.ot_req_head,
    iscoit.isco_txn_auth,
    SELECT DISTINCT rh_sys_id
    FROM orioni.pending_mr
    )pending_mr
    WHERE
    ot_req_head.rh_txn_code=txns_txn_code
    AND
    auth_comp_code(+)=ot_req_head.rh_comp_code
    AND
    auth_action_to_type(+) IS NULL
    AND
    auth_head_sys_id(+)=ot_req_head.rh_sys_id
    AND
    auth_txn_code(+)=ot_req_head.rh_txn_code
    AND
    ot_req_head.rh_clo_status IS NULL
    AND
    ot_req_head.rh_comp_code='001'
    AND
    txns_txnp_code='PURREQ'
    AND
    txns_values='N'
    AND
    ot_req_head.rh_appr_status=3
    AND
    ot_req_head.rh_sys_id = pending_mr.rh_sys_id
    AND NOT EXISTS
    SELECT 'X'
    FROM
    iscoit.isco_txn_auth A
    WHERE
    a.auth_head_sys_id = isco_txn_auth.auth_head_sys_id
    AND
    a.auth_action_from_uid = ot_req_head.rh_appr_uid
    AND
    a.auth_action_from_type = 'Action to be taken'
    AND
    a.auth_action_from_dt = ot_req_head.rh_appr_dt
    AND
    NVL(a.auth_txn_amend_no,0) = NVL(ot_req_head.rh_amd_no,0)
    AND
    a.auth_action_to_type = 'REJECT'
    AND
    ot_req_head.rh_cr_dt > TO_DATE('16-MAR-2008','DD-MON-YYYY')
    Edited by: unus on Oct 19, 2009 3:56 AM
    Edited by: unus on Oct 19, 2009 4:18 AM

    Here's what I got on 9i and 10G:
    Connected to:
    Oracle9i Enterprise Edition Release 9.2.0.8.0 - Production
    With the Partitioning, OLAP and Oracle Data Mining options
    JServer Release 9.2.0.8.0 - Production
    SQL> CREATE TABLE T_1(VAL1 NUMBER,VAL2 VARCHAR2(10));
    Table created.
    SQL> CREATE TABLE T_2(VAL1 NUMBER,VAL2 VARCHAR2(10));
    Table created.
    SQL> INSERT INTO T_1 VALUES(1,'FIRST');
    1 row created.
    SQL> INSERT INTO T_1 VALUES(2,'SECOND');
    1 row created.
    SQL> INSERT INTO T_2 VALUES(1,'FIRST');
    1 row created.
    SQL> INSERT INTO T_2 VALUES(2,'SECOND');
    1 row created.
    SQL> INSERT INTO T_1 VALUES(3,'THIRD');
    1 row created.
    SQL> INSERT INTO T_1 VALUES(4,'FOURTH');
    1 row created.
    SQL> INSERT INTO T_1 VALUES(5,'FIFTH');
    1 row created.
    SQL> commit;
    Commit complete.
    SQL> SELECT A.VAL1,B.VAL1 FROM
      2  T_1 A,T_2 B
      3  WHERE A.VAL1=B.VAL1;
         VAL1      VAL1
            1         1
            2         2
    SQL> SELECT A.VAL1,B.VAL1 FROM
      2  T_1 A,T_2 B
      3  WHERE A.VAL1=B.VAL1(+);
         VAL1      VAL1
            1         1
            2         2
            3
            4
            5
    SQL> SELECT A.VAL1,B.VAL1 FROM
      2  T_1 A,T_2 B
      3  WHERE A.VAL1=B.VAL1(+)
      4  AND
      5  NOT EXISTS (SELECT 'X' FROM t_2 C WHERE c.val1=b.val1);
         VAL1      VAL1
            3
            4
            5
    SQL> select name, value from v$parameter where name like '%optimizer%' or name like '%cursor_sharing
    NAME                                                             VALUE
    cursor_sharing                                                   EXACT
    optimizer_features_enable                                        9.2.0
    optimizer_mode                                                   CHOOSE
    optimizer_max_permutations                                       2000
    optimizer_index_cost_adj                                         100
    optimizer_index_caching                                          0
    optimizer_dynamic_sampling                                       1
    -- 10G
    Verbonden met:
    Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bit Production
    With the Partitioning, OLAP and Data Mining options
    SQL> SELECT A.VAL1,B.VAL1 FROM
      2  T_1 A,T_2 B
      3  WHERE A.VAL1=B.VAL1;
          VAL1       VAL1
             1          1
             2          2
    SQL> SELECT A.VAL1,B.VAL1 FROM
      2  T_1 A,T_2 B
      3  WHERE A.VAL1=B.VAL1(+);
          VAL1       VAL1
             1          1
             2          2
             5
             4
             3
    SQL> SELECT A.VAL1,B.VAL1 FROM
      2  T_1 A,T_2 B
      3  WHERE A.VAL1=B.VAL1(+)
      4  AND
      5  NOT EXISTS (SELECT 'X' FROM t_2 C WHERE c.val1=b.val1);
          VAL1       VAL1
             3
             4
             5( Please use the tag before and after your example, so we're sure we're looking at your complete example )                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Extract the "bind" variables for a given query running in 10g.

    how can we extract the "bind" variables for a given query running in 10g? The performance of a query may vary based on the parameters supplied to it. For example, a query like the following
    SELECT * FROM CUSTOMER_ORDERS WHERE CUSTOMER = :CUST_ID
    .might run differently when the :CUST_ID is "123" who may have very few orders versus "456" who may have tens of thousands of orders.
    So, if we see a spike in the system due to a query, we need visibility into what the exact query syntax and values are for any database session. We're aware of an Oracle view called V$SQL_BIND_CAPTURE, but what we're finding with this view is that it's only a snapshot of variables that are refreshed on an interval. That view does not give us a live view into what values are being used in the various sessions in realtime.
    If someone ould provide us with some SQL (or other means) to do get a realtime view into the SQL and variables currently running in the database, it would be greatly appreciated.

    In addition to what's been said in the other thread, you could add a layer of logging either in the database or out.
    v$sql_bind_capture and the associated ash view dba_hist_sqlbind contain sample data.
    You could up the sample rate but it's not advisable - it's still just a sample.
    If you're on 11g, this is where adaptive cursor sharing might help.
    Not help in finding the values of your binds, but help in using different plans where there is such a skew for different bind values and the plan is perhaps wrong for customer 456.
    The problem when you're got such a skew and you're using bind variables is that the two don't really go together.
    When the query is next parsed and you've got bind variable peeking enabled, you might get the 123 plan is that is the bind value at parse time and then run into problems for 456 or even vice versa.
    See http://jonathanlewis.wordpress.com/2009/05/06/philosophy-1/ for a discussion on binds and histograms which reflects the reasons for using either.

  • Running 8i and 10g on same UNIX server

    Greetings,
    I am a developer playing DBA, so please forgive me if these are elementary questions. I have no DBA support.
    I have a Solaris 8 server currently running operational software using 8i. My requirement is to load and test 64bit 10g without interfering with the operational system, then test the s/w. Later, I need to switch from 8i to 10g with little or (preferably) no downtime. It would be nice run the two in parallel before the switchover.
    I have a duplicate setup in the development lab, which is what I am working on right now.
    I was able to get 10g loaded without any apparent problems. However, when I try to run 8i and 10g, the listener’s conflict.
    After reading through various forums this morning, I have a few questions that I am hoping someone can answer.
    1. Oracle 8i is owned by user oracle. I loaded 10g as user ora10g. Should I have loaded 10g as user oracle? If so, how do I keep it from overwriting critical 8i files that are in /usr/local/bin, etc?
    2. Oracle 8i’s ORACLE_HOME is /usr/opt/oracle. 10g’s is /export/ora10g. Does 10g need to be in /usr/opt/ora10g? If so, can I set up a link to simulate this, or do I need to reload?
    Thanks in advance,
    Linda

    Won't say much about the platform (solaris) aspect here but anyway...
    1. You could and sometimes should have a different oracle software owner user for installing/managing software, either is ok. You also might want a different group to own the oraInventory (software catalog).
    You can always enter somethng other than default when prompted by root.sh - why not e.g. /home/ora10g/bin?
    2. I dont think it needs to be installed anywhere, but /export is a bit unusual isn't it? Used for nfs etc.

  • Query runs fine in 9i but results to ORA-01652 unable to extend temp in 10g

    Hi,
    We are having issues in running a SQL query in 10g. In 9i, it runs fine with no problems but when run in 10g, It takes forever and the temp tablespace grows very large upto 60GB until we get ORA-01652 error due to lack of disk space. This does not occur in 9i, where query runs in only 20 mins and does not take up temp that big. 9i version is 9.2.0.8. 10g is 10.2.0.3

    Heres the SQL query:
    SELECT
    J2.EMPLID,
    TO_CHAR(J2.EFFDT,'YYYY-MM-DD'),
    J2.EFFSEQ,
    J2."ACTION",
    J2.ACTION_REASON,
    TO_CHAR(J2.GRADE_ENTRY_DT,'YYYY-MM-DD'),
    J2.COMPRATE,
    J2.CHANGE_AMT,
    J2.COMP_FREQUENCY,
    J2.STD_HOURS,
    J2.JOBCODE,
    J2.GRADE,
    J2.PAYGROUP,
    PN2.NATIONAL_ID,
    TO_CHAR(PC.CHECK_DT,'YYYY-MM-DD'),
    SUM(PO.OTH_EARNS),
    To_CHAR(SUM(PO.OTH_EARNS)),
    PO.ERNCD,
    '3',
    TO_CHAR(PC.PAY_END_DT,'YYYY-MM-DD'),
    PC.PAYCHECK_NBR
    FROM PS_JOB J2,
    PS_PERS_NID PN2,
    PS_PAY_OTH_EARNS PO,
    PS_PAY_CHECK PC
    WHERE J2.EMPL_RCD = 0
    AND PN2.EMPLID = J2.EMPLID
    AND PN2.COUNTRY = 'USA'
    AND PN2.NATIONAL_ID_TYPE = 'PR'
    AND J2.COMPANY <> '900'
    AND J2.EFFDT <= SYSDATE
    AND PC.EMPLID = J2.EMPLID
    AND PC.COMPANY = PO.COMPANY
    AND PC.PAYGROUP = PO.PAYGROUP
    AND PC.PAY_END_DT = PO.PAY_END_DT
    AND PC.OFF_CYCLE = PO.OFF_CYCLE
    AND PC.PAGE_NUM = PO.PAGE_NUM
    AND PC.LINE_NUM = PO.LINE_NUM
    AND PC.SEPCHK = PO.SEPCHK
    AND EXISTS (SELECT ERNCD
    FROM PS_P1_CMP_ERNCD P1_CMP
    WHERE P1_CMP.ERNCD = PO.ERNCD AND EFF_STATUS = 'A')
    GROUP BY J2.EMPLID,
    J2.EFFDT,
    J2.EFFSEQ,
    J2.ACTION,
    J2.ACTION_REASON,
    J2.GRADE_ENTRY_DT,
    J2.COMPRATE,
    J2.CHANGE_AMT,
    J2.COMP_FREQUENCY,
    J2.STD_HOURS,
    J2.JOBCODE,
    J2.GRADE,
    J2.PAYGROUP,
    PN2.NATIONAL_ID,
    PC.CHECK_DT,
    PO.ERNCD,
    '3',
    PC.PAY_END_DT,
    PC.PAYCHECK_NBR

Maybe you are looking for