12
返回列表 发新帖
楼主: myownstars

[讨论] 11g为何v$session记录数远小于实际值

[复制链接]
论坛徽章:
47
蒙奇·D·路飞
日期:2017-03-27 08:04:23马上有车
日期:2014-02-18 16:41:112014年新春福章
日期:2014-02-18 16:41:11一汽
日期:2013-09-01 20:46:27复活蛋
日期:2013-03-13 07:55:232013年新春福章
日期:2013-02-25 14:51:24ITPUB 11周年纪念徽章
日期:2012-10-09 18:03:322012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:20
11#
发表于 2012-11-17 03:03 | 只看该作者
本帖最后由 Yong Huang 于 2012-11-16 13:05 编辑

Check the fixed table under v$session, i.e. x$ksuse. For easy reference of column mapping, refer to
http://oracledba.ru/fv11gr2/gv$session.html

Basically, you still join v$process (or its fixed table x$ksupr) to the session view (x$ksuse), but don't restrict the result with the where-clause. The where-clause should only contain the minimum conditions to join the two views. See if you can find entries in the session view corresponding to those "ghost" processes.

使用道具 举报

回复
论坛徽章:
86
2015中国数据库技术大会纪念徽章
日期:2015-04-24 16:04:24马上有车
日期:2014-02-19 11:55:14马上有车
日期:2014-02-18 16:41:112014年新春福章
日期:2014-02-18 16:41:11优秀写手
日期:2013-12-18 09:29:11日产
日期:2013-10-17 08:44:39马自达
日期:2013-08-26 16:28:022013年新春福章
日期:2013-02-25 14:51:24ITPUB 11周年纪念徽章
日期:2012-10-23 16:55:51马上有房
日期:2014-02-19 11:55:14
12#
发表于 2012-11-26 14:17 | 只看该作者
myownstars 发表于 2012-11-16 14:14
SQL> select count(*) from v$session;

  COUNT(*)

加上v$process的program字段看看

使用道具 举报

回复
论坛徽章:
10
2011新春纪念徽章
日期:2011-02-18 11:43:342015年新春福章
日期:2015-03-06 11:58:18懒羊羊
日期:2015-03-04 14:52:11马上有钱
日期:2014-02-18 16:43:092014年新春福章
日期:2014-02-18 16:43:09优秀写手
日期:2013-12-18 09:29:11三菱
日期:2013-08-30 20:37:412013年新春福章
日期:2013-02-25 14:51:24ITPUB十周年纪念徽章
日期:2011-11-01 16:24:51暖羊羊
日期:2015-06-22 15:51:36
13#
 楼主| 发表于 2012-11-30 14:01 | 只看该作者
目前已经恢复正常了,期间数据库被别的DBA多次重启,
SQL>  select count(*) from v$process;
  COUNT(*)
----------
        52
SQL> select count(*) from v$session;
  COUNT(*)
----------
        51
开了SR,一系列回复后得到如下结论
对仅存在于v$process的5个进程做dump errorstack 3 发现一个共性
Dump of memory from 0xfffffffffff9fcb to 0xfffffffffffa10b
FFFFFFFFFFF9FC0 00000001 08D776D0 [......v.]
FFFFFFFFFFF9FD0 00000000 00000000 00000001 10050864 [...............d]
FFFFFFFFFFF9FE0 00000000 00000001 00000001 10014980 [..............I.]
FFFFFFFFFFF9FF0 00000000 00000000 2842204F 10014980 [........(B O..I.]
FFFFFFFFFFFA000 4F52412D 32383030 313A2074 68652070 [ORA-28001: the p]
FFFFFFFFFFFA010 61737377 6F726420 68617320 65787069 [assword has expi]
FFFFFFFFFFFA020 72656400 00000000 00000000 00000000 [red.............]
FFFFFFFFFFFA030 00000000 00000000 00000000 00000000 [................]
即请求的schema已经expired, 查看dba_users,发现若干expired用户
os上有一个job,每30分钟连接数据库且该用户已经expired,初步估计可能由于此
但是仍有很多疑惑,根本原因还不能确认,需观察一段时间

使用道具 举报

回复
论坛徽章:
47
蒙奇·D·路飞
日期:2017-03-27 08:04:23马上有车
日期:2014-02-18 16:41:112014年新春福章
日期:2014-02-18 16:41:11一汽
日期:2013-09-01 20:46:27复活蛋
日期:2013-03-13 07:55:232013年新春福章
日期:2013-02-25 14:51:24ITPUB 11周年纪念徽章
日期:2012-10-09 18:03:322012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:20
14#
发表于 2012-12-1 01:46 | 只看该作者
It's so obvious, and I can easily reproduce it:

Find your IP. Say it's 10.0.0.5
sqlplus
create user u identified by u;
alter user u password expire;
conn u/u

You'll be prompted to enter a new password. Go to the server. Suppose it's UNIX/Linux.
netstat -anp | grep 10.0.0.5
You'll see a server process opening a TCP socket between your client and the server. The server process pid is after "ESTABLISHED" but before "/SID". You can go to sqlplus and find the entry in v$process:
select * from v$process where spid=<the pid you just saw>;

The session object has not been created yet. It does not exist even in x$ksuse.

What other questions do you have?

使用道具 举报

回复
论坛徽章:
10
2011新春纪念徽章
日期:2011-02-18 11:43:342015年新春福章
日期:2015-03-06 11:58:18懒羊羊
日期:2015-03-04 14:52:11马上有钱
日期:2014-02-18 16:43:092014年新春福章
日期:2014-02-18 16:43:09优秀写手
日期:2013-12-18 09:29:11三菱
日期:2013-08-30 20:37:412013年新春福章
日期:2013-02-25 14:51:24ITPUB十周年纪念徽章
日期:2011-11-01 16:24:51暖羊羊
日期:2015-06-22 15:51:36
15#
 楼主| 发表于 2012-12-3 16:47 | 只看该作者
本帖最后由 myownstars 于 2012-12-3 16:49 编辑
Yong Huang 发表于 2012-12-1 01:46
It's so obvious, and I can easily reproduce it:

Find your IP. Say it's 10.0.0.5


多谢 是我的测试用例写的有问题 现在可以正确的重现该问题了
此类现象应该是所谓的expected behaviour吧
且此类进程仍然耗用processes名额的

使用道具 举报

回复
论坛徽章:
47
蒙奇·D·路飞
日期:2017-03-27 08:04:23马上有车
日期:2014-02-18 16:41:112014年新春福章
日期:2014-02-18 16:41:11一汽
日期:2013-09-01 20:46:27复活蛋
日期:2013-03-13 07:55:232013年新春福章
日期:2013-02-25 14:51:24ITPUB 11周年纪念徽章
日期:2012-10-09 18:03:322012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:20
16#
发表于 2012-12-4 00:27 | 只看该作者
Indeed it's an expected behavior. The server is created first. Once the password is entered, a session will be created associated with this server process.

Many such processes will not only consume process slots, but use memory as well. The shared memory can be ignored (it's shared!). But each process will have a little of its private memory. Many of them add up. In addition, open file descriptors are also being used.

使用道具 举报

回复

您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

TOP技术积分榜 社区积分榜 徽章 团队 统计 知识索引树 积分竞拍 文本模式 帮助
  ITPUB首页 | ITPUB论坛 | 数据库技术 | 企业信息化 | 开发技术 | 微软技术 | 软件工程与项目管理 | IBM技术园地 | 行业纵向讨论 | IT招聘 | IT文档
  ChinaUnix | ChinaUnix博客 | ChinaUnix论坛
CopyRight 1999-2011 itpub.net All Right Reserved. 北京盛拓优讯信息技术有限公司版权所有 联系我们 未成年人举报专区 
京ICP备16024965号-8  北京市公安局海淀分局网监中心备案编号:11010802021510 广播电视节目制作经营许可证:编号(京)字第1149号
  
快速回复 返回顶部 返回列表