Solved

Deadlocks , Rollbacks and Undo

Posted on 2013-11-08
4
378 Views
Last Modified: 2013-11-10
Do rollbacks have any impact on undo activity when Oracle is attempting to break a deadlock?
0
Comment
Question by:xoxomos
  • 2
4 Comments
 
LVL 15

Assisted Solution

by:Franck Pachot
Franck Pachot earned 250 total points
ID: 39635855
Hi,
Yes, when a deadlock is detected by Oracle one of the sessions is terminated (killed) and has to rollback what was done in the transaction. That reads undo, applies changes and generate redo.
Regards,
Franck.
0
 
LVL 35

Accepted Solution

by:
Mark Geerlings earned 250 total points
ID: 39636442
Oracle uses the rollback (or undo) segments to read the information that must be applied to "rollback" the uncommitted changes in one of the two sessions when a dealock occurs.  In earlier versions of Oracle (Oracle8 and earlier) there were only rollback segments.  Starting with Oracle9, the default now is to use undo segments instead, but they function similarly (at least as far as we are concerned as users of Oracle.  There are some technical differences.)

Keep in mind that deadlocks are not caused by database bugs.  They indicate application design flaws or inconsitencies.  They happen when two users (or processes) lock records from the same two tables, but in the opposite order.  For example, is user A starts by changing an order header, then tries to change some lines for that order, while user B started changing sone lines for that same order, then tries to change the order header.  At that point, the database recognizes a deadlock, and will terminate one of these sessions, and rollback the change(s) that session had made, but not saved.  This allows the other session to proceed and save its changes.
0
 
LVL 15

Expert Comment

by:Franck Pachot
ID: 39636779
Keep in mind that deadlocks are not caused by database bugs.  They indicate application design flaws or inconsitencies.
Warning: that applies only to application locks (TM table locks and TX row locks). There are a lot of bugs where a deadloack occurs for other internal locks !
0
 

Author Closing Comment

by:xoxomos
ID: 39637075
mil gracias
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Can i Import Access Table Into Oracle Using Toad 36 229
SQL Developer 6 62
oracle DR - data guard failover. 18 48
Fill Null values 5 28
Working with Network Access Control Lists in Oracle 11g (part 1) Part 2: http://www.e-e.com/A_9074.html So, you upgraded to a shiny new 11g database and all of a sudden every program that used UTL_MAIL, UTL_SMTP, UTL_TCP, UTL_HTTP or any oth…
How to Create User-Defined Aggregates in Oracle Before we begin creating these things, what are user-defined aggregates?  They are a feature introduced in Oracle 9i that allows a developer to create his or her own functions like "SUM", "AVG", and…
This video explains at a high level about the four available data types in Oracle and how dates can be manipulated by the user to get data into and out of the database.
This video shows how to copy an entire tablespace from one database to another database using Transportable Tablespace functionality.

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question