Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> Re: ** v$log.status

Re: ** v$log.status

From: A Joshi <ajoshi977_at_yahoo.com>
Date: Fri, 30 Jan 2004 15:59:26 -0800
Message-ID: <F001.005DE781.20040130155926@fatcity.com>


Thanks Mladen and David  

 It is great to get such detailed info.
If we take your example of three redo logs then you could have a situation where one is is 'CURRENT' status and two are in 'ACTIVE' status. As follows :  

GROUP# STATUS

 Now if group 2 ('CURRENT') fills up or if 'alter system switch logfile' command is given then it will try to go to the next one. Since the next one (in fact both) is 'ACTIVE' it cannot be allocated and made current. Right? So in that case will the database hang? Will it wait for the next sequence redo log which is group 3 to get 'INACTIVE' or will it allocate group 1 if it becomes 'INACTIVE' before group 3.  

Basically given limited space is it advisable to have many smaller redo log groups instead of Oracle suggested bigger redo logs which switch once an hour.  

I agree it is unlikely and might as well just get extra space but the point is to put in the best possible setup and be ready for crazy activity instead of just going by the 'thumb rule' of having one log switch per hour.  

Thank you again

Mladen Gogala <mladen_at_wangtrading.com> wrote: David Hau explained this much better and in much more clear fashion then me. Here is the most important part from the usenet thread he was referring you to:



This makes sense if you think about where the various v$ dynamic performance
views get their info from, and which Oracle background process is responsible for each task. First, note that:
  1. v$log.status gets its redo log info from the *control file*
  2. v$datafile_header.checkpoint_change# and checkpoint_time get their info from the *datafile headers*.

Here's the sequence of events when a log switch happens:

  1. LGWR switches to the next redo log file, changes the status of the previous redo log file from CURRENT to ACTIVE in the control file, and signals DBWR to do a checkpoint on the previous redo log file.
  2. When DBWR finishes with the checkpoint, it signals CKPT to update datafile headers and update checkpoint info (only) in the control file. This is the info read by v$datafile_header.checkpoint_change# and checkpoint_time. Note that CKPT does not update redo log info in the control file. It only deals with checkpoint info, as its name implies.
  3. When CKPT is done, it signals LGWR to update the redo log status in the control file from ACTIVE to INACTIVE. This is the info read by v$log.status. This update task is a low priority item for LGWR because the only process that cares about whether the redo log status is active or not is LGWR itself. The redo log status tells LGWR whether it can reuse a redo log file or not (i.e. whether checkpoint has completed on that redo log file.) That is, by delaying this operation, LGWR is not blocking the work of any other process.

LGWR will update the redo log status in the control file when any of these
occurs (and others too, that I don't know of):

  1. when LGWR periodically checks for compliance with the LOG_CHECKPOINT_TIMEOUT parameter, which says that the checkpoint position should not lag behind the latest redo record by this amount of time.
  2. when you issue a "alter system checkpoint" which is what you did.

So if you want the redo log status to be updated more quickly to inactive
after a checkpoint, one way to do it is to decrease the value of LOG_CHECKPOINT_TIMEOUT in init.ora.

Cheers,
Dave



On 01/30/2004 03:44:29 PM, A Joshi wrote:
> Mladen,
> Thanks for info. So all the dirty blocks need to be written to disk
> after each checkpoint. After that is done the status becomes
> 'INACTIVE'. Just that sometimes this is very unpredictable.
> My question : If a log switch always causes a implicit checkpoint
> then
> what is the need for this explicit checkpoint to be given? Thank you.
>
> Mladen Gogala wrote:
> On 01/30/2004 01:24:26 PM, A Joshi wrote:
> > Hi,
> > In view v$log there is a column status. This changes from current
> > (if the redo log is in use) to atcive then to inactive.
> Documentation
> > says :
> >
> >
> > ACTIVE: The log is active but is not the current log. It is needed
> > for
> > crash recovery. It may be in use for block recovery. It might or
> > might
> > not be archived.
> >
> > INACTIVE: The log is no longer needed for instance recovery. It may
> > be
> > in use for media recovery. It might or might not be archived.
> >
> > So if it is in 'ACTIVE' status : it means it is needed for
> > crash/instance recovery? So what does it mean? That changes in this
> > log are still not written to data files? What else? Is this related
> > to
> > delayed block cleanout etc or no connection?
> >
> > What factor affects how long it will be in ACTIVE state before
> going
> > to INACTIVE? What can be changed to control how long it takes. Any
> > trade off?
> >
> > Any detailed explanation on this will be greatly appreciated. You
> can
> > mail me direct or to the list. Thank you.
> >
> Status of active means that log has been switched, but not all of the
> changes are written to the disk. It is, essentially, saying that DBWR
> has some more work to do to catch up. The only log that is open by
> the
> instance is the one marked "CURRENT". Here is an example:
> SQL> select group#,status from v$log;
>
> GROUP# STATUS
> ---------- ----------------
> 1 CURRENT
> 2 INACTIVE
> 3 INACTIVE
>
> SQL> alter system switch logfile;
>
> System altered.
>
> SQL> select group#,status from v$log;
>
> GROUP# STATUS
> ---------- ----------------
> 1 ACTIVE
> 2 CURRENT
> 3 INACTIVE
>
> So, after the checkpoint, the CKPT has updated log file headers,
> corresponding markers and termination records are written to the
> file,
> data file headers have been updated and so has been the control file.
> DBWR still has some work to do because there are still unwritten
> blocks modified by transactions whose log records are in the "ACTIVE"
> file. DBWR will take its time to write them down.
> The only log file open by the instance is redo02:
>
> [root_at_tux925 root]# fuser /data/db/OraHome1/oradata/compldb/*.log
> /data/db/OraHome1/oradata/compldb/redo02.log: 6019
> [root_at_tux925 root]#
>
> After another checkpoint, everyhing is back to normal:
>
> SQL> alter system checkpoint
> 2 /
>
> System altered.
>
> SQL> select group#,status from v$log;
>
> GROUP# STATUS
> ---------- ----------------
> 1 INACTIVE
> 2 CURRENT
> 3 INACTIVE
>
> --
> Please see the official ORACLE-L FAQ: http://www.orafaq.net
> --
> Author: Mladen Gogala
> INET: mladen_at_wangtrading.com
>
> Fat City Network Services -- 858-538-5051 http://www.fatcity.com
> San Diego, California -- Mailing list and web hosting services
> ---------------------------------------------------------------------
> To REMOVE yourself from this mailing list, send an E-Mail message
> to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
> the message BODY, include a line containing: UNSUB ORACLE-L
> (or the name of mailing list you want to be removed from). You may
> also send the HELP command for other information (like subscribing).
>
> ---------------------------------
> Do you Yahoo!?
> Yahoo! SiteBuilder - Free web site building tool. Try it!
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.net
-- 
Author: Mladen Gogala
INET: mladen_at_wangtrading.com

Fat City Network Services -- 858-538-5051 http://www.fatcity.com
San Diego, California -- Mailing list and web hosting services
---------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from). You may
also send the HELP command for other information (like subscribing).

---------------------------------
Do you Yahoo!?
Yahoo! SiteBuilder - Free web site building tool. Try it!
--0-804178148-1075507149=:63846
Content-Type: text/html; charset=us-ascii

<DIV>Thanks Mladen and David </DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;It is great to get such detailed info.</DIV>
<DIV>If we take your example of three redo logs then you could have a situation where one is is 'CURRENT'&nbsp; status and two are in 'ACTIVE' status. As follows :</DIV>
<DIV>&nbsp;</DIV>
<DIV>GROUP# STATUS<BR>&nbsp;---------- ----------------<BR>&nbsp;1 ACTIVE<BR>&nbsp;2 CURRENT<BR>&nbsp;3 ACTIVE<BR></DIV>
<DIV>&nbsp;Now if&nbsp; group 2 ('CURRENT')&nbsp; fills up or if 'alter system switch logfile' command is given then it will try to go to the next one. Since the next one (in fact both) is 'ACTIVE' it cannot be allocated and made current.&nbsp;Right?&nbsp;So in that case will the database hang?&nbsp;Will it wait for the next sequence&nbsp;redo log which is group 3 to get 'INACTIVE' or will it&nbsp;allocate <BR>group 1 if it becomes 'INACTIVE' before group 3. </DIV>
<DIV>&nbsp;</DIV>
<DIV>Basically given limited space is it advisable to have many smaller redo log groups instead of Oracle suggested bigger redo logs which switch once an hour. </DIV>
<DIV>&nbsp;</DIV>
<DIV>I agree it is unlikely and might as well just get extra space but the point is to put in the best possible setup and be ready for crazy activity&nbsp;instead of just going by the 'thumb rule' of having one log switch per hour.</DIV>
<DIV>&nbsp;</DIV>
<DIV>Thank you&nbsp;again </DIV>
<DIV><BR><B><I>Mladen Gogala &lt;mladen_at_wangtrading.com&gt;</I></B> wrote:</DIV>
<BLOCKQUOTE class=replbq style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #1010ff 2px solid">David Hau explained this much better and in much more clear<BR>fashion then me. Here is the most important part from the usenet<BR>thread he was referring you to:<BR>**********************************************************************<BR>This makes sense if you think about where the various v$ dynamic <BR>performance<BR>views get their info from, and which Oracle background process is<BR>responsible for each task. First, note that:<BR><BR>1. v$log.status gets its redo log info from the *control file*<BR>2. v$datafile_header.checkpoint_change# and checkpoint_time get their <BR>info<BR>from the *datafile headers*.<BR><BR>Here's the sequence of events when a log switch happens:<BR><BR>1. LGWR switches to the next redo log file, changes the status of the<BR>previous redo log file from CURRENT to ACTIVE in the control file, and<BR>signals DBWR to do a checkpoint on the previous !
redo log
 file.<BR>2. When DBWR finishes with the checkpoint, it signals CKPT to update<BR>datafile headers and update checkpoint info (only) in the control file.<BR>This is the info read by v$datafile_header.checkpoint_change# and<BR>checkpoint_time. Note that CKPT does not update redo log info in the<BR>control file. It only deals with checkpoint info, as its name implies.<BR>3. When CKPT is done, it signals LGWR to update the redo log status in <BR>the<BR>control file from ACTIVE to INACTIVE. This is the info read by<BR>v$log.status. This update task is a low priority item for LGWR because <BR>the<BR>only process that cares about whether the redo log status is active or <BR>not<BR>is LGWR itself. The redo log status tells LGWR whether it can reuse a <BR>redo<BR>log file or not (i.e. whether checkpoint has completed on that redo log<BR>file.) That is, by delaying this operation, LGWR is not blocking the <BR>work<BR>of any other process.<BR><BR>LGWR will update the redo log status i!
n the
 control file when any of <BR>these<BR>occurs (and others too, that I don't know of):<BR><BR>1. when LGWR periodically checks for compliance with the<BR>LOG_CHECKPOINT_TIMEOUT parameter, which says that the checkpoint <BR>position<BR>should not lag behind the latest redo record by this amount of time.<BR><BR>2. when you issue a "alter system checkpoint" which is what you did.<BR><BR>So if you want the redo log status to be updated more quickly to <BR>inactive<BR>after a checkpoint, one way to do it is to decrease the value of<BR>LOG_CHECKPOINT_TIMEOUT in init.ora.<BR><BR>Cheers,<BR>Dave<BR>**************************************************************************<BR>On 01/30/2004 03:44:29 PM, A Joshi wrote:<BR>&gt; Mladen,<BR>&gt; Thanks for info. So all the dirty blocks need to be written to disk<BR>&gt; after each checkpoint. After that is done the status becomes<BR>&gt; 'INACTIVE'. Just that sometimes this is very unpredictable.<BR>&gt; My question : If a log switch alway!
s causes
 a implicit checkpoint <BR>&gt; then<BR>&gt; what is the need for this explicit checkpoint to be given? Thank you.<BR>&gt; <BR>&gt; Mladen Gogala <MLADEN_at_WANGTRADING.COM>wrote:<BR>&gt; On 01/30/2004 01:24:26 PM, A Joshi wrote:<BR>&gt; &gt; Hi,<BR>&gt; &gt; In view v$log there is a column status. This changes from current<BR>&gt; &gt; (if the redo log is in use) to atcive then to inactive.<BR>&gt; Documentation<BR>&gt; &gt; says :<BR>&gt; &gt;<BR>&gt; &gt;<BR>&gt; &gt; ACTIVE: The log is active but is not the current log. It is needed<BR>&gt; &gt; for<BR>&gt; &gt; crash recovery. It may be in use for block recovery. It might or<BR>&gt; &gt; might<BR>&gt; &gt; not be archived.<BR>&gt; &gt;<BR>&gt; &gt; INACTIVE: The log is no longer needed for instance recovery. It may<BR>&gt; &gt; be<BR>&gt; &gt; in use for media recovery. It might or might not be archived.<BR>&gt; &gt;<BR>&gt; &gt; So if it is in 'ACTIVE' status : it means it is needed for<BR>&gt; &gt; crash/instance recover!
y? So
 what does it mean? That changes in this<BR>&gt; &gt; log are still not written to data files? What else? Is this related<BR>&gt; &gt; to<BR>&gt; &gt; delayed block cleanout etc or no connection?<BR>&gt; &gt;<BR>&gt; &gt; What factor affects how long it will be in ACTIVE state before <BR>&gt; going<BR>&gt; &gt; to INACTIVE? What can be changed to control how long it takes. Any<BR>&gt; &gt; trade off?<BR>&gt; &gt;<BR>&gt; &gt; Any detailed explanation on this will be greatly appreciated. You<BR>&gt; can<BR>&gt; &gt; mail me direct or to the list. Thank you.<BR>&gt; &gt;<BR>&gt; Status of active means that log has been switched, but not all of the<BR>&gt; changes are written to the disk. It is, essentially, saying that DBWR<BR>&gt; has some more work to do to catch up. The only log that is open by <BR>&gt; the<BR>&gt; instance is the one marked "CURRENT". Here is an example:<BR>&gt; SQL&gt; select group#,status from v$log;<BR>&gt; <BR>&gt; GROUP# STATUS<BR>&gt; ----------
 ----------------<BR>&gt; 1 CURRENT<BR>&gt; 2 INACTIVE<BR>&gt; 3 INACTIVE<BR>&gt; <BR>&gt; SQL&gt; alter system switch logfile;<BR>&gt; <BR>&gt; System altered.<BR>&gt; <BR>&gt; SQL&gt; select group#,status from v$log;<BR>&gt; <BR>&gt; GROUP# STATUS<BR>&gt; ---------- ----------------<BR>&gt; 1 ACTIVE<BR>&gt; 2 CURRENT<BR>&gt; 3 INACTIVE<BR>&gt; <BR>&gt; So, after the checkpoint, the CKPT has updated log file headers,<BR>&gt; corresponding markers and termination records are written to the <BR>&gt; file,<BR>&gt; data file headers have been updated and so has been the control file.<BR>&gt; DBWR still has some work to do because there are still unwritten<BR>&gt; blocks modified by transactions whose log records are in the "ACTIVE"<BR>&gt; file. DBWR will take its time to write them down.<BR>&gt; The only log file open by the instance is redo02:<BR>&gt; <BR>&gt; [root_at_tux925 root]# fuser /data/db/OraHome1/oradata/compldb/*.log<BR>&gt; /data/db/OraHome1/oradata/compldb/redo02.lo!
g:
 6019<BR>&gt; [root@tux925 root]#<BR>&gt; <BR>&gt; After another checkpoint, everyhing is back to normal:<BR>&gt; <BR>&gt; SQL&gt; alter system checkpoint<BR>&gt; 2 /<BR>&gt; <BR>&gt; System altered.<BR>&gt; <BR>&gt; SQL&gt; select group#,status from v$log;<BR>&gt; <BR>&gt; GROUP# STATUS<BR>&gt; ---------- ----------------<BR>&gt; 1 INACTIVE<BR>&gt; 2 CURRENT<BR>&gt; 3 INACTIVE<BR>&gt; <BR>&gt; --<BR>&gt; Please see the official ORACLE-L FAQ: http://www.orafaq.net<BR>&gt; --<BR>&gt; Author: Mladen Gogala<BR>&gt; INET: mladen@wangtrading.com<BR>&gt; <BR>&gt; Fat City Network Services -- 858-538-5051 http://www.fatcity.com<BR>&gt; San Diego, California -- Mailing list and web hosting services<BR>&gt; ---------------------------------------------------------------------<BR>&gt; To REMOVE yourself from this mailing list, send an E-Mail message<BR>&gt; to: ListGuru@fatcity.com (note EXACT spelling of 'ListGuru') and in<BR>&gt; the message BODY, include a line containing: UNSUB
 ORACLE-L<BR>&gt; (or the name of mailing list you want to be removed from). You may<BR>&gt; also send the HELP command for other information (like subscribing).<BR>&gt; <BR>&gt; ---------------------------------<BR>&gt; Do you Yahoo!?<BR>&gt; Yahoo! SiteBuilder - Free web site building tool. Try it!<BR>-- <BR>Please see the official ORACLE-L FAQ: http://www.orafaq.net<BR>-- <BR>Author: Mladen Gogala<BR>INET: mladen@wangtrading.com<BR><BR>Fat City Network Services -- 858-538-5051 http://www.fatcity.com<BR>San Diego, California -- Mailing list and web hosting services<BR>---------------------------------------------------------------------<BR>To REMOVE yourself from this mailing list, send an E-Mail message<BR>to: ListGuru@fatcity.com (note EXACT spelling of 'ListGuru') and in<BR>the message BODY, include a line containing: UNSUB ORACLE-L<BR>(or the name of mailing list you want to be removed from). You may<BR>also send the HELP command for other information (like
 subscribing).</BLOCKQUOTE><p><hr SIZE=1>
Do you Yahoo!?<br>
Yahoo! SiteBuilder - Free web site building tool. <a href="http://us.rd.yahoo.com/evt=21608/*http://webhosting.yahoo.com/ps/sb/"><b>Try it!</b></a>
--0-804178148-1075507149=:63846--
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.net
-- 
Author: A Joshi
  INET: ajoshi977_at_yahoo.com

Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
San Diego, California        -- Mailing list and web hosting services
---------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
Received on Fri Jan 30 2004 - 17:59:26 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US