PMON、SMON、DBWn、LGWR、CKPT、ARCH等后台进程说明

  • Post author:
  • Post category:其他




Process Monitor (PMON):

该进程在用户进程出现故障时执行进程恢复,负责清理内存储区和释放该进程所使用的资源。例:它要重置活动事务表的状态,释放封锁,将该故障的进程的ID从活动进程表中移去。动态注册信息至监听器。



performs process recovery when a user process fials



–cleans up the database buffer cache



–frees resources that are used by the user process



monitors sessions for idle session timeout




dynamically registers

database services with listeners



When an instance starts, PMON polls the listener to determine whether it is running. If the listener is running, then PMON passes it relevant parameters. If it is not running, then PMON periodically attempts to contact it.



System Monitor (SMON):

该进程在实例启动时执行实例恢复,还负责清理不再使用的临时段。



performs recovery at instance startup



clear up unused temporary segments



Checkpoint Process(CKPT):







完全检查点


把checkpoint写入控制文件和数据文件头部


增量检查点只把checkpoint写入控制文件







Records checkpoint information in



–controlfile



–each data file header



The checkpoint process (CKPT) updates the control file and data file headers with checkpoint information and

signals DBWn to write blocks to disk

. Checkpoint information includes the checkpoint position, SCN, location in online redo log to

begin recovery

, and so on.CKPT does not write data blocks to data files or redo blocks to online redo log files.



When Oracle Database Initiates Checkpoints



–Consistent database shutdown(完全检查点)



–ALTER SYSTEM CHECKPOINT statement

(完全检查点


)




如果LGWR的下一个日志是ACTIVE,那么LWGR会挂起,警告日志会报告”Checkpoint not complete”,oracle会发起alter system checkpoint的操作







–Online redo log switch(增量检查点)



–ALTER DATABASE BEGIN BACKUP statement

(完全检查点


)




–Tablespace and data file checkpoints such as ALTER TABLESPACE BEGIN BACKUP

(完全检查点


)




–Incremental checkpoints

(增量检查点


)









完全检查点:个人更愿意理解只有V$DATABASE.CHECKPOINT_CHANGE#增加了才算发生了一次完全检查点。虽然完全检查点的定义是只要同时写入数据文件头部和控制文件就认为是完全检查点。按个人理解其实上面BEGIN BACKUP这样的操作就不算完全检查点了。




database checkpoint:The thread checkpoint that has

the lowest SCN

. All changes in all enabled redo threads with SCNs before the database checkpoint SCN are guaranteed


to have been written to disk.



Online redo log switch时只有


V$DATABASE.CONTROLFILE_CHANGE#变大






ALTER DATABASE BEGIN BACKUP时V



$DATABASE.CHECKPOINT_CHANGE#没变

,虽然


V$DATABASE.CONTROLFILE_CHANGE#、V$DATAFILE.CHECKPOINT_CHANGE#、V$DATAFILE_HEADER.CHECKPOINT_CHANGE#都变大















–alter tablespace users begin backup时,V$DATABASE.CONTROLFILE_CHANGE#、对应的表空间文件V$DATAFILE.CHECKPOINT_CHANGE#、对应的表空间文件V$DATAFILE_HEADER.CHECKPOINT_CHANGE#变大,

$DATABASE.CHECKPOINT_CHANGE#和

其他表空间对应数据文件

CHECKPOINT_CHANGE#没变






Database Writer Process (DBWn):


散列写即随机IO,DBWn进程可以有多个




The database writer process (DBWn) writes the contents of database buffers to data files. DBWn processes write modified buffers in the database buffer cache to disk



Although one database writer process (DBW0) is adequate for most systems, you can configure additional processes—DBW1 through DBW9 and DBWa through DBWj—to improve write performance if your system modifies data heavily. These additional DBWn processes are not useful on uniprocessor(单处理器) systems.



In many cases the blocks that DBWn writes are scattered throughout the disk. Thus, the writes tend to be slower than the sequential writes performed by LGWR. DBWn performs multiblock writes when possible to improve efficiency.



The DBWn process writes dirty buffers to disk under the following conditions:



–When a server process cannot find a clean reusable buffer after scanning a threshold number of buffers, it signals DBWn to write. DBWn writes dirty buffers to disk asynchronously if possible while performing other processing.



–DBWn periodically(定期) writes buffers to advance the checkpoint



Log Writer Process (LGWR):


顺序写即顺序IO,LGWR进程只能有一个,


按漏斗原理,LGWR写入的优化是ORACLE最终极的优化目标






The log writer process (LGWR) manages the redo log buffer. LGWR writes one contiguous portion(一个连续区域) of the buffer to the online redo log. By separating the tasks of modifying database buffers, performing scattered writes of dirty buffers to disk, and performing fast sequential writes of redo to disk, the database improves performance.



In the following circumstances, LGWR writes all redo entries that have been copied into the buffer since the last time it wrote:



–A user commits a transaction.



–An online redo log switch occurs.



–Three seconds have passed since LGWR last wrote.



–The redo log buffer is one-third full or contains 1 MB of buffered data.



–DBWn must write modified buffers to disk.





ARCH进程日志归档触发条件





1. 如果设置了自动归档模式,则日志切换时,由LGWR进程触发ARCH进程进行归档。这是最常见的方式。




2. 可以手工进行归档。使用命令:alter system archive log current表示启动ARCH进程,从而对当前的日志文件进行归档。




3. 如果ARCH进程在5分钟以后还没有接收到LGWR的通知,则发生超时,于是ARCH被唤醒以检查是否存在需要归档的日志文件。ARCH通过读取控制文件中的信息来决定是否需要归档以及应该归档哪些日志文件。但是在进行实例恢复或者介质恢复的过程中,ARCH进程不会启动。




Manageability Monitor Processes (MMON and MMNL):

主要用于AWR,ADDM,触发SGA中的统计信息写到系统表,也触发统计信息收集



The manageability monitor process (MMON) performs many tasks related to the Automatic Workload Repository (AWR). For example, MMON writes when a metric violates its threshold value, taking snapshots, and capturing statistics value for recently modified SQL objects.capturing statistics value for SQL object that have been recently modified


The manageability monitor lite process (MMNL) writes statistics from the Active Session History (ASH) buffer in the SGA to disk. MMNL writes to disk when the ASH buffer is full.

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/30126024/viewspace-2142022/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/30126024/viewspace-2142022/