0 redo> 411 bytes sent via SQL*Net to client
385 bytes received via SQL*Net from client
2 SQL*Net roundtrips to/from client
6 sorts (memory)
0 sorts (disk)
1 rows processed
scott@ORCL> set autotrace off;
-->在session2中再次执行查询,可以看到会话139,25已经被释放
sys@ORCL> /
SPID SID SERIAL# STATUS USERNAME PROGRAM
------------ ---------- ---------- -------- ------------------------- --------------------------------------
4602 159 5 INACTIVE SCOTT oracle@oradb.robinson.com (TNS V1-V3)
5.SID不变,serial#变化的情形
-->将所有的会话全部退出,下面来查看SID不变而serial#变化的情形
[oracle@oradb ~]$ ps -ef | grep oracleorcl -->此时Oracle数据库无任何服务器进程
oracle 26767 16943 0 19:49 pts/0 00:00:00 grep oracleorcl
[oracle@oradb ~]$ sqlplus scott/tiger@orcl
Connected to:
Oracle Database 10g Enterprise Edition> With the Partitioning, OLAP and Data Mining options
scott@ORCL> select sid,serial#,username from v$session where username='SCOTT';
SID SERIAL# USERNAME
---------- ---------- ------------------------------
134 39 SCOTT
scott@ORCL> exit
Disconnected from Oracle Database 10g Enterprise Edition> With the Partitioning, OLAP and Data Mining options
[uniread] Saved history (652 lines)
[oracle@oradb ~]$ sqlplus scott/tiger@orcl
Connected to:
Oracle Database 10g Enterprise Edition> With the Partitioning, OLAP and Data Mining options
scott@ORCL> select sid,serial#,username from v$session where username='SCOTT';
SID SERIAL# USERNAME
---------- ---------- ------------------------------
134 41 SCOTT
-->从上面的情形可以看出尽管scott用户退出后重新登录,依然使用了相同的SID,因此在执行kill session时,一定要注意SID,serial#
-->两者的值,以免kill掉不该kill的session
三、session与process的设置关系
session:指定了一个实例中允许的会话数,即能同时登录到数据库的并发用户数。
process: 指定了一个实例在操作系统级别能同时运行的进程数,包括后台进程与服务器进程。
由上面的分析可知,一个后台进程可能同时对应对个会话,因此通常sessions的值是大于processes的值
通常的设置公式
sessions = 1.1 * processes + 5
-->如在下面的系统的设置中processes得值为150,session的值设定为170,
scott@ORCL> select name,value from v$parameter where name='processes';
NAME VALUE
-------------------- --------------------
processes 150
scott@ORCL> select name,value from v$parameter where name='sessions';
NAME VALUE
-------------------- --------------------
sessions 170
scott@ORCL> select 150*1.1+5 from dual;
150*1.1+5
----------
170
oracle视频教程请关注:http://u.youku.com/user_video/id_UMzAzMjkxMjE2.html