ORACLE log_buffer
log_buffer 日志缓冲区是日志信息在内存中临时存放的区域,这些内存块都是循环使用的,当缓冲区内容写入redo文件后,内存被重新利用。
LogBuffer写入Redo Log的条件:
1).用户提交commit
2).有1/3重做日志缓冲区未被写入磁盘(可以通过修改_LOG_IO_SIZE参数来控制 )
3).有大于1M的重做日志缓冲区未被写入磁盘
4).每隔3 秒钟
5). DBWR 需要写入的数据的SCN大于LGWR记录的SCN,DBWR 触发LGWR写入。
在不同的版本中,Oracle对log_buffer描述也不同。
LOG_BUFFER (11.2)
默认值:5 MB 到 32 MB, 取决于SGA大小, CPU数量,以及系统是 32-bit 还是 64-bit
单位:Integer
是否立即生效:否
修改范围: 2 MB
官方介绍:
LOG_BUFFER specifies the amount of memory (in bytes) that Oracle uses when buffering redo entries to a redo log file. Redo log entries contain a record of the changes that have been made to the database block buffers. The LGWR process writes redo log entries from the log buffer to a redo log file.
LOG_BUFFER在Oracle中负责记录redo信息。Redo记录了数据块的改变信息。LGWR进程负责将log buffer中的内容写入redo日志。
The log buffer size depends on the number of redo strands in the system. One redo strand is allocated for every 16 CPUs and has a default size of 2 MB. Oracle allocates a minimum of 2 redo strands per instance. When the log buffer size is not specified, any remaining memory in the redo granules is given to the log buffer.
LOG_BUFFER的大小取决于redo日志组的数量。一般16个CPU分配一个redo日志组,默认log_buffer 为2MB。Oracle要求一个实例最少2个redo日志组。如果log buffer没有指定大小,内存中仍然会为其分配空间。
LOG_BUFFER (12.2)
默认值:2 MB 到 32 MB, 取决于SGA大小, CPU数量
单位: Big integer
是否立即生效:否
修改范围: 2 MB
官方介绍:(与11g描述基本相同)
Redo log entries contain a record of the changes that have been made to the database block buffers. The LGWR process writes redo log entries from the log buffer to a redo log file.
The log buffer size depends on the number of redo strands in the system. One redo strand is allocated for every 16 CPUs and has a default size of 2 MB. Oracle allocates a minimum of 2 redo strands per instance. When the log buffer size is not specified, any remaining memory in the redo granules is given to the log buffer.
LOG_BUFFER (10.2)
默认值:大于 (512 KB 或 128 KB) * cpu数量
单位: Integer
是否立即生效:否
修改范围: 取决于操作系统
官方介绍:(与11g描述基本相同)
LOG_BUFFER specifies the amount of memory (in bytes) that Oracle uses when buffering redo entries to a redo log file. Redo log entries contain a record of the changes that have been made to the database block buffers. The LGWR process writes redo log entries from the log buffer to a redo log file.
In general, larger values for LOG_BUFFER reduce redo log file I/O, particularly if transactions are long or numerous. In a busy system, a value 65536 or higher is reasonable.
LOG_BUFFER可以降低redo日志的I/O,尤其是在有大量事务或长事务的情况下,某些情况下,大于65536大小的log buffer也是允许的。