第二章 体系结构

第二章 体系结构[align=center][/align]
2.4The process
1.There are three classess of processes in an Oracle instance:
Server Processes - These perform work based on a client's request.
Background Proocesses - These are the processes that start up with the database, and perform various maintaenance tasks, such as writng blocks to disk, maintaining the online redo log, cleaning up aborted processes, and so on
Slave Processes - These are similar to background processes but they are processes that perform extra work on behalf of either a background or a server process

2.4.1Server Process
1.In dedicated server mode, there will be a one-to-one mapping between a client session and a server process(or a thread)
2.It is this process that will come up with the query plan. It is this process that will execute the query plan, perhaps finding the necessary data in the buffer cache, or reading the data from disk int the buffer cache.
3.Your client application will have Oracle libraries linked into it. These libraries provide the Application Program Interface(API) that you need in order to talk to the database. These APIs know how to submit a query to the database, and process the cursor that is returned. They know haow to bundle your requests into network calls that the dedicated sever will know how to un-bundle. This piece of the picture is called Net8.
4.This architecture provides two benefits:
-Remote Execution - It is very natural for the client application to be executing on a machine other than the database itself
-Address Space Isolation - The server process has read-write access to the SGA. An errant pointer in a client process could easily corrupt data structures in the SGA, if the client process and server process were physically linked together.
2.4.1Dedicated Server versus Shared Server
1.The main difference between the two is not, however, in their set up. It is in their mode of operation.
2.With dedicated server, there is a one-to-one mapping between client session, and server process. With MTS there is a many-to-one relationship - many clients to a shared server.
3.Shared server is a shared resource, whereas the dedicated server is not. When using a shared resource, you must be careful not to monopolize it for long periods of time.
4.MTS is highly appropriate for an OLPT system characterized by short, frequent transactions. In an OTLP system, but is highly inappropriate for a data warehouse.
5.MTS does three things for us, mainly:
-Reduces the number of OS processes/threads
-Allows you to artificially limit the degree of concurrency
-Reduces the memory needed on the system


2.4.2Background Processes
1.The Oracle instance is made up of two things: the SGA and a set of background processes. The background processes perform the mundane maintenance tasks needed to keep the database running.
2.There are two classes of background processes: those that have a focused job to do, and those that do a variety of other jobs.
2.4.2.1PMON - The Process Monitor
1.This process is responsible for cleaning up after abnormally terminated connections. PMON will rollback uncommitted work, realease locks, and free SGA resources allocated to the failed process.
2.PMON is responsible for monitoring the other Oracle background processes and restarting them if necessary.
3.The other thing PMON does for the instance, in Oracle 8i, is to register it with the Net8 listener
2.4.2.2SMON - The System Monitor
1.清除临时表空间
2.崩溃恢复
3.聚结空闲空间
4.从不可用的文件中恢复事务的活动
5.OPS中失败节点的实例恢复 - 在Oracle并行服务器配置中,当聚簇中的一个节点宕机,实例中其他一些节点将打开失败节点的重做日志文件,对那个失败的节点执行全部数据的恢复。
6.清除OBJ$ - OBJ$是一个低级的数据字典表,它对数据库中几乎所有的对象(表、索引、触发器、视图等)都包含一个入口。很多时候,这里的入口代表着删除的对象,或代表着“不在那里”的对象。
7.缩减回滚段 - SMON是直线将回滚段自动缩减到最佳大小的进程。
8.使回滚段脱机
2.4.2.3RECO - Distributed Database recovery分布式的数据库恢复
1.2PC是一个分布式协议,它允许影响许多独立的数据库的修改能自动提交。它在提交前试图将尽可能多的分布式失败的窗口关闭。在N个数据库之间的2PC中,通常是客户端最初注册的那个数据库,将成为协调者。如果这些站点准备提交的话,协调者将请求其他的N-1个站点。该站点将进入N-1个站点,并要求它们做好提交的准备。N-1个站点中的每一个都向它报告,是YES或是NO。如果其中一个站点报告为NO,那么,整个事务就被回滚。如果所有的站点都报告为YES,那么,站点协调者在N-1个站点中的每一个上广播消息,将提交持久化。
2.如果在一些站点报告YES之后,它们准备提交,但在它们从协调者获得实际提交指示之前,网络失败或有发生了其他的问题,那么事务变成一个有问题的分别事务。2PC试图限制可能发生此事的时间窗口,但不能删除它。如果恰巧在那时、在那里发生了一个故障,那么事务将变成RECO的责任。
2.4.2.4CKPT - Checkpoint Process 检查点进程
通过更新数据文件的头文件来协助检查点进程
2.4.2.5DBWn - Database Block Writer
1. DBWn它将块分散地写到所有的磁盘上——DBWn进行很多分散的写入。当进行一个更新时,将修改到处保存的索引块,也修改随机分布在磁盘上的数据块。另一方面,LGWR完成了到重做日志的连续写入。
2.分散的写入明显比顺序地写入慢。通过拥有SGA缓冲区的修改块,LGWR进程进行大量的顺序写入,而顺序写入可以重建这些脏缓冲区。这样可以获得性能上的提升。DBWn在后台进行较慢的操作,当用户等待时,LGWR进行较快的工作,这样就保证整体上较好的性能。
3.DBWn使用异步I/0将块写入磁盘。使用异步I/O,DBWn收集了一批需要写的块,并将它们交给操作系统。DBWn不等待OS去实际地将块写入,相反它将返回去,并收集要写的下一批块。随着OS完成写入,OS异步地通知DBWn它已经完成了写入。这就是DBWn以远远快于连续处理的速度进行工作。
2.4.2.6LGWR - Log Writer日志写入器
1.LGWR进程负责将位于SGA中的重做日志缓冲区中的内容刷新的磁盘。它将如下方式进行:
每3秒;当提交时;当重做日志缓冲区1/3满时,或包含了1MB的缓存数据时。
2.4.2.7 - ARCn归档进程
1.归档进程的工作是当LGWR填满联机重做日志时,将其复制到另外的位置上。这些归档的联机重做日志文件将随后用于实施介质恢复。
2.联机重做日志是万一电源发生故障时“修改”数据文件用到,归档重做日志是万一硬盘发生故障时“修改:数据文件用的。
3.ARCn通常将联机重做日志文件复制到至少两个其他位置(冗余是使数据不丢失的一个关键)
2.4.2.8 - BSP(Block Server Process)块服务器进程
本进程专门用于Oracle并行服务器(OPS)环境。通过BSP,数据互换在聚簇之间的高速连接上通过非常快的高速缓冲存储器对高速缓冲存储器间交换来完成。
2..4.2.9 - LMON(Lock Monitor Process) 锁定监控进程
LMON进程监控聚簇中的所有进程,检测实例的失败。它随后,通过与聚簇硬件使用的分布式锁定管理器配合,实现由失败实例保存的全局块的恢复。
2.4.2.10LMD(Lock Manager Dameon)锁定管理器守护程序
LMD进程控制聚簇环境中的块缓冲区缓存高速的全局锁和全局资源
2.4.2.11 - LCKn(Lock Process)锁定进程
它出来所有全局资源的请求,而不是数据库块缓冲区的请求。
2.实用程序后台进程
SNPn(Snapshot Process)快照进程(作业队列)
QMNn(Queue Monitor Process)队列监控进程(高级队列)
EMNn(Event Monitor Process)事件监控进程


2.4.3从属进程
1.I/O从属进程
I/O从属进程用来为不支持异步I/O的系统或设备模拟异步I/0
2.并行查询从属进程
使用SQL语句,如select、create table、create index、update等等,并创建一个执行计划,计划中包含许多可以同时完成的执行计划。其中每一个计划的输出合并为一个大的结果。其目的是,这样做所用的事件只是串行执行所用事件的一小部分。

你可能感兴趣的:(体系结构)