设为首页 加入收藏

TOP

【用户连接】(一)
2015-07-24 10:50:53 来源: 作者: 【 】 浏览:4
Tags:用户 连接

1.本地连接

SQL> conn scott/tiger

Connected.

SQL> select sid,server from v$sessionwhere username='SCOTT';

SID SERVER

---------- ---------

42 DEDICATED

?

SQL> select sid,server,paddr,processfrom v$session where username='SCOTT';

?

SID SERVER PADDR PROCESS

---------- --------- ---------------- ------------------------

42 DEDICATED 000000009188D050 16592

--此处的16592标识进程

SQL> conn scott/tiger

Connected.

SQL> ho ps -ef|grep 16592

oracle 16592 16531 0 21:58 pts/1 00:00:00 sqlplus

oracle 16733 16592 0 22:02 ? 00:00:00 oracleorcl(DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))

–local=yes标识是本地连接,不经过TCP/IP

oracle 16915 16836 0 22:06 pts/2 00:00:00 /bin/bash -c ps -ef|grep 16592

2.远程连接

SQL> select sid,server,paddr,processfrom v$session where username='SCOTT';

SID SERVER PADDR PROCESS

---------- --------- ---------------- ------------------------

42 DEDICATED 000000009188D050 17041

SQL> ho ps -ef|grep 17041

oracle 17041 16531 0 22:11 pts/1 00:00:00 sqlplus

oracle 17131 16836 0 22:14 pts/2 00:00:00 /bin/bash -c ps -ef|grep 17041

远程连接用同本地连接相同的查询方法查不到结果,可以用如下查询:

SQL> select spid from v$process whereaddr='000000009188D050';

SPID

------------------------

17045

SQL> ho ps -ef|grep 17045

oracle 17045 1 0 22:11 ? 00:00:00 oracleorcl (LOCAL=NO)

–local=no 标识远程连接,走TCP/IP

oracle 17180 16836 0 22:15 pts/2 00:00:00 /bin/bash -c ps -ef|grep 17045

3.连接模式

A.专有 每个用户进程与一个服务进程进行连接

适合消耗pga为主业务比如dss、olap、 dba常规管理任务、dg实现同步--dg需要专有连接

SQL> select sid,serial#,server fromv$session where username='SCOTT';

SID SERIAL# SERVER

---------- ---------- ---------

37 236 DEDICATED

SQL> show parameter dispatchers

NAME TYPE VALUE

----------------------------------------------- ------------------------------

dispatchers string (PROTOCOL=TCP) (SERVICE=orclXDB)

max_dispatchers integer

B.共享 多个用户进程与一个服务器的子进程进行连接

[oracle@oracle ~]$ sqlplusscott/tiger@oracle:1521/orclXDB

SQL> select sid,serial#,server from v$sessionwhere username='SCOTT';

SID SERIAL# SERVER

---------- ---------- ---------

21 536 DEDICATED

27 1008 SHARED ---shared/none 标识共享连接

SQL> select sid,serial#,server,paddrfrom v$session where username='SCOTT';

SID SERIAL# SERVER PADDR

---------- ---------- --------- ----------------

27 1008 NONE 0000000091888F50

44 1430 NONE 0000000091888F50

-------注意共享连接不管是多少个,此处的PADDR都是一样的。

SQL> select sid,serial#,server,paddrfrom v$session where username=’SCOTT’;

SID SERIAL# SERVER PADDR

---------- ---------- --------- ----------------

21 536 DEDICATED 0000000091892190

44 1433 DEDICATED 0000000091894210

------注意专有连接不管是多少个,每个PADDR都是不一样的。

一个服务器进程可以服务多个用户进程,反之则不成立。

4.连接----物理方式通过协议进行连接

会话----在连接基础上产生的一些信息,可以有一个、可以有多个、可以没有

连接关闭,会话结束

会话结束,连接不一定关闭

会话1:

[oracle@oracle ~]$sqlplus scott/tiger

SQL> set autot trace stat

会话2:

SQL> select sid,serial#,server,paddrfrom v$session where username='SCOTT';

SID SERIAL# SERVER PADDR

---------- ---------- --------- ----------------

21 536 DEDICATED 0000000091892190

34 799 DEDICATED 0000000091895250

51 252 DEDICATED 0000000091895250

–--表示在一个连接上产生两个会话

SQL> selectsid,serial#,server,paddr,process from v$session where username='SCOTT';

?

SID SERIAL# SERVER PADDR PROCESS

---------- ---------- --------- ---------------- ------------------------

21 536 DEDICATED 0000000091892190 19652

34 799 DEDICATED 0000000091895250 21284

51 252 DED

首页 上一页 1 2 下一页 尾页 1/2/2
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇spfile 下一篇一次c3p0连接池连接异常错误的排查

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容:

·Asus Armoury Crate (2025-12-26 02:52:33)
·WindowsFX (LinuxFX) (2025-12-26 02:52:30)
·[ Linux运维学习 ] (2025-12-26 02:52:27)
·HTTPS 详解一:附带 (2025-12-26 02:20:37)
·TCP/IP协议到底在讲 (2025-12-26 02:20:34)