Hello Techies,
This happens most of the time that you need to add/drop redo log groups in Oracle databases due to any administrative reasons, however, if candidate redo group is in ACTIVE status, then you can't drop it and DBA need to wait until this comes in INACTIVE status to become this group available from drop.
Here is the trick.
SQL> select * from v$log;
GROUP# THREAD# SEQUENCE# BYTES BLOCKSIZE MEMBERS ARC STATUS FIRST_CHANGE# FIRST_TIME NEXT_CHANGE# NEXT_TIME
---------- ---------- ---------- ---------- ---------- ---------- --- ---------------- ------------- --------------- ------------ ---------
1 1 302111 2684354560 512 2 YES ACTIVE 1.0087E+11 16-APR-17 1.0087E+11 16-APR-17
2 1 302112 2684354560 512 2 YES ACTIVE 1.0087E+11 16-APR-17 1.0087E+11 16-APR-17
3 1 302113 2684354560 512 2 YES ACTIVE 1.0087E+11 16-APR-17 1.0087E+11 16-APR-17
4 1 302114 2684354560 512 2 NO CURRENT 1.0087E+11 16-APR-17 2.8147E+14
5 1 302109 2684354560 512 2 YES INACTIVE 1.0087E+11 16-APR-17 1.0087E+11 16-APR-17
6 1 302110 2684354560 512 2 YES ACTIVE 1.0087E+11 16-APR-17 1.0087E+11 16-APR-17
6 rows selected.
Details from alert log
Beginning log switch checkpoint up to RBA [0x49c21.2.10], SCN: 100869639337
Thread 1 advanced to log sequence 302113 (LGWR switch)
Current log# 3 seq# 302113 mem# 0: /oracle/SID/origlogA/log_g3m1.dbf
Current log# 3 seq# 302113 mem# 1: /oracle/SID/mirrlogA/log_g3m2.dbf
Sun Apr 16 12:55:09 2017
Archived Log entry 364104 added for thread 1 sequence 302112 ID 0x2947550b dest 1:
Thread 1 cannot allocate new log, sequence 302114
Private strand flush not complete
Current log# 3 seq# 302113 mem# 0: /oracle/SID/origlogA/log_g3m1.dbf
Current log# 3 seq# 302113 mem# 1: /oracle/SID/mirrlogA/log_g3m2.dbf
Beginning log switch checkpoint up to RBA [0x49c22.2.10], SCN: 100869639556
Thread 1 advanced to log sequence 302114 (LGWR switch)
Current log# 4 seq# 302114 mem# 0: /oracle/SID/origlogB/log_g4m1.dbf
Current log# 4 seq# 302114 mem# 1: /oracle/SID/mirrlogB/log_g4m2.dbf
Sun Apr 16 12:55:10 2017
Archived Log entry 364105 added for thread 1 sequence 302113 ID 0x2947550b dest 1:
Sun Apr 16 12:55:10 2017
Archived Log entry 364106 added for thread 1 sequence 302111 ID 0x2947550b dest 1:
Now, login to sqlplus as sysdba, and execute below command.
SQL> alter system checkpoint;
System altered.
When is stamped now in alert Oracle alert. This is completing all pending checkpoints related information.
Sun Apr 16 12:55:30 2017
Beginning global checkpoint up to RBA [0x49c22.3c7d.10], SCN: 100869642314
Completed checkpoint up to RBA [0x49c1f.2.10], SCN: 100869487919
Completed checkpoint up to RBA [0x49c22.3c7d.10], SCN: 100869642314
Completed checkpoint up to RBA [0x49c22.2.10], SCN: 100869639556
Completed checkpoint up to RBA [0x49c21.2.10], SCN: 100869639337
Completed checkpoint up to RBA [0x49c20.2.10], SCN: 100869639089
Now, let us see how v$log information looks like.
SQL> select * from v$log;
GROUP# THREAD# SEQUENCE# BYTES BLOCKSIZE MEMBERS ARC STATUS FIRST_CHANGE# FIRST_TIME NEXT_CHANGE# NEXT_TIME
---------- ---------- ---------- ---------- ---------- ---------- --- ---------------- ------------- --------------- ------------ ---------
1 1 302111 2684354560 512 2 YES INACTIVE 1.0087E+11 16-APR-17 1.0087E+11 16-APR-17
2 1 302112 2684354560 512 2 YES INACTIVE 1.0087E+11 16-APR-17 1.0087E+11 16-APR-17
3 1 302113 2684354560 512 2 YES INACTIVE 1.0087E+11 16-APR-17 1.0087E+11 16-APR-17
4 1 302114 2684354560 512 2 NO CURRENT 1.0087E+11 16-APR-17 2.8147E+14
5 1 302109 2684354560 512 2 YES INACTIVE 1.0087E+11 16-APR-17 1.0087E+11 16-APR-17
6 1 302110 2684354560 512 2 YES INACTIVE 1.0087E+11 16-APR-17 1.0087E+11 16-APR-17
6 rows selected.
And this is what a DBA waits sometime for long time to do his/her database maintenance job.
Please let me know, if this helped you.
Hi Kanhaiya,
ReplyDeleteThanks for the post! Much appreciated. This will help in my day to day tasks at work.
Thanks
Kal
This is a fantastic concept you explained in very simple language, I am impressed. Thanks, keep up spreading the knowledge.
ReplyDeleteThanks for sharing this concept.
ReplyDeletePlease share at what timings checkpoint occurs.
Oracle Database checkpoint is written the DBWR process of all modified buffers in SGA buffer cache to the database datafiles and datafiles headers are also updated with the latest checkpoint SCN, even if the file had no changed blocks, as well as the control files. Checkpoints occur AFTER (not during) every redo log switch and also at intervals specified by initialization parameters. LOG_CHECKPOINTS_TO_ALERT=TRUE used to observe checkpoint start and end times in the Oracle database alert log. Checkpoints can be forced with the ALTER SYSTEM CHECKPOINT; command from SQLPLUS prompt.
ReplyDeleteThis is very good concept. this is very useful. thanks for sharing.
ReplyDeletevery well explained about the use of oracle checkpoint
ReplyDeletethanks
Very helpful. Struggled with this concept
ReplyDelete. Thanks for sharing
Thank you very much for the detailed explanation about the story behind the checkpoint.
ReplyDeleteSimple and straight forward.!
ReplyDeleteThanks Nawaz, let me know in case you want to explore it further
DeleteVery nice explanation Kanhaiya Lal....also thanks for the parameter LOG_CHECKPOINTS_TO_ALERT....makes it very easy to enable and check in alert_sid.log.
ReplyDeleteAlso see this below:
To convert active group to INACTIVE we need to perform CHECKPOINT as in
alter system checkpoint;
SQL> alter system switch logfile;
System altered.
SQL> select group#, sequence#, status, archived from v$log order by sequence#;
GROUP# SEQUENCE# STATUS ARC
---------- ---------- ---------------- ---
1 7 INACTIVE NO
2 8 ACTIVE NO <<>>
3 9 CURRENT NO
SQL> alter system checkpoint;
System altered.
SQL> select group#, sequence#, status, archived from v$log order by sequence#;
GROUP# SEQUENCE# STATUS ARC
---------- ---------- ---------------- ---
1 7 INACTIVE NO
2 8 INACTIVE NO <<>>
3 9 CURRENT NO <<< To make the CURRENT REDO group to ACTIVE, here it is Group 3-Seq 9, issue alter system switch logfile.>>>
Nonetheless Kanhaiya Lal......it was very nice for you to introduce this.
Bhagwaan aap kaa Bhalaa Kare!
Thank you dear for your time to respond here. Aapka din shubh ho
Delete