Saturday, July 22, 2023

Why we perform "alter system switch logfile/alter system archive log current (RAC) and alter system checkpoint "

 alter system switch logfile;

switch the logfile in the current instance so log sequence move to another 

number by executing the command without waiting to full the logfile and 

archiving it. forcing it also switches checkpoint.


alter system archive log current;

this forces all redo log files to get archived.

It performs the switch and archiving both.

RAC DB it forces global switch and archiving both in all instances.


for only a thread : since one db instances can contain only one thread....

alter system archive log current thread 1;


alter system checkpoint;

it makes change in checkpoint but not switch redo log file. 

it makes current active redo log to inactive so that we can drop the redo log sequence.


alter system checkpoint;

LOG SWITCH  "alter system switch logfile (STANDALONE)  / alter system archive log current (RAC DB) ------> triggers checkpoint

CHECKPOINT "alter system checkpoint"  ----------------> does not trigger LOG SWITCH



select first_time,first_change#,sequence#,status from v$log;

select checkpoint_change#,checkpoint_time from v$datafile_header;

alter system switch logfile;  

alter system checkpoint;

alter system archive log current;



  • ALTER SYSTEM SWITCH LOGFILE;: Manually switches the current redo log file to the next available log file.
  • ALTER SYSTEM CHECKPOINT;: Forces a checkpoint, ensuring modified data in the buffer cache is written to data files.
  • ALTER SYSTEM ARCHIVE LOG CURRENT;: Manually archives the current redo log file, making it available for backup and recovery.

No comments:

Post a Comment

Enable OpenSSH on Windows 11

Step 1: Install OpenSSH Server You can do this via PowerShell (run as Administrator ): Check if it's already available: Get-WindowsCapab...