Cursor_sharing parameter in Force or Similar

Hi ALL,
OS:AIX
DB:11gR2
We are facing performance issues in one of our database and after investigation ADDM is suggesting that there is a lot of Hard parsing happening at the datbase level and there is a undersized SGA, We have taken care of the Shared Pool size but we for Cursor_sharing we are in a predicament. Currently it is being set to similar and earlier it was set to force but still no affect of these paremeter. These settings were suggested by Oracle Support Team.
I have also read that from 11gr2, cursor_sharing=similar has deprecated but still Oracle team sugested this setting. I more inclined to setting it to Force but I am not sure as I have also read that FORCE should be avoided as this affects the execution plan and hence similar is a more recommede method. I need to know how does it affects the execution plan per say.
Regards,
Sphinx

For this type of query, http://asktom.oracle.com has always been an excellent resource.
Here is your link
Ask Tom "cursor sharing exact VS force in 11g"
I recommend you always try to use it.
Sybrand Bakker
Senior Oracle DBA

Similar Messages

  • Cursor_Sharing parameter

    Hi All,
    On one of our db the CURSOR_SHARING parameter is set to SIMILAR (non default value) coz I think the developers are not using the Bind variables in their queries, so literals will be replaced with bind variables as this parameter is set.
    I remember this parameter can also be set to FORCE to do the same. So what is the exact difference between these two.
    Please clarify me on the same.
    Thanks in Advanced
    - Bhupinder

    When using FORCE, the literals are exchanged with bind variables whenever the meaning (sematnics) of the SQL will not be changed by the bind variables.
    When using SIMILAR, literals will be replaced by bind variables whenever the meaning and the optimizer plan will not be chnaged by the bind variables.
    So this means that when using FORCE, by using the bind variable the optimzier plan can be changed for example:
    select * from big_table where id = 12345
    if there is a index on the column ID and the percent of rows having ID = 12345 is small index will be used (the table is analyzed).
    but if Oracle replaces 12345 by :b1 the optimzier will not know what is the percebnt od rows with that ID until run time, sothe execution plan might be changed and full table scan can be done. If using cursor_sharing = SIMILAR Oracle in this case will not change the literal with bind variable.
    Gorjan Todorovski
    Oracle DBA
    MOBIMAK

  • To solve ORA-1008,set cursor_sharing parameter to EXACT

    Per Bug 7154579 customer, to solve ORA-1008,set cursor_sharing parameter to EXACT but still see the error on the application.
    One of the instance in our 4 node RAC USED to have cursor_sharing=similar, and the rest set to exact. Customer changed it to 'exact' longtime back. but still found some background process using cursor_sharing=similar ( and still see the error 1008) .
    After the bounce of the above-mentioned node, but absent a clean restart of the whole RAC database, the customer still experienced the 1008 error. Session level is showing,INSTEAD OF "SIMILAR" for the background processes,the entries of "uninitialized". See query below:
    SYS@ptmpnew4 >select inst_id,id,name,value from gV$SYS_OPTIMIZER_ENV where name like 'cursor%' ;
    INST_ID ID NAME VALUE
    4 48 cursor_sharing exact
    3 48 cursor_sharing exact
    2 48 cursor_sharing exact
    1 48 cursor_sharing exact
    SYS@ptmpnew4 >
    SYS@ptmpnew4 >select inst_id,name,value,count(1) from gV$ses_OPTIMIZER_ENV where name like 'cursor%'
    group by inst_id,name,value; 2
    INST_ID NAME VALUE COUNT(1)
    1 cursor_sharing exact 599
    1 cursor_sharing uninit 20
    2 cursor_sharing exact 590
    2 cursor_sharing uninit 18
    3 cursor_sharing exact 583
    3 cursor_sharing uninit 19
    4 cursor_sharing exact 600
    4 cursor_sharing uninit 18
    what could be the possible reason

    cursor_sharing parameter in the init. ora allows you to change the shared pool's default behaviour when parsing and caching SQL statements.
    force - allows two SQL statements, which differ only by a literal value, to share parsed code cached in the shared pool. the difference in literal values must not change the meaning of the statement.
    similar - allows two sql statements, which differ only by a literal value, to share parsed code cached in the shared pool. the difference in literal values must not change the meaning of the statement or its cached execution plan.
    exact - two sql statements must match exactly in order to share the parse code cached in shared pool.
    refer the link given below , you will get answer for all your questions.
    http://www.oracle.com/technology/oramag/oracle/06-jan/o16asktom.html
    to know Parsing in Oracle, refer.
    http://www.databasejournal.com/features/oracle/article.php/3341851/Parsing-in-Oracle.htm
    Edited by: rajeysh on Jun 19, 2010 12:40 PM

  • What does this parameter do "Force SQLExecute" in the background.

    Can anybody tell me  what does this parameter does  "Force SQLExecute" in the background?
    It is in the sbo file.

    Guarav,
    I searched for your comment "Force SQLExecute" in the slew of BO XI R2 PDFs I have stockpiled away and found this entry in the PDF "boxir2sp2_readme_with_chf.pdf":
    -quote
    CHF14
    ADAPT00597178 Patch ID: 39,211,515
    Description:
    When an SQL server ODBC connection is used, users are unable to create a Desktop Intelligence report that is based on a stored procedure that creates, populates, and then drops a temporary table.
    New Behavior:
    This problem is resolved.
    Known Limitations:
    If users want to execute a stored procedure that creates, populates, and then drops a temporary table in Free-Hand mode, they can modify the odbc.sbo file:
    1. In a text editor, open the odbc.sbo file, which is in the following directory: <BOEINSTALLFOLDER>\BusinessObjects
    Enterprise 11.5\win32_x86\dataAccess\connectionServer\odbc.sbo.
    2. In the sections "MS SQL Server 7.x", "MS SQL Server 2000" and "MS SQL Server 2005", locate the following line:
    <Parameter Name="Force SQLExecute">Procedures</Parameter>
    3. Replace the line with the following:
    <Parameter Name="Force SQLExecute">Always</Parameter>
    -unquote
    So hopefully this tidibit of information helps you to understand the parameter and usage.
    Thanks,
    John

  • Alternative to cursor_sharing parameter

    Hello,
    We presently have a 3rd party application that has an Oracle 9.2.0.8 db with statistics run on it and would like to improve performance with some bind variable queries in setting the cursor_sharing = force.
    The problem is that when certain queries return a larger character set string, the apps does not accept and errors out.
    Does anyone have any experience with this parameter and it's alternatives?
    Much appreciated.
    JR

    Hi JR,
    would like to improve performance with some bind variable queries in Cursor_sharing is a Godsend for shops with vendor SQL that cannot be changed, and for shops with ad-hoc query where literals appear in the SQL.
    Does anyone have any experience with this parameter and it's alternatives?Before cursor_sharing, we made the shared_pool very tiny.
    Since there was no reason to cached non-reentrant SQL, why even have a shared pool?
    Obviously, the best remedy is to re-write your code to use host variables, but that's rarely a practical solution!
    Also note that cursor_sharing=similar now works in 11g . . .
    I have some notes here that you may find helpdul:
    http://www.dba-oracle.com/t_cursor_sharing.htm
    Hope this helps . . .
    Donald K. Burleson
    Oracle Press author
    Author of "Oracle Tuning: The Definitive Reference"
    http://www.rampant-books.com/book_2005_1_awr_proactive_tuning.htm

  • Hint or parameter to force physical read

    I am using  Oracle 11.2.0.3. I have a query which took 45 minute the first time and it take 4 minutes in subsequent run  in QC environment. In both the cases it uses same plan. If I try the query again in few days , first time it takes considerable amount of time.Most of the wait is in range index scan - 'db file parallel read'
    Same query runs within 2 minutes in lower environment with different plan. I have used  hint to make the plan same in QC environment. Now query runs as expected but I suspect it might slow down if the data is not cached. I do not have access to  alter system flush buffer cache privilege.
    Is there any  hint or parameter I can use force physical read?
    Which view will tell me if a table is still cached in memory?

    spur230 wrote:
    <snip>
    Which view will tell me if a table is still cached in memory?
    v$bh will tell you what blocks of an object are cached:
    orcla> select file#,block#,status from v$bh where objd=(select data_object_id
      2  from dba_objects where owner='SCOTT' and objecT_name='DEPT');
    no rows selected
    orcla> select * from scott.dept;
        DEPTNO DNAME          LOC
            10 ACCOUNTING     NEW YORK
            20 RESEARCH       DALLAS
            30 SALES          CHICAGO
            40 OPERATIONS     BOSTON
    orcla> select file#,block#,status from v$bh where objd=(select data_object_id
      2  from dba_objects where owner='SCOTT' and objecT_name='DEPT');
         FILE#     BLOCK# STATUS
             4        131 xcur
             4        134 xcur
             4        132 xcur
             4        135 xcur
             4        130 xcur
             4        133 xcur
    6 rows selected.
    orcla>
    but you do need to be aware of the status. There may be several versions of a block cached.

  • How to check query is getting reused after changing parametr cursor_sharing

    Hello,
    Oracle Version: 11g
    OS Version: Windows 2003 64Bit
    How to find if a particular query is getting reused after change in a cursor_sharing parameter from EXACT to SIMILAR.
    Which set of Views/DD's should i query go get the relevant details.
    Thanks in advance.
    -Vijay.

    SQL> desc v$sqlarea
    Name                                                  Null?    Type
    SQL_TEXT                                                       VARCHAR2(1000)
    SQL_FULLTEXT                                                   CLOB
    SQL_ID                                                         VARCHAR2(13)
    SHARABLE_MEM                                                   NUMBER
    PERSISTENT_MEM                                                 NUMBER
    RUNTIME_MEM                                                    NUMBER
    SORTS                                                          NUMBER
    VERSION_COUNT                                                  NUMBER
    LOADED_VERSIONS                                                NUMBER
    OPEN_VERSIONS                                                  NUMBER
    USERS_OPENING                                                  NUMBER
    FETCHES                                                        NUMBER
    EXECUTIONS                                                     NUMBER
    PX_SERVERS_EXECUTIONS                                          NUMBER
    END_OF_FETCH_COUNT                                             NUMBER
    USERS_EXECUTING                                                NUMBER
    LOADS                                                          NUMBER
    FIRST_LOAD_TIME                                                VARCHAR2(19)
    INVALIDATIONS                                                  NUMBER
    PARSE_CALLS                                                    NUMBER
    DISK_READS                                                     NUMBER
    DIRECT_WRITES                                                  NUMBER
    BUFFER_GETS                                                    NUMBER
    APPLICATION_WAIT_TIME                                          NUMBER
    CONCURRENCY_WAIT_TIME                                          NUMBER
    CLUSTER_WAIT_TIME                                              NUMBER
    USER_IO_WAIT_TIME                                              NUMBER
    PLSQL_EXEC_TIME                                                NUMBER
    JAVA_EXEC_TIME                                                 NUMBER
    ROWS_PROCESSED                                                 NUMBER
    COMMAND_TYPE                                                   NUMBER
    OPTIMIZER_MODE                                                 VARCHAR2(10)
    OPTIMIZER_COST                                                 NUMBER
    OPTIMIZER_ENV                                                  RAW(797)
    OPTIMIZER_ENV_HASH_VALUE                                       NUMBER
    PARSING_USER_ID                                                NUMBER
    PARSING_SCHEMA_ID                                              NUMBER
    PARSING_SCHEMA_NAME                                            VARCHAR2(30)
    KEPT_VERSIONS                                                  NUMBER
    ADDRESS                                                        RAW(4)
    HASH_VALUE                                                     NUMBER
    OLD_HASH_VALUE                                                 NUMBER
    PLAN_HASH_VALUE                                                NUMBER
    MODULE                                                         VARCHAR2(64)
    MODULE_HASH                                                    NUMBER
    ACTION                                                         VARCHAR2(64)
    ACTION_HASH                                                    NUMBER
    SERIALIZABLE_ABORTS                                            NUMBER
    OUTLINE_CATEGORY                                               VARCHAR2(64)
    CPU_TIME                                                       NUMBER
    ELAPSED_TIME                                                   NUMBER
    OUTLINE_SID                                                    VARCHAR2(40)
    LAST_ACTIVE_CHILD_ADDRESS                                      RAW(4)
    REMOTE                                                         VARCHAR2(1)
    OBJECT_STATUS                                                  VARCHAR2(19)
    LITERAL_HASH_VALUE                                             NUMBER
    LAST_LOAD_TIME                                                 DATE
    IS_OBSOLETE                                                    VARCHAR2(1)
    CHILD_LATCH                                                    NUMBER
    SQL_PROFILE                                                    VARCHAR2(64)
    PROGRAM_ID                                                     NUMBER
    PROGRAM_LINE#                                                  NUMBER
    EXACT_MATCHING_SIGNATURE                                       NUMBER
    FORCE_MATCHING_SIGNATURE                                       NUMBER
    LAST_ACTIVE_TIME                                               DATE
    BIND_DATA                                                      RAW(2000)

  • Custom Schedule Task error

    Schedule Task Logic:
    SQL query to get list of user id's
    For each user get resource objects
    Update UPN for AD resource if Status 'provisioned' or 'enabled'
    1) After Schedule task processes 500-600 users i get following error in log for each subsequent user.
    09:42:27,608 ERROR [XELLERATE.DATABASE] Class/Method: tcDataBase/readPartialStatement encounter some problems: ORA-01000: maximum open cursors exceeded
    java.sql.SQLException: ORA-01000: maximum open cursors exceeded
         at oracle.jdbc.driver.SQLStateMapping.newSQLException(SQLStateMapping.java:70)
    2) i do check for isStop() method and try to return from code but Schedule Task keeps running till all the users are processed.
    NOTE: Number of users to be processed are 9-10K.
    Thanks a lot.

    Here is the solution:
    1) Login to the OIM database as sys and run the query:
    SQL> select name,value from v$parameter where name like '%curs%';
    NAME - VALUE
    cursor_space_for_time - FALSE
    session_cached_cursors - 20
    cursor_sharing - EXACT
    open_cursors - 300
    change cursor_sharing parameter to *'FORCE'* in the init.ora or spfile, and bounce the database.
    2) The method should be isStopped() for checking the Stop Execution checkbox in the shceduler.
    Thanks
    Sunny

  • ORA-12801: error signaled in parallel query server P001 and ORA-01008:

    I am trying to refresh a refresh group i am getting the below error. This refresh group is on a database RIO12. All Mviews on this database point to target database - TRIO23 (which has master tables) using database link. The refresh group has 21 Mviews. Mview ACCOUNT is one of them i am getting the below error.
    BEGIN dbms_refresh.refresh('PLATS.PLATS_RG'); END;
    ERROR at line 1:
    ORA-12048: error encountered while refreshing materialized view "PLATS"."ACCOUNT"
    ORA-12801: error signaled in parallel query server P001
    ORA-01008: not all variables bound
    ORA-02063: preceding 2 lines from TRIO23
    ORA-06512: at "SYS.DBMS_SNAPSHOT", line 2254
    ORA-06512: at "SYS.DBMS_SNAPSHOT", line 2460
    ORA-06512: at "SYS.DBMS_IREFRESH", line 683
    ORA-06512: at "SYS.DBMS_REFRESH", line 195
    ORA-06512: at line 1
    TRIO23 is oracle version 10.2.0.5.0, RIO12 is oracle version 10.2.0.3.0
    Refreshing PLATS_RG refresh group has no problems from last 2 years, other 20 MViews when executed manually they are refreshed. Please help me in resolving this error. Thanks.

    Do you have cursor_sharing set to force or similar? if so then you may be hitting bug Bug 5863277. Please confirm with Oracle support.
    thanks

  • Oracle CPU usage on web application

    I have a Dell desktop running Windows XP professional. (pentium 4, 2gb ram) This desktop is being used for a web app that does employee time cards. A contractor did this for the company and we are not proficient with Oracle, so we need some assistance!
    The web application uses asp.net for the site and the database is oracle 11g.
    So the various problems are:
    1. The system will work flawlessly for a few days; once even a week! Lately, it has not been that good. There are four services related to oracle - two of them are sometimes having problems starting.. (status says "starting" then it will time out, then try to start again.) We have been rebooting the system multiple times just to get things working again so people can login.
    services are as follows:
    ORACLEDBConsole-timeentry - problems starting lately.
    Oraclejobscheduler-timeentry - not currently set to start automatically
    OracleoraDb11g_homeTNSlistener - usually starts fine
    OracleServicetimeentry - have had problems starting sometimes, working good for now.
    2. A few days ago I logged on to the machine and checked running processes. Oracle was consuming 100% cpu, and lots of memory. (~512mb) Also, there were many instances of TNSPing.exe running consuming resources as well.
    3. Lately it doesn't work for over a day. We have to reboot every morning, and Oracle will not "crash" but does stay at 40-50% cpu usage. We think there is something going wrong with oracle services/oracle in general but have no idea where to look for a solution. There are no error messages or clues to what is going on!
    Thanks in advance for your help!
    -Ryan

    The excessive cpu usage in oracle is usually caused by code that does not use bind variables.
    eg your sql string is passed as follows:
    select * from customer where customer_number = '12345';
    Your code should be passing:
    select * from customer where customer_number = :BV1;
    BV1 is a placeholder for a bind variable. Whatever language you use you need to associate a value with BV1. All the languages are capable of using bind variables, and once you know how, its easier than the usual :
    'select * from customer where customer_number = '||customer_number;
    If you're on oracle 8.1.7. then you can set the cursor_sharing parameter to force.
    You will add this to your init.ora file and then restart the database.
    I highly recommend you look at http://asktom.oracle.com as there is a wealth of useful information there, including how to determine whether your database is using bind variables.
    Note: We run a web app server here with a database and 2 gb is easily sufficient. We are a development environment so dont get a lot of users. I have had the guys here recode there java code to use bind variables and we got a lot of performance improvement.

  • Cursor_sharing改成force,会引起什么bug吗?

    公司的数据库内有一套老的应用,跑了好多年了,但没有绑定变量,导致SQLAREA占用大量资源
    我想将cursor_sharing改成force,会不会引起bug
    我在此之前将此参数similar ,应用会报错
    数据库版 10.2.0.4 64bit
    SELECT substr(sql_text, 1, 40) "SQL", count(*), sum(executions) "TotExecs"
    FROM v$sqlarea
    WHERE executions < 5
    GROUP BY substr(sql_text, 1, 40) HAVING count(*) > 30 ORDER BY 2 desc;
    结果为
    1     SELECT …………     22625     23047
    2     insert …………     21437     21437
    3     insert …………     21429     21429
    4     select …………     19464     22630
    5     delete …………     18655     18655
    6     INSERT …………     18078     20520
    7     SELECT …………     13218     15798
    8     INSERT …………     9060     9060
    9     INSERT …………     9060     9060
    10     select ………… 7870     8451
    11     insert …………     7837     8350
    12     select …………     7790     7790
    13     select …………     7789     7789
    14     insert …………     7768     7937
    15     SELECT …………     7716     9052
    16     insert …………     6636     6643
    17     SELECT …………     6392     6392
    18     UPDATE …………     6077     6439
    19     SELECT …………     6027     6389
    20     update …………     4414     4414
    21     INSERT …………     4018     4016

    1. 不推荐在任何版本上继续使用 CURSOR_SHARING=SIMILAR
    2. cursor_sharing=force 在某些特性条件下会触发bug, 主要是在低版本(9iR2,10gR2早期),具体是否触发bug取决于SQL的写法。
    建议你直接参考以下 10.2.0.4上cursor_sharing的 bug list:
    NB     Bug     Fixed     Description
    12862170     12.1.0.0     INSERT ALL fails with ORA-600[kkslhsh1] with CURSOR_SHARING enabled / High Version Count on HASH_MATCH_FAILED
    12374212     11.2.0.3, 12.1.0.0     Assorted dump , internal errors, memory corruptions with cursor_sharing = force
    12334286     11.2.0.3, 12.1.0.0     High version counts with CURSOR_SHARING=FORCE (BIND_MISMATCH and INCOMP_LTRL_MISMATCH)
    11063191     11.2.0.2.7, 11.2.0.2.BP17, 11.2.0.3.2, 11.2.0.3.BP04, 12.1.0.0     ORA-4031 with hint /*+ CURSOR_SHARING_EXACT */ - excessive "KKSSP^nn" memory
    10013170     11.2.0.3, 12.1.0.0     ORA-600 [736] from literal replacement with a "WAIT n" clause
    9877964     11.2.0.3, 12.1.0.0     ORA-600 [19003] raised by LIKE :BIND in query
    9680430     11.2.0.3, 12.1.0.0     High version count with CURSOR_SHARING = FORCE due to CBO transformation
    9411496     11.2.0.2, 12.1.0.0     ORA-979 on GROUP BY query with CURSOR_SHARING set
    9362218     11.2.0.2, 12.1.0.0     Literals replaced by binds when CURSOR_SHARING=EXACT
    9348402     12.1.0.0     OERI [kks-hash-collision] can occur with CURSOR_SHARING=FORCE|SIMILAR
    9223586     11.2.0.2, 12.1.0.0     Problems with variable length NCHAR literals with cursor sharing
    9031183     11.2.0.2, 12.1.0.0     ORA-1722 with CURSOR_SHARING=SIMILAR and with NCHAR
    8246445     11.2.0.2, 12.1.0.0     Query rewrite not working for multi-MV rewrite with literal replacement
    5751866     11.2.0.2     Wrong Results with CASE and CURSOR_SHARING
    9767674     10.2.0.5.5     Dump [kkslmtl] using CURSOR_SHARING - superceded
    8794693     11.2.0.2     Dump [kkscsmtl] using literal replacement (CURSOR_SHARING)
    8453245     11.2.0.1     Many child cursors with CURSOR_SHARING = FORCE
    8264642     11.2.0.1     ORA-600 [kkexbindopn0] with CURSOR_SHARING = SIMILAR
    7516867     10.2.0.5, 11.1.0.7.1, 11.2.0.1     Intermittent Wrong results from literal replacement with fix for bug 6163785
    7272297     10.2.0.4.1, 10.2.0.5, 11.1.0.7, 11.2.0.1     Memory corruption / OERI[17114] / OERI[17125] with literal replacement
    6337716     10.2.0.5, 11.1.0.7, 11.2.0.1     Wrong max column size for NULL strings with literal replacement
    4071519     10.2.0.5, 11.1.0.7, 11.2.0.1     GROUP BY query with CURSOR_SHARING fails with ORA-1802
    3461251     11.1.0.7, 11.2.0.1     V$SQL_SHARED_CURSOR shows all N with CURSOR_SHARING
    7296258     10.2.0.5, 11.1.0.7.1     Intermittent Wrong results from literal replacement and remote objects
    6163785     10.2.0.5, 11.1.0.7     Intermittent Wrong Results with dblink and cursor_sharing
    8202234          Intermittent Wrong Results with dblink and cursor_sharing
    4867724     10.2.0.5, 11.1.0.6     Literal replacement limits column names to 30 characters

  • Cursor_sharing=similar or cursor_sharing=exact

    Hai,
    I have doubt regarding setting cursor_sharing parameter exact and similar at session level.
    On my database cursor_sharing is set similar at system level.
    test >show parameter cursor
    NAME                                 TYPE                             VALUE
    cursor_sharing                       string                           SIMILARI have fired a simple select statement without setting any cursor_sharing at session level
    TEST >variable b1 number;
    TEST >exec :b1:=7499;
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:00.00
    TEST >select empno,job from emp where job='SALESMAN' and empno=:b1;
         EMPNO JOB
          7499 SALESMANchecking the hash value for query fired
    test >select sql_text,invalidations,hash_value,executions,loads from v$sqlarea
    16:14:50   2  where sql_text like '%select empno,job from%';
    SQL_TEXT
    INVALIDATIONS HASH_VALUE EXECUTIONS      LOADS
    select empno,job from emp where job=:"SYS_B_0" and empno=:b1
                0 3727168047          1          1Literal job='SALESMAN' is converted into system generated bind variable job=:"SYS_B_0" as my cursor_sharing=similar
    Fired the same statement by setting cursor_sharing=exact at session level
    TEST >alter session set cursor_sharing=exact;
    Session altered.
    Elapsed: 00:00:00.00
    16:15:25 TEST >select empno,job from emp where job='SALESMAN' and empno=:b1;Checking the hash value for newly fired query with cursor_sharing=exact
    SQL_TEXT
    INVALIDATIONS HASH_VALUE EXECUTIONS      LOADS
    select empno,job from emp where job='SALESMAN' and empno=:b1
                0 2065003705          1          1
    select empno,job from emp where job=:"SYS_B_0" and empno=:b1
                0 3727168047          1          1literal job='SALESMAN' is not converted into bind variable as my cursor_sharing=exact
    At the same session fired the same query by setting cursor_sharing=similar ..to check which hash value would be shared.
    16:15:28 TEST >alter session set cursor_sharing=similar;
    Session altered.
    Elapsed: 00:00:04.09
    17:27:54 TEST >select empno,job from emp where job='SALESMAN' and empno=:b1;
         EMPNO JOB
          7499 SALESMAN
    16:28:26 test >select sql_text,invalidations,hash_value,executions,loads from v$sqlarea
    17:28:13   2  where sql_text like '%select empno,job from%';
    SQL_TEXT
    INVALIDATIONS HASH_VALUE EXECUTIONS      LOADS
    select empno,job from emp where job='SALESMAN' and empno=:b1
                0 2065003705          2          *2*
    select empno,job from emp where job=:"SYS_B_0" and empno=:b1
                0 3727168047          1          1The hash value 2065003705 (cursor_sharing=exact) is shared as executions column is changed from 1 to 2.
    So after setting parameter cursor_sharing = similar why the hash value of 3727168047(cursor_sharing=similar)
    is not shared?I guess something is cached at session level but i want to know the exact reason..
    Again i flushed the shared pool
    test >alter system flush shared_pool;
    System altered.
    Elapsed: 00:00:03.09
    17:39:40 test >select sql_text,invalidations,hash_value,executions,loads from v$sqlarea
    17:39:44   2  where sql_text like '%select empno,job from%';
    SQL_TEXT
    INVALIDATIONS HASH_VALUE EXECUTIONS      LOADS
    select empno,job from emp where job='SALESMAN' and empno=:b1
                0 2065003705          0          2The hash value of 3727168047(cursor_sharing=similar) is removed ..not hash value 2065003705
    What is the reason behind that ...
    Regards,
    Meeran

    Meeran wrote:
    The hash value 2065003705 (cursor_sharing=exact) is shared as executions column is changed from 1 to 2.
    So after setting parameter cursor_sharing = similar why the hash value of 3727168047(cursor_sharing=similar)
    is not shared?I guess something is cached at session level but i want to know the exact reason..Because there is a query in the shared_pool with same literal value so it doesn't have to use the hash 3727168047 and substitute the bind where it already has a plan for the same statement which is 2065003705.
    I think with setting CURSOR_SHARING=similar again, If you try the query with JOB='ANALYST' then it will use the plan 3727168047 and substitute the bind with 'ANALYST'.
    Again i flushed the shared pool
    test >alter system flush shared_pool;
    System altered.
    Elapsed: 00:00:03.09
    17:39:40 test >select sql_text,invalidations,hash_value,executions,loads from v$sqlarea
    17:39:44   2  where sql_text like '%select empno,job from%';
    SQL_TEXT
    INVALIDATIONS HASH_VALUE EXECUTIONS      LOADS
    select empno,job from emp where job='SALESMAN' and empno=:b1
    0 2065003705          0          2The hash value of 3727168047(cursor_sharing=similar) is removed ..not hash value 2065003705
    What is the reason behind that ...If you have noticed, the executions for the hash plan 2065003705 are 0 after the shared_pool flushing. It seems that with flush shared_pool, oracle doesn't flush the queries with literals and just reset their stats. As literals are always the culprits.
    You may also wanna read this, as good document on CURSOR_SHARING.

  • CURSOR_SHARING universe parameter

    Does anyone know if the CURSOR_SHARING parameter is supported in a universe (BOXI R2 SP3, FP3.3)?  BOXI R2 is running on AIX, and the reporting and CMS databases are on Oracle 10g.  On the database side, CURSOR_SHARING is set to FORCE.  On the universe side, we want to set the CURSOR_SHARING value to EXACT.  Is this possible?

    The solution to this is to add the following value to the ConnectInit parameter in the Universe Connection, "alter session set cursor_sharing=exact".  Don't use the double quotes in your value.

  • Curso_sharing similar

    My database is running on 9.2.0.8.0 i am facing perfomance problem with library cache latch contention.
    cursor_sharing parameter value is similar.
    There are lot of child cursors were created for single parent cursor
    The query's prediacate column is not having histogram, >,<,>=,<=
    but using Like operator.
    SELECT * FROM V$SQL_SHARED_CURSOR WHERE address ' '
    shows all column value as N.
    I tried to similuate the same on test database using like operator in the where condition
    but the version count is not increasing....
    What would be the reason...

    Hai,
    This my test simulation of cursor_sharing=similar with like operator in where condition
    17:33:34 TEST >select /*+ cursorsharing */ ename,empno from emp where empno like 7499;
    ENAME EMPNO
    ALLEN 7499
    Elapsed: 00:00:00.00
    17:35:26 TEST >select /*+ cursorsharing */ ename,empno from emp where empno like 7876;
    ENAME EMPNO
    ADAMS 7876
    The version count is not increasing.............
    17:35:06 test >select sql_text,version_count,hash_value,ADDRESS from v$sqlarea where sql_text like '%cursorsharing%';
    SQL_TEXT
    VERSION_COUNT HASH_VALUE ADDRESS
    select /*+ cursorsharing */ ename,empno from emp where empno like :"SYS_B_0"
    *1* 134763330 66C30684
    Elapsed: 00:00:00.00
    17:35:37 test >/
    SQL_TEXT
    VERSION_COUNT HASH_VALUE ADDRESS
    select /*+ cursorsharing */ ename,empno from emp where empno like :"SYS_B_0"
    *1* 134763330 66C30684
    Elapsed: 00:00:00.00
    But on production db version count is increasing --------------- y---------
    Version
    Count Executions Hash Value
    809 40
    SELECT ROWID,S.NUMBER,S.CUST,S.Name,S.CONT,S.CODE,S.C_CODE FROM Dv_W_Details S WHERE NUMBER LIKE :"SYS_B_0"

  • Dedicated database & cursor_sharing

    I have Oracle db 11gr2 on aix wich is running in dedicated mode.
    Based on a application documentation, I put cursor_sharing parameter to EXACT.
    but, I wonder... could it there be any cursor sharing if a db is in dedicated mode?

    PrafullaNath wrote:
    Oracle says we should keep cursor_sharing=similar. Could you point out a documentation with this ?
    EXACT is the default value:
    http://download.oracle.com/docs/cd/E11882_01/server.112/e10820/initparams041.htm#REFRN10025
    Using any other value than the default one requires strong application testing since it has been caused a lot of troubles by the past (wrong results were returned).
    Nicolas.

Maybe you are looking for

  • How to display the first node in a nested folder?

    If my navigation structure has nested folders and the first page node is in a nested folder. Is it possible to have user click the outer folder and the first node displayed in the content area?

  • Error occurred in Lockbox Processing.....

    Hello All, While running Lockbox import program in Receivables: Interfaces > Lockbox Its ending with Error. I herewith submitting the Source file, Data File and Error Logout put file. Please look into error and guide me to clear this error. Source Fi

  • Table cell with invisible border?

    Hi, I am trying to get table-cells with e.g. the right border missing (invisible). I am using the following XSL-FO to get this: <fo:table-cell border="solid black 1px" border-right-width="0px" border-collapse="collapse" number-columns-spanned="1"> Th

  • During playing music all my photos , my contact, my messages appears in the back ground. What can I do.

    During airplaying music, automatically start in the back ground, my contacts, photos messages etc. What can I do?

  • Error when i start my NWDS

    Hi Experts, When i ahve clicked on the NWDS icon i am getting the following error: Problems during startup.Check the ".log" file in the ".metadata" directory of your workspace. When i have checked the log in the workspace this is what it is showing: