473,398 Members | 2,088 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

Problem with spid by sp_who

Hello 2 all,

Maybe my question can be very stupid, but I'm a little confused.
When I run sp_who on my database, I see one process (accessing remotely
my database from another database on another SQL server) many many
times.

Well, I assume that this is one process, because I cannot imagin that
the data aquiring can be done by almost 1000 (thousand) opened
connections.
This is what I have. Almost 1000 spids running (sleeping) with cmd =
awaiting command.

The best part is, that when I run sp_lock, I see, that the current
session of the client, (lets say spid 53) is locking tempdb, with
objects id below 10 (system).

As far as i know, and as far as I'm using this in my software, there is
no necessity to open-close-open-close connection.
Normaly, you can just open a connection to db, with assigned spid, and
operate within this just one. After the disconect ist done, the session
shoould be removed.

I think, there is something wrong in the way, the remote system is
connecting to my database, but i'm not sure is it normal what I'm
expieriencing or not.

below, a piece of that what sp_who returned:

SPID ECID status loginname hostname blk dbname cmd
266 0 sleeping remote_user_name host_ERP 0
PRIMARY_PROCESS_DB AWAITING COMMAND
267 0 sleeping remote_user_name host_ERP 0
PRIMARY_PROCESS_DB AWAITING COMMAND
268 0 sleeping remote_user_name host_ERP 0
PRIMARY_PROCESS_DB AWAITING COMMAND
269 0 sleeping remote_user_name host_ERP 0
PRIMARY_PROCESS_DB AWAITING COMMAND
270 0 sleeping remote_user_name host_ERP 0
PRIMARY_PROCESS_DB AWAITING COMMAND
271 0 sleeping remote_user_name host_ERP 0
PRIMARY_PROCESS_DB AWAITING COMMAND

and these are locks from sp_lock 53 which is the current running
process:
53 7 0 0 DB S GRANT
53 2 6 0 TAB IX GRANT
53 2 1 0 TAB IX GRANT
53 2 3 0 TAB IX GRANT
53 2 2 0 TAB IX GRANT
53 2 12 0 TAB IX GRANT
53 2 9 0 TAB IX GRANT
53 2 11 0 TAB IX GRANT

53 2 3 2 KEY (1902141b21c7) X GRANT
53 2 1 3 KEY (e60041ad2c6f) X GRANT
53 2 3 2 KEY (5b0233670fb9) X
GRANT
53 2 3 2 KEY (6e0212a7298c) X GRANT
53 2 3 2 KEY (97013ece81c8) X GRANT
53 2 3 1 KEY (e7006f987fb0) X GRANT
53 2 1 3 KEY (ad00a33f46b9) X GRANT
53 2 1064356070 0 TAB Sch-M GRANT

any idee?

Thanks

Mateusz

Nov 28 '05 #1
1 5690
Matik (ma****@sauron.xo.pl) writes:
Maybe my question can be very stupid, but I'm a little confused.
When I run sp_who on my database, I see one process (accessing remotely
my database from another database on another SQL server) many many
times.

Well, I assume that this is one process, because I cannot imagin that
the data aquiring can be done by almost 1000 (thousand) opened
connections.
Unfortunately, I can imagine that. :-)

Modern applications, usually opens a connection to run a query and then
disconnects. The idea is that the API then maintains a connection pool.
That is, when the application says "close", the API lingers to the
connection for some time, typically 60 seconds, and if the application
requests a new connection with the same properties within that time,
the API will reuse the dormant connection.

But if the application is improperly written, the connection cannot be
reused. I know that there is a pitfall with SqlClient in ADO .Net. I
don't remember the exact details, but it has something to do if you
close the connection before you close the command or somesuch.
The best part is, that when I run sp_lock, I see, that the current
session of the client, (lets say spid 53) is locking tempdb, with
objects id below 10 (system).


It looks as the processes have been creating objects in tempdb within
a transaction. And since the syscomments is among the listed tables,
one could suspect that it has created stored procedures. (But it could
also be default values for table columns.)

Note that if a process starts a transaction and then disconnects, but
the API retains the connection open, the transaction will remain open
until the connection is reused. (When the connection is reused, the API
issues sp_reset_connection which rollbacks transaction, reset SET options
etc.)
--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx
Nov 30 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: wireless | last post by:
I've had my SQL server database running for two years now without a problem. However, just today one of the main tables started returning an error. The table is contained within a database...
5
by: Matik | last post by:
Hello, I've very often a deadlock problem. The deadlock is generated always in the same way, by one application calling in DB two sp's (application has two threads). This is an error message...
4
by: perspolis | last post by:
Hi all I have a master-detail tables in sql server. I use SqlTransaction to insert data into both tables. it works well but if I check the "Cascade Delete Related Records" option in it's realtion...
2
by: VU2LOC | last post by:
Well I am the MS-SQL user I always face the problem in my application. After some time my application stop working goes in to the not responding stage. Then I have to KILL some session which are...
3
by: shark | last post by:
Hi all. i am facing a deadlock problem .i have included the -t1204 and -T3605 trace flags and have got the following o/p pu tin sqls server logs. 2006-06-01 17:49:21.84 spid4 2006-06-01...
1
by: msmith | last post by:
MSSQL Server 2000 SP3 in both houston and memphis I have a database in houston, lets call it RED. Specific tables from database RED are copied to database BLUE. Database BLUE is then backed...
3
by: gjspaho | last post by:
it occours every about 5-6 minutes this is the info i fo8und on sql server log 2007-03-26 12:55:33.64 spid4 ResType:LockOwner Stype:'OR' Mode: S SPID:135 ECID:0 Ec:(0x4DB77570) Value:0x4a...
0
by: Mezhnik | last post by:
Could anyone help me understand the deadlock graph posted below? and, maybe, the reason behind the deadlock? Any help is very appreciated. Thank you. 2008-03-31 04:32:06.40 spid4s Deadlock...
4
by: Neil | last post by:
Having trouble with inserting a record into a table. It's a list of names. But, for some reason, it won't take a particular name. When a user tries to enter a name into the table, the system hangs...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.