Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 SQL Server Administration (2008)
 A databae with two DBid

Author  Topic 

CanadaDBA

583 Posts

Posted - 2012-02-13 : 19:32:33
Running the following, I see a database with two DBid.

SELECT spid, dbid, DB_Name(dbid) as DBName, status
FROM master.sys.sysprocesses



spid dbid DBName status
----- ----- ---------------- ------------
1 0 TBSTAGE background
2 0 TBSTAGE background
3 0 TBSTAGE background
4 0 TBSTAGE background
6 0 TBSTAGE background
7 0 TBSTAGE background
52 7 TBSTAGE sleeping
56 7 TBSTAGE sleeping
57 7 TBSTAGE sleeping
60 7 TBSTAGE sleeping
61 7 TBSTAGE sleeping
62 7 TBSTAGE sleeping
63 7 TBSTAGE sleeping


Does the database have a problem? How can I fix it?

Canada DBA

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2012-02-13 : 21:17:00
Ignore spids less than 50 as those are system processes. Add this to your query: where spid > 50

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

GilaMonster
Master Smack Fu Yak Hacker

4507 Posts

Posted - 2012-02-14 : 03:38:54
On SQL 2008, spids above 50 can also be system processes. Join to sys.dm_exec_sessions (and stop using sysprocesses if you can) and filter on is_user_session = 1

--
Gail Shaw
SQL Server MVP
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2012-02-14 : 11:04:21
50 wasn't enough?

Damn



Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx


Want to help yourself?

http://msdn.microsoft.com/en-us/library/ms130214.aspx

http://weblogs.sqlteam.com/brettk/

http://brettkaiser.blogspot.com/


Go to Top of Page

GilaMonster
Master Smack Fu Yak Hacker

4507 Posts

Posted - 2012-02-14 : 14:31:47
No, it's not.

--
Gail Shaw
SQL Server MVP
Go to Top of Page
   

- Advertisement -