1. Get rid of all advertisements and get unlimited access to documents by upgrading to Premium Membership. Upgrade to Premium Now and also get a Premium Badge!

Oracle Backup Control files - The mystery behind it

Discussion in 'Server Administration and Options' started by simply_dba, Oct 16, 2008.

  1. simply_dba

    simply_dba Forum Advisor

    Messages:
    95
    Likes Received:
    5
    Trophy Points:
    140
    Location:
    Kolkata, India
    We all know that in certain recovery situations we need to use backup control files.And after the recovery, Oracle requires a RESETLOGS operation because Oracle needs to update certain structures in the backup control file before opening the database and resetting the logs.Let's try to understand what is updated and why?

    But let me first tell you what a backup control file is not :

    -An OS copy of the Control file taken when the database close.
    -An OS copy of the Control file taken when the database open.
    -An OS copy of the Control file taken when the database mounted.
    -A trace of the control file taken with the command 'Alter database backup controlfile to trace;'


    A backup control file is an image of the control file with some distinctive features of it's own.

    -It contains a file type flag(value=4) that tells oracle that it is a backup control file.
    -It is consistent with respect to a single point in time.
    -the stop SCN markers for each data file record are set to "0xffff.ffffffff". This means "not available".

    The above mentioned qualities ensure that the integrity of the control file is preserved. The file type flag of the control file tells oracle to ignore it's redo thread, checkpoint progress and log file records.By instructing Oracle to recover using a backup control file you are telling Oracle to avoid the redo thread records and log file records in the control file – and you know why.

    So, when we backup the control file to trace and generate the control file creation script,can we create a backup control file?
    The answer is yes. If you remember the script, there are are two sets of control file creation statements, one with resetlogs and another with noresetlogs.The one with resetlogs creates the backup control file.


    You can get the file type information by using the oradebug command

    Code (Text):
    sql>oradebug setmypid;
    Statement processed.
     
    sql>oradebug dump controlf 10;
    Statement processed.
    You will get the dump file at your user_dump_dest location.

    Be careful about using the backup control file command during recovery, as it may turn your current control file to a backup control file thereby destroying the log sequence ancestry via the resetlogs command.

    So why does one needs to do a resetlogs after recovery with backup control file ?
    Well the answer is as below

    Within each control file there are checkpoint progress records that provide Oracle with the on-disk RBA (redo byte address). This tells Oracle the offset into the current redo log file(s) that the LGWR has flushed the redo thread.

    Let’s suppose Oracle permitted you to open the database without a RESETLOGS after recovery using a backup control file. Then Oracle must use what it knows to be true about its online redo thread: the log file records, redo stream records and checkpoint progress records. If the redo log files remained intact during your restore and recovery then they probably have previously generated redo. If you have 3 online redo log groups and your backup control file states that the on-disk RBA is half way into group 2 and the existing (non-reset) redo log for group 2 is full of previously generated redo, Oracle would start writing redo to its last know on-disk RBA. Hopefully you see where this is going. Potentially, the last half of redo written to group 2 would correspond to changes post-recovery, i.e. you would have a redo log that is corrupt. There could be a major gap in SCNs between the last entry pre-recovery and the first entry post-recovery within the same redo log file. For this reason, Oracle needs to update the redo thread, log file and checkpoint progress records in accord with the new incarnation of the database.

    Cheers
    :D

    My heartful thanks to Eric S. Emrick, the author of the article "Backup Control Files- Are they Special ?", who , so beautifully, explained the concept of Backup control file.
     
  2. tyro

    tyro Forum Genius

    Messages:
    368
    Likes Received:
    20
    Trophy Points:
    260
    Location:
    India
    very good post! i was not quite aware of what control files do and for that matter what is a backup control file.

    This was very good to learn :D
     
  3. dcraig

    dcraig Guest

    Hello,
    This is called PLAGIARISM!
    Atleast say a Thanks to the original Author.
    A complete copy paste of Eric S. Emrick blog
     
  4. simply_dba

    simply_dba Forum Advisor

    Messages:
    95
    Likes Received:
    5
    Trophy Points:
    140
    Location:
    Kolkata, India
    Ok, I have been accused of plagiarism here. Let's see it's definition first.
    Noun: plagiarism 'pleyju`rizum
    1. A piece of writing that has been copied from someone else and is presented as being your own work.
    2. The act of plagiarizing; taking someone's words or ideas as if they were your own.
    So, I have been accused of taking someone's words or ideas and presenting them as they were of my own.

    Can you point me out from the thread which of the point i mentioned is the 'original' idea of Erick S Emrick?. Isn't all of them facts? If the repeatation of the same facts by different persons is called plagiarism, then all the authers of Oracle should be accused of plagiarism since they repeated and explained the concepts of the designers of the Oracle RDBMS.I cannot alter facts that backup controlfile has a file type flag or that it's stop scn markers have the value "0xffff.ffffffff". That would be wrong
    Furthermore, this is a forum you are visiting,and none of us are authors over here (well, I may be wrong). I am not selling anything here. Nor does posting anything here benefits me in any way (except for the fact that i may win some friends). This is a place where we exchange ideas about the database and it's utilities that we have gathered from different sources and by working on it all this years.I have read many of Eric's blogs (They are all so fantastic and easy to understand, by the way.) and also of lot of others. I wrote about the analytic functions after reading,understanding and experimenting about them from Tom Kyte's Expert One on One.(So I should be accused of plagiarizing Tom Kyte too.)
    About thanking the author? Of course, I am heartily thankful to not only Eric S Emric, but also to Tom Kyte, Cary Millsap, Jonathan Lewis, Rama Vhelpuri and host of other Oracle authors (I like to call them philosophers) who have guided me so well in all this years.I religiously read their books and articles and try to follow them wherever I can. Most of my writings reflect their thoughts and actions.
    However, these are my internal thoughts that have come out. I would request the admin to remove this thread and/or any other threads that he thinks are plagiarized
     
  5. Sadik

    Sadik Community Moderator Forum Guru

    Messages:
    1,906
    Likes Received:
    252
    Trophy Points:
    1,455
    hi simply_dba

    i think dcraig's concern was perhaps regarding whether it's a copy-paste. However I understand your point of view and i am not deleting this thread. I suggest you edit the original post and mention the source. That should be sufficient.