Oracle中有三类进程:
1 User Process
2 Server Process
Server Process is a program that directly interacts with the Oracle Server. Once a user has established a connection, a server is started to handle the user processes requests. The user process does not interact directly with the Oracle Server. Server Process generate SQL tasks on behalf of user process and return results to user process.
A Server process can be either a deidcated server process or a shared server process.
- Dedicated server process: the server handles the request of a single user process. Once a user process disconnects, the server process is terminated.
- Shared server process: the server can handles the requests of several user processes. Once a user has established a connection, an avaliable server is started to handle the user processes requests.
3 Background processe
Started when an oracle instance is started.
DBWn(Database Writer):writes the dirty buffers from the Database Buffer Cache to the data files.
LGWR(Log Writer): writes from the Redo Log Buffer to the online redo log file.
SMON(System Monitor): If the Oracle instance fails, any information in the SGA that has not been written to disk is lost. After the loss of the instance, SMON will automatically performs instance recovery when the database is reopened.
Instance recovery:
- Rolling forward to recover data that has not been recorded in the data files but that has been recorded in the online redo log file.
- Opening the database so that users can log on.
- Rolling back uncommitted transactions.
PMON(Process Monitor):
Cleans up after failed processes:
- Rolling back the user’s current transaction
- Freeing the resources currently reserved by the user
CKPT(CheckPoint):
Responsible for:
- Signaling DBWn to ensure that Database Buffer Cache that were modified prior to the checkpoint in time have been written to disks.
- Updating datafile headers with checkpoint information.
- Updating control files with checkpoint information.
SCN(System Change number)是一个随着时间不断递增的数字。每对checkpoint进行一次更新操作,就将checkpoint更新为指令执行时的SCN。SCN号和检查点号均可在database表中查到(分别是current_scn和checkpoint_change#)。
data file和control file的每一个文件的文件头中都会有一个检查点号,标志当前文件的同步版本。执行更新checkpoint首先会通知DBWn进行写盘,将所有文件同步到checkpoint,然后会去修改data file和control file的检查号。
检查点的更新策略:
①手动更新。
通过指令”alter system checkpoint”
②自动更新。
系统中有一个动态参数ESTIMATED_MTTR(可以在instance_rcovery表中查到),这个参数代表了当前系统预估所需恢复时间。
可以通过设置fast_start_mttr_target参数(通过”alter system set fast_start_mttr_target=…”指令来设置)来指定多长时间更新一次,当ESTIMATED_MTTR大于fast_start_mttr_target时就执行一次checkpoint更新操作。