Oracle MTS的相关问题
上一篇 / 下一篇 2009-03-01 16:45:22 / 个人分类:Oracle
- 文件版本: V1.0
- 开发商: 本站原创
- 文件来源: 本地
- 界面语言: 简体中文
- 授权方式: 免费
- 运行平台: Win9X/Win2000/WinXP
一、什么是MTS
MTS = Multi-Threaded Server
MTS是ORACLE SERVER的一个可选的配置选择,是相对DEDICATE方式而言,它最大的优点是在以不用增加物理资源(内存)的前提下支持更多的并发的连接。
Joseph C.Johnson以餐馆给出一个MTS的形象的比喻 51Testing软件测试网&A
Xg2B#T?
假设ORACLE是一家餐馆,当你走进一家餐馆时你感觉最舒服的服务方式就是有一个专门的waiter来为你服务,而不管餐馆中来了多少人,她只对你请求应答,这是DEDICTE的处理方式,也就是说每一个ORACLE客户端的连接都有一个专门的服务进程来为它服务。而大部的餐馆的服方式都不是一对一的,当你走进的时侯,你就被指定了一个waiter,她也可能为其它桌服着务,这对于餐馆来说是最有利的,因为他们可以服务更多的客人而不需要增加他们的员工。这样对你来说也可能是不错的,如果餐馆不是太忙,她服务的客人的请求都很简短且容易完成,你的感觉也好像自己拥有一个专门的waiter,waiter把你的ORDER转给厨师,然后把做好的菜拿给你,这就是MTS的处理方式,这些共享的waiters我们叫她们为Dispatchers,厨师我们则叫他们为Shared Server Processes。
假设ORACLE是一家餐馆,当你走进一家餐馆时你感觉最舒服的服务方式就是有一个专门的waiter来为你服务,而不管餐馆中来了多少人,她只对你请求应答,这是DEDICTE的处理方式,也就是说每一个ORACLE客户端的连接都有一个专门的服务进程来为它服务。而大部的餐馆的服方式都不是一对一的,当你走进的时侯,你就被指定了一个waiter,她也可能为其它桌服着务,这对于餐馆来说是最有利的,因为他们可以服务更多的客人而不需要增加他们的员工。这样对你来说也可能是不错的,如果餐馆不是太忙,她服务的客人的请求都很简短且容易完成,你的感觉也好像自己拥有一个专门的waiter,waiter把你的ORDER转给厨师,然后把做好的菜拿给你,这就是MTS的处理方式,这些共享的waiters我们叫她们为Dispatchers,厨师我们则叫他们为Shared Server Processes。
二、MTS架构
[metalink-Note:29038.1]
1. Oracle Multi-Threaded Server Architecture.
#nzD+f2H"M\*YJ0----------------------------------------------51Testing软件测试网1Z-G s_,R0Ge
51Testing软件测试网X2} p"J.~ G
+-----------+ user
g1B-x)X e0 +-----------+| processes
#tqTpr\E$W0 | ||51Testing软件测试网S1S1ru'oR
|APPLICATION||
U]5@8u} T0 | CODE ||51Testing软件测试网i/IGU u8X
| |+51Testing软件测试网zuE\ck
+-----------+
/cD CZG0 /|\
OrCg(tf'yb0 | CLIENT
4U)jLs M0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - -51Testing软件测试网zAo[wl"@`4L
| SERVER
;b6\dV$J;m%yP&PWp6@],f0 \|/51Testing软件测试网*PuW$U*H
+----------------------------------+51Testing软件测试网:U ? qt5xt!e0i
+----------------------------------+|51Testing软件测试网*_E6bhP+p
| ||
5i-d'b9z9A3~i"u0 | DISPATCHER PROCESSES ||
'^dn lF0 | |+
,m'H%i{.wi0 +----------------------------------+
oC?i-v AU0 | /|\51Testing软件测试网:N/|J7e'zv
| |
T;B]"G we!s'p0 | +-----------+ |51Testing软件测试网TI @V!?
| +-----------+| shared |
E9[:W(ak5lm0 | +-----------+|| server |
}-l&@ju$ejMM"z0 | | ORACLE ||+ processes |
X~jDR'A9p`)O"{0 | |SERVER CODE|+ |51Testing软件测试网'RaD"T_4{8s kRkp
| +-----------+ |
'D;Wl$T$T8p.}Js0 | /|\ /|\ | |
(jy+px f{0 | | | | |
J*f+K&?lV"{/evq K0 | | | | |51Testing软件测试网)~JL0H4c)}
| | \|/ | |51Testing软件测试网x*Y/l's4]-SG$^
+---------------|-----|-------|----------------|-------+51Testing软件测试网Se;yF;M&Oh#e1i h8aX
| \|/ | \|/ | |51Testing软件测试网V,t;[^;sZHU z
| +-------------------+ +----------------------+ |
XW3m/A_1b5y#I0 | | REQUEST | | RESPONSE QUEUES | |
2T+V|*fte1r0 | | QUEUES | +----------------------+ |51Testing软件测试网5U+l4j _reY
| +-------------------+ |
2]&pI0w-l'KO_T(e0 | SYSTEM GLOBAL AREA |
u^FG6x$[(\+s0 | |51Testing软件测试网"}Rx;q4\-l8Um4L
+------------------------------------------------------+
:u1TCSTj051Testing软件测试网7~ A ?,_7B~ RV#w&]U8B
Client Connections to MTS51Testing软件测试网_$X$[X0R+MaV2l+K
~~~~~~~~~~~~~~~~~~~~~~~~~
+D2}{aA({ p0 A client process wanting to connect to an Oracle instance using MTS51Testing软件测试网3X1F1Thp,s
should go through the following steps:
#nzD+f2H"M\*YJ0----------------------------------------------51Testing软件测试网1Z-G s_,R0Ge
51Testing软件测试网X2} p"J.~ G
+-----------+ user
g1B-x)X e0 +-----------+| processes
#tqTpr\E$W0 | ||51Testing软件测试网S1S1ru'oR
|APPLICATION||
U]5@8u} T0 | CODE ||51Testing软件测试网i/IGU u8X
| |+51Testing软件测试网zuE\ck
+-----------+
/cD CZG0 /|\
OrCg(tf'yb0 | CLIENT
4U)jLs M0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - -51Testing软件测试网zAo[wl"@`4L
| SERVER
;b6\dV$J;m%yP&PWp6@],f0 \|/51Testing软件测试网*PuW$U*H
+----------------------------------+51Testing软件测试网:U ? qt5xt!e0i
+----------------------------------+|51Testing软件测试网*_E6bhP+p
| ||
5i-d'b9z9A3~i"u0 | DISPATCHER PROCESSES ||
'^dn lF0 | |+
,m'H%i{.wi0 +----------------------------------+
oC?i-v AU0 | /|\51Testing软件测试网:N/|J7e'zv
| |
T;B]"G we!s'p0 | +-----------+ |51Testing软件测试网TI @V!?
| +-----------+| shared |
E9[:W(ak5lm0 | +-----------+|| server |
}-l&@ju$ejMM"z0 | | ORACLE ||+ processes |
X~jDR'A9p`)O"{0 | |SERVER CODE|+ |51Testing软件测试网'RaD"T_4{8s kRkp
| +-----------+ |
'D;Wl$T$T8p.}Js0 | /|\ /|\ | |
(jy+px f{0 | | | | |
J*f+K&?lV"{/evq K0 | | | | |51Testing软件测试网)~JL0H4c)}
| | \|/ | |51Testing软件测试网x*Y/l's4]-SG$^
+---------------|-----|-------|----------------|-------+51Testing软件测试网Se;yF;M&Oh#e1i h8aX
| \|/ | \|/ | |51Testing软件测试网V,t;[^;sZHU z
| +-------------------+ +----------------------+ |
XW3m/A_1b5y#I0 | | REQUEST | | RESPONSE QUEUES | |
2T+V|*fte1r0 | | QUEUES | +----------------------+ |51Testing软件测试网5U+l4j _reY
| +-------------------+ |
2]&pI0w-l'KO_T(e0 | SYSTEM GLOBAL AREA |
u^FG6x$[(\+s0 | |51Testing软件测试网"}Rx;q4\-l8Um4L
+------------------------------------------------------+
:u1TCSTj051Testing软件测试网7~ A ?,_7B~ RV#w&]U8B
Client Connections to MTS51Testing软件测试网_$X$[X0R+MaV2l+K
~~~~~~~~~~~~~~~~~~~~~~~~~
+D2}{aA({ p0 A client process wanting to connect to an Oracle instance using MTS51Testing软件测试网3X1F1Thp,s
should go through the following steps:
a) Call the listener51Testing软件测试网0P,@4Ah
@yIv
b) The listener tells it to call back on the address where51Testing软件测试网o A.r4O8wS[4]
the dispatcher is listening (a REDIRECT)51Testing软件测试网~\o7x&\7RKz
c) The client calls the dispatcher and establishes a connection.51Testing软件测试网5D#hHt*q0[-h
d) The dispatcher now has a CLIENT connection ESTABLISHED and
g(V9}i!Y`B1gr0 will also continue to listen for any new connections.
%H8?hjdWQ-XH#pb0 e) The client sends a SQL message to the dispatcher.
6}t*f$vzCJ0 f) The dispatcher unwraps this message packet and places the51Testing软件测试网 [m:ehSakF4R3W.U
request onto a queue in the SGA (System Global Area).
uP0Se1V5X^}~b0 This queue has NOTHING to do with SQL*Net. The SQL*Net51Testing软件测试网l-a$pk&N#h3P
layer ends in the dispatcher.51Testing软件测试网a+i?V!e
g) A shared server will pick up the request from the SGA queue
UP&~1O&\nP[0 and process it. When there is any result this is placed51Testing软件测试网$C%]"_Ws
on a separate queue in the SGA ready for the dispatcher.51Testing软件测试网ZZN(W @:ln@
h) The dispatcher picks up the response message from the SGA51Testing软件测试网tm`m[vwF
and wraps this into a SQL*Net message. This is passed51Testing软件测试网A9SZ5_,st
back to the client.
b) The listener tells it to call back on the address where51Testing软件测试网o A.r4O8wS[4]
the dispatcher is listening (a REDIRECT)51Testing软件测试网~\o7x&\7RKz
c) The client calls the dispatcher and establishes a connection.51Testing软件测试网5D#hHt*q0[-h
d) The dispatcher now has a CLIENT connection ESTABLISHED and
g(V9}i!Y`B1gr0 will also continue to listen for any new connections.
%H8?hjdWQ-XH#pb0 e) The client sends a SQL message to the dispatcher.
6}t*f$vzCJ0 f) The dispatcher unwraps this message packet and places the51Testing软件测试网 [m:ehSakF4R3W.U
request onto a queue in the SGA (System Global Area).
uP0Se1V5X^}~b0 This queue has NOTHING to do with SQL*Net. The SQL*Net51Testing软件测试网l-a$pk&N#h3P
layer ends in the dispatcher.51Testing软件测试网a+i?V!e
g) A shared server will pick up the request from the SGA queue
UP&~1O&\nP[0 and process it. When there is any result this is placed51Testing软件测试网$C%]"_Ws
on a separate queue in the SGA ready for the dispatcher.51Testing软件测试网ZZN(W @:ln@
h) The dispatcher picks up the response message from the SGA51Testing软件测试网tm`m[vwF
and wraps this into a SQL*Net message. This is passed51Testing软件测试网A9SZ5_,st
back to the client.
三、确定你的DB是否在使用MTS
[metalink-Note:1071305.6]
Solution Description:51Testing软件测试网e!I'oIad6u
=====================
(H Y(C:OoA(Z#R,hG0
F5|&U'_|0Look at the "init.ora" parameter MTS_DISPATCHERS.
2aVU o*R0QQ x0
x"`B s&jw slVK0MTS_DISPATCHERS defines the number of dispatchers created when the instance51Testing软件测试网z&ob(t9fRO
starts up. If this is set to zero, or is null (default value), then you are NOT
bT%gJ#z{2y%c"eW0using MTS.
=====================
(H Y(C:OoA(Z#R,hG0
F5|&U'_|0Look at the "init.ora" parameter MTS_DISPATCHERS.
2aVU o*R0QQ x0
x"`B s&jw slVK0MTS_DISPATCHERS defines the number of dispatchers created when the instance51Testing软件测试网z&ob(t9fRO
starts up. If this is set to zero, or is null (default value), then you are NOT
bT%gJ#z{2y%c"eW0using MTS.
If MTS_DISPATCHERS is greater than zero, then check these other "init.ora"
GFpaf0zT)r-F4^9r)R0parameters for valid values:
GFpaf0zT)r-F4^9r)R0parameters for valid values:
MTS_MAX_DISPATCHERS Maximum number of dispatchers
&kM*x.M1qr&a*d0 MTS_SERVERS Number of server processes created at startup51Testing软件测试网1jJS,~(\ t aZ
MTS_MAX_SERVERS Maximum number of shared server processes
K(i0U E|b0 MTS_SERVICE SID
k Qo-u^0 MTS_LISTENER_ADDRESS Configuration of the listener51Testing软件测试网)C]GN UN*|y8l
&kM*x.M1qr&a*d0 MTS_SERVERS Number of server processes created at startup51Testing软件测试网1jJS,~(\ t aZ
MTS_MAX_SERVERS Maximum number of shared server processes
K(i0U E|b0 MTS_SERVICE SID
k Qo-u^0 MTS_LISTENER_ADDRESS Configuration of the listener51Testing软件测试网)C]GN UN*|y8l
Solution Explanation:51Testing软件测试网4a!](Q w(gx
=====================
J;U l mC0
m5E[Zv&s"hm0These other "init.ora" parameters may have valid values, but if MTS_DISPATCHERS
XQj/ho tK(D0is zero or null, MTS is not being used.
=====================
J;U l mC0
m5E[Zv&s"hm0These other "init.ora" parameters may have valid values, but if MTS_DISPATCHERS
XQj/ho tK(D0is zero or null, MTS is not being used.
四、MTS相关参数的含义
[metalink-Note:29038.1]
The main parameters required to start MTS are:
o MTS_SERVICE - This parameter establishes the name of the MTS service
|A sY;_0 that clients connect to, in order for the dispatchers to handle requests.
o;Ie C0}2h q#} S+W rg0 51Testing软件测试网)B+~-O/vnCvf
o MTS_DISPATCHERS - Dispatchers are detached processes that handle client51Testing软件测试网.yT_h'F'T y bW,Q'Wj
process requests and communicate them to server processes for execution.
|A sY;_0 that clients connect to, in order for the dispatchers to handle requests.
o;Ie C0}2h q#} S+W rg0 51Testing软件测试网)B+~-O/vnCvf
o MTS_DISPATCHERS - Dispatchers are detached processes that handle client51Testing软件测试网.yT_h'F'T y bW,Q'Wj
process requests and communicate them to server processes for execution.
This parameter defines the number of dispatchers to startup for
)?&LkR-l{&~0 each protocol that is configured for MTS. For example,51Testing软件测试网%U*DwC*U't+g
B"kQ\(vzy2d,Q0 mts_dispatchers = "ipc, 2"
)?&LkR-l{&~0 each protocol that is configured for MTS. For example,51Testing软件测试网%U*DwC*U't+g
B"kQ\(vzy2d,Q0 mts_dispatchers = "ipc, 2"
o MTS_SERVERS - This is the number of shared server processes that51Testing软件测试网:j`IC_
start at instance startup time. Shared servers service the51Testing软件测试网7W Qv[(t9tj%C
client requests passed on to them by the dispatchers.
start at instance startup time. Shared servers service the51Testing软件测试网7W Qv[(t9tj%C
client requests passed on to them by the dispatchers.
o MTS_LISTENER_ADDRESS - This is the full address for dispatchers to listen
^DeBSD3l0 on, and is the same as the address configured in the TNS listener. The
fwm/K2ny8Yt0 address specification is protocol-specific. For example:
^DeBSD3l0 on, and is the same as the address configured in the TNS listener. The
fwm/K2ny8Yt0 address specification is protocol-specific. For example:
mts_listener_address = "(address=(protocol=ipc)(key=sw))"
五、使用MTS连接DB
先在主机命令行$ lsnrctl services;
"D000" established:0 refused:0 current:1 max:972 state:ready
jw"y&[)Y&RG(Q0 DISPATCHER <machine: db1, pid: 3950>
\/NdWw0 (ADDRESS=(PROTOCOL=tcp)(HOST=eagle1)(PORT=33166));
jw"y&[)Y&RG(Q0 DISPATCHER <machine: db1, pid: 3950>
\/NdWw0 (ADDRESS=(PROTOCOL=tcp)(HOST=eagle1)(PORT=33166));
查看dispather的监听端口号——33166。(dispather进程名称一般是 ora_dNNN_SID,NNN in (000-999))
在client端的tnsname.ora中,注意:
TODB_MTS =51Testing软件测试网#s^acr8Ur*Pb
(DESCRIPTION =
)}6W%TzX;P5md0 (ADDRESS_LIST =51Testing软件测试网Jl2OeZ)PCE
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.2)(PORT = 33166))
[v#KD?5Y|0 )51Testing软件测试网0i#]%SqB2A
(CONNECT_DATA =
n.t tr\D"Vn-t0 (SERVER = SHARED)
K/\x$f$Ax4Z0 (SERVICE_NAME = dbname)
C$Z0X_[-\0 )
X;W1U!L ] Vr{0 )
(DESCRIPTION =
)}6W%TzX;P5md0 (ADDRESS_LIST =51Testing软件测试网Jl2OeZ)PCE
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.2)(PORT = 33166))
[v#KD?5Y|0 )51Testing软件测试网0i#]%SqB2A
(CONNECT_DATA =
n.t tr\D"Vn-t0 (SERVER = SHARED)
K/\x$f$Ax4Z0 (SERVICE_NAME = dbname)
C$Z0X_[-\0 )
X;W1U!L ] Vr{0 )
这样可以解决ora-12520问题(当然这只是解决方法之一)
六、一问一答
Q:MTS一定比Delicated模式好吗?
A:不是。如果硬件好点,建议使用Delicated模式。biti语录:“我是能不用MTS就不用”
Q:MTS与Delicated模式可以相互转换吗?
A:可以。
MTS => Delicated
Reset the MTS Parameters in init.ora and reopen your DB.
Delicated => MTS
Added the MTS Parameters in init.ora and reopen your DB.
Q:MTS模式下可以用Delicated连进来吗?
A:可以。(SERVER = Delicated)即可。反之则不行。
Q:RAC环境一定得是MTS吗?
A:不是。
Q:JDBC thin 支持MTS吗?
A:目前不支持。
TAG:
我的栏目
标题搜索
日历
|
|||||||||
日 | 一 | 二 | 三 | 四 | 五 | 六 | |||
1 | 2 | 3 | 4 | ||||||
5 | 6 | 7 | 8 | 9 | 10 | 11 | |||
12 | 13 | 14 | 15 | 16 | 17 | 18 | |||
19 | 20 | 21 | 22 | 23 | 24 | 25 | |||
26 | 27 | 28 | 29 | 30 | 31 |
我的存档
数据统计
- 访问量: 229825
- 日志数: 58
- 文件数: 305
- 书签数: 21
- 建立时间: 2007-01-31
- 更新时间: 2009-07-27