| Lesson 12 || Limiting the number of dirty buffers |
| Objective || How to limit the number of dirty buffers |
Limiting the Number of Dirty Buffers
How to limit dirty buffers
You can use the
DB_BLOCK_MAX_DIRTY_TARGET parameter to place an upper limit on the number of dirty buffers in the database buffer cache. You set this parameter in your initialization file, like this:
The example above limits the maximum number of dirty blocks to 200. The default behavior is to have no upper limit at all.
In this context, blocks and buffers are interchangeable. Strictly speaking, a buffer is an area in memory, a block is a piece of data from disk. However, Oracle always sizes the buffers in the buffer cache to match the block size.
200 dirty blocks is equal to 200 dirty buffers.
Why limit dirty buffers?
The number of dirty buffers has a direct impact on the amount of time needed for crash recovery.
That is because when the server crashes, it's the buffered data that you lose. When you restart the instance, those lost changes need to be reconstructed based on information in the redo logs.
The more dirty buffers that are lost, the longer recovery will take.
Recovery time versus performance
If you are in a time-sensitive environment, you might use the
DB_BLOCK_MAX_DIRTY_TARGET parameter to keep the number of dirty blocks, and thus the recovery time, low.
Of course this comes at a cost. Performance might suffer somewhat during periods of high activity, because
Oracle will occasionally need to wait for the database writer to lower the dirty block count (by writing buffers back to the datafiles).
|Parameter type ||Integer|
|Default value ||1 or CPU_COUNT / 8, whichever is greater|
|Range of values ||1 to 20|
DB_WRITER_PROCESSES is useful for systems that modify data heavily. It specifies the initial number of database writer processes for an instance.
DBwriter Process -Quiz
Click the Quiz link below to test what you have learned about the DBWR and database buffers.DBwriter Process -Quiz