DIFFERENCE BETWEEN ARCHIVE LOG CURRENT AND SWITCH LOGFILE ORACLE

ARCHIVE LOG CURRENT:

  • Syntactically different
  • Specifically used in RAC
  • Slow
  • Synchronous IO
  • Can be used for log switch of individual RAC instance or all instances of RAC
  • Waits for ARCH process to archive the current log
kish@PRIM>set timing on
kish@PRIM>alter system archive log current;

System altered.

Elapsed: 00:00:10.80

kish@PRIM>alter system archive log current to 2;

System altered.

Logfile:

Sun Oct 17 23:27:32 2021
ALTER SYSTEM ARCHIVE LOG
Sun Oct 17 23:27:34 2021
Thread 1 advanced to log sequence 46 (LGWR switch)
  Current log# 2 seq# 46 mem# 0: +DATAC1/DBX00/ONLINELOG/group_2.287.1086069543
  Current log# 2 seq# 46 mem# 1: +RECOC1/DBX00/ONLINELOG/group_2.373.1086069545
Sun Oct 17 23:27:34 2021
Archived Log entry 88 added for thread 1 sequence 45 ID 0x82fcdd20 dest 1:
Sun Oct 17 23:27:34 2021

SWITCH LOGFILE:

  • Fast log switch
  • Checkpoint will be incomplete
  • Asynchronous IO
  • Used for both single instance and RAC instance
  • Writes the archived logs in background using ARCH process
kish@PRIM>alter system switch logfile;

System altered.

Elapsed: 00:00:02.57

Logfile:

******************************************************************
TT00: Setting 'active' archival for destination LOG_ARCHIVE_DEST_2
******************************************************************
Sun Oct 17 23:27:52 2021
Thread 1 cannot allocate new log, sequence 47
Checkpoint not complete
  Current log# 2 seq# 46 mem# 0: +DATAC1/DBX00/ONLINELOG/group_2.287.1086069543
  Current log# 2 seq# 46 mem# 1: +RECOC1/DBX00/ONLINELOG/group_2.373.1086069545
Sun Oct 17 23:27:55 2021
Thread 1 advanced to log sequence 47 (LGWR switch)
  Current log# 1 seq# 47 mem# 0: +DATAC1/DBX00/ONLINELOG/group_1.288.1086069541
  Current log# 1 seq# 47 mem# 1: +RECOC1/DBX00/ONLINELOG/group_1.374.1086069543
Sun Oct 17 23:27:55 2021
Archived Log entry 92 added for thread 1 sequence 46 ID 0x82fcdd20 dest 1:
Sun Oct 17 23:27:55 2021
******************************************************************
TT00: Setting 'active' archival for destination LOG_ARCHIVE_DEST_2
******************************************************************

Tracing both options:

Using the hash value, found number of parse and execute calls between two options

#ARCHIVE LOG CURRENT:
[oracle@dc01x01 ~]$ grep '140065630014360' /u01/oracle_base/diag/rdbms/dbx00/dbx001/trace/dbx001_ora_3938_LOGSWITCH.trc|wc -l
140
#SWITCH LOGFILE:
[oracle@dc01x01 ~]$ grep '140065630015800' /u01/oracle_base/diag/rdbms/dbx00/dbx001/trace/dbx001_ora_3938_LOGSWITCH.trc|wc -l
8

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s