Locked table stats on volatile IOT result in suboptimal execution plan

Hello,
since upgrading to 10gR2 we are experiencing weird behaviour in execution plans of queries which join tables with a volatile IOT on which we deleted and locked statistics.
Execution plan of the example query running ok (SYS_IOT... is the volatile IOT):
   0       SELECT STATEMENT Optimizer Mode=ALL_ROWS (Cost=12 Card=1 Bytes=169)
   1    0    SORT AGGREGATE (Card=1 Bytes=169)
   2    1      NESTED LOOPS OUTER (Cost=12 Card=1 Bytes=169)
   3    2        NESTED LOOPS OUTER (Cost=10 Card=1 Bytes=145)
   4    3          NESTED LOOPS (Cost=6 Card=1 Bytes=121)
   5    4            NESTED LOOPS OUTER (Cost=5 Card=1 Bytes=100)
   6    5              NESTED LOOPS (Cost=5 Card=1 Bytes=96)
   7    6                INDEX FAST FULL SCAN ...SYS_IOT_TOP_76973 (Cost=2 Card=1 Bytes=28)
   8    6                TABLE ACCESS BY INDEX ROWID ...VSUC (Cost=3 Card=1 Bytes=68)
   9    8                  INDEX RANGE SCAN ...VSUC_VORG (Cost=2 Card=1)Since 10gR2 the index on the joined table is not used:
   0       SELECT STATEMENT Optimizer Mode=ALL_ROWS (Cost=857 Card=1 Bytes=179)
   1    0    SORT AGGREGATE (Card=1 Bytes=179)
   2    1      NESTED LOOPS OUTER (Cost=857 Card=1 Bytes=179)
   3    2        NESTED LOOPS OUTER (Cost=855 Card=1 Bytes=155)
   4    3          NESTED LOOPS (Cost=851 Card=1 Bytes=131)
   5    4            NESTED LOOPS OUTER (Cost=850 Card=1 Bytes=110)
   6    5              NESTED LOOPS (Cost=850 Card=1 Bytes=106)
   7    6                TABLE ACCESS FULL ...VSUC (Cost=847 Card=1 Bytes=68)
   8    6                INDEX RANGE SCAN ...SYS_IOT_TOP_76973 (Cost=3 Card=1 Bytes=38)I did a UNLOCK_TABLE_STATS and GATHER_TABLE_STATS on the IOT and everything worked fine - the database used the first execution plan.
Also, setting OPTIMIZER_FEATURES_ENABLE to 10.1.0.4 results in the correct execution plan, whereas 10.2.0.2 (standard on 10gR2) doesn't use the index - so i suppose it's an optimizer problem/bug/whatever.
I've also tried forcing the index with a hint - it's scanning the index but the costs are extremly high.
Any help would be greatly appreciated,
regards
-sd

sdeng,
The first thing you should do is to switch to using the dbms_xplan package for generating execution plans. Amongst other things, this will give you the filter and access predicates as they were when Oracle produced the execution plan. It will also report comments like: 'dynamic sampling used for this statement'.
If you have deleted and locked stats on the IOT, then 10gR2 will (by default) be using dynamic sampling on that object - which means (in theory) it gets a better picture of how many rows really are there, and how well they might join to the next table. This may be enought to explain the change in plan.
What you might try, if the first plan is guaranteed to be good, is to collect stats on the IOT when there is NO data in the IOT, then lock the stats. (Alternatively, fake some stats that say the table is empty if it never is really empty).
Regards
Jonathan Lewis
http://jonathanlewis.wordpress.com
http://www.jlcomp.demon.co.uk

Similar Messages

  • Locked table stats

    Hi All,
    We actually locked a table stats (TABLE1) with intention to prevent the nightly auto gather stats from picking up from stats gathering.
    Understand that the nightly gather stats job kick start at 10pm daily (during wkday).
    The below manual stats gathering will run about 4 hours.
    If we trigger the below at 8.30pm, will the nightly gather stats (10pm) pick it up for stats gathering?
    As the first sql will unlock the stats and lock it only after completion which is about 12.30am.
    exec dbms_stats.unlock_table_stats('AC', 'TABLE1');
    exec dbms_stats.gather_table_stats(ownname=>'ac',tabname=>'TABLE1',estimate_percent => 50,cascade=>true, method_opt => 'for all columns size 254');
    exec dbms_stats.lock_table_stats('AC', TABLE1);
    thanks

    Didn't see your version mentioned but there may be no need to unlock them if you are updating them manually. Just add the force parameter to your call to gather_table_stats if your version has that option.
    From the doc..
    force
    Gather statistics of table even if it is locked

  • Force statement to use a given rule or execution plan

    Hi!
    We have a statement that in our production system takes 6-7 seconds to complete. The statement comes from our enterprise application's core code and we are not able to change the statement.
    When using a RULE-hint (SELECT /*+RULE*/ 0 pay_rec...........) for this statement, the execution time is down to 500 milliseconds.
    My question is: Is there any way to pin a execution plan to a given statement. I have started reading about outlines, which seems promising. However, the statement is not using bind-variables, and since this is core code in an enterprise application I cannot change that either. Is it possible to use outlines with such a statement?
    Additional information:
    When I remove all statistics for the involved tables, the query blows away in 500 ms.
    The table tran_info_types has 61 rows and is a stable table with few updates
    The table ab_tran_info has 1 717 439 records and is 62 MB in size.
    The table query_result has 777 015 records and is 216 MB in size. This table is constantly updated/insterted/deleted.
    The query below return 0 records as there is no hits in the table query_result.
    This is the statement:
    SELECT  /*+ALL_ROWS*/
           0 pay_rec, abi.tran_num, abi.type_id, abi.VALUE
      FROM ab_tran_info abi,
           tran_info_types ti,
           query_result qr1,
           query_result qr2
    WHERE abi.tran_num = qr1.query_result
       AND abi.type_id = qr2.query_result
       AND abi.type_id = ti.type_id
       AND ti.ins_or_tran = 0
       AND qr1.unique_id = 5334549
       AND qr2.unique_id = 5334550
    UNION ALL
    SELECT 1 pay_rec, abi.tran_num, abi.type_id, abi.VALUE
      FROM ab_tran_info abi,
           tran_info_types ti,
           query_result qr1,
           query_result qr2
    WHERE abi.tran_num = qr1.query_result
       AND abi.type_id = qr2.query_result
       AND abi.type_id = ti.type_id
       AND ti.ins_or_tran = 0
       AND qr1.unique_id = 5334551
       AND qr2.unique_id = 5334552;Here is the explain plan with statistics:
    Plan
    SELECT STATEMENT  HINT: ALL_ROWSCost: 900  Bytes: 82  Cardinality: 2                           
         15 UNION-ALL                      
              7 NESTED LOOPS  Cost: 450  Bytes: 41  Cardinality: 1                 
                   5 NESTED LOOPS  Cost: 449  Bytes: 1,787,940  Cardinality: 59,598            
                        3 NESTED LOOPS  Cost: 448  Bytes: 19,514,824  Cardinality: 1,027,096       
                             1 INDEX RANGE SCAN UNIQUE TRADEDB.TIT_DANIEL_2 Search Columns: 1  Cost: 1  Bytes: 155  Cardinality: 31 
                             2 INDEX RANGE SCAN UNIQUE TRADEDB.ATI_DANIEL_7 Search Columns: 1  Cost: 48  Bytes: 471,450  Cardinality: 33,675 
                        4 INDEX UNIQUE SCAN UNIQUE TRADEDB.QUERY_RESULT_INDEX Search Columns: 2  Bytes: 11  Cardinality: 1       
                   6 INDEX UNIQUE SCAN UNIQUE TRADEDB.QUERY_RESULT_INDEX Search Columns: 2  Bytes: 11  Cardinality: 1            
              14 NESTED LOOPS  Cost: 450  Bytes: 41  Cardinality: 1                 
                   12 NESTED LOOPS  Cost: 449  Bytes: 1,787,940  Cardinality: 59,598            
                        10 NESTED LOOPS  Cost: 448  Bytes: 19,514,824  Cardinality: 1,027,096       
                             8 INDEX RANGE SCAN UNIQUE TRADEDB.TIT_DANIEL_2 Search Columns: 1  Cost: 1  Bytes: 155  Cardinality: 31 
                             9 INDEX RANGE SCAN UNIQUE TRADEDB.ATI_DANIEL_7 Search Columns: 1  Cost: 48  Bytes: 471,450  Cardinality: 33,675 
                        11 INDEX UNIQUE SCAN UNIQUE TRADEDB.QUERY_RESULT_INDEX Search Columns: 2  Bytes: 11  Cardinality: 1       
                   13 INDEX UNIQUE SCAN UNIQUE TRADEDB.QUERY_RESULT_INDEX Search Columns: 2  Bytes: 11  Cardinality: 1            Here is the execution plan when I have removed all statistics (exec DBMS_STATS.DELETE_TABLE_STATS(.........,..........); )
    Plan
    SELECT STATEMENT  HINT: ALL_ROWSCost: 12  Bytes: 3,728  Cardinality: 16                           
         15 UNION-ALL                      
              7 NESTED LOOPS  Cost: 6  Bytes: 1,864  Cardinality: 8                 
                   5 NESTED LOOPS  Cost: 6  Bytes: 45,540  Cardinality: 220            
                        3 NESTED LOOPS  Cost: 6  Bytes: 1,145,187  Cardinality: 6,327       
                             1 TABLE ACCESS FULL TRADEDB.TRAN_INFO_TYPES Cost: 2  Bytes: 104  Cardinality: 4 
                             2 INDEX RANGE SCAN UNIQUE TRADEDB.ATI_DANIEL_6 Search Columns: 1  Cost: 1  Bytes: 239,785  Cardinality: 1,547 
                        4 INDEX UNIQUE SCAN UNIQUE TRADEDB.QUERY_RESULT_INDEX Search Columns: 2  Bytes: 26  Cardinality: 1       
                   6 INDEX UNIQUE SCAN UNIQUE TRADEDB.QUERY_RESULT_INDEX Search Columns: 2  Bytes: 26  Cardinality: 1            
              14 NESTED LOOPS  Cost: 6  Bytes: 1,864  Cardinality: 8                 
                   12 NESTED LOOPS  Cost: 6  Bytes: 45,540  Cardinality: 220            
                        10 NESTED LOOPS  Cost: 6  Bytes: 1,145,187  Cardinality: 6,327       
                             8 TABLE ACCESS FULL TRADEDB.TRAN_INFO_TYPES Cost: 2  Bytes: 104  Cardinality: 4 
                             9 INDEX RANGE SCAN UNIQUE TRADEDB.ATI_DANIEL_6 Search Columns: 1  Cost: 1  Bytes: 239,785  Cardinality: 1,547 
                        11 INDEX UNIQUE SCAN UNIQUE TRADEDB.QUERY_RESULT_INDEX Search Columns: 2  Bytes: 26  Cardinality: 1       
                   13 INDEX UNIQUE SCAN UNIQUE TRADEDB.QUERY_RESULT_INDEX Search Columns: 2  Bytes: 26  Cardinality: 1            Our Oracle 9.2 database is set up with ALL_ROWS.
    Outlines: http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96533/outlines.htm#13091
    Cursor sharing: http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:3696883368520

    Hi!
    We are on Oracle 9iR2, running on 64-bit Linux.
    We are going to upgrade to Oracle 10gR2 in some months. Oracle 11g is not an option for us as our application is not certified by our vendor to run on that version.
    However, our performance problems are urgent so we are looking for a solution before we upgrade as we are not able to upgrade before we have done extensive testing which takes 2-3 months.
    We have more problem sql's than the one shown in this post. I am using the above SQL as a sample as I think we can solve many other slow running SQL's if we solve this one.
    Is the SQL Plan management an option on Oracle 9i and/or Oracle 10g?

  • LOCK TABLE vs select for update

    Hello All,
    if the requirement is to lock an entire huge table to prevent any users from performing any update statement, which statement has more performance gain and why: LOCK TABLE or select fro update nowait?
    is there any overhead of using LOCK TABLE statement?
    Thanks,

    The reason I said to revoke update privilege is because I do not understand the requirement. Why do you want to prevent users from updating the table? I am assuming that users should never be allowed to update the table. In that case locking the table and select for update would be no good. If you want to stop users from updating while some one else is updating, why? All the lock table or select for update will do is cause their session to wait (hang) until the locking process commits or rolls back. This could generate a few (sic) complaints that the user application is slow/freezing.
    If you can state the business problem, perhaps we can offer a solution.

  • How are execution plan created with tables of stale stats

    Hello
    I would like to ask the group
    1. How oracle handels the execution plan with table joins where some tables have stale stats
    2. How would oracle handel execution plan where the table has histogram but the stats are stale.
    Database version 11.1.0.7.0
    Thanks
    Arun

    ALTER SESSION SET EVENTS='10053 trace name context forever, level 1';
    by doing above before executing the SQL, you can see what & how CBO arrives at the actual execution plan

  • Same Query returning different result (Different execution plan)

    Hi all,
    To day i have discovered a strange thing: a query that return a different result when using a different execution plan.
    The query :
    SELECT  *
      FROM schema.table@database a
    WHERE     column1 IN ('3')
           AND column2 = '101'
           AND EXISTS
                  (SELECT null
                     FROM schema.table2 c
                    WHERE a.column3 = SUBSTR (c.column1, 2, 12));where schema.table@database is a remote table.
    when executed with the hint /*+ ordered use_nl(a c) */ these query return no result and its execution plan is :
    Rows     Row Source Operation
          0  NESTED LOOPS  (cr=31 r=0 w=0 time=4894659 us)
       4323   SORT UNIQUE (cr=31 r=0 w=0 time=50835 us)
       4336    TABLE ACCESS FULL TABLE2 (cr=31 r=0 w=0 time=7607 us)
          0   REMOTE  (cr=0 r=0 w=0 time=130536 us)When i changed the execution plan with the hint /*+ use_hash(c a) */
    Rows     Row Source Operation
       3702  HASH JOIN SEMI (cr=35 r=0 w=0 time=497839 us)
      22556   REMOTE  (cr=0 r=0 w=0 time=401176 us)
       4336   TABLE ACCESS FULL TABLE2 (cr=35 r=0 w=0 time=7709 us)It seem that when the execution plan have changed the remote query return no result.
    It'is a bug or i have missed somthing ?
    PS: The two table are no subject to insert or update statement.
    Oracle version : 9.2.0.2.0
    System version : HP-UX v1
    Thanks.

    H.Mahmoud wrote:
    Oracle version : 9.2.0.2.0
    System version : HP-UX v1Hard to say. You're using a very old and deprecated version of the database, and one that was known to contain bugs.
    9.2.0.7 was really the lowest version of 9i that was considered to be 'stable', but even so, it's old and lacking in many ways.
    Consider upgrading to the latest database version at your earliest opportunity. (or at least apply patches up to the latest 9i version before querying if there is bugs in your really low buggy version)

  • Lock Table and permit only SELECT-Statement

    Hi all,
    can I lock a Table and permit only SELECT-statements on a Table?
    Regards
    Leonid

    Hi Kamal,
    I would like to configure it in such a way that if I implement the SELECT statement, another user can't insert
    a data into the table.
    If it is possible, I even the LOCK would like in such a way to configure the fact that the entry of the user arrives into the buffer and if the table is unlocked, all lines from the Buffer again into the table.
    I make it in such a way:
    SQL Script script_test.sql:
    set echo off
    set verify off
    set pagesize 0
    set termout off
    set heading off
    set feedback off
    lock table mytable in share row exclusive mode;
    spool c:\Temp\script_info.lst
    select id||'|'||dae||'|'||name||'|'||name1||'|'||hiredate
    ||'|'||street||'|'||nr||'|'||plznum||'|'||city
    ||'|'||email||'|'||telephon||'|'||cddfeas||'|'||number
    ||'|'||why||'|'||fgldwer||'|'||wahl||'|'||adress
    ||'|'||las
    from mytable
    where las is null
    spool off
    spool c:\Temp\select_from_all_tables.lst
    select *
    from all_tables
    order by owner
    spool off
    spool c:\Temp\select1_from_all_tables.lst
    select *
    from all_tables
    order by owner
    spool off
    update mytable
    set las = 'x';
    commit;
    set feedback on
    set heading on
    set termout on
    set pagesize 24
    set verify on
    set echo on
    Afterwards I start another session:
    insert into briefwahl
    values(38,'11.06.2003 09:37','Test','Test','01.01.1990',
    'Test','12','90000','Test',
    '[email protected]','12345657','test','123',
    'test','test','test','test',
    null);
    Then I go into the first session and start script. And I go immediately into the second session and do commit; And although I have the table closed, the new entries are spent also with spool into the .lst-File. Why, I do not understand. And in the table all lines become updated.
    Regadrs
    Leonid
    P.S. Sorry for my English. I have write with translator.

  • MySQL lock table size Exception

    Hi,
    Our users get random error pages from vibe/tomcat (Error 500).
    If the user tries it again, it works without an error.
    here are some errors from catalina.out:
    Code:
    2013-07-31 06:23:12,225 WARN [http-8080-8] [org.hibernate.util.JDBCExceptionReporter] - SQL Error: 1206, SQLState: HY000
    2013-07-31 06:23:12,225 ERROR [http-8080-8] [org.hibernate.util.JDBCExceptionReporter] - The total number of locks exceeds the lock table size
    2013-07-31 06:23:12,242 WARN [http-8080-8] [org.kablink.teaming.web.portlet.handler.LogContextInfoInterceptor] - Action request URL [http://vibe.*******.ch/ssf/a/do?p_name=ss_forum&p_action=1&entryType=4028828f3f0ed66d013f0f3ff208013d&binderId=2333&action=add_folder_entry&vibeonprem_url=1] for user [kablink,ro]
    2013-07-31 06:23:12,245 WARN [http-8080-8] [org.kablink.teaming.spring.web.portlet.DispatcherPortlet] - Handler execution resulted in exception - forwarding to resolved error view
    org.springframework.dao.InvalidDataAccessApiUsageException: object references an unsaved transient instance - save the transient instance before flushing: org.kablink.teaming.domain.FolderEntry; nested exception is org.hibernate.TransientObjectException: object references an unsaved transient instance - save the transient instance before flushing: org.kablink.teaming.domain.FolderEntry
    at org.springframework.orm.hibernate3.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:654)
    at org.springframework.orm.hibernate3.HibernateAccessor.convertHibernateAccessException(HibernateAccessor.java:412)
    at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:411)
    2013-07-31 06:23:36,474 ERROR [Sitescape_QuartzSchedulerThread] [org.quartz.core.ErrorLogger] - An error occured while scanning for the next trigger to fire.
    org.quartz.JobPersistenceException: Couldn't acquire next trigger: The total number of locks exceeds the lock table size [See nested exception: java.sql.SQLException: The total number of locks exceeds the lock table size]
    at org.quartz.impl.jdbcjobstore.JobStoreSupport.acquireNextTrigger(JobStoreSupport.java:2794)
    at org.quartz.impl.jdbcjobstore.JobStoreSupport$36.execute(JobStoreSupport.java:2737)
    at org.quartz.impl.jdbcjobstore.JobStoreSupport.executeInNonManagedTXLock(JobStoreSupport.java:3768)
    at org.quartz.impl.jdbcjobstore.JobStoreSupport.acquireNextTrigger(JobStoreSupport.java:2733)
    at org.quartz.core.QuartzSchedulerThread.run(QuartzSchedulerThread.java:264)
    Caused by: java.sql.SQLException: The total number of locks exceeds the lock table size
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:946)
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2870)
    at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1573)
    at com.mysql.jdbc.ServerPreparedStatement.serverExecute(ServerPreparedStatement.java:1169)
    2013-07-31 06:27:12,463 WARN [Sitescape_Worker-8] [org.hibernate.util.JDBCExceptionReporter] - SQL Error: 1206, SQLState: HY000
    2013-07-31 06:27:12,463 ERROR [Sitescape_Worker-8] [org.hibernate.util.JDBCExceptionReporter] - The total number of locks exceeds the lock table size
    2013-07-31 06:27:12,463 ERROR [Sitescape_Worker-8] [org.jbpm.graph.def.GraphElement] - action threw exception: Hibernate operation: could not execute update query; uncategorized SQLException for SQL [update SS_ChangeLogs set owningBinderKey=?, owningBinderId=? where (entityId in (? , ?)) and entityType=?]; SQL state [HY000]; error code [1206]; The total number of locks exceeds the lock table size; nested exception is java.sql.SQLException: The total number of locks exceeds the lock table size
    org.springframework.jdbc.UncategorizedSQLException: Hibernate operation: could not execute update query; uncategorized SQLException for SQL [update SS_ChangeLogs set owningBinderKey=?, owningBinderId=? where (entityId in (? , ?)) and entityType=?]; SQL state [HY000]; error code [1206]; The total number of locks exceeds the lock table size; nested exception is java.sql.SQLException: The total number of locks exceeds the lock table size
    at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:83)
    at org.springframework.orm.hibernate3.HibernateAccessor.convertJdbcAccessException(HibernateAccessor.java:424)
    2013-07-31 06:27:22,393 INFO [CT-kablink] [org.kablink.teaming.lucene.LuceneProvider] - (kablink) Committed, firstOpTimeSinceLastCommit=1375251142310, numberOfOpsSinceLastCommit=12. It took 82.62174 milliseconds
    2013-07-31 06:28:22,686 INFO [Sitescape_Worker-9] [org.kablink.teaming.jobs.CleanupJobListener] - Removing job send-email.sendMail-1375252102500
    2013-07-31 06:29:51,309 INFO [Sitescape_Worker-10] [org.kablink.teaming.jobs.CleanupJobListener] - Removing job send-email.sendMail-1375252191099
    2013-07-31 06:32:08,820 WARN [http-8080-2] [org.hibernate.util.JDBCExceptionReporter] - SQL Error: 1206, SQLState: HY000
    2013-07-31 06:32:08,820 ERROR [http-8080-2] [org.hibernate.util.JDBCExceptionReporter] - The total number of locks exceeds the lock table size
    2013-07-31 06:32:10,775 WARN [http-8080-1] [org.hibernate.util.JDBCExceptionReporter] - SQL Error: 1206, SQLState: HY000
    2013-07-31 06:32:10,775 ERROR [http-8080-1] [org.hibernate.util.JDBCExceptionReporter] - The total number of locks exceeds the lock table size
    2013-07-31 06:32:12,305 WARN [http-8080-1] [org.hibernate.util.JDBCExceptionReporter] - SQL Error: 1206, SQLState: HY000
    2013-07-31 06:32:12,305 ERROR [http-8080-1] [org.hibernate.util.JDBCExceptionReporter] - The total number of locks exceeds the lock table size
    2013-07-31 06:32:14,605 WARN [http-8080-3] [org.hibernate.util.JDBCExceptionReporter] - SQL Error: 1206, SQLState: HY000
    2013-07-31 06:32:14,606 ERROR [http-8080-3] [org.hibernate.util.JDBCExceptionReporter] - The total number of locks exceeds the lock table size
    2013-07-31 06:32:16,056 WARN [http-8080-3] [org.hibernate.util.JDBCExceptionReporter] - SQL Error: 1206, SQLState: HY000
    2013-07-31 06:32:16,056 ERROR [http-8080-3] [org.hibernate.util.JDBCExceptionReporter] - The total number of locks exceeds the lock table size
    2013-07-31 06:32:24,166 WARN [http-8080-1] [org.hibernate.util.JDBCExceptionReporter] - SQL Error: 1206, SQLState: HY000
    2013-07-31 06:32:24,166 ERROR [http-8080-1] [org.hibernate.util.JDBCExceptionReporter] - The total number of locks exceeds the lock table size
    2013-07-31 06:32:24,167 WARN [http-8080-1] [org.kablink.teaming.spring.web.portlet.DispatcherPortlet] - Handler execution resulted in exception - forwarding to resolved error view
    org.springframework.jdbc.UncategorizedSQLException: Hibernate flushing: could not insert: [org.kablink.teaming.domain.AuditTrail]; uncategorized SQLException for SQL [insert into SS_AuditTrail (zoneId, startDate, startBy, endBy, endDate, entityType, entityId, owningBinderId, owningBinderKey, description, transactionType, fileId, applicationId, deletedFolderEntryFamily, type, id) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 'A', ?)]; SQL state [HY000]; error code [1206]; The total number of locks exceeds the lock table size; nested exception is java.sql.SQLException: The total number of locks exceeds the lock table size
    at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:83)
    at org.springframework.orm.hibernate3.HibernateTransactionManager.convertJdbcAccessException(HibernateTransactionManager.java:805)
    at org.springframework.orm.hibernate3.HibernateTransactionManager.convertHibernateAccessException(HibernateTransactionManager.java:791)
    at org.springframework.orm.hibernate3.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:664)
    It always logs the Mysql error code 1206:
    MySQL :: MySQL 5.4 Reference Manual :: 13.6.12.1 InnoDB Error Codes
    1206 (ER_LOCK_TABLE_FULL)
    The total number of locks exceeds the lock table size. To avoid this error, increase the value of innodb_buffer_pool_size.
    The value of innodb_buffer_pool_size is set to 8388608 (8MB) on my server.
    In the documentation (MySQL :: MySQL 5.4 Reference Manual :: 13.6.3 InnoDB Startup Options and System Variables) it says that the default is 128MB.
    Can i set the value to 134217728 (128MB) or will this cause other problems? Will this setting solve my problem?
    Thanks for your help.

    I already found an entry from Kablink:
    https://kablink.org/ssf/a/c/p_name/s...beonprem_url/1
    But i think this can't be a permanent solution...
    Our MySQL Server version is 5.0.95 running on sles11

  • How to get the number of hits ("returned rows") in read table statement

    Hi Experts
    I have the statement shown below, which seems not to work as I would like it to. My problem is that I would like to do two different things depending on weather or not a read table statement results in 0 hits or 1 (or more) hits.
        READ TABLE g_ship_item
            WITH KEY
         l_ztknum = DATA_PACKAGE-/bic/ztknum
         BINARY SEARCH.
          IF sy-subrc is initial.
          no hits found
            DATA_PACKAGE-/BIC/ZSTAGEERR = 1.
          ELSE.
          hits where found and we will do something else...
            DATA_PACKAGE-/BIC/ZSTAGEERR = 0.
    Hope someone can help me out of my problem...
    Thanks in advance, regards
    Torben

    Hi,
    As you are using READ statement with Binary search, check whether the internal table g_ship_item is sorted with field /bic/ztknum or not. If it is not sorted then the result of this READ statement is not correct.
    Below is the correct code.
    sort  g_ship_item by /bic/ztknum.
    READ table g_ship_item with key g_ship_item = xxx.
    Thanks,
    Satya

  • Timeout when inserting row in a locked table

    How can I set the timeout before an INSERT statement fails with error ORA-02049 (timeout: distributed transaction waiting for lock) when the entire table has been lock with LOCK TABLE .
    Documentation says to modify DISTRIBUTED_LOCK_TIMEOUT parameter, but it is obsolete in Oracle 8i.
    Any idea ???

    You could set an alarm() in a signal. Then on return (for whatever reason) you clear the alarm, inspect the return code of the sql execute call and determine what happened (i.e. did the transaction completed or did the alarm get you).
    Hope it helps.
    -Lou
    [email protected]
    How can I set the timeout before an INSERT statement fails with error ORA-02049 (timeout: distributed transaction waiting for lock) when the entire table has been lock with LOCK TABLE .
    Documentation says to modify DISTRIBUTED_LOCK_TIMEOUT parameter, but it is obsolete in Oracle 8i.
    Any idea ???

  • MM42 change material, split valuation at batch level, M301, locking table

    Dear All,
    I'm working on ECC 6.0 retail and I have activated split valuation at batch level.  Now in MBEW for this specific material I have almost 14.400 entries.
    If I try to change some material data (MM42) I receive an error message M3021 A system error has occurred while locking and then Lock table overflow.
    I used SM12 to see the table (while MM42 is still running) and it seems that MBEW is the problem.
    What should I do?  For any material modification the system has to modify every entry in MBEW? Is there any possibility to skip this?
    Thank you.

    Hi,
    Symptom
    Key word: Enqueue
    FM: A system error has occurred in the block handler
    Message in the syslog: lock table overflowed
    Other terms
    M3021 MM02 F5 288 F5288 FBRA
    Reason and Prerequisites
    The lock table has overflowed.
    Cause 1: Dimensions of the lock table are too small
    Cause 2: The update lags far behind or has shut down completely, so that the lock entries of the update requests that are not yet updated cause the lock table to overflow.
    Cause 3: Poor design of the application programs. A lock is issued for each object in an application program, for example a collective run with many objects.
    Solution
    Determine the cause:
    SM12 -> Goto -> Diagnosis (old)
    SM12 -> Extras -> Diagnosis (new)
    checks the effectiveness of the lock management
    SM12 -> Goto -> Diagnosis in update (old)
    SM12 -> Extras -> Diagnosis in update (new)
    checks the effectiveness of the lock management in conjunction with updates
    SM12 -> OkCode TEST -> Error handling -> Statistics (old, only in the enqueue server)
    SM12 -> Extras -> Statistics (new)
    shows the statistics of the lock management, including the previous maximum fill levels (peak usage) of the partial tables in the lock table
    If the owner table overflows, cause 2 generally applies.
    In the alert monitor (RZ20), an overrunning of the (customizable) high-water marks is detected and displayed as an alert reason.
    The size of the lock table can be set with the profile parameter u201Cenque/table_size =u201C. specifies the size of the lock table in kilobytes. The setting must be made in the profile of the enqueue server ( u2026_DVEBM.. ). The change only takes effect after the restart of the enqueue server.
    The default size is 500 KB in the Rel 3.1x implementation of the enqueue table. The resulting sizes for the individual tables are:
    Owner table: approx 560.
    Name table: approx 560.
    Entry table: approx 2240.
    As of Rel 4.xx the new implementation of the lock table takes effect.
    It can also be activated as described in note 75144 for the 3.1I kernel. The default size is 2000 KB. The resulting sizes for the individual tables are:
    Owner table: approx 5400
    Name table: approx 5400
    Entry table: approx 5400
    Example: with the
    u201Cenque/table_size =32000u2033 profile parameter, the size of the enqueue table is set to 32000 KB. The tables can then have approx 40,000 entries.
    Note that the above sizes and numbers depend on various factors such as the kernel release, patch number, platform, address length (32/64-bit), and character width (Ascii/Unicode). Use the statistics display in SM12 to check the actual capacity of the lock table.
    If cause 2 applies, an enlargement of the lock table only delays the overflow of the lock table, but it cannot generally be avoided.
    In this case you need to eliminate the update shutdown or accelerate the throughput of the update program using more update processes. Using CCMS (operation modes, see training BC120) the category of work processes can be switched at runtime, for example an interactive work process can be converted temporarily into an update process, to temporarily increase the throughput of the update.
    For cause 3, you should consider a tuning of the task function. Instead of issuing a large number of individual locks, it may be better to use generic locks (wildcard) to block a complete subarea. This will also allow you to considerably improve the performance.

  • Command object locks table (TX)

    Im having locking probmlems with ODP.NET. Im updating same table with many connections in many threads. I get table locks for hours (over 24 hours) and I cant find any timout to set. The CommandTimeout on the Command object is not implemented.
    In the V$Lock table I can see two locks on the same table made by two session ids from the same computer.
    Im using transactions on the Connection object.
    How do I set a timout for the update so that the lock will dissapear?
    String connString = "Data Source="     + dsn + ";"
              + "User ID="          + user + ";"
              + "Password="          + pwd;
    OracleConnection conn = new OracleConnection(connString);
    String sql = "UPDATE ABDATA2 SET ABNAVN='SOLNA STAD ' WHERE OBJID = -21805738";
    OracleCommand command = new OracleCommand(sql, m_conn);
    //command.CommandTimeout = 60000; Exists but not supported
    command.ExecuteNonQuery();
    Is there anyone who has a clue?

    Hi Neo, thanks for responding;
    I did not publish the report with saved data, and I'm not sure what you mean about appending the string value?  Could you explain that part?
    The parameter I created is only declared as a string with no default value with a name of "CodeTableName".  I used the Create paramter button you have in the Command object window to make it.
    I then added the parameter name to my SQL statement as listed above.
    The actual code table names in the database is actually longer then what the parameter calls for.  They all start with "TIBURON.ZZ_" and end with "_Codes".  I didn't want the users to have to remember the full names so that's why the SQL statement shows those additional parts.
    The report works perfect when I'm running this report from Crystal Reports 9 or CR11 itself.  It's only when I upload the report to our web server that the users isn't provided a prompt to enter a parameter.  They only have button labed "Run Report".
    Any ideas?
    Thanks,
    Joe

  • Querying v$lock table causes instance CPU to jump

    Hi all. I run several queries to find out metrics on my Oracle instance for monitoring purposes. One of the queries I tried using to give me a PercentLockutilization is
    SELECT round(NVL((count(b.sid)/a.value)*100,0.0),3) "Pct Lock Utilization" FROM v$lock b, v$parameter a WHERE a.name = 'dml_locks' GROUP BY a.value
    Everytime I run this query however, the CPu usage of the Oracle instance spikes about 10 percentage points. At this point I am assuming it is something with the query causing this but I am not sure what that is. My question is if there is a better query to use to get lock utilization stats via a SQL statement? Any and all help is appreciated.

    You must be coming from a Sybase/SQL Server background :-)
    Lock utilization is not an issue in Oracle since there are an infinite number of locks available, and most locks (or latches or enqueues) are held for only a very short period of time. Having said that, the jump in CPU is not surprising.
    The v$ tables are all complex memory structures and not physical tables. It is very expensive to query them and also slows the system, since Oracle needs to aquire latches (lightweight locks) to prevent changes to these structures, and do a lot of memory manipulation to get at the values.
    TTFn
    John

  • Lock table in share mode

    hi ...
    what is the benifit to lock the table explicitily using sql command
    "lock table <table_name> in share mode"
    is there any performance gain. ?
    code....
    ==================
    *Here, we lock the table in share mode
    EXEC SQL
    LOCK TABLE GLDM IN SHARE MODE
    END-EXEC.
    EXEC SQL
    LOCK TABLE GLDV IN SHARE MODE
    END-EXEC.
    EXEC SQL DECLARE D_ACCOUNT_CURSOR CURSOR FOR
    SELECT /*+ FIRST_ROWS */
    ===================================================

    As others have pointed out, this type of locking should be unnecessary. Unless there is documentation explaining why the locks are there, we can only guess the intention. Here are a couple of thoughts:
    a) The cursor select is used to create results that are copied from one table to another (e.g. the query is against gdlm and the results are used to update gdlv in a loop) - a lock on the table being updated might then be seen as necessary to ensure that no other process updates it in a conflicting fashion whilst the loop is running - thus avoiding problems of inconsistent results, or a locking/deadlocking issues.
    b) If the cursor loop takes a long time to run then (for read consistency purposes) the session has to keep generating clones of blocks that have changed since the query started. So the table locking may have been introduced as a way of reducing this cloning work by stopping any other changes. This could be seen as a performance enhancer - at a cost of blocking anyone else who wants to update the tables.
    c) For reasons similar to (b) it may have been introduced to reduce the risk of Oracle error ORA-01555 (Snapshot too old).
    Regards
    Jonathan Lewis
    http://jonathanlewis.wordpress.com
    http://www.jlcomp.demon.co.uk

  • Difference between tables statement and work area

    Hi
    i would like know the difference between these statement.
    tables: vttk.
    data :itab type standard table of vttk,
             wa_itab like line of vttk.
    what will happen with the table statement keyword ???
    whether any difference between the ouput created through tables and wa_itab statement???

    Hi
    HI,
    INTERNAL Table and it's background:
    ===================================
    Internal table acts as a container which is used to store the record sets. That is used to store the data fetched from the database table.
    So due to performance reason every time access to database would not be so good and decrease the performance. So you just select the data from the database and store it in the intermediate table. This table is called INTERNAL TABLE. So it's an replica of the database. The design foes like this,
    PRESENTATION SERVER <> APPLICATION SERVER <>
    DATABASE SERVER.
    So everytime gain accessing to database results in high resource usage and bad permformance.
    So always play around with internal tables. So obviously the whenever you access the data in the INTERNAL TABLE, the application server will be used.
    WORK AREA:
    ==========
    When ever you loop at the internal table, the current record should be stored in a temporary work place. That is called WORK AREA.
    LOOP AT ITAB INTO WORKAREA.
    ENDLOOP.
    ITAB :An internal table
    WORKAREA:An instance of internal table
    Go thru the link below
    Internal tables
    appending internal tables.
    <b>Reward if usefull</b>

Maybe you are looking for

  • Auto approval for self registration request in OIM 11G R2

    Hi all, We have a requirement where we want end users to be able to self-register without needing any sort of approval. We are using OIM 11G R2 with the latest patchset. The way to do it in 11G R1 is explained in the following document: [http://docs.

  • Duplicate vendor Invoice check in FB60

    Hi Experts, I want to put the duplicate invoice check while posting the vendor invoice through FB60. I want the system to check the duplicate invoices in combination of the Vendor code and vendor invoice number ( we put the vendor invoice no. in the

  • How to create a watermark in Pages?

    I seem to remember there was a process by which an image could be use to create a watermark in pages but there is no longer anything in Help.  Is this still available?

  • [SOLVED] pacman times out

    Hi, I'm new to arch, but have used ubuntu for a while now. New installation, and when I run pacman -Syu, it says the following #pacman -Syu :: Synchronizing package databases... error: failed retrieving file `core.db.tar.gz` from mirror.pacific.net.a

  • Forms 6i, ORA-06508, and Character Functions

    Hi, We have an installation of Forms 6i, and when we run our form(s), an ORA-06508 error is received. The problem has been drilled down to pl/sql usage of built-in character functions such as SUBSTR, INSTR, etc. For example: myvar := substr(myotherva