tags:

views:

226

answers:

4

Can any body give me an idea about Redo logs? An example would be most appreciated.

+2  A: 

As Oracle changes data in a datafile, it writes out information to the redo log. In the event of a database failure, you can use this information to get the database back to the point it was before the database failure.

In a disaster recovery scenario, you could restore your last full database backup, and then apply the redo logs taken since that last backup to get the database recovered. Without those redo logs, you could only recover to the last full backup, and changes made since then would be lost.

In Oracle, you can also run in "no archive log mode", which basically means, "redo logs can be overwritten without being saved". This is generally only acceptable for a development database where you don't care about losing data since the last backup. You wouldn't typically run in this mode in a production environment, as it could be disastrous.

Here's a reference link with more info, and also an example of how you can find out the amount of generated redo.

http://www.adp-gmbh.ch/ora/concepts/redo%5Flog.html

dcp
Oracle generally writes to the redo log #before# writing to the data files. The commit can be carried out without the dirty blocks being flushed to the data files at all.
David Aldridge
A: 

To expand on @dcp's answer: Technically, @dcp is referring to archived redo logs. These are optional, and as stated are only produced when running the database in archivelog mode. Every Oracle database has at least two mandatory online redo log files. These track all changes to the database. They are essential for recovery if the database crashes unexpectedly, whereas archived logs are not. Oracle uses the online redo log files to transparently bring the database back to the most recently committed state in the event of a system crash. Archived logs are used during recovery from a backup - the backup is restored, then archived logs are applied to the backup to bring the database back to it's current state or some prior point in time.

The online logs are written to in circular fashion - as one fills the next one is "swtiched" to. If archive log mode is set, then these older logs are written to the archive log destination(s). If not, they are overwritten as needed, once the changes they track are written to the datafiles.

This overview of backup and recovery at Oracle's site is pretty good to give one an idea of how the whole thing is put together.

DCookie
+3  A: 

A definitive answer from the documentation: http://download.oracle.com/docs/cd/B19306%5F01/server.102/b14231/onlineredo.htm#sthref850

David Aldridge
A: 

excellent Article

charanjit