Nonrepeatable reads & phantom reads

hi
whats the difference nonrepetable(fuzzy) read & phantom read phenomena.
from the docs i undertand they both are same but non repetable reads signify that
modified or deleted rows committed by other transactions can be seen by the same query
when run again
whereas in case of phantom read when the query is run again for the second time
it can see newly inserted rows committed by other transactions.
Correct me if i am wrong. If possible illustrate with an example.
bye
Sushant

Non-Repeatable reads: When a row is updated in database. 2 reads may not return same data.
Phantom reads is where a new row is inserted into the database, hence the 2 selects may not return same set of data.
Chekc the link below for example queies. hope it helps.
http://en.wikipedia.org/wiki/Isolation_(computer_science)
#Phantom_Reads

Similar Messages

  • Nonrepeatable Reads and Phantom Reads

    Guys, I am very confuse about the definitions of Nonrepeatable Reads and Phantom Reads when I read the BEA Documentaion in http://e-docs.bea.com/workshop/docs81/doc/en/wls/guide/advanced/EJBsAndTransactions.html
    The definition was queit confusing to me because they seems to describe the same thing, but it is obviously not the same thing. The problem is to see the difference among then.
    What is that difference? Could I have an practical example of that difference?
    Thanks everyone

    Non-Repeatable reads: When a row is updated in database. 2 reads may not return same data.
    Phantom reads is where a new row is inserted into the database, hence the 2 selects may not return same set of data.
    Chekc the link below for example queies. hope it helps.
    http://en.wikipedia.org/wiki/Isolation_(computer_science)
    #Phantom_Reads

  • Read committed isolation level must not produce nonrepeatable read

    Hi,
    I am sql server DBA. But i am trying to improve myself in oracle too.
    I read isolation levels in oracle. And it says, In read committed isolation level , oracle guarantees the result set that contains committed records at the beginning of reading operation.
    İf it is guaranteed , how does nonrepeatable read can occur? It must not occur then.
    I think , I misunderstood something .
    can you explain me?
    Thanks

    >
    I read isolation levels in oracle. And it says, In read committed isolation level , oracle guarantees the result set that contains committed records at the beginning of reading operation.
    İf it is guaranteed , how does nonrepeatable read can occur? It must not occur then.
    >
    See the 'Multiversion Concurrency Control' section in the database concepts doc. It discusses this and has a simple diagram (can't post it) that shows it.
    http://docs.oracle.com/cd/B28359_01/server.111/b28318/consist.htm
    >
    As a query enters the execution stage, the current system change number (SCN) is determined. In Figure 13-1, this system change number is 10023. As data blocks are read on behalf of the query, only blocks written with the observed SCN are used. Blocks with changed data (more recent SCNs) are reconstructed from data in the rollback segments, and the reconstructed data is returned for the query. Therefore, each query returns all committed data with respect to the SCN recorded at the time that query execution began. Changes of other transactions that occur during a query's execution are not observed, guaranteeing that consistent data is returned for each query.
    Statement-Level Read Consistency
    Oracle Database always enforces statement-level read consistency. This guarantees that all the data returned by a single query comes from a single point in time—the time that the query began. Therefore, a query never sees dirty data or any of the changes made by transactions that commit during query execution. As query execution proceeds, only data committed before the query began is visible to the query. The query does not see changes committed after statement execution begins.
    >
    The first sentence is the key:
    >
    As a query enters the execution stage, the current system change number (SCN) is determined.
    >
    Oracle will only query data AS OF that SCN that was determined.
    If you now rerun the query Oracle repeats the process: it determines the SCN again which could be newer if other users have committed changes.
    That second execution of the query may find that some rows have been modified or even deleted and that new rows have been inserted: nonrepeatable read.
    If you use the SERIALIZABLE isolation level then that second query will use the SCN that was determined at the very START of the transaction. For the simple example above it means the second query would use the SAME SCN that the first query used: so the same data would be returned.
    Table 13-2 in that doc (a few pages down) lists the isolation levels
    >
    Read committed
    This is the default transaction isolation level. Each query executed by a transaction sees only data that was committed before the query (not the transaction) began. An Oracle Database query never reads dirty (uncommitted) data.
    Because Oracle Database does not prevent other transactions from modifying the data read by a query, that data can be changed by other transactions between two executions of the query. Thus, a transaction that runs a given query twice can experience both nonrepeatable read and phantoms.

  • Isolation level in cftransaction

    Hi all,
    We have been using cftransaction on our transaction process page where we need to do multiple insert queries to save transaction data.  If there is no error, we commit the transaction.  Once in a while though, we get the error message "Transaction was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction."  We are on SQL Server 2005.
    What I understand from that error message is that there are multiple transactions trying to access the same tables at the same time.  Implicitly, one transaction has locked the tables while it is inserting data, and other transactions are not able to access them.
    Now I don't fully understand cftransaction beyond its commit / rollback functionality.  I never quite understood the isolationLevel attribute of cftransaction.  I have read a number of descriptions, but the terms dirty read, phantom data, nonrepeatable reads are still confusing to me.  What I do understand is that unless we specify isolationLevel = serializable in a transaction, it is not locking the tables it is accessing.  In our use of cftransaction, we don't specify the isolationLevel attribute ( I believe the default is read committed .)
    So here are my questions:
    1.  If we don't specify any isolation level, why are we getting deadlock transactions?
    2.  If we do want to lock the tables using isolationLevel = serializable, does a concurrent transaction trying to use the same tables automatically get deadlocked?  Or is there a mechanism to specify timeout ala cflock timeout attribute?
    I'd appreciate someone clearing up my understanding of cftransaction.  Thanks!

    I know this is an old post, but I have had the same questions recently and based on my recent findings, have attempted to answer your questions below for anyone in the future:
    1.  If we don't specify any isolation level, why are we getting deadlock transactions?
    The reason this could be happening is because the cftransaction tag will use the default isolation level of your database. For SQL Server this is usually Read Committed. However, it is important to note that, "Choosing a transaction isolation level does not affect the locks acquired to protect data modifications. A transaction always gets an exclusive lock on any data it modifies, and holds that lock until the transaction completes, regardless of the isolation level set for that transaction. For read operations, transaction isolation levels primarily define the level of protection from the effects of modifications made by other transactions." This quote is taken directly from the MS SQL Server site. I understand this by stating that if you are doing a read, the isolation level determines the quality and/or quantity of the data returned from the read. If you are doing data modifications, the transaction will always get an exclusive lock on any data being modified. The cftransaction tag can control when it is committed based on its placement, but does not control the data modification isolation levels.
    2.  If we do want to lock the tables using isolationLevel = serializable, does a concurrent transaction trying to use the same tables automatically get deadlocked?  Or is there a mechanism to specify timeout ala cflock timeout attribute?
    The first question helps to answer this second one. The isolation level attribute (serializable or other) applies to the level of protection read operations will receive from other transactions' modifications. It does not effect on the locks aquired to protect data modifications. This is controlled by the database itself. The cflock tag only applies to CF meaning it ensures single thread access to that code (e.g. application, session or server variables), not to the database.
    I hope this helps someone in the future and that I have not misstated anything. If anyone can provide better clarification please do so.

  • Understanding isolation levels

    I'm having a difficult time understanding isolation levels. I know what problems each isolation level solves (i.e. dirty reads, nonrepeatable reads, phantom reads) and the classic textbook description of each level, but I simply cannot understand how it works. Let me explain my understanding of the various isolation levels:
    READ_UNCOMMITTED:
    The data read by TX 1 is held in a read lock, correct? TX 1 modifies the data. TX 2 therefore can read that data (but cannot write to it, due to the read lock). TX 2 can therefore read uncommitted data.
    READ_COMMITTED:
    The data read by TX 1 is held in a write lock, correct? TX 1 modifies the data. TX 2 cannot read the data because of the write lock, hence solving the dirty read problem. It cannot read the data TX 1 has so much as read during the course of its transaction (true?).
    REPEATABLE_READ:
    This is the biggest source of my confusion. How is it that the nonrepeatable read problem is not solved by READ_COMMITTED? TX 1 reads some data, TX 2 cannot read that data due to the read lock...but somehow it manages to modify TX 1's data so that when TX 1 repeats its query, it gets different results? How is this possible? And apart from the read and write lock of the two previous isolation levels, what does the database do to enforce this new isolation level on top of the other two?
    SERIALIZABLE:
    TX 2 cannot do anything without TX 1 finishing. (But isn't this similar to READ_COMMITTED, whereby TX 2 cannot even read TX 1's data until it has committed.) What is being meant by sequential execution here?
    I think a source of confusion is that I am unaware of whether isolation levels are applied to an entire database, to a transaction, to a query, or some other category. Can one transaction have one isolation level while another transaction has another isolation level?
    Any insight into isolation levels would be appreciated. Thanks.

    It depends upon the database implementation - there are various different ways to solve the problem.
    I think a source of confusion is that I am unaware of whether isolation levels are applied to an entire database, to a transaction, to a query, or some other category.
    By definition the isolation levels are applied to the transaction. Other transactions can have other isolation levels.

  • TRANSACTION_REPEATABLE_READ???   TRANSACTION_SERIALIZABLE???

              I went through the documentation for isolation levels TRANSACTION_REPEATABLE_READ
              and TRANSACTION_SERIALIZABLE. But i am not getting a clear picture of what they
              really mean. It apprears like, Looks like TRANSACTION_READ_COMMITTED already covers
              TRANSACTION_REPEATABLE_READ. Also not sure when do we use TRANSACTION_REPEATABLE_READ
              and TRANSACTION_SERIALIZABLE.
              I've asked lot of people, i didn't get a clear explanation. Can a transaction
              "Guru" throw some light on it?
              thanks,
              Jegan
              Sembium Corporation
              

    Jegan, I'm no guru, but thought that this might help:
              TRANSACTION_SERIALIZABLE
              This level prohibits all of the following types of reads:
              Dirty reads, where a transaction reads a database row containing uncommitted
              changes from a second transaction.
              Nonrepeatable reads, where one transaction reads a row, a second transaction
              changes the same row, and the first transaction rereads the row and gets a
              different value.
              Phantom reads, where one transaction reads all rows that satisfy an SQL
              WHERE condition, a second transaction inserts a row that also satisfies the
              WHERE condition, and the first transaction applies the same WHERE condition
              and gets the row inserted by the second transaction.
              TRANSACTION_REPEATABLE_READ
              This level prohibits dirty reads and nonrepeatable reads, but it allows
              phantom reads.
              TRANSACTION_READ_COMMITTED
              This level prohibits dirty reads, but allows nonrepeatable reads and phantom
              reads.
              TRANSACTION_READ_UNCOMMITTED
              This level allows dirty reads, nonrepeatable reads, and phantom reads.
              "Jegan" <[email protected]> wrote in message
              news:[email protected]...
              >
              > I went through the documentation for isolation levels
              TRANSACTION_REPEATABLE_READ
              > and TRANSACTION_SERIALIZABLE. But i am not getting a clear picture of what
              they
              > really mean. It apprears like, Looks like TRANSACTION_READ_COMMITTED
              already covers
              > TRANSACTION_REPEATABLE_READ. Also not sure when do we use
              TRANSACTION_REPEATABLE_READ
              > and TRANSACTION_SERIALIZABLE.
              >
              > I've asked lot of people, i didn't get a clear explanation. Can a
              transaction
              > "Guru" throw some light on it?
              >
              > thanks,
              >
              > Jegan
              > Sembium Corporation
              

  • Phantom Reads / Data Concurrency

    I am using OWB 10.2.
    I am encountering phantom reads within some of my OWB maps. These phantom reads are caused by activity on the source system when I am sucking the data from the source tables. The problem is my map does an update and then an insert. The activity on the source occurs after the update transaction has started but before the insert transaction.
    Does anyone know of a setting in OWB that allows serializable transactions?
    I thought of using the command "SET TRANSACTION ISOLATION LEVEL SERIALIZABLE" and changing the Commit Control to Manual for the map but can I put the set transaction command in a Pre-Mapping process? Or does it have to be in a SQL*Plus operator in the Process Flow.
    I cannot find any information about Data Concurrency in the OWB documentation and am surprised that no one has encountered this problem before.
    Help!

    Hi,
    Check the below links:
    http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:27523665852829
    http://www.experts-exchange.com/Database/Oracle/Q_20932242.html
    Best regards,
    Rafi.
    http://rafioracledba.blogspot.com

  • Dirty reads vs phantom reads

    Hi,
    What is the difference between a "Dirty Read" and "Phantom Reads". Can anyone explain in brief or give an example?
    Thanks in advance.

    A dirty read is an uncommitted read, which may or may not be exist in the table. A phantom is a ghost record that doesn't appear in a transaction initially but appears if it is read again because some other transaction has inserted rows matching the criteria.
    Here are examples of both:
    --Dirty read example
    create table t1 (c1 int null, c2 varchar(50) null)
    go
    insert t1(c1, c2) values (1, 'one')
    insert t1(c1, c2) values (2, 'two')
    insert t1(c1, c2) values (3, 'three')
    insert t1(c1, c2) values (4, 'four')
    begin tran
    update t1 set c2 = 'zero'
    -- let this run in the current query window and open a new query window to run the below statement
    --and you will see all 4 rows having a value of 0 in column c2, which is uncommitted data
    select * from t1 with (nolock)
    --uncomment this and run the below statement and rerun the above statement
    --and you will see the previous values of one, two, three and four
    --rollback tran
    Here's an example of a phantom reads: 
    --Phantom example
    create table t1 (c1 int null, c2 varchar(50) null)
    go
    insert t1(c1, c2) values (1, 'one')
    insert t1(c1, c2) values (2, 'two')
    insert t1(c1, c2) values (3, 'three')
    insert t1(c1, c2) values (4, 'four')
    -- let this run in the current first query window and open a second query window to run the below statement
    --and you will see all 2 rows having a value in column c2 starting with character t
    begin tran
    select * from t1
    where c2 like 't%'
    --now insert the new value of ten (matching the query criteria - starts with t) from the first query window
    insert t1(c1, c2) values (10, 'ten')
    --Run the below statement again from the second query window that is open and you will see the new row
    --that got inserted - so 3 rows are seen including the newly inserted ten
    --this new row is a phantom read
    select * from t1
    where c2 like 't%'
    --uncomment this and run the below statement in the second query window
    --rollback tran
    Satish Kartan www.sqlfood.com

  • Can't find a 'phantom' unread mail or mark it as being read

    I'm using mail on various machines to access an Exchange server account. It generally works with no problems, but on my work MacPro (and only on this computer not the iMac at home, various laptops, iPad, iPhone etc) mail tells me there is an unread message. However, I can't find this message and it's not there when I use a webmail interface to access the same account. No problem, I figured I could just right click on the mailbox and 'mark all messages as read', but this doesn't work! I like to keep a clear inbox with no unread messages and it's driving me nuts!
    I'm guessing that there's some strange synching conflict, but don't know how to solve it. Any ideas, please?
    Thanks, Jon.

    I tried both, but neither has worked.
    a) Rebuilding the mailbox revealed another unread mail that actually existed, but didn't remove the 'phantom'.
    b) The SM trick uncovered lots of unread news items from Apple, but not the 'phantom'.
    Thanks for your help, but I might need to do something more drastic like deleting the account and adding it again.
    Thanks, Jon.

  • Phantom read

    Phantom reads     :
    A transaction reexecutes a query returning a set of rows that satisfy a search condition and finds that the set of rows satisfying the condition has changed due to another committed transaction in the meantime.
    Occurs when one transaction begins reading data and another inserts to or deletes data from the table being read.
    Question :
    whats the output we get when there is a phantom read ?
    let me make a demo example which will mimic the above scenario.
    say, I am a bank customer . i have an account ....i am searching for transaction records for the past 2 months via netbanking online statement search option.
    Now, in the mean time(concurrently)......one banker deleted some of my transaction records .
    I think , I have framed the phantom read problem correctly now.
    Question is : what will be the output when really there is such type of situation occurs ?
    see, i am assuming that this is not a dirty read case...that is the banker has commited his activity.
    so, what output i would expect when there is a phantom read ?

    Dirty read would be when you would read data made by another transaction that would be rolled back.
    Phantom read seems to be reading data that doesn't exist at the time of the making of the query (in the case of inserting). Doesn't sound very dangerous to me, when comparing to a dirty read.
    For your bank example, you would just see one transaction less in your records.

  • How do you delete phantom albums from the music on my iPad?  I keep all my shareable music in the cloud and don't want to utilize iPad storage.  I read the answer that says I have to download the music again so I can delete it but that seems silly.

    i have most of my shareable music in the cloud.  I try to clean out the downloaded music on my iPad to clean up storage.  i used to be able to delete local copied music easily but somehow in ios 8 or so, I lost the ability to delete albums.  I read the support suggestion that I should re download this music so I then can delete it.   This seems so silly I can't imagine that this was Apple's intention.  Anybody got a clue?

    See Recover your iTunes library from your iPod or iOS device.
    tt2

  • Ipad 2 phantom touching. I have read several forums about phantom touching, but this seems to only happen to our ipad when it is really low on battery. We reset it to factory and took to Apple. Anyone have this problem only with a low battery?

    The problem seems to happen when the battery is low. It seems fine now that the battery is fully charged. I took it to Apple Genius and they ran a diagnotic test and everything checke out fine. The tech told me to watch it and if it hapens again they would replace it. It is only a month old and we are already having problems with it. Does anyone know if there is a fix in the works or is the only fix to replace it?

    Not normal. Take it to an Apple Store for evaluation.
    Make a Genius Bar Reservation
    http://www.apple.com/retail/geniusbar/
     Cheers, Tom

  • NTFS External Hard Drive now read only

    Hello Everyone,
    For months I have been connecting a NTFS 1 TB Phantom Labs external hard drive to my mac book, to access my music collection, as well as store additional large files. Today, however, I found my external hard drive to be "read only," rather than read and write. Interestingly, the folder where I keep my music, also includes the lock image as the external hard drive icon.
    When I look in Disk Utility, the Phantom Drive is originally listed as read/write. However, the mounting point, named disk2s1 is listed as read only.
    Does anyone have any idea how to resolve this situation and return to the read/write status I originally enjoyed?
    Thanks.

    I have got the exact same problem!!
    have a 320 seagate ext HD formatted as NTFS that I have been using for the last 3-4 months that suddenly became read only.
    I'm running macfuse with 3G to read and write to the drive and prior to this have never had an issue.
    Have another ext HD formatted as NTFS that reads and writes fine. I have tried disk utility but verify and first aid are greyed out for the seagate drive, One minute I was writing to my drive fine and next time I plugged it in Read only (yes I ejected properly as always)
    Any ideas?? I hope it's not a re format and start again..

  • Pl/sql block reading reading table data from single point in time

    I am trying to figure out whether several cursors within a PL/SQL block are executed from within a Single Point In Time, and thus do not see any updates to tables made by other processes or procedures running at the same time.
    The reason I am asking is since I have a block of code making some data extraction, with some initial Sanity Checks before the code executes. However, if some other procedure would be modifying the data in between, then the Sanity Check is invalid. So I am basically trying to figure out if there is some read consistency within a PL/SQL, preventing updates from other processes to be seen.
    Anyone having an idea?.
    BR,
    Cenk

    "Transaction-Level Read Consistency
    Oracle also offers the option of enforcing transaction-level read consistency. When a transaction runs in serializable mode, all data accesses reflect the state of the database as of the time the transaction began. *This means that the data seen by all queries within the same transaction is consistent with respect to a single point in time, except that queries made by a serializable transaction do see changes made by the transaction itself*. Transaction-level read consistency produces repeatable reads and does not expose a query to phantoms."
    http://www.oracle.com/pls/db102/search?remark=quick_search&word=read+consistency&tab_id=&format=ranked

  • Problems Seeing Faint Images in Reader XI

    I have not experienced the issue myself, but several of my customers have. They are unable to see faint or phantomed images in Reader XI. I had one customer uninstall the latest update and he was then able to see the images again. Has anyone else been experiencing this kind of issue and is there an easy fix or patch in the works?

    You can (temporarily) rotate the entire pages view, not individual items in the file. This was never possible in Reader. This option is available under the View menu.

Maybe you are looking for

  • Printing only in red

    my printer hp 3520 printing only in red colour, i have changed all the inks cartridges, it's a new one what sould i do?????

  • IMovie won't open for one user.

    Hi, I recently installed the iLife 09 on my machine and all was fine. I am now having problems opening iMovie to the extent that the icon bounces and then I get the box saying that the application has quite but nothing else is effected. I set up a gu

  • Issues when syncing photos with iPad

    It just gets better...iPhoto 11 will not sync with iPad library if it contains old iPhoto 9 pictures. Excellent, a communication device that can longer communicate (Spot the irony). Aperture sync with iPad is OK Message was edited by: Bruce Robbie Me

  • Beta Testing Ends For "Oracle Database 11g: Performance Tuning" Exam

    !http://blogs.oracle.com/certification/2009-0204-1122.gif! <p>The beta period ended on Aug 31, 2009 for the <strong>Oracle Database 11g: Performance Tuning</strong> certification exam (1Z1-054), which is a single exam requirement for Oracle 11g DBA O

  • Install failure Acrobat XI trial on my Mac (OS X Yosemite 10.10.2)

    I have tried to install Acrobat XI on my Mac (OS X Yosemite 10.10.2) and I get the message "The Installation Failed!  The installer encountered an error that caused the installation to fail.  Contact the software vendor for assistance".  This occurs