按照使用对象分为客户端进程(client)ORACLE进程,ORACLE进程有分为后台进程(background)、服务进程(server)和从进程(slav
Oracle进程类型:
对于数据库的进程,数据库实例包含或与之交互。
按照使用对象分为客户端进程(client)ORACLE进程,ORACLE进程有分为后台进程(background)、服务进程(server)和从进程(slave)。server进程执行基于client进程的请求。
例如:server进程解析SQL查询,将这些查询语句存放于shared pool中,对每个查询创建并执行查询计划。并且从buffer cache或磁盘中读取数据。
进程结构依赖于操作系统和ORACLE数据库可选模式。
服务(server)进程可以分为专享(dedicated)和共享(shared)服务
专享模式下的进程结构
共享模式下的进程结构
通过V$PROCESS视图查看一下进程信息:
col addr for a16
COL SPID FORMAT a8 --系统进程
COL STID FORMAT a8 --系统线程
col usrname for a20
col program for a25
select addr,pid,spid,stid,usrname,program from v$process order by stid;
客户端(client)进程:
ps -ef | grep -e sample -e sqlplus | grep -v grep
在客户端和服务端用以下命令查看的结果是不同的,客户端仅显示sqlplus进程。服务端显示为非本地连接。
关于会话连接:
使用ORACLE的autotrace收集执行语句统计信息时,会自动创建一个场景
SQL> select sid,serial#,paddr from v$session where username=user;
SID SERIAL# PADDR
---------- ---------- ----------------
96 3 00000001F051C858
SQL> set autotrace on statistics; ---跟踪SQL语句执行计划额外重建了一个场景
SQL> select sid,serial#,paddr from v$session where username=user;
SID SERIAL# PADDR
---------- ---------- ----------------
96 3 00000001F051C858
98 5 00000001F051C858
SQL> SELECT PROGRAM FROM V$PROCESS WHERE ADDR = hextoraw('00000001F051C858');
PROGRAM
---------------------------------------------------------------------
oracle@021Y-SH-BKAP (TNS V1-V3)
后台(background)进程
1234 SELECT PNAME
FROM V$PROCESS
WHERE PNAME IS NOT NULL
ORDER BY PNAME;
后台进程可以分为强制(mandatory)进程、可选(Optional)进程和从(Slave)进程
强制(mandatory)进程包括:
PMON --监控其他后台进程,当服务或调度进程异常终断。PMON被用于清理并释放客户端进程使用的数据buffer cache和资源。如:PMON重置事务表的状态,释放闲置的锁并且移除闲置的进程ID。
LREG 实例动态注册监听进程。当实例启动时,LREG进程判断监听器是否运行。该进程在12c被引入。
SMON 系统监控进程负责多个系统级的清理工作,于之相关的包括:
1、执行实例恢复。
2、恢复因文件读或表空间offline错误导致终断的事务。
3、清理临时的未使用的段。
4、通过表空间的字典管理合并连续空闲的区间。
SMON会定期检查是否需要使用,其他进程需要时也会调用SMON。
DBW 数据库写进程,将Buffer cache中修改的内容写到数据文件中。通常一个DBW进程就可以满足系统的写需求,也可以开启多个来改进性能。范围从DBW0-9,DBWa-z,DBW36-99
修改DBW进程数的参数db_writer_processes,该参数是动态参数,重启后生效。
1 show parameter db_writer_processes
以下两个条件触发DBW进程的写操作:
1、当服务进程扫描buffer池,当在阀值内找不到可用的buffers时,触发DBW将dirty buffers异步的写到磁盘。
2、DBW定期的写buffers并触发checkpoint,而这些checkpoint在redo线程中就是实力恢复的开始点。记录的checkpoint的位置取决于最早的dirty buffer。
大多数情况,DBW写入磁盘的块都是散列的,这样的速度会比顺序的写入慢,,通过LGWR,DBW执行
多块并行写来改进效率。所写块的数量有操作系统来决定。
LGWR 该进程用于管理online redo log buffer。LGWR将buffer中的部分内容记录到redo日志中。分离改动buffer的操作。将dirty buffer分散的写入磁盘,并快速连续的将redo写入磁盘。
下列情况,LGWR把上次写出操作之后所有的改动过的buffer写出
1、用户提交事务(commit命令)。
2、发生online redo log的切换。
3、从上次LGWR写出后又过了三秒。
4、 在redo log 中已缓存了1/3或1M的缓存数据。
5、DBW必须将改动的buffer写出到磁盘。
在DBW写出脏数据之前,数据库必须将与改变的buffer相关的redo记录写出到磁盘(write-ahead protocol),如果这些redo记录未写出,DBW会向LGWR进程发出信号,并等待LGWR进程完成记录的写出后,再将脏数据写出到磁盘。
CKPT 该进程主要用于更新control file和数据文件头的checkpoint信息,并触发DBW的写出操作。checkpoint信息包含checkpoint计数点,SCN及定位恢复起始点等。其工作模式如下图示:
MMON/MMNL 与AWR(Automatic Workload Repository)任务相关。如,当测算的结果超过阀值时MMON记录状态并创建状态快照,抓取最近的SQL对象改动的统计值。MMNL则将SGA buffer中的ASH(Active Session History)状态写出到磁盘,当ASH buffer满时写出。

This article explores optimizing MySQL memory usage in Docker. It discusses monitoring techniques (Docker stats, Performance Schema, external tools) and configuration strategies. These include Docker memory limits, swapping, and cgroups, alongside

This article addresses MySQL's "unable to open shared library" error. The issue stems from MySQL's inability to locate necessary shared libraries (.so/.dll files). Solutions involve verifying library installation via the system's package m

The article discusses using MySQL's ALTER TABLE statement to modify tables, including adding/dropping columns, renaming tables/columns, and changing column data types.

This article compares installing MySQL on Linux directly versus using Podman containers, with/without phpMyAdmin. It details installation steps for each method, emphasizing Podman's advantages in isolation, portability, and reproducibility, but also

This article provides a comprehensive overview of SQLite, a self-contained, serverless relational database. It details SQLite's advantages (simplicity, portability, ease of use) and disadvantages (concurrency limitations, scalability challenges). C

Article discusses configuring SSL/TLS encryption for MySQL, including certificate generation and verification. Main issue is using self-signed certificates' security implications.[Character count: 159]

This guide demonstrates installing and managing multiple MySQL versions on macOS using Homebrew. It emphasizes using Homebrew to isolate installations, preventing conflicts. The article details installation, starting/stopping services, and best pra

Article discusses popular MySQL GUI tools like MySQL Workbench and phpMyAdmin, comparing their features and suitability for beginners and advanced users.[159 characters]


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

SublimeText3 Linux new version
SublimeText3 Linux latest version

Notepad++7.3.1
Easy-to-use and free code editor

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

Dreamweaver CS6
Visual web development tools
