DBAsupport.com Forums - Powered by vBulletin
Results 1 to 10 of 39

Thread: when log switch occurs....

Threaded View

  1. #20
    Join Date
    Nov 2006
    Location
    Sofia
    Posts
    630
    So, Tamil,
    You are telling me, that if I issue VEEEERY long update, and suppose I have just 2 VEEERY SMALL redo log groups, I can hypotetically fail in situation where the update fills up the first log, then fills up the second one (the first is checkpointed at that time) and then the first gets reused.
    And the reused redo is still needed for the instance recovery?
    So if now my instance fail I will loose data?

    Sorry, but I do not belive that. The check point have nothing to deal with the size of the transactions and with the trasactions at all. Nothing is wrong if we checkpoint the file and writre the dirty buffers of an uncommited transaction to the disk, so that the redo is no longer needed.
    About the experiment, yes, the effect will be as you said, but the reason is quite different.
    When you do 'alter system checkpoint' this is a SYNCHRONIOUS comand. That means that system starts agrresively to checkpoint and you do not get the control back until the checkpoint does not finishes. So when then you issue shutdown abort, you really do not need an instance recovery
    'Alter system switch logfile' on the other hand switches the log file, hence STARTS the checkpoint, and returns the control to you, so now, when you "shutdown abort" the checkpoint is not yet finished and hence the redo log is still needed for instance recovery.
    Here is the proove of what I say
    ------------------------
    1* select group#,status from v$log

    GROUP# STATUS
    ---------- ----------------
    1 CURRENT
    2 ACTIVE
    3 ACTIVE

    SQL> alter system switch logfile
    2 /

    System altered.

    SQL> select group#,status from v$log
    2 /

    GROUP# STATUS
    ---------- ----------------
    1 ACTIVE
    2 CURRENT
    3 ACTIVE

    SQL> alter system checkpoint;

    System altered.

    SQL> select group#,status from v$log
    2 /

    GROUP# STATUS
    ---------- ----------------
    1 INACTIVE
    2 CURRENT
    3 INACTIVE

    SQL>
    ----------------------------------------------------

    As you can see, alter system switch logfile leaves the previously "current" logfile in ACTIVE status, what means it is currently checkpointed
    Alter system checkpoint
    on the other hand leaves all the non-current log files INACTIVE what means the checkpoint have completed and the files are no longer needed for instance recovery


    Regards
    Boris
    Last edited by Bore; 03-19-2007 at 12:39 PM.

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