Solved

Cross-server queries

Posted on 2004-09-09
11
186 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
Comment Utility
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
Comment Utility
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
Comment Utility
- 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
 

Author Comment

by:geoffbtbc
Comment Utility
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
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 
LVL 15

Assisted Solution

by:SRigney
SRigney earned 83 total points
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
sp_who2 will tell you who is blocking and sp_lock will tell what lock are maintained by the processes.
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

Having an SQL database can be a big investment for a small company. Hardware, setup and of course, the price of software all add up to a big bill that some companies may not be able to absorb.  Luckily, there is a free version SQL Express, but does …
Introduction In my previous article (http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SSIS/A_9150-Loading-XML-Using-SSIS.html) I showed you how the XML Source component can be used to load XML files into a SQL Server database, us…
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.

771 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now