一:进程简介
- 应用程序或者Oracle数据库实用程序
- Oracle数据库代码
1:多进程Oracle 数据库代码
2:进程类型
实例恢复:SMON
清理进程:PMON
重做缓冲区写入磁盘:dbwn
---查看数据库状态 SYS@orcl> select status from v$instance; STATUS ------------ OPEN ---从上得知:此时数据库是打开open状态:查看此时数据库的后台进程信息 SYS@orcl> ho ps -ef |grep ora_ oracle 11999 1 0 May09 ? 00:00:05 ora_pmon_orcl oracle 12001 1 0 May09 ? 00:00:18 ora_psp0_orcl oracle 12003 1 0 May09 ? 00:00:29 ora_vktm_orcl oracle 12007 1 0 May09 ? 00:00:01 ora_gen0_orcl oracle 12009 1 0 May09 ? 00:00:01 ora_diag_orcl oracle 12011 1 0 May09 ? 00:00:02 ora_dbrm_orcl oracle 12013 1 0 May09 ? 00:00:10 ora_dia0_orcl oracle 12015 1 0 May09 ? 00:00:01 ora_mman_orcl oracle 12017 1 0 May09 ? 00:00:19 ora_dbw0_orcl oracle 12019 1 0 May09 ? 00:00:28 ora_lgwr_orcl oracle 12021 1 0 May09 ? 00:00:26 ora_ckpt_orcl oracle 12023 1 0 May09 ? 00:01:10 ora_smon_orcl oracle 12025 1 0 May09 ? 00:00:01 ora_reco_orcl oracle 12027 1 0 May09 ? 00:00:20 ora_mmon_orcl oracle 12029 1 0 May09 ? 00:01:48 ora_mmnl_orcl oracle 12031 1 0 May09 ? 00:00:01 ora_d000_orcl oracle 12033 1 0 May09 ? 00:00:02 ora_s000_orcl oracle 12062 1 0 May09 ? 00:00:09 ora_arc0_orcl oracle 12064 1 0 May09 ? 00:00:10 ora_arc1_orcl oracle 12066 1 0 May09 ? 00:00:01 ora_arc2_orcl oracle 12070 1 0 May09 ? 00:00:14 ora_arc3_orcl oracle 12072 1 0 May09 ? 00:00:01 ora_qmnc_orcl oracle 12088 1 0 May09 ? 00:00:17 ora_cjq0_orcl oracle 12092 1 0 May09 ? 00:00:01 ora_q000_orcl oracle 12126 1 0 May09 ? 00:00:01 ora_smco_orcl oracle 25238 1 0 15:56 ? 00:00:00 ora_q002_orcl oracle 28073 1 0 22:00 ? 00:00:00 ora_vkrm_orcl oracle 28839 1 0 23:41 ? 00:00:00 ora_w000_orcl oracle 28853 28836 0 23:42 pts/2 00:00:00 /bin/bash -c ps -ef |grep ora_ oracle 28855 28853 0 23:42 pts/2 00:00:00 grep ora_ SYS@orcl>
---删除后台进程 smon ; SYS@orcl> ho kill -9 12023 /bin/bash: line 0: kill: (12023) - No such process ---再来查看数据库状态 SYS@orcl> select status from v$instance; select status from v$instance * ERROR at line 1: ORA-03135: connection lost contact Process ID: 28837 Session ID: 200 Serial number: 4305 ---从查询结果来看:数据库的o'r'c'l实例已经不存在了,所以其数据库状态 也就不存在; SYS@orcl>---此时:oracle的所有后台进程全部终止 SYS@orcl> ho ps -ef |grep ora_ oracle 28885 28836 0 23:48 pts/2 00:00:00 /bin/bash -c ps -ef |grep ora_ oracle 28887 28885 0 23:48 pts/2 00:00:00 grep ora_ SYS@orcl>
SYS@orcl> exit Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - Production With the Partitioning, OLAP, Data Mining and Real Application Testing options [oracle@localhost ~]$ rlwrap sqlplus / as sysdba; SQL*Plus: Release 11.2.0.3.0 Production on Mon May 14 23:49:37 2018 Copyright (c) 1982, 2011, Oracle. All rights reserved. Connected to an idle instance. ---退出再登陆后;发现此时是空闲实例 SYS@orcl>----当数据库实例不能运行或者阻塞状态时,可以直接 kill -9 smon后台进程;然后再重新启动数据库: SYS@orcl> exit Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - Production With the Partitioning, OLAP, Data Mining and Real Application Testing options [oracle@localhost ~]$ rlwrap sqlplus / as sysdba; SQL*Plus: Release 11.2.0.3.0 Production on Mon May 14 23:49:37 2018 Copyright (c) 1982, 2011, Oracle. All rights reserved. Connected to an idle instance. SYS@orcl> startup ORACLE instance started. Total System Global Area 523108352 bytes Fixed Size 1346052 bytes Variable Size 394266108 bytes Database Buffers 121634816 bytes Redo Buffers 5861376 bytes Database mounted. Database opened. SYS@orcl> ho ps -ef |grep ora_ oracle 28970 1 0 23:53 ? 00:00:00 ora_pmon_orcl oracle 28972 1 0 23:53 ? 00:00:00 ora_psp0_orcl oracle 28974 1 0 23:53 ? 00:00:00 ora_vktm_orcl oracle 28978 1 0 23:53 ? 00:00:00 ora_gen0_orcl oracle 28980 1 0 23:53 ? 00:00:00 ora_diag_orcl oracle 28982 1 0 23:53 ? 00:00:00 ora_dbrm_orcl oracle 28984 1 0 23:53 ? 00:00:00 ora_dia0_orcl oracle 28986 1 3 23:53 ? 00:00:00 ora_mman_orcl oracle 28988 1 0 23:53 ? 00:00:00 ora_dbw0_orcl oracle 28990 1 0 23:53 ? 00:00:00 ora_lgwr_orcl oracle 28992 1 0 23:53 ? 00:00:00 ora_ckpt_orcl oracle 28994 1 0 23:53 ? 00:00:00 ora_smon_orcl oracle 28996 1 0 23:53 ? 00:00:00 ora_reco_orcl oracle 28998 1 2 23:53 ? 00:00:00 ora_mmon_orcl oracle 29000 1 0 23:53 ? 00:00:00 ora_mmnl_orcl oracle 29002 1 0 23:53 ? 00:00:00 ora_d000_orcl oracle 29004 1 0 23:53 ? 00:00:00 ora_s000_orcl oracle 29033 1 0 23:53 ? 00:00:00 ora_p000_orcl oracle 29035 1 0 23:53 ? 00:00:00 ora_p001_orcl oracle 29037 1 0 23:53 ? 00:00:00 ora_p002_orcl oracle 29039 1 0 23:53 ? 00:00:00 ora_arc0_orcl oracle 29041 1 9 23:53 ? 00:00:00 ora_arc1_orcl oracle 29043 1 12 23:53 ? 00:00:01 ora_arc2_orcl oracle 29045 1 9 23:53 ? 00:00:00 ora_arc3_orcl oracle 29051 1 0 23:53 ? 00:00:00 ora_qmnc_orcl oracle 29067 1 2 23:53 ? 00:00:00 ora_cjq0_orcl oracle 29069 1 0 23:54 ? 00:00:00 ora_vkrm_orcl oracle 29071 1 16 23:54 ? 00:00:00 ora_j000_orcl oracle 29073 1 3 23:54 ? 00:00:00 ora_j001_orcl oracle 29075 1 4 23:54 ? 00:00:00 ora_j002_orcl oracle 29077 1 0 23:54 ? 00:00:00 ora_j003_orcl oracle 29078 28891 0 23:54 pts/2 00:00:00 /bin/bash -c ps -ef |grep ora_ oracle 29080 29078 0 23:54 pts/2 00:00:00 grep ora_ SYS@orcl>
二:客户端 进程描述
1:客户端和服务器进程
oracle 进程必须是在 oracle服务器上产生
2:连接和会话
三:服务器进程概述
1:专用服务器进程
2:共享服务器进程
四:后台进程概述
查看后台进程
SYS@orcl> set linesize 3000; SYS@orcl> select pname from v$process where pname is not null order by pname; PNAME ----- ARC0 ARC1 ARC2 ARC3 CJQ0 CKPT D000 DBRM DBW0 DIA0 DIAG PNAME ----- GEN0 J000 J001 LGWR MMAN MMNL MMON PMON PSP0 Q000 Q001 PNAME ----- QMNC RECO S000 SMCO SMON VKTM W000 29 rows selected. SYS@orcl>
SYS@orcl> ho ps -ef |grep ora_ oracle 3497 1 0 09:49 ? 00:00:00 ora_w000_orcl oracle 3635 1 0 10:00 ? 00:00:00 ora_j000_orcl oracle 3637 1 0 10:00 ? 00:00:00 ora_j001_orcl oracle 3638 28891 0 10:01 pts/2 00:00:00 /bin/bash -c ps -ef |grep ora_ oracle 3640 3638 0 10:01 pts/2 00:00:00 grep ora_ oracle 28970 1 0 May14 ? 00:00:00 ora_pmon_orcl oracle 28972 1 0 May14 ? 00:00:01 ora_psp0_orcl oracle 28974 1 0 May14 ? 00:00:01 ora_vktm_orcl oracle 28978 1 0 May14 ? 00:00:00 ora_gen0_orcl oracle 28980 1 0 May14 ? 00:00:00 ora_diag_orcl oracle 28982 1 0 May14 ? 00:00:00 ora_dbrm_orcl oracle 28984 1 0 May14 ? 00:00:00 ora_dia0_orcl oracle 28986 1 0 May14 ? 00:00:00 ora_mman_orcl oracle 28988 1 0 May14 ? 00:00:01 ora_dbw0_orcl oracle 28990 1 0 May14 ? 00:00:01 ora_lgwr_orcl oracle 28992 1 0 May14 ? 00:00:02 ora_ckpt_orcl oracle 28994 1 0 May14 ? 00:00:00 ora_smon_orcl oracle 28996 1 0 May14 ? 00:00:00 ora_reco_orcl oracle 28998 1 0 May14 ? 00:00:01 ora_mmon_orcl oracle 29000 1 0 May14 ? 00:00:03 ora_mmnl_orcl oracle 29002 1 0 May14 ? 00:00:00 ora_d000_orcl oracle 29004 1 0 May14 ? 00:00:00 ora_s000_orcl oracle 29039 1 0 May14 ? 00:00:00 ora_arc0_orcl oracle 29041 1 9 May14 ? 00:55:49 ora_arc1_orcl oracle 29043 1 9 May14 ? 00:55:37 ora_arc2_orcl oracle 29045 1 9 May14 ? 00:55:33 ora_arc3_orcl oracle 29051 1 0 May14 ? 00:00:00 ora_qmnc_orcl oracle 29067 1 0 May14 ? 00:00:00 ora_cjq0_orcl oracle 29082 1 0 May14 ? 00:00:00 ora_q000_orcl oracle 29084 1 0 May14 ? 00:00:00 ora_q001_orcl oracle 29130 1 0 May14 ? 00:00:00 ora_smco_orcl SYS@orcl>
1:强制性后台进程
进程监视器进程 PMON
即:如果 PMOM进程出现问题,则数据库的网络连接可能链接不了
系统监视器进程 SMON
表空间:居多使用的都是本地管理方式
数据库写入器进程DBwn
DBWn: n 表示 数字:从0 开始 1,2,3,4,5……….
增量检查点
日志写入器进程 LGWR
commit ;命令执行的操作:此时只是把缓冲区的数据写入到练级重做日志文件。此时数据还未写入到数据文件。
3秒钟 开始执行
先执行 LGWR 然后再执行 DBwn 。即:当缓冲区的脏数据写入到练级重做日志文件后,才开始将数据缓冲区的数据写入到数据库文件中。
LGWR与提交
当 ckpt开始工作的时候, 调用 DBWn开始工作,把缓冲区的数据写入到数据文件中,并从日志文件中获取SCN号来更新控制文件和数据文件头部的SCN号。
恢复器进程 RECO
2:可选后台进程
归档器进程ARCn
作业队列进程 CJQ0 Jnnn
闪回数据存档器进程 FBDA
3:从属进程
——————————————————————————————————————————————————————