This discussion is archived
1 2 Previous Next 22 Replies Latest reply: Apr 18, 2013 3:18 PM by Roger25 RSS

backup vs redo log files

Roger25 Explorer
Currently Being Moderated
Hi,
Can anyone tell me what's the real difference between a backup file and a redo log file/archived redo log file and the scenarios (examples) when each of them can be used (for example, "......") ? Both are used for database/instance recovery. I have read the concepts of there 2 terms, but I need some additional information about the difference.

Thanks!
  • 1. Re: backup vs redo log files
    jgarry Guru
    Currently Being Moderated
    That's kind of a broad question.

    Redo is needed to re-do transactions in a recovery, backups are needed to have data to apply redo to.
  • 2. Re: backup vs redo log files
    Aman.... Oracle ACE
    Currently Being Moderated
    I shall say the same what Joel has said, it's a very broad question.
    Roger25 wrote:
    Can anyone tell me what's the real difference between a backup file and a redo log file/archived redo log file and the scenarios (examples) when each of them can be used (for example, "......") ?
    The backup files can be understood as like the xerox copy of a file. So if you want to save a duplicate of an original document, how would you do that, you would make a xerox of it right? Backup of a file is just that, a duplicate copy of the original source file. But assume that the source file is getting updated too. So how would you ensure that the duplicate copy of the source file, which you made a month ago is going to match exactly with the new and updated source file? Well, simply by fitting in those missing new entries right? Those new entries are updated in the redo log/ archive log. If you understand this (sort of) analogy , it's good else it would be tricky to make you get the concept.
    Both are used for database/instance recovery. I have read the concepts of there 2 terms, but I need some additional information about the difference.
    No, you are wrong in the concept. The backup files are not used in the case of the instance recovery and so are the archive logs . In the instance recovery, only the online log files are going to be used. The backup files and the archive logs are going to be asked only in the case of the media recovery.

    HTH
    Aman....
  • 3. Re: backup vs redo log files
    Roger25 Explorer
    Currently Being Moderated
    Ok, thanks for reply.
    Like your example with the xerox file give me please an example/scenario with online redo log / archive redo log, to better understant the concept with an example.

    Regards,
  • 4. Re: backup vs redo log files
    Aman.... Oracle ACE
    Currently Being Moderated
    Roger25 wrote:
    Ok, thanks for reply.
    Like your example with the xerox file give me please an example/scenario with online redo log / archive redo log, to better understant the concept with an example.
    Didn't I give the example to explain the same concept?

    Aman....
  • 5. Re: backup vs redo log files
    EdStevens Guru
    Currently Being Moderated
    Roger25 wrote:
    Ok, thanks for reply.
    Like your example with the xerox file give me please an example/scenario with online redo log / archive redo log, to better understant the concept with an example.

    Regards,
    Database changes are written to the online redo logs, which are of a fixed number and fixed size. Since they are fixed in size and number, they can only hold a fixed number of changes. When one online redolog group is full, the changes begin to be written to the next online redo log group. While that group is being used, the previous log is being copied to an archivelog file. Once the copy to the archivelog file is complete, that online redo log is available to be used again when the others get full.

    The achivelog file is simply a copy of an online redo log.

    See the Concepts Manual, at http://docs.oracle.com/cd/E11882_01/server.112/e25789/physical.htm#sthref1425
  • 6. Re: backup vs redo log files
    Hemant K Chitale Oracle ACE
    Currently Being Moderated
    An ArchivedRedoLog is a copy of an OnlineRedoLog that is made after the Online Log is full. Making the copy allows LGWR to subsequently overwrite the Online Log as it operates in a circular manner through the Online Logs.

    A Backup of one or more ArchivedRedoLogs is a backup of the file(s). Why backup ?
    a. The Archived Redo Log filesystem (log_archive_dest / log_archive_dest_n) has finite space and space needs to be cleared by purging ArchivedRedoLogs. So, they are backed up before being purged.
    b. The Backups are written to a different set of disks and/or to tape. This is to help protect against loss of the ArchivedRedoLogs if the disk/filesystem containing these files is lost/damaged/corrupted.
    c. The Backups and Archived Redo Logs not yet backed up are used for Media Recovery if the database has to be restored from an older backup.

    Hemant K Chitale
  • 7. Re: backup vs redo log files
    Roger25 Explorer
    Currently Being Moderated
    What i still don't understand is how redo mechanism works; I know, redo logs records changes made to the database and it's used to re-do informations in case of a system failure/crash, for example. Ok, let's say I have a huge update, but when the system crash has occured, the transaction is neither comitted, nor rolled back. Then, how this redo is useful? If a system crash occur, all those updates aren't rolled back automatically? So the database state is as before executing that huge update? So in this case, 'what to redo'?
  • 8. Re: backup vs redo log files
    sb92075 Guru
    Currently Being Moderated
    when all else fails Read The Fine Manual

    http://docs.oracle.com/cd/E11882_01/server.112/e25789/startup.htm#CNCPT1301
  • 9. Re: backup vs redo log files
    Aman.... Oracle ACE
    Currently Being Moderated
    Roger25 wrote:
    What i still don't understand is how redo mechanism works; I know, redo logs records changes made to the database and it's used to re-do informations in case of a system failure/crash, for example. Ok, let's say I have a huge update, but when the system crash has occured, the transaction is neither comitted, nor rolled back. Then, how this redo is useful? If a system crash occur, all those updates aren't rolled back automatically? So the database state is as before executing that huge update? So in this case, 'what to redo'?
    No, with the system's crash, the transaction never gets a chance to get committed (and even rolled back) because a commit is only supposed to happen if there is an explicit or implicit commit statement is issued. Now, for the redo , with the statement, a commit marker is entered at the end of the redo stream of that transaction denoting that it's finally over now and for the corresponding transaction, the status is cleared from the transaction table that's stored in the Undo segment in which the Undo information of that transaction is stored. If you have given a huge update, the redo would be very highly required as you should be knowing that it's not all the time that the dirty buffers that are written to the data files unlikely the redo log files which are written every 3 econds. This means, there is a very fair chance that many changes have yet not even propagated to the data files for which the change vectors are now already there in the redo log files. Now, for the sake of clarity, assume that this transaction was actually committed! So now, without those changes be applied to the data files how Oracle can actually show the committed reults when the database next time would be opened? For this purpose, the redo change vectors are required. And for the uncommitted transactions , the applcation of the redo change vectors would keep on updating the Checkpoint numbers of the data files and would eventually get them synched with the control file and redo log files, without which the database would never be opened.

    HTH
    Aman....
  • 10. Re: backup vs redo log files
    mbobak Oracle ACE
    Currently Being Moderated
    In the event of an instance crash, on instance startup, Oracle will do what's called instance recovery.

    The purpose of instance recovery is to get the database into a consistent state, and recover up to the last committed transaction.

    So, at the time of the crash, many transactions may have been 'in-flight' (neither committed or rolled back). So, Oracle needs to sort all that out, and clean up what's been committed vs. what hasn't,

    So, at instance restart, it will read the datafile headers and control file information to determine the last checkpoint of each datafile. Then, Oracle can refer to redo (the online redo logs) and apply all the changes, up to the point in time of the crash. But now, some of those transactions were not committed at the point of the crash. So, now Oracle will use undo to determine which transactions were not committed, and use the undo data to rollback uncommitted transactions.

    So, that's how Oracle recovers from an instance crash. First, use redo to replay all the transactions and roll foward to the point in time of the crash. Then, use undo to rollback all the uncommitted transactions, and the database will be fully recovered, up to the last committed transaction.

    Hope that helps,

    -Mark
  • 11. Re: backup vs redo log files
    Roger25 Explorer
    Currently Being Moderated
    >
    The backup files and the archive logs are going to be asked only in the case of the media recovery.
    >

    Please give me an example of "media recovery". Or.. an example of media error, or a situation which requires media recovery. It's about the physical storage?

    For example, one year ago, one of my colleague, erroneously modified an update in a package, on a very large table (~30 millions rows) and failed to write the where clause too. In that case, all the production was blocked and was down for ~1 hour. I was curious what the DBA has done in that moment, the previous database state was restored from the online redo logs? So it's not about backups here, since the media storage was ok. That "huge" update was not commited, nor rolled back, all the modified rows (since the DBA stopped the instance), have remained 'in-flight' :)
  • 12. Re: backup vs redo log files
    jgarry Guru
    Currently Being Moderated
    http://docs.oracle.com/cd/E11882_01/server.112/e25789/cncptdba.htm#CNCPT88772

    I don't know if your description of what your colleague did is accurate, but if he crashed the instance to prevent the update, on restart the uncommitted transaction would roll forward then roll back. That's an instance recovery. Media recovery usually refers to damaged media. The "damage" could be as simple as echo "" > system.dbf.
  • 13. Re: backup vs redo log files
    Roger25 Explorer
    Currently Being Moderated
    Yes, it's accurate.. that update "crashed" the instance (that table is very often used and no one can do nothing on the instance in that moment), but why "on restart the uncommitted transaction would roll forward then roll back" ? In this case (instance recovery) only the online redo log file was used and not the backup?
  • 14. Re: backup vs redo log files
    sb92075 Guru
    Currently Being Moderated
    Roger25 wrote:
    Yes, it's accurate.. that update "crashed" the instance (that table is very often used and no one can do nothing on the instance in that moment), but why "on restart the uncommitted transaction would roll forward then roll back" ? In this case (instance recovery) only the online redo log file was used and not the backup?
    too bad for us that you never read or understood details available from Reading The Fine Manual below

    http://docs.oracle.com/cd/E11882_01/server.112/e25789/toc.htm
1 2 Previous Next

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points