之前我们学习Oracle基础的时候,有一个概念,叫多进程和多线程。在Unix/Linux等环境下面。数据库是以多进程的方式运行的,当一个会话连接进来,就会通过监听,然后在服务器上创建一个进程。而在Windows上面它是以多线程的方式来运行的。一个进程有很多个thread线程。而在12c这个版本上面,Oracle在Unix/Linux平台上做出了一些改变,引入了多线程的方式。通过参数threaded_execution,我们可以控制数据库是以多进程方式运行还是以多线程方式运行,默认该参数是false数据库以多进程方式运行。
1.查看参数的默认值,和数据库进程状态.
2.修改参数重启数据库
ALTER SYSTEM SET threaded_execution = true SCOPE = SPFILE;
System altered.
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
[oracle@ol6 ~]$ sqlplus / as sysdba
SQL*Plus: Release 12.2.0.1.0 Production on Fri Aug 3 15:59:47 2018
Copyright (c) 1982,Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup
ERROR:
ORA-01017: invalid username/password; logon denied
当重启数据库的时候会遇到一些障碍,这里居然报无效的用户名和密码。这是因为我们修改了线程模式导致的,在这个时候我们需要通过先sqlplus /nolog,然后在conn的方式进行连接。
3.修改完参数之后查看进程状态。
后台进程的数量减少了。一些后台进程(pmon,dbw,lgwr,psp,vktm)的行为与以前一样。奇怪的是居然smon也没了。其他backgtound进程属于名为ora_uxxx_ 的多线程进程。
4.通过系统视图查看进程状态。
这里我们可以发现execution_type,一部分已经变成了THREAD,我们的SMON也变成了THREAD状态。
select spid,stid,pname,program,execution_type from v$process order by execution_type,spid,stid;
SPID STID PNAME PROGRAM EXECUTION_
PSEUDO NONE
25236 25236 PMON oracle@ol6.localdomain (PMON) PROCESS
25242 25242 PSP0 oracle@ol6.localdomain (PSP0) PROCESS
25244 25244 VKTM oracle@ol6.localdomain (VKTM) PROCESS
25268 25268 DBW0 oracle@ol6.localdomain (DBW0) PROCESS
25238 25238 SCMN oracle@ol6.localdomain (SCMN) THREAD
25238 25240 CLMN oracle@ol6.localdomain (CLMN) THREAD
25238 25247 GEN0 oracle@ol6.localdomain (GEN0) THREAD
25238 25248 MMAN oracle@ol6.localdomain (MMAN) THREAD
25238 25262 DBRM oracle@ol6.localdomain (DBRM) THREAD
25238 25265 PMAN oracle@ol6.localdomain (PMAN) THREAD
25238 25273 CKPT oracle@ol6.localdomain (CKPT) THREAD
25238 25274 SMON oracle@ol6.localdomain (SMON) THREAD
25238 25278 LREG oracle@ol6.localdomain (LREG) THREAD
25251 25251 SCMN oracle@ol6.localdomain (SCMN) THREAD
25251 25253 GEN1 oracle@ol6.localdomain (GEN1) THREAD
25255 25255 SCMN oracle@ol6.localdomain (SCMN) THREAD
25255 25257 DIAG oracle@ol6.localdomain (DIAG) THREAD
25255 25263 VKRM oracle@ol6.localdomain (VKRM) THREAD
25255 25264 SVCB oracle@ol6.localdomain (SVCB) THREAD
25255 25266 DIA0 oracle@ol6.localdomain (DIA0) THREAD
25255 25275 SMCO oracle@ol6.localdomain (SMCO) THREAD
25255 25276 RECO oracle@ol6.localdomain (RECO) THREAD
25255 25277 W000 oracle@ol6.localdomain (W000) THREAD
25255 25279 W001 oracle@ol6.localdomain (W001) THREAD
25255 25280 PXMN oracle@ol6.localdomain (PXMN) THREAD
25255 25282 MMON oracle@ol6.localdomain (MMON) THREAD
25255 25283 MMNL oracle@ol6.localdomain (MMNL) THREAD
25255 25284 D000 oracle@ol6.localdomain (D000) THREAD
25255 25285 S000 oracle@ol6.localdomain (S000) THREAD
25255 25286 TMON oracle@ol6.localdomain (TMON) THREAD
25255 25287 N000 oracle@ol6.localdomain (N000) THREAD
25255 25296 oracle@ol6.localdomain THREAD
25255 25297 oracle@ol6.localdomain THREAD
25255 25298 oracle@ol6.localdomain THREAD
25255 25299 oracle@ol6.localdomain THREAD
25255 25300 oracle@ol6.localdomain THREAD
25255 25301 oracle@ol6.localdomain THREAD
25255 25302 oracle@ol6.localdomain THREAD
25255 25303 oracle@ol6.localdomain THREAD
25255 25304 oracle@ol6.localdomain THREAD
25255 25305 oracle@ol6.localdomain THREAD
25255 25306 oracle@ol6.localdomain THREAD
25255 25307 oracle@ol6.localdomain THREAD
25255 25308 oracle@ol6.localdomain THREAD
25255 25309 oracle@ol6.localdomain THREAD
25255 25310 oracle@ol6.localdomain THREAD
25255 25311 oracle@ol6.localdomain THREAD
25255 25312 oracle@ol6.localdomain THREAD
25255 25313 oracle@ol6.localdomain THREAD
25255 25314 oracle@ol6.localdomain THREAD
25255 25315 oracle@ol6.localdomain THREAD
25255 25319 TT00 oracle@ol6.localdomain (TT00) THREAD
25255 25320 TT01 oracle@ol6.localdomain (TT01) THREAD
25255 25321 TT02 oracle@ol6.localdomain (TT02) THREAD
25255 25330 oracle@ol6.localdomain THREAD
25255 25331 oracle@ol6.localdomain THREAD
25255 25332 oracle@ol6.localdomain THREAD
25255 25333 oracle@ol6.localdomain THREAD
25255 25334 oracle@ol6.localdomain THREAD
25255 25335 oracle@ol6.localdomain THREAD
25255 25336 oracle@ol6.localdomain THREAD
25255 25337 oracle@ol6.localdomain THREAD
25255 25338 oracle@ol6.localdomain THREAD
25255 25339 oracle@ol6.localdomain THREAD
25255 25340 AQPC oracle@ol6.localdomain (AQPC) THREAD
25255 25342 P000 oracle@ol6.localdomain (P000) THREAD
25255 25343 P001 oracle@ol6.localdomain (P001) THREAD
25255 25344 P002 oracle@ol6.localdomain (P002) THREAD
25255 25345 P003 oracle@ol6.localdomain (P003) THREAD
25255 25491 CJQ0 oracle@ol6.localdomain (CJQ0) THREAD
25255 25528 QM02 oracle@ol6.localdomain (QM02) THREAD
25255 25530 Q002 oracle@ol6.localdomain (Q002) THREAD
25255 25531 Q003 oracle@ol6.localdomain (Q003) THREAD
25255 25532 Q004 oracle@ol6.localdomain (Q004) THREAD
25255 25533 Q005 oracle@ol6.localdomain (Q005) THREAD
25255 25534 Q006 oracle@ol6.localdomain (Q006) THREAD
25255 25535 Q007 oracle@ol6.localdomain (Q007) THREAD
25255 25536 Q008 oracle@ol6.localdomain (Q008) THREAD
25255 25633 W002 oracle@ol6.localdomain (W002) THREAD
25259 25259 SCMN oracle@ol6.localdomain (SCMN) THREAD
25259 25261 OFSD oracle@ol6.localdomain (OFSD) THREAD
25270 25270 SCMN oracle@ol6.localdomain (SCMN) THREAD
25270 25272 LGWR oracle@ol6.localdomain (LGWR) THREAD