• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
Techgoeasy

Techgoeasy

Learn Oracle, PHP, HTML,CSS,Perl,UNIX shell scripts

  • Home
  • Oracle
    • Oracle database
    • Oracle Ebusiness Suite
    • Oracle weblogic
    • Oracle Performance Tuning
    • Oracle Hyperion
    • Oracle Cloud Tutorials
  • SQL
  • interview questions
  • Linux
  • PHP and HTML
  • Downloads
  • General
Home » Oracle » Oracle Database » alter system switch logfile v/s archive log current

alter system switch logfile v/s archive log current

June 15, 2020 by techgoeasy 9 Comments

Oracle Redo and archive log files are two important pieces in Oracle database environment. They both are used for recovering the database from failure.I would be explaining two important command alter system switch logfile and alter system archive log current about them ,their difference and what they command actually performs in the oracle database

ALTER SYSTEM SWITCH LOGFILE

This command switch the redo log in the instance where it is executed. So log sequence move to another number by executing the command.

Also The SQL statement ALTER SYSTEM SWITCH LOGFILE forces the current instance to begin writing to a new redo log file, regardless of whether the current redo log file is full.

Forcing a log switch also forces a checkpoint. Oracle returns control to you immediately after beginning the log switch, rather than waiting until the checkpoint is finished.

This SQL statement does not ensure the redo log is archived. So log switch happened only, archiving of the redo log might happen at latter point

Also this perform the Log switch in the current instance only. If we have Oracle RAC environment ,the command need to executed desperately for each instance

You can use below query to check the status of redo log files after executing the command

select l.thread#, l.group#, l.archived, l.status, bytes/1024/1024 MB
from v$log l,
v$instance i
where l.thread# = i.thread#
order by 1, 2

ALTER SYSTEM ARCHIVE LOG CURRENT

This statement forces all the redo log files to get archived before control is returned to it.So it perform the switch and archiving both.

Also in case of Oracle RAC environment, it forces the global switch in all the instance  and archiving also

In case you want to execute this for particular thread ,you need to specify the thread number

ALTER SYSTEM ARCHIVE LOG CURRENT THREAD 1 ;

In-case we are taking Hot-backup of the oracle database , it is recommended to use the alter system archive log current command at the beginning of the backup and at the end of the oracle database backup.  This will ensure all the red generate during the hot-backup  will get archived and get backed easily

Hope this short post make the point clear for alter system switch logfile and alter system archive log current

Also Reads
v$system_parameter
supplemental logging in Oracle
how to get table definition in oracle
Query to find object dependencies in oracle
how to find archive log sequence number in oracle

Filed Under: Oracle, Oracle Database

Reader Interactions

Comments

  1. chinchan4772 says

    February 8, 2019 at 10:49 am

    It’s interesting that many of the bloggers to helped clarify a few things for me as well as giving.
    Most of ideas can be nice content.The people to give them a good shake to get your point and across the command.
    https://www.besanttechnologies.com/training-courses/java-training

    Reply
  2. Shivaji Bade says

    July 4, 2020 at 3:43 am

    Thanks for this Post

    Reply
  3. Jayalakshmi says

    August 3, 2020 at 6:29 pm

    yes, definitely this type of blogs are really help for people great job.

    Reply
  4. yaminiundavalli says

    August 5, 2020 at 11:48 am

    Nice blog. Thank you for sharing your experiences with us and keep going on.

    Reply
    • techgoeasy says

      August 11, 2020 at 5:01 am

      Thanks for the feedback

      Reply
  5. JENI says

    August 12, 2020 at 3:55 pm

    I simply wanted to thank you so much again. I am not sure the things that I might have gone through without the type of hints revealed by you regarding that situation.

    Reply
  6. Mohd Sharique says

    November 3, 2020 at 8:09 am

    Thanks for sharing information to our knowledge, it helps me plenty keep sharing…

    Reply
  7. Amlida James says

    November 5, 2020 at 10:58 am

    Thank for sharing excellent post on your blog keep it up and share more.

    Reply
  8. Prince Arora says

    January 1, 2021 at 12:05 pm

    This is most informative and also this post most user-friendly and super navigation to all posts.

    Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Primary Sidebar



Subscribe to our mailing list

Enter your email address to subscribe to this blog and receive notifications of new posts by email

Recent Posts

  • How to start/stop Node manager and Managed server in Weblogic
  • Weblogic Administration Console
  • How to enable SSL in Oracle Weblogic
  • How to stop-start WebLogic AdministrationServer
  • ORA-28007: the password cannot be reused

Copyright © 2022 : TechGoEasy

  • Hire me
  • Privacy Policy
  • Contact Us
  • New? Start Here
  • About Us