Forum Stats

  • 3,876,250 Users
  • 2,267,083 Discussions


In Memory Undo



  • Kamran Agayev A.
    Kamran Agayev A. Member Posts: 5,520 Bronze Crown
    Earlier I remember in one of the threads i read Sybrand pointed out , when datafile is in begin backup mode,it is not written??
    It's incorrect. They are written. See the following discussion of Tom Kyte

    - - - - - - - - - - - - - - - - - - - - -
    [Kamran Agayev A. |] (OCP 9i/10g)
    Author of *"Oracle Backup & Recovery: Expert secrets for using RMAN and Data Pump"*
  • This link will provide all the necessary information
  • 695836
    695836 Member Posts: 785
    I know what happens in begin backup mode.I know the necesary basics.
    Whqat i wanted to say was as damorgan said redo streams contain only committed data.Likewise Sybrand once said, a datafile is not written in backup mode. All these are senior people with far more knowledge than us but they too can forget the basics not only us.So thats why I said ...
  • Anyone can forget anything at anytime...Its just that simple...We are human... :)
  • 695836
    695836 Member Posts: 785
    Nah!! You cannot forget the basics. Its not permissible :)
  • Aman....
    Aman.... Member Posts: 22,919 Gold Crown
    Permissible, but only when you are ready to come to my classes after forgetting it ;-) .

  • 695836
    695836 Member Posts: 785
    Are you an instructor in india?
  • Jonathan Lewis
    Jonathan Lewis Member Posts: 10,117 Blue Diamond

    I think Craig has described in-memory undo incorrectly.

    Essentially+ the content of the undo blocks and the content of the redo log file are the same whether or not you use in-memory undo (and private redo threads) or traditional redo logging. The main difference is one of timing and ordering; there is also a reduction in redo record+ count with in-memory undo, though the number of redo change vectors+ remains the same.

    With a traditional small transaction the steps are as follows:
    you change a table or index block - this requires you to generate a redo change vector
    at the same time you have to record enough information to rollback the change - this is an undo record
    but an undo record is stored in an undo block, so you generate a redo change vector to describe the change you make to the undo block
    Oracle combines the two change vectors into a single redo record - which is reported in the session statistic as an increment to "redo entries"
    to make the change Oracle uses the redo allocation and redo copy latches to acquire space and copy the record into the redo buffer.

    Say you inserted 10 rows, one at a time, into a table with 4 indexes - this would generate 50 redo records and 50 undo records, and hit the redo latches 50 times. (That's 5 records per row, one for the table row, one each for each of the indexes - times 10).

    With In-memory undo enabled - and since my example is a small enough piece of work:
    As you change the first table row Oracle allocates one private redo buffer (called a redo strand) and one private "undo" buffer from the shared pool.
    The "in memory undo" buffer is actually a buffer for the redo that describes the changes to the undo.
    As you make your changes to the table and indexes, each change vector is written into the private redo buffer
    At the same time, each change vector that describes the corresponding undo record is written into the "in memory undo" buffer.
    The total number of change vectors, and the content of those change vectors is exactly the same as in the traditional change vectors
    When you commit, Oracle concatenates the two buffers into a single large redo record and writes it into the redo buffer
    At the same time all 100 change vectors are applied to the table, index, and undo blocks (and all the other stuff relating to commits also happens).
    Consequently the final number of "db block changes" is the same in either case
    The most significant difference in volume of redo is that the traditional method results in 50 redo record headers (600 bytes) whereas the in-memory undo produces only one redo record header (12 bytes).

    There are lots of little details and variations around the edges - start and end of transaction, for example, and what happens if one of the two buffers fills (because they're only 64KB or 128KB in size) - but the description above covers the most significant differences in the strategy.

    Jonathan Lewis

    To post code, statspack/AWR report, execution plans or trace files, start and end the section with the tag {noformat}
    {noformat} (lowercase, curly brackets, no spaces) so that the text appears in 
    fixed format
    "Science is more than a body of knowledge; it is a way of thinking" 
    Carl Sagan                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
  • Aman....
    Aman.... Member Posts: 22,919 Gold Crown
    Thanks so much for the clarification sir.

    Best regards
  • PAB
    PAB Member Posts: 266
    I know I am too late to ask this followup question....I am sorry for that.....

    I am curious to know if private redo buffer (called a redo strand) and one private "undo" buffer in shared pool then how Oracle guarantee no data loss against system crash....

    Let me explain this in brief...

    Suppose at t1, I start instance and perform some update, as a result there will be one private redo and private undo buffer are created in shared pool.
    immediately after this system crash, So nothing yet written to redo log file and nothing in Undo segment too(as yet no undo collapse occurs). In this situation how oracle recover undo data?

    Shared pool is not DBBC, So I am just curious....

This discussion has been closed.