ITPUB??ì3
12月微软Hyper-V虚拟化沙龙主题征集
ITPUB论坛 » IBM数据库产品 » 简单的问题:数据库的连接数的两种不同结果

标题: [有问必答活动] 简单的问题:数据库的连接数的两种不同结果
离线 icesnowcn



精华贴数 0
个人空间 0
技术积分 106 (16990)
社区积分 0 (1825145)
注册日期 2008-7-15
论坛徽章:0
      
      

发表于 2008-8-29 14:39 
简单的问题:数据库的连接数的两种不同结果

查询数据库的连接数:
第一种方法:

connect to sample;
SELECT  COUNT(*)  AS CONNCTED_NUM
   FROM   SYSIBMADM.APPLICATIONS AS APPLICATIONS
WHERE  APPL_STATUS='CONNECTED'


第二种方法:

CONNECT TO SAMPLE;

SELECT  APPLS_CUR_CONS
FROM   SYSIBMADM.SNAPDB AS SNAPDB

两种方法怎么结果有时一样 有时不一样。请大家解惑!


只看该作者    顶部
离线 wangzhonnew
Murphy was an optimist


精华贴数 24
个人空间 0
技术积分 9100 (136)
社区积分 513 (1428)
注册日期 2005-11-12
论坛徽章:16
现任管理团队成员管理团队2007贡献徽章管理团队2006纪念徽章会员2007贡献徽章会员2006贡献徽章授权会员
2008北京奥运纪念徽章:蹦床2008北京奥运纪念徽章:举重2008北京奥运纪念徽章:射箭2008北京奥运纪念徽章:射箭2008北京奥运纪念徽章:跆拳道生肖徽章2007版:鼠

发表于 2008-8-29 21:07 
D:\TEMP\GA\AIX6495>db2 "select APPL_NAME from sysibmadm.applications as applicat
ions"

APPL_NAME



--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
----------------
db2taskd



db2stmm



db2bp.exe




  3 record(s) selected.


D:\TEMP\GA\AIX6495>db2 "select appls_cur_cons from sysibmadm.snapdb as snapdb"

APPLS_CUR_CONS
--------------------
                   1

  1 record(s) selected.


D:\TEMP\GA\AIX6495>


1) you should remove WHERE APPL_STATUS='CONNECTED' clause, because the application status may changed to UOW Waiting, UOW Exeucting or etc....
2) the second way seems only show the real application, but there's also connections like STMM or db2taskd that not normal applications.
so the first method (without WHERE clause) should be same as "list applications", the second method should be same as "get snapshot for database on <dbname>"
D:\TEMP\GA\AIX6495>db2 list applications

Auth Id  Application    Appl.      Application Id
                  DB       # of
         Name           Handle
                  Name    Agents
-------- -------------- ---------- ---------------------------------------------
----------------- -------- -----
TAOEWANG db2taskd       960        *LOCAL.DB2.080827205006
                  SAMPLE   1
TAOEWANG db2stmm        959        *LOCAL.DB2.080827205005
                  SAMPLE   1
TAOEWANG db2bp.exe      962        *LOCAL.DB2.080827205004
                  SAMPLE   1



D:\TEMP\GA\AIX6495>db2 get snapshot for database on sample | more

              Database Snapshot

Database name                              = SAMPLE
Database path                              = D:\DB2\NODE0000\SQL00002\
Input database alias                       = SAMPLE
Database status                            = Active
Catalog database partition number          = 0
Catalog network node name                  =
Operating system running at database server= NT
Location of the database                   = Local
First database connect timestamp           = 08/27/2008 16:50:03.797799
Last reset timestamp                       =
Last backup timestamp                      =
Snapshot timestamp                         = 08/29/2008 09:05:53.367903

Number of automatic storage paths          = 1
Automatic storage path                     = D:
      File system ID                       = 604554608
      Storage path free space (bytes)      = 29831479296
      File system used space (bytes)       = 77704491008
      File system total space (bytes)      = 107603079168

High water mark for connections            = 7
Application connects                       = 1957
Secondary connects total                   = 3
Applications connected currently           = 1
Appls. executing in db manager currently   = 0
Agents associated with applications        = 3
Maximum agents associated with applications= 7
Maximum coordinating agents                = 7


__________________
wangzhonnew@hotmail.com
http://spaces.msn.com/members/wangzhonnew/
只看该作者    顶部
离线 icesnowcn



精华贴数 0
个人空间 0
技术积分 106 (16990)
社区积分 0 (1825145)
注册日期 2008-7-15
论坛徽章:0
      
      

发表于 2008-9-4 11:33 
It's very cool!
thanks!


只看该作者    顶部
离线 Germin
初学者


精华贴数 0
个人空间 0
技术积分 328 (6125)
社区积分 2 (32373)
注册日期 2007-12-6
论坛徽章:0
      
      

发表于 2008-9-4 12:52 
不懂
  死看
  呵呵......


__________________
不在于选择什么, 而在于坚持多久。
只看该作者    顶部
离线 pastime_Wang



精华贴数 0
个人空间 0
技术积分 246 (7984)
社区积分 1 (39574)
注册日期 2005-7-31
论坛徽章:1
2008北京奥运纪念徽章:艺术体操     
      

发表于 2008-9-9 21:55 
狼的回答总是详细和深入,好好向你学习啊!


只看该作者    顶部
离线 PUB-CEO
^妩媚阳光^


来自 china
精华贴数 0
个人空间 206
技术积分 1231 (1453)
社区积分 6325 (247)
注册日期 2008-9-9
论坛徽章:70
2008北京奥运纪念徽章:赛艇ERP板块每日发贴之星ERP板块每日发贴之星ERP板块每日发贴之星ERP板块每日发贴之星2008北京奥运纪念徽章:赛艇
      

发表于 2008-9-10 00:02 
学生  路过


__________________

假如没有明天,你现在最想做的事是什么?



Do the right things. Do the things right!

只看该作者    顶部
 
    

相关内容


CopyRight 1999-2006 itpub.net All Right Reserved.
北京皓辰广域网络信息技术有限公司. 版权所有
E-mail:Webmaster@itpub.net
京ICP证:010037号 联系我们 法律顾问