oracle数据库后台进程

oracle数据库的主要后台进程

一.data  writer  (DBwn or BWnn)

The database writer writes modified blocks from the database buffer cache to the data files.

Oracle Database allows a maximum of 100 database writer processes. The names of the first 36 database writer processes are DBW0-DBW9 and DBWa-DBWz. The names of the 37th through 100th database writer processes are BW36-BW99.

The DB_WRITER_PROCESSES initialization parameter specifies the number of database writer processes.

The database selects an appropriate default setting for this initialization parameter or adjusts a user-specified setting based on the number of CPUs and the number of processor groups.

二.log write(LGWR)

The log writer process writes redo log entries to disk.

Redo log entries are generated in the redo log buffer of the system global area (SGA).

LGWR writes the redo log entries sequentially into a redo log file.

If the database has a multiplexed redo log, then LGWR writes the redo log entries to a group of redo log files.

三.checkpoint(CKPT)

At specific times, all modified database buffers in the system global area are written to the data files by DBWn. This event is called a checkpoint.

The checkpoint process is responsible for signalling DBWn at checkpoints and updating all the data files and control files of the database to indicate the most recent checkpoint.

四.system monitor(SMON)

The system monitor performs recovery when a failed instance starts up again.

In an Oracle Real Application Clusters database, the SMON process of one instance can perform instance recovery for other instances that have failed.

SMON also cleans up temporary segments that are no longer in use

and recovers terminated transactions skipped during system failure and instance recovery because of file-read or offline errors. These transactions are eventually recovered by SMON when the tablespace or file is brought back online.

五.process MONITOR(PMON)

The process monitor performs process recovery when a user process fails.

PMON is responsible for cleaning up the cache and freeing resources that the process was using.

PMON also checks on the dispatcher processes (described later in this table) and server processes and restarts them if they have failed.

六.archive(arcn)

One or more archiver processes copy the redo log files to archival storage when they are full or a log switch occurs.

七.recoverer(RECO)

The recoverer process is used to resolve distributed transactions that are pending because of a network or system failure in a distributed database.

At timed intervals, the local RECO attempts to connect to remote databases and automatically complete the commit or rollback of the local portion of any pending distributed transactions.

八.dispatcher(Dnnn)

Dispatchers are optional background processes, present only when the shared server configuration is used.

总体来说,数据库后台进程主要有DBWR,LGWR,CKPT,SMON,PMON,ARCH六大后台进程。

其他的作用从名字能够看出来,重点在于SMON和PMON的作用:

smon:重点在于system:实例恢复;清理不再使用的临时段;恢复异常事务。

下面是网友的整理:

PMON  --Process Monitor Process 进程监控进程  
    1.监控进程与执行进程的恢复  
    2.负责清理buffer cache以及释放客户端进程使用的资源。  
    例如重置事务表的状态,释放锁,删除进程ID等  
    3.注册实例信息和调度进程到oracle net service  
    4.pmon会调查监听是否启动,若是启动会传递相关参数给listener,若是没有,pmon会定时尝试连接listener  

pmon:重点在process:进程恢复;清理缓存和释放资源。检查dispatcher进程和服务器进程。

下面是网友的整理:

SMON --System Monitor Process 系统监控进程  
    1.执行实例恢复。例如当实例是不一致性关闭后启动就需要实例恢复  
    2.恢复由于读文件或表空间脱机错误引起中断的事务。  
    3.清空未使用的临时段。--相当于管理tempfile  
    4.合并数据字典管理的表空间里的连续的空闲区块  --管理数据字典管理的表空间  

进程之间的相互关系:

一.dbwn和lgwr的触发条件:

dbwn的触发条件:

1.ckpt发生时;2.脏块太多时;3.db_buffer自由空间不够时;4.3秒。5.表空间read only,offline,backup等模式。

lgwr的触发条件:

1.commit;2.三分之一满(或1M满)3.先于dbwr写;4.3秒。

二.lgwr必须先于dbwn写。 

比如update employees set sale=1000 where employee_id=111;

必须是logbuffer中的信息先写到到日志文件中,然后dgwn把信息从db_buffer_cache中修改到磁盘。

猜你喜欢

转载自www.cnblogs.com/liang-ning/p/12212641.html
今日推荐