Solved

Cross-server queries

Posted on 2004-09-09
11
188 Views
Last Modified: 2008-01-09
Our production system is a quad-processor server with 2gb of ram dedicated to SQL. It runs SQL7 in 6.0 emulation mode due to the old software package we use.
Our web server is running SQL 2k with 3gb of ram and quad processors. Connections are TCP/IP over 10/100 Ethernet (soon to be gigabit).

A program on the web server, written in VB6 and ADO, provides detailed data from our production system to our intranet. Another similar one is written in VB.NET and ADO.NET.

Occasionally, Enterprise Manager on our production system is unable to provide process activity details, returning an error showing a timeout waiting for locks.

Our diagnostic program has shown processes running from the web server with Shared table locks on some of our critical tables. I am assured that the program is read only (except for temp tables I noticed), so why is it locking tables? I have assumed that the query comes to the production server without optimization, and because of the way it is written,
it isn't optimized there and so starts doing table locks while it retrieves data.

I have thought of having the web server program and its stored procedures changed to do SELECT .... WITH NO LOCK to try any ease this problem. DTS would take care of update transactions, but these are inquiry only.

I am looking for any ideas to get out of this hole.
0
Comment
Question by:geoffbtbc
  • 3
  • 2
  • 2
  • +1
11 Comments
 
LVL 18

Accepted Solution

by:
SjoerdVerweij earned 84 total points
ID: 12020264
A shared table lock only means that other processes cannot modify the table while the select query is running. It is by no means a blocking lock.

Anyway, try out With (NoLock) by all means. If that doesn't work, your queries might need work and/or you might need indexes.
0
 

Author Comment

by:geoffbtbc
ID: 12020300
If I have a user in production whose process wants to update that table (say an order header for example), will they just be forced to wait?

If I 'lose' the original request from the webserver, will the production server not keep the lock until all the dataset has been returned?

In one case, the production process had been active for over 20 minutes.
0
 
LVL 18

Expert Comment

by:SjoerdVerweij
ID: 12020387
- With a shared table lock, they can do anything they want except modify the structure of the table.

- How long the process stays active all depends on how your web stuff is set up.
0
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 

Author Comment

by:geoffbtbc
ID: 12020438
I was under the impression from SQL 7 BOL that a shared lock stopped any other transaction from updating the data, which is why a table lock causes problems.

The web process should have timed-out in only a couple of minutes, but the production process wouldn't know that ?
0
 
LVL 15

Assisted Solution

by:SRigney
SRigney earned 83 total points
ID: 12021383
The web connection may not be a client side recordset.  If it's opening the connection and leaving it open to loop through rather than pulling the data and working with it in a disconnected fashion it may also affect locking.
0
 
LVL 18

Expert Comment

by:ShogunWade
ID: 12026069
1)  EM stinks for locking,   I cant believe how many times EM has been the cause of deadlocks. etc.

 better to use sp_who2 to get running processes state   (i have even tweaked this into a sp_who3 for better performance). and sp_lock2 for viewing locks.

2) ? the web server has SQL on it, you do understand that this can cause performance problems having SQL and IIS  on same box ?

3) yes i agree that a performance monitoring tool should probably make a lot of use of WITH(NOLOCK) hint.
0
 

Author Comment

by:geoffbtbc
ID: 12030394
Thanks for the ideas!

The web server does have SQL on it, but that is not where I am seeing the problems;however, that server is using a linked server connection to production to query and insert data there.

I am using SQL Diagnostic Monitor from Idera to monitor all SQL servers. I have just found Microsoft's article on sp_blocker_pss70 and a script to monitor blocking, and then info on how to compare this to Profiler run at the same time, so I am going to crank that up. I still get the feeling at times that the web server finishes its process before production does, leaving resources allocated in production that should and need to be reclaimed.
0
 
LVL 18

Assisted Solution

by:ShogunWade
ShogunWade earned 83 total points
ID: 12042612
sp_who2 will tell you who is blocking and sp_lock will tell what lock are maintained by the processes.
0

Featured Post

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

When you hear the word proxy, you may become apprehensive. This article will help you to understand Proxy and when it is useful. Let's talk Proxy for SQL Server. (Not in terms of Internet access.) Typically, you'll run into this type of problem w…
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.
Viewers will learn how the fundamental information of how to create a table.

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question