Skip to Main Content
  • Questions
  • Correlation between MAXLOGHISTORY & CONTROL_FILE_RECORD_KEEP_TIME

Breadcrumb

Question and Answer

Tom Kyte

Thanks for the question, Saibabu.

Asked: October 05, 2001 - 8:26 pm UTC

Last updated: April 27, 2009 - 2:38 pm UTC

Version: 8.1.7

Viewed 10K+ times! This question is

You Asked

Hi,Iam really confused after going through numureous documents on these parameters.I have some doubts to be clarified :

1)What is significance of MAXLOGHISTORY parameter in non-OPS environments.
2)If Control_file_record_keep_time=0,then upto what point recovery can go back under RMAN backups and disk hot backups.
3)In one of our 8.1.7.1 Databases,MAXLOGHISTORY is at 1405.
count from v$loghist=1405
count from v$archived_log=1393
value from v$controlfile_record_section=1393 for Archived Logs.
My assumption is counts between v$loghist and v$archived_log should match.What are the reasons for it.
control_file_record_keep_time=7
select min(completion_time) from v$archived_log=22-AUg-2001.(?????)
If control_file_record_keep_time says to keep records for 7 days,why Iam seeing the records from 22-AUG-2001.Please explain.

4)In another 8.1.6 databases,
MAXLOGHISTORY=4991
control_file_record_keep_time=7
count from v$archived_log=8783
count from v$loghist=4991
value from v$controlfile_record_section=8783 for Archived Logs.
If MAXLOGHISTory will increase dynamically when control_file_record_keep_time<>0,then the above counts should match.
I don't understand how MAXLOGHISTORY is less than count from v$archived_log.
In this database,select min(completion_time) from v$archived_log=28-SEP-2001,which is expected.

5) What can be done if ORA-19571 error comes up while backing up archived logs using RMAN.How can I backup those logs which are missing from control file.

You help is very much aprreciated.
Thanks
Sai.



and Tom said...

1) well -- the documentation seems clear on this to me:

<quote>
Note: This parameter is useful only if you are using Oracle with the Parallel Server option in parallel mode, and archivelog mode enabled.
</quote>

so, it would be saying that is has not significance outside of OPS/RAC. It controls the number of log history records available on v$log_history.

2) well, it depends. RMAN usually uses a recovery catalog, not the control file. If you are using RMAN with just the control file and no recovery catalog, it'll totally depend on how fast you cycle through and reuse reusable records in the control file. In any case -- you can always recover manually regardless (you do not lose the ability to recover, we just might not be able to supply you the filenames)

3 & 4) they shouldn't be the same. loghist (log_history is the prefered view) is controled by the maxloghistory. v$archived_log is controlled by the control_file_record_keep_time -- those records are among the circularly reusable records. We'll dynamically expand the control file to hold 7 days worth of archive log information for you (if you have it set to 7). On the 8th day, we just overwrite the old records and reuse their slots.

So, one is retained by a physical count (maxloghistory) and shows the history of the logs.

The other is retained by a number of days -- keep the history for the last N days -- and will cause the control file to grow as needed.


As for why you are seeing really old records in v$archived log -- you must have had a 7 day period in which you generated LOTS of archives, more then you did in the recent past. That caused this section to grow larger to hold it. We won't shrink it back -- hence you have more space then you need to hold your current 7 days worth of information. The 7 is a MINIMUM retention time. It does not mean we purge records older then 7 days.


5) set your control_file_record_keep_time to be at least one day GREATER then the period of time between your backups, else there is a chance that an archive record gets aged out during the backup which thoroughly confuses the situation.

Rating

  (16 ratings)

Is this answer out of date? If it is, please let us know via a Comment

Comments

Reader

A reader, April 16, 2002 - 9:24 am UTC

Tom,
Could you elaborate on this:
"
In any case -- you can always recover manually regardless
(you do not lose the ability to recover, we just might not be able to supply you
the filenames)
"

It implies as though, you can recover the database, even if you lose the recovery catalog, and the target database, as long as you know the names of the data sets that have
backed up using RMAN.

Thanks

Tom Kyte
April 16, 2002 - 12:13 pm UTC

yes.

bits are bits and bytes are bytes after all. if you can access the backups....

Reader

A reader, April 16, 2002 - 12:46 pm UTC

Tom,

I am still a bit unclear

The backup sets are in RMAN special format. Therefore we
have to use RMAN command to either *restore* and recover
OR *recover*. The command line syntax does not specify
the location of backup set or name of backup set. How
to supply the information to RMAN command

Thanks

Tom Kyte
April 21, 2002 - 5:34 pm UTC

</code> http://docs.oracle.com/docs/cd/A87860_01/doc/server.817/a76990/rmanreco.htm#441496 <code>

you'll get a control file out and then you can use the control file with rman to get the rest.

Reader

A reader, April 17, 2002 - 10:06 am UTC

Tom,

This is an absolute extremely useful Recovery scenario.

If we can know the process involved in accomplishing this,
we can test this scenario before bringing a Production
database go alive. Could you outline in a high level,
steps involved to perform this.

Thanks

A reader, April 22, 2002 - 2:04 pm UTC

Tom,

"
</code> http://download-west.oracle.com/docs/cd/A87860_01/doc/server.817/a76990/rmanreco.htm#441496 <code>
"

Could you give us the Title of the article. The URL only
gets to the main login frame

Thanks

Tom Kyte
April 22, 2002 - 9:00 pm UTC

That link -- if you wait for the page to load -- will take you to:

....
Restoring the Control File from a Backup Set Without Using RMAN

You must use a non-standard procedure to restore a control file from an RMAN backup set in the following situations:

* You are using a pre-8.0.5 version of RMAN to restore a database when more than one database with the same name is registered in the recovery catalog (see "Restoring When Multiple Databases Share the Same Name" for a discussion of this problem).

* You are not using a recovery catalog, and your only control file backup is in an RMAN backup set.
............


you are the second * there.


Reader

A reader, May 02, 2002 - 10:09 am UTC

Tom,

I was able to try out this scenario successfully

One caveat though:
If you backup using RMAN (ex. backup database ), the
controlfile is backed up with system datafile (default).
The control file from this backup set, when restored, is
unaware of the names of the backup sets

Probable solutions:
1. Subsequent to RMAN backup of database and archivelogs,
   backup the control file in its own backup piece

2. Use the logfile from the RMAN to determine the names
   of the constituent file names of backup set.
   Use the PROCEDURES "restoredatafileto" and
   "restoreArchivedlog" to restore datafiles and
   archive logs

In either case, recover is conventional recover
SQL>recover database using backup controlfile until ....
SQL>alter database open resetlogs;


Your comments please

Thanks 

Review my script....

Sikandar Hayat Awan, February 17, 2003 - 1:03 am UTC

I am using the following scripts to take full backup with RMAN on Oracle 8.1.7 (Win 2000). Please suggest me if I am doing any thing wrong or any improvement?

***I am using control file instead of catalog.***

--------RMAN_Backup.bat

--delete the previous backup files as it is moved to dat.
!del F:\HotBackup\*.* /q

rman target internal/oracle nocatalog @d:\cglmis\sikandar\rman\full_back.txt log=d:\cglmis\sikandar\rman\of_back.log

sqlplus internal/oracle @d:\cglmis\sikandar\rman\ctrlfile.sql

net send sikandar 'ORAPT backup Completed......'

echo on

Exit

--------Full_backup.txt
run {
allocate channel c1 type disk;
backup database format 'f:\hotbackup\oraptdb_%d_%t_%u.bus';
}

------ctrlfile.sql
alter system archive log current;

alter database backup controlfile to trace;

alter database backup controlfile to 'f:\hotbackup\ctrl_OF.ora';

Exit;

+++++++
I am taking full backup on daily basis please also suggest me that incremental/commulative will be the good option as the data is increasing. Any drawback of commulative backups at the time of restore (time is not my consideration at the moment) as I want to make sure 100% recovery of data.

For reference I am using online manuals and Oracle RMAN Pocket Reference by Darl Kuhn (O'REILLY).


how to read a Control file

Mir, May 11, 2004 - 1:07 pm UTC

Tom,

We had a situation when one of the harddrives failed and our database wont startup becoz it was not able to read the control file on that harddrive.

Do Oracle have or supply a utility which can read Control Files and display them in Text format. Much like "ALTER DATABASE BACKUP CONTROLFILE TO TRACE".

as always thank you very much.

Tom Kyte
May 11, 2004 - 3:04 pm UTC

if the control file is garbage, the control file is garbage (if the database cannot read it because it is on a failed harddisk, how would you read it?).


take one from your backup and use it to create a new control file from it. documented in the backup and recovery guide.

how to read a Control file

Mir, May 11, 2004 - 6:14 pm UTC

Sorry i wasn't very clear on my previous post. what i am tryin to do is figure out the directories for all my files associated with the database. In our case one harddrive failed so i was trying to figure out the list of files on various driectories. since this information is stored in the Control file i was wondering if oracle has some utility which can read the control file found on other drives, in order for us to figure out the layout of files for our DB.

Tom Kyte
May 11, 2004 - 9:02 pm UTC

if you have good control files -- I'm not seeing what your problem is????

just comment out the bad one from your init.ora and startup.


if you have at least one good control file -- that is all you need. not understanding what the problem is?

re: control file

Mark A. Williams, May 11, 2004 - 10:11 pm UTC

If you can successfully start the database using at least one good control file, you could do an 'alter database backup controlfile to trace' to get a 'text' version of the file that you could then read. Is that what you are wanting?

- Mark

is my customer lucky

Marvin, July 08, 2004 - 11:57 am UTC

Hi

I have a customer who is using controlfile for his RMAN backups. He has 

control_file_record_keep_time        integer 7

So one would expect he can only recover his databae using RMAN until 7 days ago however when I run list backup I can actually see RMAN recognizes backups from a month ago. When counting v$archived_log I can actually count logs from February to today. 

SQL> select min(FIRST_TIME), min(COMPLETION_TIME), max(FIRST_TIME), max(COMPLETION_TIME) from v$archived_log;

MIN(FIRST MIN(COMPL MAX(FIRST MAX(COMPL
--------- --------- --------- ---------
05-FEB-04 05-FEB-04 08-JUL-04 08-JUL-04


select * from V$CONTROLFILE_RECORD_SECTION

TYPE              RECORD_SIZE RECORDS_TOTAL RECORDS_USED FIRST_INDEX LAST_INDEX LAST_RECID
----------------- ----------- ------------- ------------ ----------- ---------- ----------
DATABASE                  192             1            1           0          0          0
CKPT PROGRESS            4084             8            0           0          0          0
REDO THREAD               104             8            1           0          0          0
REDO LOG                   72            32            6           0          0          9
DATAFILE                  180           254           18           0          0         99
FILENAME                  524           319           28           0          0          0
TABLESPACE                 68           254           16           0          0         25
RESERVED1                  56           254            5           0          0          9
RESERVED2                   1             1            0           0          0          0
LOG HISTORY                36          2949         2949         113        112      11227
OFFLINE RANGE              56           291            0           0          0          0
ARCHIVED LOG              584          2867         2867         116        115       8883
BACKUP SET                 40           612          612         495        494       2126
BACKUP PIECE              736           510          510          87         86       2126
BACKUP DATAFILE           116           563          563         476        475       2164
BACKUP REDOLOG             76         23859        23859       14545      14544      41842
DATAFILE COPY             660           519            2           1          2          2
BACKUP CORRUPTION          44           371            0           0          0          0
COPY CORRUPTION            40           408            0           0          0          0
DELETED OBJECT             20          7351         7351        7115       7114      69189
PROXY COPY                852           575            0           0          0          0
RESERVED4                   1          8168            0           0          0          0


Is this a lucky case that controlfile data are not overwritten? 

Tom Kyte
July 08, 2004 - 12:17 pm UTC

7 is the minimum, it can be much larger.

if for example, they had a period of really big activity for 7 days -- the control file would have grown to hold that.

Now, they settle down - the control file stays big and uses things in a circular (fifo) manner so much more than 7 would be there.

they don't even need a big period of activity -- could be that their activity is just slow enough that given the size of their control files, it sticks around.

great

Marvin, July 08, 2004 - 3:55 pm UTC

Hi

Thanks for the explanation, is there a way to shrink a control file?

Cheers

Tom Kyte
July 08, 2004 - 8:42 pm UTC

you can recreate them...

large controlfile - should I be concerned?

AR, November 23, 2004 - 12:53 pm UTC

Tom,
I just inherited a 500G database where the control_file_record_keep_time has been set to 270days. Consequently, controlfile sections have been expanding every couple of weeks to accomodate this value. The controlfile size is upto 250Mb already (and still growing).

Should I be concerned about this large controlfile? Yes, an RMAN "resync catalog" would be slightly slower with a large controlfile. But are there any other performance implications? (waits??) Is there an immediate need for me to reduce the keep_time parameter and recreate the controlfile?

Thank you for your time.

Tom Kyte
November 23, 2004 - 2:10 pm UTC

other than rman wanting to exclusively lock it during some backup operations - while getting a copy (250m might take longer than your average control file copy)-- I'm not aware of any issues.

might back off that keep time if you feel you have sufficient history to avoid it growing more.

if you do hit an issue, at least they are very easy to rebuild "empty"

controlfile size

Sam, August 17, 2005 - 10:34 pm UTC

Is there a limit on the size of controlfile? My colleague was saying that on unix/linux platform it is about 20000*oracle block size? He said he heard from someone. I could not find any oracle document discussing about it? Could you share if you have any information on this? Thanks.

Controlfile Rebuild

reader, September 28, 2005 - 8:20 am UTC

When we rebuild the Controlfile we will loose the RMAN information stored in the controlfile.Is there a way to keep them and rebuild .

Why I am asking this because I think I read somewhere that with 10gr2 it is possible (but lost the link)

Thanks

abort MAXLOGHISTORY

alan tan, May 09, 2007 - 2:07 am UTC

Hi,Tom:
I create a controlfile as parameter like:

CREATE CONTROLFILE REUSE DATABASE "STUDY" RESETLOGS ARCHIVELOG

2 -- SET STANDBY TO MAXIMIZE PERFORMANCE

3 MAXLOGFILES 20

4 MAXLOGMEMBERS 5

5 MAXDATAFILES 100

6 MAXINSTANCES 1

7 MAXLOGHISTORY 50-- I set this value.

¿¿¿



and then I backup control to trace,I got:

MAXLOGFILES 20

MAXLOGMEMBERS 5

MAXDATAFILES 100

MAXINSTANCES 1

MAXLOGHISTORY 226 -- is differenct !

why?
Thank you !
Tom Kyte
May 11, 2007 - 9:33 am UTC

some things are rounded up to minimums based on other parameters, your operating system and the like.

sequence# and thread# in RAC

jian huang zheng, April 27, 2009 - 11:07 am UTC

Hi Tom
I want to know sequence# is unique within each thread or globally unique, such as
could this make sense for 2 node RAC:
thread 1 sequence# 20998
thread 2 sequence# 20998

Thanks!
Tom Kyte
April 27, 2009 - 2:38 pm UTC

you need both to identify a redo log file, yes.

More to Explore

Backup/Recovery

Check out the complete guide to all of the Backup & Recovery techniques in the Oracle Database.