Search

Join this Blog for direct reference of any post into your inbox. To join just click on "Join this Site" under "Follower" then Login with your Email.*** DECLARATION: I Maintain this Blog for Helping Myself While at Work and Welcome any body Needing Help!!!.*** CAUTION: Using any of the script from this Blog may contain at Own Risk. These scripts May or May not have been Tested.***

Wednesday, 22 October 2014

Alter System ‘SWITCH LOGFILE’ vs ‘ARCHIVE LOG CURRENT’

Both the command is used to force the log switch but they do it in different way. ARCHIVELOG CURRENT waits for the writing to complete. This can take several minute to complete for large redologs file where as SWITCH LOGFILE is fast as it does not wait for the archiver process to complete writing the online redologs.
The ‘ARCHIVELOG CURRENT’ command is safer because it waits for OS to acknowledge that the redolog has been successfully written. Hence this command is best practice for production backup script for RMAN.
The ‘ARCHIVELOG CURRENT’ allows, you to specify the thread to archive (If you do not pass the thread parameter then oracle will archive all full online redo logs) where as ‘SWITCH LOGFILE’ archives only the current thread.
Note: In case of RAC environment, the ‘ARCHIVELOG CURRENT’ will switch the log of all nodes (instances) where as ‘SWITCH LOGFILE’ will only switch the log file on the instance where you issue this command.
SWITCH LOGFILE’ is not a correct method after hot backup
In order to be sure that all changes generated during a hot backup are available for a recovery, Oracle recommends that the current online log be archived after the last tablespace in a hot backup is taken out of backup mode. A similar recommendation stands for after a recovery manager online database backup is taken.
Many DBA’s or Oracle books will suggest using the ‘ALTER SYSTEM SWITCH LOGFILE’ command to achieve this. The use of ‘SWITCH LOGFILE’ to obtain archives of the current logs is not a perfect to follow because the command returns success as soon as the log writer has moved to the next log, but before the previous log has been completely archived. This could allow a backup script to begin copying that archived redolog before it is completely archived, resulting in an incomplete copy of the log in the backup.
Thus the better command to use for archiving the current log is ‘ALTER SYSTEM ARCHIVE LOG CURRENT’ This command will not return until the current log is completely archived. For the same reasons outlined above, a backup script should never just back up “all the archived redologs”. If a script does not restrict itself only to those logs that it knows to be archived, it may improperly try to back up an archived redolog that is not yet completely archived.
To determine which logs are archived, a backup script should query the v$archived_log view to obtain a file list for copying.

13 comments:

  1. Nice work..I am clear now; Thanks...

    ReplyDelete
  2. Hai,

    Nicely written post. I am just about to start a new blog and there could not have been a better guide than this one for some good pointers. I am looking forward to starting a successful blog after reading this incredibly useful post of yours. Waiting for more such posts like this.

    Keep writing and sharing!

    aamala

    SEO Training in Chennai

    ReplyDelete

  3. Thanks for sharing this valuable information to our vision. You have posted a trust worthy blog keep sharing

    dot net training in chennai

    php training in chennai

    java training in chennai

    ReplyDelete
  4. for preparing bank exam and group exam , we are providing an online test model questions papers

    Group Exam Questions and Answers
    Bank Exam Questions and Answers

    ReplyDelete
  5. Thanks for sharing this valuable information to our vision. You have posted a trust worthy blog keep sharing..
    Cloud-Computing training in chennai

    ReplyDelete
  6. Nice article
    Thanks for sharing the informative blog.

    Asp .net Training In Bangalore

    ReplyDelete
  7. Awesome resources!
    Thanks for sharing such good article.

    Outsourcing company in Bangalore

    ReplyDelete
  8. Great post.
    It really helped me to learn something new. So thanks.
    Web Design Company In Bangalore

    ReplyDelete
  9. Awesome resources!
    Thanks for sharing such good article. This is really helpful.

    Wooden Tiles price
    Imported Tiles
    Best Tiles Company In Bangalore

    ReplyDelete
  10. Thanks a lot brother for sharing your valueable information in sample way.

    ReplyDelete