Oracle Process Architecture - Oracle 进程结构篇3

来源:互联网 发布:mac快速回到桌面 编辑:程序博客网 时间:2024/05/16 09:19

前言:接上一篇 Oracle Process Architecture - Oracle 进程结构篇2

           http://blog.csdn.net/nature_ann/article/details/12620813

1.Mandatory background Processes

1.1 Database Writer Process –DBWn

<<---- DBWn进程写数据库缓冲区的内容到数据文件。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.

<<---- 虽然一个数据库写进程适合于大部分的系统,你可以配置追加额外的进程:DBW1—DBW9 & DBWa—DBWj,改进写的性能在系统有大量的修改数据时。但这些附加的DBWn进程在单处理器系统上是无用的。---->>

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.

<<----DBWn进程写脏缓冲区的数据到磁盘,需要下面的触发条件:1.当一个服务器进程,在扫描缓冲区的临界值后,不能发现一个干净的可在使用的缓冲区时,会向DBWn进程发出一个写的信号。当系统正在处理其他IO请求的时候,dbwn会将脏数据块以异步方式写入到磁盘。2.DBWn周期性的将数据块写入磁盘,推进检查点的位置(redo中实例恢复的起始点)。这个检查点的日志位置是由高速缓冲区里的最老的脏块所决定的。---->>

The DBWn process writesdirty buffers to diskunder the following conditions:

>>When a server process cannot find aclean 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 thecheckpoint, which is the position in the redo thread from which instance recovery begins. The log position of the checkpoint is determined by the oldest dirty buffer in the buffer cache.

<<----在很多情况下,DBWn写入磁盘数据是离散的。因此,比起LGWR的顺序写入磁盘的速度要慢。DBWn会可能以批量多块的方式写入以提高性能,每次写入的数据块的数量不是固定的。---->>

In many cases the blocks that DBWn writes arescattered throughout the disk. Thus, the writes tend to be slower than the sequential writesperformed by LGWR. DBWn performsmultiblock writes when possible to improve efficiency. The number of blocks written in a multiblock write varies by operating system.

1.2 Log Writer Process –LGWR

<<----LGWR管理重做日志缓冲区。LGWR写一部分连续的缓冲区数据到在线重做日志。通过分离脏块的任务,进行离散写入脏块到磁盘,快速顺序写入redo到磁盘,这样子数据库可以提高性能。---->>

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.

 

<<----触发LGWR写的条件如下:1.用户提交一个事务。2.在线重做日志的切换。3.三秒超时。4.重做日志缓冲区有1/3满或缓冲区的数据大于1M5.DBWn必须写脏块到磁盘 ---->>

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.

<<----DBWn写脏块之前,redo记录必须写入到磁盘(write-ahead protocol.在写数据缓冲区的数据到磁盘之前,如果DBWn发现一些redo记录没有被写入,它会发信号提醒LGWR写入并等待LGWR写入完成。--->>

Before DBWn can write a dirty buffer, redo records associated with changes to the buffer must be written to disk (thewrite-ahead protocol). If DBWn finds that some redo records have not been written, it signals LGWR to write the records to disk and waits for LGWR to complete before writing the data buffers to disk.

1.2.1 LGWR and Commits

<<----Oracle 数据库使用快速提交的机制提交事务,已提高性能。当一个用户发出一个commit命令时,这个事务将被指定一个scn号。LGWR讲提交记录连同提交SCN及事务redo条目立即写入到磁盘。---->>

Oracle Database uses afast commit mechanism to improve performance for committed transactions. When a user issues aCOMMIT statement, the transaction is assigned a system change number(SCN). LGWR puts a commit record in the redo log buffer and writes it to disk immediately, along with the commit SCN and transaction's redo entries.

<<----重做日志缓冲区是循环的。当LGWRredo条目从重做日志缓冲区到在线重做日志文件时,服务器进程一个新的条目,写入磁盘。一般情况下,LGWR写是足够的快的,以保证日志缓冲区里面新的redo条目总是有空间可用。---->>

The redo log buffer iscircular. When LGWR writes redo entries from the redo log buffer to an online redo log file, server processes can copy new entries over the entries in the redo log buffer that have been written to disk. LGWR normally writes fast enough to ensure that space is always available in the buffer for new entries, even when access to the online redo log is heavy.

<<----重做条目包含事务的提交记录的原子写是单一事件,决定事务是提交的。 Oracle数据库返回一个成功代码提交事务,尽管数据缓冲区尚未被写入到磁盘。相应的变化数据块被延迟,直到DBWn将它们写入数据文件。---->>

The atomic write of the redo entry containing the transaction's commit record is the single event that determines the transaction has committed. Oracle Database returns asuccess code to the committing transaction although the data buffers have not yet been written to disk. The corresponding changes to data blocks are deferred until it is efficient for DBWn to write them to the data files.

<<----LGWR在事务提交之前,会写重做日志条目到磁盘。只有事务提交之后,重做日志条目会成为永久的。---->>

LGWR can writeredo log entries todisk before a transaction commits. The redo entries becomepermanent only if the transaction later commits.

<<----当事务高峰时,LGWR使用组提交。比如:一个用户提交,LGWR写事务redo条目到磁盘。期间发生其他用户提交,LGWR不能写这些事务到磁盘提交,一直到上一个事务未完成之前。如果上一个事务提交完成后,LGWR会写那些等待事务的重做条目的列表。使用这种方法,数据库可以最少的减少磁盘I/O,提交性能。如果提交请求持续在一个高峰点,每一个LGWR写从包含多个提交记录。---->>

When activity is high, LGWR can usegroup commits. For example, a user commits, causingLGWR to write the transaction's redo entries to disk. During this write other users commit. LGWR cannot write to disk to commit these transactions until its previous write completes. Upon completion, LGWR can write the list ofredo entries of waiting transactions (not yet committed) in one operation. In this way, the database minimizes disk I/O and maximizes performance. If commits requests continue at a high rate, then every write by LGWR can contain multiple commitrecords.

1.2.2 LGWR and Inaccessible Files

<<----LGWR同时写在线重做日志文件组中活动的镜像文件。如果一个日志文件是无法写入的,LGWR会继续去写日志组中的其它文件,并发一个错误信息到跟踪文件与警告日志中。如果日志组中的所有文件都是损坏的,或日志组是不可以用的(未活动状态),这时LGWR不能执行它的工作。---->>

LGWR writes synchronously to the active mirrored group of online redo log files. If a log file is inaccessible, thenLGWR continues writing to other files in the group and writes anerror to the LGWRtrace file and the alert log. If all files in a group are damaged, or if the group is unavailable because it has not been archived, then LGWR cannot continue to function.

1.3 Checkpoint Process –CKPT

<<----CKPT进程更新控制文件和数据文件头的检查点信息,并发一个写的信号给DBWn进程。检查点信息包含检查点的位置,scn号,在线重新日子开始恢复的位置等等。如下图所示,CKPT不能写数据块到数据文件或重做日志块到重做日志文件。---->>

The checkpoint process (CKPT)updates thecontrol file anddata file headers with checkpoint information andsignals DBWn to write blocks to disk. Checkpoint information includes thecheckpoint position,SCN,location in online redo log to begin recovery, and so on. As shown in figure 4.1.5 ,CKPT does not write data blocks to data files or redo blocks to online redo log files.

 

          Figure 4.1.5Checkpoint Process

1.4 Manageability Monitor Processes –MMON and MMNL

<<----MMON执行很多有关AWR的任务,比如,MMON写阀值域,收集快照,捕获最近修改sql对象的统计信息。MMNLSGAASH缓冲区到磁盘。当ASH缓冲区满时触发MMNL进程写入磁盘。---->>

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

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.

1.5 Recoverer Process –RECO

<<----在分布式数据库中,RECO进程自动处理分布式事务中失败的事务。一个节点的RECO进程自动连接到其他的数据库,包含in-doubt分布式数据库。当RECO重新在数据库之间确立连接时,它会自动解决所有的 in-doubt事务,移除每一个数据库里pending事务表里的所有行。---->>

In a distributed database , the recoverer process (RECO) automatically resolves failures indistributed transactions. The RECO process of a node automatically connects to other databases involved in an in-doubt distributed transaction. When RECO reestablishes a connection between the databases, it automatically resolves all in-doubt transactions, removing from each database's pending transaction table any rows that correspond to the resolved transactions.

 

 

待续。。。

 

 

 

 

 

 

 

原创粉丝点击