The function of the redo logs
DBAsupport.com Forums - Powered by vBulletin
Results 1 to 7 of 7

Thread: The function of the redo logs

  1. #1
    Join Date
    Sep 2000
    Posts
    78

    Question

    Hi,
    I am wondering why the Oracle server writes to the redo log anyway? Why can it first put changed blocks in some memory buffer and then when the transaction commits or rollbacks write them to disk or from the rollback segment respectively? They say redo logs are for recovery, but if blocks are written directly to disk when commited transactions what is the purpose of recovery?

    Clearly I am missing something crucial...HELP...

  2. #2
    Join Date
    Sep 2001
    Location
    NJ, USA
    Posts
    1,287
    Because oracle is professional database, and u can restore it "till last transaction"
    even if u lost all datafiles.

  3. #3
    Join Date
    Aug 2000
    Posts
    462
    Writing to logs allows old versions of data files to be used in place of current files in cases of media failure, then the "outdated" files have the appropriate transactions written to them from the logs. Without this mechanism, there would be no way to recover to any time more recent than the most recent backup.

    Logs are written to sequentially and only changed data is written. Conversely, writes to data files are random access and are written in DB_BLOCK_SIZE increments (2-8k). Subsequently, the data file writes are performed asynchronously. This is done because the sequential small write to the log with subsequent asyncronous data file write is MUCH faster than writing to data files synchronously during transactions.
    Oracle DBA and Developer

  4. #4
    Join Date
    Dec 2001
    Posts
    221
    as kmesser said .. sequential write to the logs are much faster than to the data files which is not sequential. thats perfect.

    can u imagine if oracle tries to write at each and every commit or rollback ,as u said, how badly it will perform. everytime it has to look for free extents, format the blocks, in some cases allocate the extents and so many other things. thats the reason log file come into picture. instead it just sequentilly write the blocks into logs. and then bulk insert into data file.

    so in case of crash log files are used for recovery.
    Santosh Jadhav
    8i OCP DBA

  5. #5
    This is not an Oracle problem, nor an Oracle invention. Every single modern RDBMS technology take advantage of speeding and recovery using logs...
    ovidius over!

  6. #6
    Join Date
    Mar 2002
    Posts
    301

    Wink

    I agree completely to sjadhavdba. Oracle does something called as
    "Fast Commit". It means that Oracle, does not writes into the datafiles as and when
    an Commit statement is issued especially due to 2 reasons:
    1. More amount of IO reduces performance.
    2. In the redo log files, oracle just writes minimal information required to
    redo all the amount of work. More over writes in redo log is sequential, which
    may not be the case in directly writing to the files.

  7. #7
    Join Date
    Jun 2000
    Location
    Madrid, Spain
    Posts
    7,448
    Not only RDBMS uses this, UNIX Journal Filesystem works pretty similar

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width