Oracle Internals Notes

Log Buffer Guard Pages

On platforms that support memory protection there are guard pages on each side of the log buffer. These are one memory protection unit in size - normally 4K or 8K. Oracle uses an mprotect() system call during instance startup to set the permissions on the guard pages to PROT_NONE. Thus any attempt to read from or write to either of the guard pages will return the EACCES error and cause the process to abort, even if the effective user id of the process is oracle.

The intent of the guard pages is to reduce the risk of log buffer corruption. It is possible for an Oracle bug, hardware memory error or hacker stack corruption attack to cause a pointer or offset to be corrupted so that data is copied into memory at an incorrect location. The guard pages prevent such corruptions from over running the log buffer.

Log buffer protected by guard pages

The following listing shows that the guard pages are included in the size of the "Redo Buffers" as shown in V$SGA, but are excluded from the size of the "log_buffer" as shown in V$SGASTAT. Oracle DBAs are often puzzled by this discrepancy.

SQL> select name, value from v$sga where name = 'Redo Buffers';

NAME                      VALUE
-------------------- ----------
Redo Buffers             532480

SQL> select name, bytes from v$sgastat where name = 'log_buffer' and pool is null;

NAME                            BYTES
-------------------------- ----------
log_buffer                     524288

© Ixora Pty Ltd.   All rights reserved.
05-Apr-2002
Search   Questions   Feedback   Up   Home