Table lock ? dictionary row lock? recursive?

hi guys,
was looking at dml locks and ddl locks
for example
DML changes to table tab
1) (TX lock for table tab's affected row - stored in the row itself)
2) (TM lock for table tab - store in V$lock)
DDL changes to table tab
1) (DDL lock for table tab -> store in v$lock ?)
2) (TX lock for dictionary affected row -> locking that row in data dictionary tab to reflect changes)
3) (TM lock for dictionary tab -> store in V$lock ?)
(Since i doing a DML to the data dictionary table, am i going to hold another TM lock for that data dictionary table)
what is a DDL lock exactly?
1) a lock on the table tab in v$lock
or
2) or tx lock on the data dictionary row (which will then incurr a recursive TM lock the data dictionary table)
or ?
please advise!

On behalf of Tanel. :)
is that TM lock in v$lock view a DDL lock? (tried an alter table command and saw a TM lock appeared)No, TM lock is dml lock as documented. DDL lock(a.k.a, library cache lock) is not exposed via v$lock view. It's exposed only via x$kgllk view.
so how many locks are actually acquire for e.g when i issue a ALTER TABLE tab xxx ADD col1 NUMBER;You can identify it yourself without big effort.
alter session set events '10704 trace name context forever, level 10';
alter table ...;
alter session set events '10704 trace name context off';==================================
Dion Cho - Oracle Performance Storyteller
http://dioncho.wordpress.com (english)
http://ukja.tistory.com (korean)
http://dioncho.blogspot.com (japanese)
==================================

Similar Messages

  • Identifying deadlocked resources in graph with 1 row lock and 1 table lock

    Hi, I have run into repeated occurrences of the deadlock graph at the bottom of this post and have a few questions about it:
    1. It appears that proc 44, session 548 is holding a row lock (X). Is the waiter, proc 30, session 542, trying to acquire a row lock (X) also or an exclusive table lock (X) on the table containing that row?
    2. Under what circumstances would something hold a row exclusive table lock (SX) and want to upgrade that to a share row exclusive table lock (SSX)?
    3. Our table cxml_foldercontent has a column 'structuredDataId' with a FK to cxml_structureddata.id and an ON DELETE SET NULL trigger. Would this help explain why an "update" to one table (i.e.g cxml_foldercontent) would also need to acquire a lock in a foreign table, cxml_structureddata?
    4. What is the difference between "Current SQL statement:" and "Current SQL statement for this session:"? That terminology is confusing. Is session 542 executing the "update" or the "delete"?
    5. In the "Rows waited on:" section is it saying that Session 542 is waiting on on obj - rowid = 0000BE63 - AAAL5jAAGAAA6tZAAK or that it is has the lock on that row and other things are waiting on it?
    A couple of notes:
    - the cxml_foldercontent.structuredDataId FK column has an index on it already
    Deadlock graph:
                           ---------Blocker(s)--------  ---------Waiter(s)---------
    Resource Name                    process session holds waits  process session holds waits
    TX-003a0011-000003d0        44       548     X               30        542             X
    TM-0000be63-00000000       30       542     SX              44        548     SX    SSX
    session 548: DID 0001-002C-000002D9     session 542: DID 0001-001E-00000050
    session 542: DID 0001-001E-00000050     session 548: DID 0001-002C-000002D9
    Rows waited on:
    Session 542: obj - rowid = 0000BE63 - AAAL5jAAGAAA6tZAAK
      (dictionary objn - 48739, file - 6, block - 240473, slot - 10)
    Session 548: no row
    Information on the OTHER waiting sessions:
    Session 542:
      pid=30 serial=63708 audsid=143708731 user: 41/CASCADE
      O/S info: user: cascade, term: unknown, ospid: 1234, machine:
                program: JDBC Thin Client
      application name: JDBC Thin Client, hash value=2546894660
      Current SQL Statement:
    update cascade.cxml_foldercontent set name=:1 , lockId=:2 , isCurrentVersion=:3 , versionDate=:4 , metadataId=:5 , permissionsId=:6 , workflowId=:7 , isWorkingCopy=:8 , parentFolderId=:9 , relativeOrder=:10 , cachePath=:11 , isRecycled=:12 , recycleRecordId=:13 , workflowComment=:14 , draftUserId=:15 , siteId=:16 , prevVersionId=:17 , nextVersionId=:18 , originalCopyId=:19 , workingCopyId=:20 , displayName=:21 , title=:22 , summary=:23 , teaser=:24 , keywords=:25 , description=:26 , author=:27 , startDate=:28 , endDate=:29 , reviewDate=:30 , metadataSetId=:31 , expirationNoticeSent=:32 , firstExpirationWarningSent=:33 , secondExpirationWarningSent=:34 , expirationFolderId=:35 , maintainAbsoluteLinks=:36 , xmlId=:37 , structuredDataDefinitionId=:38 , pageConfigurationSetId=:39 , pageDefaultConfigurationId=:40 , structuredDataId=:41 , pageStructuredDataVersion=:42 , shouldBeIndexed=:43 , shouldBePublished=:44 , lastDatePublished=:45 , lastPublishedBy=:46 , draftOriginalId=:47 , contentTypeId=:48  where id=:49
    End of information on OTHER waiting sessions.
    Current SQL statement for this session:
    delete from cascade.cxml_structureddata where id=:1

    Mohamed Houri wrote:
    What is important for a foreign key is to be indexed (of course if the parent table is deleted/merged/updated, or if a performance reason imposes it). Wether this index is unique or not doesn't matter (as far as i know).But, you should ask your self the following question : what is the meaning of having a 1 to 1 relationship between a parent and a child table ? if you succeed to create a unique index on your FK then this means that for each PK value corresponds at most one FK value!! Isn't it? is this what you want to have?Thanks, as I mentioned above, cxml_structureddata is actually the child table of cxml_foldercontent with 1 or more records' owningEntityId referring to rows in cxml_foldercontent. The reason for the FK on cxml_foldercontent.structuredDataId is a little ambiguous but it explained above.
    Will a TX-enqueue held on mode X always be waited on by another TX-enqueue row lock X? Or can it be waited on by an Exclusive (X) table lock?Not really clear. Sorry, are you saying my question is unclear or it's not clear why type of eXclusive lock session 542 is trying to acquire in the first line of the trace? Do you think that the exclusive lock being held by session 548 in the first line is on rows in cxml_foldercontent (due to the ON DELETE SET NULL on these child rows) or rows in the cxml_structureddata that it's actually deleting?
    Is there any way for me to tell for certain?
    The first enqueue is a TX (Transaction Enqueue) held by session 548 on mode X (exclusive). This session represents the blocking session. At the same time the locked row is waited on by the blocked session (542) and the wait is on mode X (exclusive). So put it simply, we have here session 542 waiting for session 548 to release it lock (may be by commiting/roll backing). At this step we are not in presence of a deadlock.
    The second line of the deadlock graph shows that session 542 is the blocking session and it is doing a TM enqueue (DML lock) held on SX(Shared eXclusive). While session 548(which is the waiting session) is blocked by session 542 and is waiting on SSX mode.
    Here we see that 548 is blocking session 542 via a TX enqueue and session 542 is blocking session 548 via a TM enqueue ---> That is the deadlock. Oracle will then immediately choose arbitrarlly a victim session (542 or 548) and kill its process letting the remaining session continuing its work.
    That is your situation explained here.Thanks, any idea why session 542 (the DELETE from cxml_structureddata) would be trying to upgrade it's lock to SSX? Is this lock mode required to update a child tables foreign key columns when using an ON DELETE SET NULL trigger? Having read more about SSX, I'm not sure I understand in what cases it's used. Is there a way for me to confirm with 100% certainty specifically which tables in the TM enqueue locks are being held on? Is session 548 definitely trying to acquire an SSX mode on my cxml_foldecontent table or could it be cxml_structureddata table?
    (a) Verify that all your FK are indexed (be carreful that the FK columns should be at the leading edge of the index)Thanks, we've done this already. When you say the "leading edge" you mean for a composite index? These indexes are all single column.
    (b) Verify the logic of the DML against cxml_foldercontentCan you be more specific? Any idea what I'm looking for?

  • Multiple parallel loads into one table with TABLE LOCK option

    Hi everyone:
    We have several SSIS packages where each package has the basic design of having one sequence container. Inside each sequence container can be anywhere from 2 - 9 data flow tasks where for each data is selected from a different table but all 2-9 tasks do
    an OLEDB fast load (with table lock option checked) into the same single destination table.
    The number of rows were pulling from the various sources might be anywhere from 5 up to 100,000.
    Right now this doesn't seem to be causing any issues, but I wanted to check to see if this set up (since we're doing a review) could potentially cause problems down the road?
    We seem to think that each parallel task will acquire its data as normal, and just won't be able to insert until one of the other parallel tasks completes its fast load. To us, that's no big deal as we're at least able to acquire the data in parallel.
    What are everyone's thoughts?
    Thanks!

    >>>We seem to think that each parallel task will acquire its data as normal, and just won't be able to insert
    until one >>>of the other parallel tasks completes its fast load. 
    That is correct observation.
    Best Regards,Uri Dimant SQL Server MVP,
    http://sqlblog.com/blogs/uri_dimant/
    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting:
    Large scale of database and data cleansing
    Remote DBA Services:
    Improves MS SQL Database Performance
    SQL Server Integration Services:
    Business Intelligence

  • Share Table Locks (S)

    Hi All,
    I'm using version - Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod
    Oracle doc(relase 10.2) - A share table lock is acquired automatically for the table specified in the following statement:
    LOCK TABLE table IN SHARE MODE;
    Permitted Operations: A share table lock held by a transaction allows other transactions only to query the table, to lock specific rows with SELECT ... FOR UPDATE, or to run LOCK TABLE ... IN SHARE MODE statements successfully.
    --It means...if table is locked in share mode ,than other transaction can fire <select * from table_name where ... for update> statment.
    the way I have tried...
    Scott_1> lock table t_chk in share mode;
    scott_> select * from t_chk where a = 10 for update; <this stmt waits for scott_1 to fire rollback or commit>
    than Pls let me know what is meaning of --<to lock specific rows with SELECT ... FOR UPDATE> in above explation.
    source -
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14220/consist.htm#sthref1939

    Hi,
    if I understand what you are asking...
    Lock for update tells the database that you have locked your database set for UPDATE purposes.
    So if you attempt to do this with a data set that it is currently being updated then your code fails when it tries to reserve and no updates are done.
    If you do it and some tries to update the same data whilst you have it locked for update, then there update will be pending the completion of yours, and will not be allowed to happen until after you finish.
    If someone else attempts to Lock for Update whilst you have your lock for update then there code will fail and no updates are done by them...
    As for SELECT - as SQL updates are either committed (have happened) or not - then the user will always get a read consistent result, but your locks never prevent their snapshots allowing normal query behaviour.
    Make sense??
    regards,
    Robert.

  • Time out parameter to avoid Table locking

    Hi,
    I am looking at any configurable parameter if any for setting the time out parameter to avoid Table locking.Now what's happening is : If i run select ...for update from one session,oracle is applying a lock till i do a commit.And if i run the same query from another session,it takes unspecified time without returning any error.Using the query with NOWAIT options does not serve my purpose.
    Any help in this regard is appreciated
    Thanks
    Sam

    Are you looking for a way to time out the original query, or are you looking for a way for the second query to wait for some time and then abort if it is unable to lock the row(s)?
    Justin
    Distributed Database Consulting, Inc.
    www.ddbcinc.com

  • Table locking in MS SQL Server

    Hi
    Can anyone help with a locking problem I have. I have a jsp accessing an MS SQL 7 table. The data access has exception handling and the connection and resultset are closed within the finally block, however the table accessed sometimes gets locked preventing any updates to the records. I am using web logics jdbc driver.
    Any help would be appreciated.
    Dave

    A quite wide issue.
    Firstly, if you don't do locks, you may experince the locks other connections (by other programs) have caused.
    If you do your connection with setTarnsactionIsolation( Connection.READ_UNCOMMITTED ), then you should not be influenced by other's locks. But this level is not to be recommended.
    The default is Connection.READ_COMMITTED. In this level - and the higher levels as well - you are prevented from even reading a value which another connection has written, but not yet committed.
    Much more locking influences, if you want to do an update.
    Now, from the transaction logic only that row that is touched would have to be locked. But SQLServer has a kind of "self-deciding" locking behaviour. It starts with row locks, but if certain internal DBMS resources come low, it switches to using page locks and finally even table locks.
    MS claims this as an advantage, my impression. If it is, decide on your own.
    This is all described quite largely in the SQLServer docs.
    We had some large discussions on this here, too. Search for "+lock +sqlserver" to find them.

  • Reliable detect number of occurences (table lock needed or ?)

    Hi all,
    I got an issue with detecting duplicate messages. Database clients process files and messages and create a hash value that is passed on to the database. The database should return the number of occurences of this hash value in the last (e.g) 14 days.
    create table HashHistory ( ID NUMBER,
    MESSAGEHASH VARCHAR2 (20),
    TS TIMESTAMP);
    create sequence SomeSequence;
    insert into HashHistory values (SomeSequence.nextval,'first hash', systimestamp);
    insert into HashHistory values (SomeSequence.nextval,'second hash', systimestamp);
    create or replace procedure DuplDetection  (p_HashIn varchar2,
                                         p_occurences OUT number) AS
    l_timestamp timestamp default systimestamp;                          
    begin
      -- possible exclusive table lock here... lock table HashHistory in exclusive mode;
      insert into HashHistory values (SomeSequence.nextval, p_HashIn, l_timestamp);
      select count (1)
      into p_occurences
      FROM HashHistory
      where MESSAGEHASH = p_HashIn
      and   TS < l_timestamp
      and   TS > l_timestamp-14;
      commit; --to release the table lock if applicable
    end;When this procedure is called by two different machines at the same time with the same new hash value ('third hash'). One session should return 0 while the other should return 1 as number of occurences.... With default Oracle behaviour using row level locks, and executing them in parallel both sessions will not be able to see the others sessions hash values, and both will return 0 occurences. Is an exclusive table lock my only option to enforce this behaviour or can I trust Oracle to handle this correctly?
    I expect 10^6 hashes each day and possible up to 10 or 20 clients running at the same time generating and checking these hash values. What are the changes of both sessions returning the same value without an exclusive table lock (as in this example)? What other parameters would you consider?
    I am on Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi

    Nicosa wrote:
    Hi,
    Wouldn'that work if you do it as follows ?insert into HashHistory values (SomeSequence.nextval, p_hashIn,...);
    commit;
    select count (1)
    into p_occurences
    FROM HashHistory
    where MESSAGEHASH = p_HashIn
    and   TS > l_timestamp-14
    and ID!=SomeSequence.currval;The second session should see that some others existing hash were inserted, and hence an be warned.No, it wouldn't work. Some kind of synchronization is required.
    In multi-threaded environment you cannot predict the order of execution of this program.
    Let say we have a server with only one processor and 3 users (sessions) connected to that server.
    Three users (let say U1, U2 and U3) call this procedure to insert the same hash. The procedure has 3 operations: insert, commit, select,
    and assume theoretically that these 3 operation are atomic (each takes only one processor cycle - in reality each of these operations can consume thousands of cycles).
    Server can execute these calls in this order:
    U1-insert (sequence + 1)
    U1-commit
    U1-select (returns 0)
    U2-insert (sequence + 1)
    U2-commit
    U2-select (returns 1)
    U3-insert (sequence + 1)
    U3-commit
    U3-select (returns 2)
    - in this scenario results will be OK.
    But the order might be:
    U1-insert (sequence + 1)
    U1-commit
    - here server decides to switch to another process/thread
    U2-insert (sequence + 1)
    U2-commit
    - server switches to proccess 3
    U3-insert (sequence + 1)
    U3-commit
    - server switches back to U2
    U2-Select (user 2 sees record commited by U1 and U3 and returns 2)
    - server switches to U3
    U3-Select (user 1 sees record commited by U1 and U2 and returns 2)
    - server switches to U1
    U1 - Select (this also returns 2)
    - results are 2,2,2, but should be 0,1,2
    If 20 users cal this procedure at the same moment with the same hash value, it is even possible that each user gets 19 as the final result,
    but proper results should be 0, 1, 2, 3 .... 19 ;)
    Without some kind of synchronization this a lottery.
    There is also another trap with the sequence - consider this example:
    Session 1
    SQL> create sequence abc;
    Sequence created.
    SQL> select abc.nextval from dual connect by level <=5;
       NEXTVAL
          1
          2
          3
          4
          5
    SQL> select abc.currval from dual;
       CURRVAL
          5Session 2
    SQL> select abc.nextval from dual;
       NEXTVAL
          6
    SQL> select abc.nextval from dual connect by level <=5;
       NEXTVAL
          7
          8
          9
         10
         11
    SQL> select abc.currval from dual;
       CURRVAL
         11Back to session 1
    SQL> select abc.currval from dual;
       CURRVAL
          5What happens in this scenario:
    - user 1 does insert (select nextval from the sequence)
    - user 2,3,4,5,6 ..... 100 call the procedure just 3 microseconds after U1 and do insert (increase the sequence)
    - user 1 retrieve currval from the sequence ?

  • Timesten Table Locking - ttxactadmin

    Hi,
    Point number 1.
    Trace file output
    15:42:41.961   10667 SQL      2L   13C   7866P Preparing: {CALL ttOptSetFlag('RowLock', 0)}
    15:42:41.961   10668 SQL      3L   13C   7866P Executing: {CALL ttOptSetFlag('RowLock', 0)}
    15:42:41.961   10669 SQL      2L   13C   7866P Preparing: {CALL ttOptSetFlag('TblLock', 1)}
    15:42:41.961   10670 SQL      3L   13C   7866P Executing: {CALL ttOptSetFlag('TblLock', 1)}
    15:44:11.013  246101 SQL      3L    1C  23864P Opening: SELECT SMST_SHORT_SELL_FLG, NVL(SM.SMST_INTRADAY_ALLWED_FLG, 'N'), NVL(SM.SMST_MAR_ALLOWD_FLG, 'N'), NVL(SM.SMST_T2_ALLOW_FLG, 'N'), NVL(SM.SMST_COVER_ALLOW_FLG, 'N'), DECODE(:B3 , :B2 , NVL(SM.SMST_RCBM_BASKET_ID, 'NO_BKT'), NVL(SMST_EBM_BASKET_ID, 'NO_BKT')), SM.SMST_ISIN_CODE, SM.SMST_OPEN_POSITION, SM.SMST_EXPOSURE_LIMIT FROM SECURITY_MASTER SM WHERE SMST_SECURITY_ID = :B1
    15:44:11.013  246102 SQL      3L   10C   8041P Executing: update ttrep.reppeers set sendlsnhigh = :h, sendlsnlow = :l, reptableslsnhigh = :rh, reptableslsnlow = :rl, commit_timestamp = :ct, commit_seqnum = :cs, timesend = :t where replication_name = :rname and replication_owner = :rowner and tt_store_id   = :mid and subscriber_id = :sid
    15:44:11.013  246103 SQL      3L    1C  23864P execEnvGet: Allocated new env 8412790936 due to size reqd, nr=52, sdsz=34343
    15:44:11.013  246104 SQL      3L    1C  23864P Opening: SELECT NVL(SUM(TONE_CURR_TRADE_QTY),0), NVL(SUM(TONE_BUY_ORD_QTY),0), NVL(SUM(TONE_SELL_ORD_QTY),0) FROM TRADE_ORD_NET_EXPOSURE WHERE TONE_ENTITY_ID = :B6 AND TONE_SECURITY_ID = :B5 AND TONE_EXCH_ID = :B4 AND TONE_ACC_TYPE = :B3 AND TONE_PRODUCT_ID = :B2 AND TONE_DATE = :B1
    15:44:11.014  246105 SQL      3L   62C  23943P execEnvGet: Allocated new env 8413003648 due to size reqd, nr=47, sdsz=18633
    15:44:11.014  246106 SQL      3L   62C  23943P Opening: select nvl(RQ.RQ_ORDER_NO,0) ,nvl(RQ.RQ_ORD_SERIAL_NO,0) ,trim(RQ.RQ_BUY_SELL_IND) ,trim(RQ.RQ_CLIENT_ID) ,to_number(trim(RQ.RQ_USER_ID)) ,trim(RQ.RQ_ENTITY_ID) ,trim(RQ.RQ_SECURITY_ID) ,trim(RQ.RQ_EXCH_ID) ,RQ.RQ_SEQ_NO ,nvl(RQ.RQ_D2C1_FLAG,'Y') ,nvl(RQ.RQ_FI_RETAIL_FLG,'L') ,nvl(RQ.RQ_OIB_INT_REF_ID,0) ,RQ.RQ_SOURCE_FLAG ,RQ_SESSION_TYPE ,RQ_PRODUCT_ID ,RQ_GROUP_ID ,RQ_HANDL_INST ,RQ_SETTLEMENT_TYPE ,RQ_CLIENT_SUB_TYPE ,RQ_ALGO_OI_NUM into :b1,:b2,:b3,:b4,:b5,:b6,:b7,:b8,:b9,:b10,:b11,:b12,:b13,:b14,:b15,:b16,:b17,:b18,:b19,:b20  from REQUEST_QUEUE RQ where (((RQ.RQ_EXCH_ORDER_NO=:b21 and RQ
    15:44:11.014  246107 SQL      3L    1C  23864P Opening: SELECT RELD_LMT_FLG FROM RMS_ENTITY_LIMIT_DTLS WHERE RELD_EM_ENTITY_ID = :B2 AND RELD_SEGMENT_TYPE = 'C' AND RELD_EXM_EXCH_ID = 'ALL' AND RELD_ACC_TYPE = :B1
    15:44:11.014  246108 SQL      3L    1C  23864P Opening: SELECT SEM_VAR_PERCENTAGE, SEM_EXCH_SPCL_MAR_PCT FROM SECURITY_EXCH_MAP S WHERE SEM_SMST_SECURITY_ID = :B2 AND SEM_EXM_EXCH_ID = :B1 AND SEM_STATUS = 'A' AND SEM_DERIVATIVE_FLG = 'N'
    15:44:11.014  246109 SQL      3L   62C  23943P Opening: select OS_SEQ_NO into :b1  from ORDER_SEQ where OS_ORDER_NO=:b2
    15:44:11.014  246110 SQL      3L    1C  23864P execEnvGet: Allocated new env 8412793368 due to size reqd, nr=108, sdsz=2400
    15:44:11.014  246111 SQL      3L    1C  23864P Opening: SELECT SUM(NVL(TONE_TOT_NET_EXP, 0)), SUM(NVL(TONE_CURR_NET_EXP, 0)), SUM(NVL(TONE_BUY_ORD_QTY, 0)), SUM(NVL(TONE_SELL_ORD_QTY, 0)), SUM(NVL(TONE_CURR_TRADE_QTY, 0)), MAX(TONE_MARGIN_PCT), SUM(TONE_BUY_ORD_VAL), SUM(TONE_SELL_ORD_VAL), SUM(T.TONE_AVG_TRANS_PRICE), SUM(TONE_AVG_CUM_BUY_AMT), SUM(TONE_AVG_CUM_SELL_AMT), SUM(TONE_BUY_EXPOSURE), SUM(TONE_SELL_EXPOSURE), SUM(TONE_CURR_TRADE_VAL), SUM(TONE_BOOKED_PROFIT) FROM TRADE_ORD_NET_EXPOSURE T WHERE TONE_ENTITY_ID = :B7 AND TONE_EXCH_ID = :B6 AND TONE_SECURITY_ID = :B5 AND TONE_TCURR = :B4 AND TONE_ACC_TYPE = :B3 AND TONE_PRODUCT_ID = :B2 AND
    15:44:11.014  246112 SQL      3L   62C  23943P execEnvGet: Allocated new env 8411217112 due to size reqd, nr=121, sdsz=5916
    15:44:11.014  246113 SQL      3L   62C  23943P Opening: select ORD_ORDER_NO ,ORD_SERIAL_NO ,LTRIM(RTRIM(ORD_SEM_SMST_SECURITY_ID)) ,ORD_BTM_EMM_MKT_TYPE ,ORD_EXCH_ID ,LTRIM(RTRIM(ORD_EPM_EM_ENTITY_ID)) ,nvl(ORD_EXCH_ORDER_NO,0) ,nvl(ORD_CLIENT_ID,'0') ,ORD_BUY_SELL_IND ,to_char(ORD_ENTRY_DATE,'DD-MM-YYYY HH24:MI:SS') ,to_char(ORD_ORDER_TIME,'DD-MM-YYYY HH24:MI:SS') ,to_char(ORD_ORIGINAL_TIME,'DD-MM-YYYY HH24:MI:SS') ,ORD_QTY_ORIGINAL ,ORD_ORDER_PRICE ,nvl(ORD_TRIGGER_PRICE,0) ,ORD_DISC_QTY_FLG ,to_char(ORD_GTC_FLG) ,to_char(ORD_DAY_FLG) ,to_char(ORD_IOC_FLG) ,to_char(ORD_MIN_FILL_FLG) ,to_char(nvl(ORD_MKT_FLG,0)) ,to_char(ORD_STOP_LOSS_FLG) ,to_cha
    15:44:11.014  246114 SQL      3L    1C  23864P Executing: UPDATE TRADE_ORD_NET_EXPOSURE SET TONE_BUY_ORD_QTY = TONE_BUY_ORD_QTY + :B17 , TONE_BUY_ORD_VAL = TONE_BUY_ORD_VAL + :B16 , TONE_SELL_ORD_QTY = TONE_SELL_ORD_QTY + :B15 , TONE_SELL_ORD_VAL = TONE_SELL_ORD_VAL + :B14 , TONE_CURR_NET_EXP = TONE_CURR_NET_EXP + :B13 , TONE_TOT_NET_EXP = TONE_TOT_NET_EXP + :B12 , TONE_TOT_BROKERAGE = TONE_TOT_BROKERAGE + :B11 , TONE_BUY_EXPOSURE = TONE_BUY_EXPOSURE + :B10 , TONE_SELL_EXPOSURE = TONE_SELL_EXPOSURE + :B9 WHERE TONE_ENTITY_ID = :B8 AND TONE_EXCH_ID = :B7 AND TONE_SECURITY_ID = :B6 AND TONE_TCURR = :B5 AND TONE_PRODUCT_ID = :B4 AND TONE_ACC_TYPE = :B3
    15:44:11.014  246115 SQL      3L    1C  23864P execEnvGet: Allocated new env 8412792952 due to size reqd, nr=62, sdsz=1994
    15:44:11.014  246116 SQL      3L   10C   8041P Executing: update ttrep.reppeers set sendlsnhigh = :h, sendlsnlow = :l, reptableslsnhigh = :rh, reptableslsnlow = :rl, commit_timestamp = :ct, commit_seqnum = :cs, timesend = :t where replication_name = :rname and replication_owner = :rowner and tt_store_id   = :mid and subscriber_id = :sid
    15:44:11.014  246117 SQL      3L    1C  23864P Executing: UPDATE RMS_ENTITY_LIMIT_DTLS R SET RELD_RTO_EXP = NVL(RELD_RTO_EXP, 0) + :B12 , RELD_NE_EXP = NVL(RELD_NE_EXP, 0) + :B11 , RELD_MAR_UTILIZATION = NVL(RELD_MAR_UTILIZATION, 0) + :B5 , RELD_BROKERAGE_AMT = NVL(RELD_BROKERAGE_AMT, 0) + :B10 , RELD_BUY_EXP = R.RELD_BUY_EXP + :B9 , RELD_SELL_EXP = R.RELD_SELL_EXP + :B8 , RELD_EMARGIN_UTILIZATION = RELD_EMARGIN_UTILIZATION + DECODE(:B7 , :B6 , :B5 , 0) WHERE RELD_EM_ENTITY_ID = :B4 AND R.RELD_EXM_EXCH_ID = :B3 AND R.RELD_SEGMENT_TYPE = 'E' AND R.RELD_ACC_TYPE = :B2 AND R.RELD_PROCESS_ID = :B1
    15:44:11.014  246118 SQL      3L    1C  23864P execEnvGet: Allocated new env 8412793496 due to size reqd, nr=54, sdsz=2524This content is displayed in my trace file
    and o/p of ttxactadmin is
    Program File Name: EquNseParent1
    30486   0x139202b0           54.7002   Active      Database  0x01312d0001312d00   IX    0
                                                       Command   8416780720           S     8416780720
                                                       Row       BMUFVUAAAC2BwAALDe   Xn    8416776768           DAIWAPRODV7.RMS_ENTITY_LIMIT_DTLS
                                                       Row       BMUFVUAAABGEAAABgz   Xn    8416766544           DAIWAPRODV7.RMS_ENTITY_LIMIT_DTLS
                                                       Table     12144968             IXn   8416766544           DAIWAPRODV7.RMS_ENTITY_LIMIT_DTLS
                                                       Row       BMUFVUAAABPEAAAFhL   Xn    8416493904           DAIWAPRODV7.TRADE_ORD_NET_EXPOSURE
                                                       Table     719136               IXn   8416493904           DAIWAPRODV7.TRADE_ORD_NET_EXPOSURE
                                                       Row       BMUFVUAAACoFAAAIBt   Xn    8413989000           DAIWAPRODV7.RMS_SOD_EOD_LOG
                                                       Table     721136               IXn   8413989000           DAIWAPRODV7.RMS_SOD_EOD_LOG
                                                       Command   8419805088           S     8419805088
                                                       Command   8419800256           S     8419800256
                                                       Command   8419759480           S     8419759480
                                                       Command   8412801112           S     8412801112
                               13 locks found for transaction 54.7002As per my understanding of this " Table 12144968 IXn 8416766544" lock is that there is a table lock.
    So we tried setting as per http://docs.oracle.com/cd/E11882_01/timesten.112/e21643/proced.htm#TTREF271
    CALL ttOptSetFlag('RowLock', 1)
    CALL ttOptSetFlag('TblLock', 0)
    but result is still the same.
    22878 0x9555770 151.643 Active Database 0x01312d0001312d00 IX 0
    Row BMUFVUAAAAOJQAAJD2 Xn 6306707440 VSEVEN.RMS_ENTITY_LIMIT_DTLS
    Table 12827064 IXn 6306707440 VSEVEN.RMS_ENTITY_LIMIT_DTLS
    Row BMUFVUAAABbKwAAIDO Xn 6306693872 VSEVEN.TRADE_ORD_NET_EXPOSURE
    Table 719232 IXn 6306693872 VSEVEN.TRADE_ORD_NET_EXPOSURE
    Row BMUFVUAAABqBgAAGj1 Xn 6306573400 VSEVEN.RMS_SOD_EOD_LOG
    Table 12826952 IXn 6306573400 VSEVEN.RMS_SOD_EOD_LOG
    We are facing locking issues degrading our performance. What does ttoptesetflag('TblLock', 1) and ttoptesetflag('TblLock', 0) implies and why is it showing table level locks
    Point number 2.
    Also we run the procedure from backend it takes 1 ms for complete process, where as same when called from proc is taking more than 160 ms
    Point number 3.
    Also as seen in trace file there is frequent statement
    "23864P execEnvGet: Allocated new env 8412790936 due to size reqd, nr=52, sdsz=34343"
    what does it imply..?
    Regards,
    Yogita

    Hi Chris,
    Sorry for the delay.. The Pro*C code snippet is :
    logTimestamp("BEFORE PK_RMS_INTEGRATED_MAIN.PR_RMS_ORDER_MAIN");
            logDebug3("TESTIN db_conn value: %s", db_conn.arr);
            EXEC SQL AT :db_conn EXECUTE
                    BEGIN
                            PK_RMS_INTEGRATED_MAIN.PR_RMS_ORDER_MAIN (
                            rtrim(ltrim(:TempEntityId)),
                            rtrim(ltrim(:TempClientFamilyId)),
                            rtrim(ltrim(:TempEntityType)),
                            :TempClientAccType,
                            :TempSettType,
                            rtrim(ltrim(:TempAccCode)),
                            rtrim(ltrim(:TempClientProdPriv)),
                            rtrim(ltrim(:TempClientId)),
                            rtrim(ltrim(:TempClientProfileId)),
                            :TempClientStatus,
                            rtrim(ltrim(:D2C1ControllerId)),
                            rtrim(ltrim(:TempDealerProfileId)),
                            :TempDealerStatus,
                            rtrim(ltrim(:TempBranchId)),
                            rtrim(ltrim(:TempBranchProfileId)),
                            :TempBranchStatus,
               rtrim(ltrim(:TempBranchId)),
                            rtrim(ltrim(:TempBranchProfileId)),
                            :TempBranchStatus,
                            rtrim(ltrim(:TempBrokerId)),
                            rtrim(ltrim(:TempBrokerProfileId)),
                            :TempBrokerStatus,
                            :RMS_Deact_Entity,
                            :RMS_Status,
                            :RMS_Reason_Id,
                            :TempOrderNo,
                            :TempSerialNo,
                            rtrim(ltrim(:TempExchId)),
                            :TempQtyRemaining,
                            :TempPrice,
                            :TempPrice_Mrg,
                            :old_ord_qty_remaining,
                            :old_price,
                            :Transcode,
                            rtrim(ltrim(:TempBuyOrSell)),
                            rtrim(ltrim(:TempSecurityId)),
                            :SeriesInd,
                            rtrim(ltrim(:TempMktType)),
                            :off_on_order,
                            'F001',
                            rtrim(ltrim(:TempUserId)),
                            :TempProductId,
                            :TempSourceFlag,
                            :BasketOrderNumber,
                            :TempSeqNo,
                            :TempSeqNo_Mrg,
                            :msg_count,
                            :TempUserIdString,
                            :TempUsrMesgString,
                            :RetCode,
                            :RetString
                    END;
            END-EXEC;
    logTimestamp("AFTER PK_RMS_INTEGRATED_MAIN.PR_RMS_ORDER_MAIN");
          if(sqlca.sqlcode !=0)
                    printf("\n 1. Error in execution RMS_MAIN   : %d",sqlca.sqlcode );
                    printf("\n ERROR :%s\n",sqlca.sqlerrm.sqlerrmc) ;
                    /**Added for user friendly_RMS Message for version 3.3***/
                    printf("\n Error is %s : %d",errstr,sqlca.sqlcode);
                    /**Added for user friendly_RMS Message for version 3.3***/
                    sprintf(p_req_out->ind_str[0],RMS_ERROR);
                    EXEC SQL ROLLBACK;               /* ganesh */
                    p_req_out->user_id[0]=p_req->IntReqHeader.UserIdOrLogPktId ;
                    p_req_out->tot_num_user=1;
                    logDebug3("User Id:%d,Tot Num Of User:%d",p_req_out->user_id[0],p_req_out->tot_num_user) ;
                    return (FALSE);
            }logTimestamp function is defined as
    void
    logTimestamp (const char *fmt, ...)
            va_list ap;
            va_start(ap, fmt);
        CHAR buffer[LOG_TIMESTAMP_LENGTH];
            CHAR chktime[DATE_LEN];
        static CHAR message[LOG_BUFFER_LENGTH];
            struct timeval tv;
            time_t curtime;
            gettimeofday(&tv, NULL);
            curtime=tv.tv_sec;
           strftime(chktime, DATE_LEN, "%d:%m:%Y", localtime(&curtime));
            if ( strcmp(chktime,logTime))
                    logLevelSet = 0;
            strftime(buffer, LOG_TIMESTAMP_LENGTH, "%d:%m:%Y %T", localtime(&curtime));
            vsprintf(message, fmt, ap);
        fprintf(stdout, "%s.%06ld: %s\n", buffer, tv.tv_usec, message);
            va_end(ap);
        return;
    }Can you point us towards some documentation towards the impact of using memorylock=4 for linux ?
    Regards,
    Karan

  • Best table lock suggested ??

    hi,
    i have a scenario as follows:
    i am developing a custom transaction, dialog based, basically to perform add/modify/delete data from custom tables. Multiple users can login and try to work on the data, one can add records to the same table and another can modify teh records of the same table. So whats the best kind of table lock to be used ? and how to hande that ?
    thks

    Hi,
    For Locking look at the below code
      DATA: l_v_locktab   TYPE tabname,
            l_v_funcname  TYPE rs38l_fnam,
            l_v_noobj     TYPE flag,
            l_v_garg      TYPE eqegraarg,
            l_i_enq       TYPE STANDARD TABLE OF seqg3.
      IF rb_upd = space.
        EXIT.
      ENDIF.
      l_v_locktab = fp_table.
      CASE l_v_locktab.
        WHEN 'LIPS'.
          l_v_locktab = 'LIKP'.
        WHEN 'VBAP'.
          l_v_locktab = 'VBAK'.
        WHEN 'VBRP'.
          l_v_locktab = 'VBRK'.
        WHEN 'PLPO'.
          l_v_locktab = 'PLKO'.
      ENDCASE.
    * Search Lock objects for the table
      SELECT viewname FROM dd25l INTO v_lockobj
             UP TO 1 ROWS
             WHERE aggtype = 'E'
             AND   roottab = l_v_locktab.
      ENDSELECT.
      IF sy-subrc = 0.
        CONCATENATE 'ENQUEUE_' v_lockobj INTO l_v_funcname.
    *   Check if the  Enqueue function is OK
        SELECT SINGLE funcname FROM tfdir INTO l_v_funcname
                      WHERE funcname = l_v_funcname.
        IF sy-subrc = 0.
          CALL FUNCTION l_v_funcname
    *       EXPORTING
    *         MANDT                = SY-MANDT
    *         _SCOPE               = '2'
    *         _WAIT                = ' '
    *         _COLLECT             = ' '
           EXCEPTIONS
             foreign_lock         = 1
             system_failure       = 2
             OTHERS               = 3
          IF sy-subrc <> 0.
            MESSAGE ID sy-msgid TYPE 'I' NUMBER sy-msgno
                    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
            LEAVE LIST-PROCESSING.
          ENDIF.
        ELSE.
          CLEAR v_lockobj.
          l_v_noobj = 'X'.
        ENDIF.
      ELSE.
        CLEAR v_lockobj.
        l_v_noobj = 'X'.
      ENDIF.
    *   If No lock object is found for the table, do a general check.
    *   Read Locks
      IF l_v_noobj = 'X'.
        CALL FUNCTION 'ENQUEUE_READ'
         EXPORTING
            gname                       = fp_table
    *       GARG                        = ' '
            guname                      = space
    *       LOCAL                       = ' '
    *     IMPORTING
    *       NUMBER                      =
    *       SUBRC                       =
          TABLES
            enq                         = l_i_enq
         EXCEPTIONS
           communication_failure       = 1
           system_failure              = 2
           OTHERS                      = 3
        IF l_i_enq[] IS NOT INITIAL.
          MESSAGE i023.
          LEAVE LIST-PROCESSING.
        ELSE.
          CONCATENATE fp_table '*' INTO l_v_garg.
          CALL FUNCTION 'ENQUEUE_READ'
           EXPORTING
              gname                       = 'RSTABLE'
              garg                        = l_v_garg
              guname                      = space
    *         LOCAL                       = ' '
    *       IMPORTING
    *         NUMBER                      =
    *         SUBRC                       =
            TABLES
              enq                         = l_i_enq
           EXCEPTIONS
             communication_failure       = 1
             system_failure              = 2
             OTHERS                      = 3.
          IF l_i_enq[] IS NOT INITIAL.
            MESSAGE i023.
            LEAVE LIST-PROCESSING.
          ENDIF.
        ENDIF.
    * if No Lock exists. Do a common lock
        CALL FUNCTION 'ENQUEUE_E_TABLE'
         EXPORTING
    *      MODE_RSTABLE         = 'E'
           tabname              = fp_table
    *      VARKEY               =
    *      X_TABNAME            = ' '
    *      X_VARKEY             = ' '
    *      _SCOPE               = '2'
    *      _WAIT                = ' '
    *      _COLLECT             = ' '
         EXCEPTIONS
           foreign_lock         = 1
           system_failure       = 2
           OTHERS               = 3
        IF sy-subrc <> 0.
          MESSAGE ID sy-msgid TYPE 'I' NUMBER sy-msgno
                  WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
          LEAVE LIST-PROCESSING.
        ENDIF.
      ENDIF.
    for unlocking
      DATA: l_v_funcname  TYPE rs38l_fnam.
      IF v_lockobj NE space.
    *   if Lock Object is available
        CONCATENATE 'DEQUEUE_' v_lockobj INTO l_v_funcname.
    *   Check if the  Dequeue function is OK
        SELECT SINGLE funcname FROM tfdir INTO l_v_funcname
                      WHERE funcname = l_v_funcname.
        IF sy-subrc = 0.
          CALL FUNCTION l_v_funcname.
        ENDIF.
      ELSE.
    *  Do a common Unlock
        CALL FUNCTION 'DEQUEUE_E_TABLE'
         EXPORTING
    *     MODE_RSTABLE       = 'E'
          tabname            = fp_table
    *     VARKEY             =
    *     X_TABNAME          = ' '
    *     X_VARKEY           = ' '
    *     _SCOPE             = '3'
    *     _SYNCHRON          = ' '
    *     _COLLECT           = ' '
      ENDIF.
    Shreekant

  • Custom Scenario requiring table Lock - Please Suggest

    Hi ,
    Custom usecase :
    There exist a table with following column :
    FileName, LastUpdatedBy, ApprovedBy, DisapprovedBy, LogicallyDeleted, FileDescription, Col2
    Primary Key - ( FileName, LastUpdatedBy,ApprovedBy)
    Constraint : FileName,lastUpdatedBy,ApprovedBy cannot be null. Default values for LastUpdatedBy, ApprovedBy, DisapprovedBy is NONE, and LogicallyDeleted is N.
    Note : User should not be allowed to create more that two records for same fileName.
    Edit functionality required on UI : On editing a record, a copy of the row should be created with same fileName , LastUpdatedBy with userId of logged in User.
    How should I restrict user from doing the following :
    Two users open the UI. Selected same record to edit. At time of commit only record for one should get commited, while for other it should not happen as 2 records gets created for same file name as soon as commit is done for one user.
    Do i need to have table lock, then count row with a particular file name and if count >2 then commit else throw some exception. And if this is needs to be done than which method should be overridden to do that.
    Thanks,
    Rajdeep

    Hi
    To Shay : ( You can define a new method validation at the entity level to do the check for you. http://docs.oracle.com/cd/E16162_01/web.1112/e16182/bcvalidation.htm#CACGFEDC )
    From my post : - Where should that logic can be implemented in ADF BC and what logic ( anything different from what I mentioned in post ) ?
    If I am going to write validation in custom method at entity level, I think it is not handling the scenario properly. For example : Query for Count on fileName records is fired in validator method for two entities before the commit is happening for any of the two.
    Also What logic : do you agree with table lock logic requirement here ?
    To Santosh,
    I think you didn't got the scenario. It does not talk about two user doing normal edit on same record. Notice two facts mentioned in post :
    1. When a user selects a record to edit... he is not actually editing it. We create a copy of the row ( with FileName , LastUpdatedBy,ApprovedBy,LogicallyDeleted as readOnly and prepopulated with sameFileName as original record, UserId in LastUpdatedBy, NONE defaults for Approved by and Disapproved By , N default for LogicallyDeleted) launched in popup. Popup has two buttons ... save and cancel. On cancel we rollback transaction ( i.e. deletes the newly created copy ) and Save ... eventually commits the row.
    2. Not more two records should get created in table for same fileName. So two users trying to edit same record will eventually try to create the 3 records in database table. It should fail for 3rd one...
    What logic should be written ... Does it really need the table lock ? Etc
    Thanks,
    Rajdeep

  • Deactivate table locks for SAP courses

    Hello,
    when visiting SAP courses in Walldorf, I observed that it was possible that all participants where able to maintain the same customizing table without getting informed that the table is locked.
    How can this behaviour be achived? Usually only one user is able to maintain a table at a time, however, especially for SAP courses it would be great to deactivate this.
    Any ideas?
    Thanks & regards
    Wolfgang

    Hello all,
    if this is still interesting for someone:
    I found this page http://****************/Tutorials/ABAP/Lock/Page1.htm where they explain how to create a special report that will call the customizing view for a specific table in a different mode.
    The report will delete the general table lock and create row-based locks (based on key fields) instead, allowing at least several users to work with the same table - as long as they edit entries that have different key fields.
    I haven't tried it yet, but it looks promising...
    Best regards
    Tobias

  • Configuring profile parameter for a table lock object

    Hi Experts-
      I want to set the 'wait time' (_WAIT) parameter as a profile parameter for a table lock object.
      I have created a lock object on a ZTable. I lock and unlock this object in exclusive non-cumulative mode through the enqueue and dequeue lock object function modules. These generated FMs are invoked via my custom function module.
      My function module will run in the background as a scheduled task in R/3. I execute the Enqueue FM at the start of the FM and keep the table locked until the last step finishes in my FM and then I Dequeue it. I want to have the processing wait and retry the Enqueuring FM at set intervals in case the one run doesn't finish entirely and a new run of this same job kicks off.
    Thank you,
    - Vik.

    Set the wait parameter = 'X'.  These means that if it encounters a lock, then it will wait a certain time for the lock to be released.  This certain time is a system value set by your basis team.  I don't imagine it being a very long time.
      CALL FUNCTION 'ENQUEUE_EZPIPHYINVREF'
           EXPORTING
                MODE_ZPIPHYINVREF = 'E'
                MANDT             = SY-MANDT
                _WAIT             = 'X'.
    Regards,
    Rich Heilman

  • How to release table locks?

    I was running Data Services (4.0 SP2) to load data into Hana (1.0 SP2 patch 20) using the Bulk load option. Apparently, the DS process hung and now the table I was writing to is locked although the DS Job is dead. How do you release the table lock without restarting Hana DB?

    Hello Sachin,
    you could try these statements. The first one will cancel the currently executed operation, the second one will disconnect the idle session:
    ALTER SYSTEM CANCEL SESSION session_id;
    ALTER SYSTEM DISCONNECT SESSION session_id;
    Regards,
    Mark

  • Disk space transaction  and temp table lock  in oracle

    Hi,
    Today many sessions used to get disk space transaction lock and temp table lock and i am seeing these locks first time in my Production database,
    is there any workaround to avoid this contension.
    Thanks
    Prakash GR

    Post your version (all 3 decimal places).
    Post the SELECT statement and results that have led you to this conclusion.
    Other than the fact that you have seen a number what, precisely, is the issue.

  • Table Lock DB2

    Hello All,
    Just wanted some advice, here is my situation.
    I have a message driven bean which i want to ensure i only receive once.
    So i am storing the MDB id's in a DB2 Database.
    (simple table that just stores MDB id's plus some other mdb data)
    I would like to do a table lock to keep MDB reading/inserting consistency. In my transaction I would be.
    check if the id is there already and an insert if its not.
    I think I can use a select for update in DB2 but i have also been reading about setting isolation type of TRANSACTION_SERIALIZABLE. Which would be the best approach?

    also just found another DB2 SQL statment LOCK TABLE not sure if this is another good soultion.

Maybe you are looking for