Question On Table Locks

Hello,
I have a question on locks.
USER A runs a batch job of insert statements have 100000 records and does a commit after every 1000 records.
USER B is also running a batch job on similar tables and is blocked due to locks held by USER A
I have identified that USER A is blocking USER B and now i need USER B to continue with the batch job. My question is that i need to kill the USER A's session without making him lose all the data he already inserted. In short as SYS can i commit his inserted transactions on his behalf.
I assume if I kill his session he will lose all the INSERTS he performed since he hasnt commited until that point.
Please Help.

is there any way i could save the INSERTED transcations of USER A.No. User A commits or User A is killed and rolls back.
i'm also confused about this type of lock i seeIf you supply details of what the sessions are waiting on / locks held, then this will clarify.
do u suggest i commit every 500 records No. In general, you should commit at the end of a transaction - all or nothing. Committing every X is nasty.
a lot of refrential constariants with other tables and this could be causing the lockYou can get locking problems with unindexed foreign keys.
If you could provide more details of what's going on in both sessions / what they're waiting on this should clarify.

Similar Messages

  • Question about Table Locks

    Hi All,
    Is there any Oracle defined table/place from where we can know the details about Tables that have been locked in the current session?
    Thank you.

    Hi ,
    To know which all objects are locked, you can use the below query :-
    COLUMN owner FORMAT A20
    COLUMN username FORMAT A20
    COLUMN object_owner FORMAT A20
    COLUMN object_name FORMAT A30
    COLUMN locked_mode FORMAT A15
    SELECT b.session_id AS sid,
           NVL(b.oracle_username, '(oracle)') AS username,
           a.owner AS object_owner,
           a.object_name,
           Decode(b.locked_mode, 0, 'None',
                                 1, 'Null (NULL)',
                                 2, 'Row-S (SS)',
                                 3, 'Row-X (SX)',
                                 4, 'Share (S)',
                                 5, 'S/Row-X (SSX)',
                                 6, 'Exclusive (X)',
                                 b.locked_mode) locked_mode,
           b.os_user_name
    FROM   dba_objects a,
           v$locked_object b
    WHERE  a.object_id = b.object_id
    ORDER BY 1, 2, 3, 4;Anand

  • About session abnormal termination, table locked question.

    Hi all,
    i test some table lock,after i run this statement:
    select * from testt for update nowait;
    i abnormal terminate session, then the table testt will be locking until after 20 minutes,
    i checked some document, the parameter of SQLNET.EXPIRE_TIME = 5 in sqlnet.ora file can release that lock, i set with 5,and then test again, but still wait 20 minutes the lock can release, why?

    I've changed this now to use the URL variable. I am used to using that to go from a results page to a details page where the recordset on the details page is used. I hadn't realised that you could just set a link to:
    <a href="addNomination.php?LodgeID=<?php echo($_GET['LodgeID']); ?>">Add Nomination</a>
    where there is no recordset on a page, just for the purposes of passing the variable. (Yeah, I know - this is probably really basic!)
    I do have one last question on this though - my form action is:
    <form method="post" id="form1" action="<?php echo KT_escapeAttribute(KT_getFullUri()); ?>">
    And then the link to a NominationAdded page is in the php code at the top of the AddNomination page:
    $ins_nominations->registerTrigger("END", "Trigger_Default_Redirect", 99, "NominationAdded.php");
    What would be useful would be to pass the URL variable through again, so that on the NominationAdded page I can have a link back to the same Lodge to add another Nomination without finding the Lodge again.
    But I'm not sure what the syntax would be, as it included some PHP within existing PHP, so not just:
    $ins_nominations->registerTrigger("END", "Trigger_Default_Redirect", 99, "nominationAdded.php?LodgeID=echo($_GET['LodgeID'])");
    I assume this must be possible, but not sure of the exact syntax?

  • 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?

  • Basic questions on row locks

    Oracle 11.0.1.7
    I just have a basic question about locks. What happens when 2 transactions at the same time try to delete the row? Does one get the row and other wouldn't? Is there a implicit locks that oracle takes care of?
    Could you also point me to some examples or source.

    That is what I have seen with for update and thought for update is for. But when I look at the oracle docs this is what it says. And what's confusing is "Permitted Operations" piece. It says other transactions can query, update etc.
    A row exclusive table lock (also called a subexclusive table lock, SX) generally indicates that the transaction holding the lock has made one or more updates to rows in the table or issued SELECT ... FOR UPDATE. A row exclusive table lock is acquired automatically for a table modified by the following types of statements:
    SELECT ... FROM table ... FOR UPDATE OF ...;
    INSERT INTO table ... ;
    UPDATE table ... ;
    DELETE FROM table ... ; 
    LOCK TABLE table IN ROW EXCLUSIVE MODE;
    A row exclusive table lock is slightly more restrictive than a row share table lock.
    Permitted Operations: A row exclusive table lock held by a transaction allows other transactions to query, insert, update, delete, or lock rows concurrently in the same table. Therefore, row exclusive table locks allow multiple transactions to obtain simultaneous row exclusive and row share table locks for the same table.
    Prohibited Operations: A row exclusive table lock held by a transaction prevents other transactions from manually locking the table for exclusive reading or writing. Therefore, other transactions cannot concurrently lock the table using the following statements:
    LOCK TABLE table IN SHARE MODE; 
    LOCK TABLE table IN SHARE ROW EXCLUSIVE MODE;
    LOCK TABLE table IN EXCLUSIVE MODE;

  • Why my question thread is locked?

    I found that my question thread is locked, why?
    Hi Guys,
    Here are two questions about ABAP.
    (1)
    UML provides various diagram types. Mark the valid UML diagrams
    (More than one answer is correct)
    1 Aggregation
    2 Composition
    3 Class
    4 Component
    5 Behavior
    I think the correct answers are (1) (2) (3). But the standard answers are (3)(4)(5).
    Why?
    (2)
    Mark the valid logical nodes.
    (More than one answer is correct)
    1 Node
    2 Table
    3 Structure
    4 Complex Data Object
    5 File
    The standard answers are (2) (3) (4). Can anybody explain it in details?
    Thanks.
    Edited by: Michael on Jan 29, 2008 3:36 PM

    Hi Micheal,
    The answer for the first question is:
    1)
    Firstly Aggregation & Composition are types of relationships and they are part of an UML Diagram used to connect the various classes/parts of that specific diagram.
    They are not the actual diagrams
    The remainig three options
    Class,
    Component &
    Behavioural are the UML Diagrams, which contain the various classes,components, packages etc.
    Hence the options 3,4,5 are correct.
    The UML Diagrams are categorized as
    Structural and Behavioural Diagrams.
    Under Structural Diagrams
    Class Diagram
    Object Diagram
    Component Diagram
    Deployment Diagram
    Under Behavioral Diagrams
    Use Case Diagram
    Sequence Diagram
    Collaboration Diagram
    Statechart Diagram
    Activity Diagram
    If you are still not clear then please go through the below link which clearly shows  the various relations existing and about the UML Diagrams.
    [http://www.dotnetcoders.com/web/learning/uml/diagrams/classdiagram.aspx]
    Reward if useful,
    Sravani.

  • 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.

  • Simple question about table structure and HR in BW

    i need to following data from HR:
    current FTE, employee number, cost place
    i dont think the current FTE is stored per employee. Therefor is would need a list that contains:
    mutation start date, mutation end date, FTE, employee, cost place
    i think cost place is a custom field.
    my question : what tables names and field names do i need?
    Thanks in advanced

    Hi,
    For Head Count you can use 0HR_PA_0 datasource and the other Employee details like start date and end date you can get them from employee master data and FTE can be calculated from the Emloyee Master Data and Head count data.
    Hope this helps...
    Thanks,

  • 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

  • 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

  • How can I create a matrix question? Specifically, I need a question in table format that allows each respondent to list a number of events and then data for each event (date, location, number of participants, topics covered, etc.

    How can I create a matrix question? Specifically, I need a question in table format that allows each respondent to list a number of events and then data for each event (date, location, number of participants, topics covered, etc.

    Hi,
    Sorry, we do not support a matrix-question field.   Please try the multilines text field (where your participant can enter multiple lines in the input text box) and see if it works for you.
    Thanks,
    Lucia

  • 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

  • Calling one form from another

    hi im trying to open another form from an exixting form by clicking on a button. so i hae used the when button pressed trigger and inserted: open_form(customerform); it has complied fine but when i run the form and press thr button this error comes u

  • Invoice Correction Request- Both the lines with G2N

    Hi I  am facing a problem while using a standard invoice correction request with reference to billing document. In the standard SAP, there should be 2 line items created one with item category G2N and one with item category L2N which we can change th

  • ITunes Moving Information box

    I have iTunes 6.0.1 (3) and when I'm listening to music there is a new feature of a central info box with track details and the album art (don't know the official title) but it doesn't always display the album art? (have checked its definitely there)

  • Datamart using stock cube

    Hi experts, I have a stock cube which is compressed and having marker update till today. Now I am trying to do datamart using this cube. Is it possible to do datamart with the cube which is compressed and having marker update. suggest me the procedur

  • FCPX 10.1 Error message: Argument invalid

    When I launched FCPX with new upgrade this morning, my external hard drive with most every fcp project and event was on line. I was asked from launch to upgrade projects and events. I said ok. From then on, all I get is an error message, saying argum