1

While going through the Oracle architecture documentation I got stuck while trying to understand the following inforamtion. Could someone help me answering this?

Why do we need both redo log buffer cache and redo log files? Why can't we write the data directly to redo log files from the database buffer cache?

1

4 Answers 4

2

I suppose you could write the information directly to the redo log at each modification, but that would mean a lot of very small 'write' operations on disk.

If you cache this instead you can at least wait the next 'COMMIT' and do less 'writes'. In my experience this buffer does not need to be very large because of this, on a typical system COMMITs will come quite often, and there are other rules to flush as well...

So to answer the question: For performance reasons!

0
2

Redo Log Buffers: A log buffer is a circular buffer in the SGA that holds information about changes made to the database. This information is stored in the redo entries. Redo entries contain the information necessary to reconstruct or redo changes made to the database by insert, update, delete, create, alter, or drop operations. Redo entries are primarily used for database recovery as necessary.

Redo Log: The most crucial structure for recovery operations is the redo log, which consists of two or more preallocated files that store all changes made to the database as they occur. Every instance of an Oracle Database has an associated redo log to protect the database in case of an instance failure.

for more information about database structure please refer to https://docs.oracle.com/en/

0
-1

Why can't we write the data directly to redo log files from database buffer cache?

When DML or DDL operation occurs, database buffer cache does not hold old version of data and new version of data to perform redo or undo operations. Thus, it is not convenient to write data from database buffer cache to redo log files.

Why do we need both redo log buffer cache and redo log files?

In Oracle, redo log buffer resides redo entries that have the information to redo changes made by DML and DDL operations. There is at least one LGWR (Log Writer Process) that writes redo entries in the redo log buffer to redo file on the disk. When a user commits a transaction LGWR must write the transaction's redo entries to disk immediately. Imagine your system does not have a redo log buffer and you configured one LGWR process. When a user commits his transaction, LGWR writes the transaction's redo entries to disk and there could be multiple incoming COMMIT statements from other users that must be written to disk while LGWR is writing first transaction's entries. In the absence of a buffer those incoming COMMIT statements would be blocked.

-2

while doing the dml in the database , redo buffers and db buffers are two different activities first 1.redolog buffers and db buffers will allocate after execution plan , the redo log buffers fill and based on commit and threshold values the data parallel moving to redo log files .This is only for recovery . in redo buffers based the instance type of down the redo log buffers will may roll back or roll forward based on commit to recover the instance to bring up the instance . So hear is redo files will have commited data for recovery we need redo buffers information.

Second one :- db duffers are use to store the data to dbf file , It's again depend up on threshold value, it's not depend up on commit .

So for the recovery purpose redo log files will have exact committed data or recoverable data. redo log buffers can have the commit and non commit data for roll forward and roll backward .

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.