[20161212]ezconnect与共享服务模式.txt
--EZCONNECT的好处不需配置tnsnames.ora文件,快速连接数据库.最近在使用时遇到一件登录后模式是共享模式的情况,做一个记录:
1.环境:
SYS@book> @ &r/ver1
PORT_STRING VERSION BANNER
------------------------------ -------------- --------------------------------------------------------------------------------
x86_64/Linux 2.4.xx 11.2.0.4.0 Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
SCOTT@127.0.0.1:1521/book> show parameter shared_server
NAME TYPE VALUE
---------------------- -------- --------
max_shared_servers integer 1
shared_server_sessions integer
shared_servers integer 1
SCOTT@127.0.0.1:1521/book> show parameter dispatchers
NAME TYPE VALUE
--------------- -------- -------------------------------------
dispatchers string (PROTOCOL=TCP) (SERVICE=book,bookXDB)
max_dispatchers integer
$ rlsql scott/book@127.0.0.1:1521/book
...
SCOTT@127.0.0.1:1521/book> select saddr,sid,paddr,status,server from v$session where sid in (select sid from v$mystat);
SADDR SID PADDR STATUS SERVER
---------------- ---------- ---------------- -------- ---------
00000000854BA6A0 221 000000008591A280 ACTIVE SHARED
$ rlsql scott/book@192.168.100.78:1521/book
...
SCOTT@192.168.100.78:1521/book> select saddr,sid,paddr,status,server from v$session where sid in (select sid from v$mystat);
SADDR SID PADDR STATUS SERVER
---------------- ---------- ---------------- -------- ---------
00000000854BA6A0 221 000000008591A280 ACTIVE SHARED
--//你可以发现使用共享服务模式连接数据库.很奇怪我的测试环境使用ezconnect都是是共享服务模式.
2.可能跟我前面测试使用共享模式是否存在联系呢?
--以前测试的链接:http://blog.itpub.net/267265/viewspace-2124172/=> [20160830]使用共享服务模式的弊端.txt
--想起以前链接的测试:http://blog.itpub.net/267265/viewspace-1816211/ => [20151023]不启动监听远程能连接数据库吗?
--当时使用的是另外的机器:
SYS@test> show parameter dispatchers
NAME TYPE VALUE
------------------------------------ -------------- --------------------------------
dispatchers string (PROTOCOL=TCP) (SERVICE=testXDB)
max_dispatchers integer
--而dispatchers的服务仅仅包括testXDB.会不会这个参数dispatchers引起的呢?
3.修改参数dispatchers,继续测试:
SYS@book> alter system set dispatchers='(PROTOCOL=TCP) (SERVICE=bookXDB)' scope=memory;
System altered.
sqlplus scott/book@192.168.100.78:1521/book
...
SCOTT@192.168.100.78:1521/book> select saddr,sid,paddr,status,server from v$session where sid in (select sid from v$mystat);
SADDR SID PADDR STATUS SERVER
---------------- ---------- ---------------- -------- ---------
0000000085A8E240 56 00000000859238F8 ACTIVE DEDICATED
--这次连接使用专用模式.如果改用如下登录:
sqlplus scott/book@192.168.100.78:1521/bookxdb
...
SCOTT@192.168.100.78:1521/bookxdb> select saddr,sid,paddr,status,server from v$session where sid in (select sid from v$mystat);
SADDR SID PADDR STATUS SERVER
---------------- ---------- ---------------- -------- ---------
00000000854BA6A0 221 000000008591A280 ACTIVE SHARED
--可以再次验证如果当配置共享服务模式后,使用ezconnect优先选择共享服务模式登录.