May 25 2009 11:00AM GMT
Posted by: mrdenny
SQL,
VMware,
Lock Pages
With the recent release of the ability for the Lock Pages in Memory setting to be used on SQL Server 2005 and 2008 Standard Edition I see more and more people shooting them selves in the foot with this setting when running under VMware. I see this as becoming more of an issue now that this switch is available for Standard edition as I would assume that most virtualized SQL Server installations are done using SQL Server Standard Editions.
Continued »
Mar 12 2009 11:00AM GMT
Posted by: mrdenny
SQL,
SQL Server 2000,
SQL Server 2005,
Execution Plan,
Back To Basics,
SQL Server 2008,
Index Performance
All to often when helping people look at query performance problems I’ll ask them to look at the execution plan, and see what it says. Most query performance problems can be resolved simply by looking at the execution plan and seeing where you need to add an index.
All to often I (and others) then get asked, how to I look at the execution plan, and what does it mean?
Continued »
Mar 2 2009 2:43PM GMT
Posted by: mrdenny
SQL,
Standalone SQL Agent
I’ve been quiet about the Standalone SQL Agent for a while now. I haven’t forgotten about the project, in fact I’ve been busily working on it in what little free time I have. I’ve been working on phase 2 of the project which is adding in the UI to handle job management. Needless to say, I forgot how much I hate building User Interfaces. I much prefer building windows services which no one sees.
I’m trying to keep the UI as simple as possible while providing all the functionality that the native job management via SSMS provides; even if not all that functionality is supported by the Standalone SQL Agent at this time.
Even though you can’t download a client installer, or the source (since I haven’t checked and in yet) I figured that I’d post a few screenshots to show where I’m at and get some feedback on it.

The first screenshot here is the job list which comes up after you select the SQL Server instance you want to connect to (yes you can connect to a remote instance so that you can manage SQL Express machines remotely). It shows the jobs, there current state as queried from the SQL Server, if they are enabled and the Next Run Time. Currently I’m not getting the Last Run Time back from the SQL Server so that needs to be corrected.
The next screenshot is the
job step info page. This should look very similar to what you see in SQL Server Management Studio or SQL Server Enterprise Manager.
It has the job name, owner, category, and the date information.
The third screenshot (below) are the job steps for the selected job.
This screen should also look very similar to what is shown in SQL Server Management Studio and SQL Server Enterprise Manager.
I hope that this looks useful as I’m still plugging away at the UI (I hate making UIs).
I’ve also added in a command line application which will remove the three (so far) stored procedures which are placed within the msdb database. The service puts these in place when the Agent is started, and I need a way to remove them easily during install, so I put them in a separate executable so that they could be easily removed if needed.
Denny
Dec 25 2008 11:00AM GMT
Posted by: mrdenny
SQL,
Anti-Virus
My answer to that one is pretty easy. Let him / her. I’m a firm believer that every machine on the network should have anti-virus software installed. Most anti-virus software is pretty lightweight (especially compared to the amount of hardware that your SQL Server has), and if a virus did get onto the SQL Server the results could be awful.
Continued »
Nov 22 2008 7:08PM GMT
Posted by: mrdenny
SQL,
PASS
Well the PASS 2008 summit must be official over as I’m sitting at the airport waiting for my plane. I was expecting a very long security line here at SeaTac but I was through security within maybe 10 minutes. While means that the two hours I was planning on standing in line I instead get to sit at Terminal D3 (after just moving from N11 on the far side of the airport) and wait for my flight to Ontario. I guess the upside is that I got to get some lunch before my flight.
Overall I would have to say that the PASS 2008 summit was a success. I got some good info about SQL Server, and met a lot of people that I either know from forums or who’s writings I’ve been reading for quite a while now. Overall the sessions were very informative, and I know that I got something out of just about every session I attended.
Last night a group of MVPs got together for dinner with our MVP lead. The dinner was a blast with about 30 people attending the dinner. It was on Friday night so a lot of people had already gone home. It was great to be able to sit and chat and relax with other people after the rush of PASS being over.
It was great to meet everyone, as well as say high again to people that I met at PASS 2007, SQL 2008 Launch and other conferences.
There were a couple of people that I didn’t have a chance to run across that I wish I did. Hopefully next year.
See you at PASS 2009 back here in Seattle, Washington.
Denny
Oct 30 2008 4:53AM GMT
Posted by: mrdenny
SQL
So yesterday I was asked to setup a few x64 workstations on our ESX server. The Vista x64 machines detected the LSI controller no problem, but the Windows XP machines couldn’t find the controller, and the drivers that VMware included with ESX (3.0.2) were x86 only drivers.
Continued »
Oct 13 2008 11:01AM GMT
Posted by: mrdenny
SQL,
Query tuning
Take a look at the execution plan for your query. You’ll notice that the query is doing an Index Scan (or a table scan), not an Index Seek which is why the SELECT COUNT(*) takes so long. The reason for this is that the COUNT(*) function needs to look at every record in the table.
As a workaround you can use the technique that Microsoft uses to quickly display the number of rights when you right click on the table and select properties.
select sum (spart.rows)
from sys.partitions spart
where spart.object_id = object_id(’YourTable’)
and spart.index_id < 2
You should find that this returns very quickly no matter how many tables you have.
If you are using SQL 2000 still you can use the sysindexes table to get the number.
select max(ROWS)
from sysindexes
where id = object_id(’YourTable’)
This number may be slightly off depending on how often SQL updates the sysindexes table, but it’s usually corrent (or at least close enough).
Denny
(I was informed that my prior information on this post was not quite accurate, so I have revised the post accordingly. In a nutshell when doing a SELECT count(*) FROM Table even if the row contains all NULLs the record is still counted.)
Sep 19 2008 7:04PM GMT
Posted by: mrdenny
SQL,
In Person Events,
SoCal Code Camp,
Federated Database,
San Diego SSUG
I’d like to say thanks to the San Diego SQL Server Users Group for inviting me to speak last night.
I had a great time speaking to the group, and just like last time the questions were all excellent.
The slide deck for last night session on Federated Databases is now available. I believe that it will also be made available on the San Diego SQL Server Users Group website.
For those that missed the session, it is one of the sessions which I’m giving at the SoCal Code Camp on October 25 and 26 at USC in Los Angeles. Based on the time the presentation took last night, I’ll be expanding it a bit to better fill the two hours I’ve allocated for it at the Code Camp. If you are going to attend the Code Camp, be sure to mark the interested check box after you register so that the Code Camp staff knows how large of a room to put all the session in.
Denny
Sep 11 2008 11:00AM GMT
Posted by: mrdenny
SQL,
SQL Server 2005,
Service Broker,
TempDB,
END CONVERSATION
I’ve seen an issue with Service Broker that others may be seeing. Messages are sent into the service broker, and are processed as normal, and they are removed from the message queue. However you still see the conversation in the sys.conversation_endpoints DMV in a CONVERSING state instead of a CLOSED state. There are no records in the sys.transmission_queue which is the very strange part. There are also no errors when checking with SQL Server Profiler.
Apparently this is a known issue which they are working on. The strange thing is that when it happens on my system, it only happens on a single queue in my database.
Currently the only workaround is to do an END CONVERSATION WITH CLEANUP on the conversations. I’ve written this script which clears out the conversations. I’ve made it so that it only removes the messages which are for the problem conversation which don’t currently exist in the queue (this queue is not auto processed, there is a service which queries the queue every 30 seconds so there can be a backlog of valid messages in the queue which I don’t want to delete).
declare @i int
set @i = 1
while @i <> 10000
begin
declare @conversation_handle uniqueidentifier
declare cur CURSOR for
SELECT TOP (1000) conversation_handle
FROM sys.conversation_endpoints
WHERE NOT EXISTS (SELECT *
FROM [tcp://AWT/Sonar/Q_ObjectDelete] a
WHERE a.conversation_handle = sys.conversation_endpoints.conversation_handle)
AND sys.conversation_endpoints.far_service = ‘tcp://AWT/Sonar/Svc_ObjectDelete’
AND sys.conversation_endpoints.state <> ‘CD’
open cur
fetch next from cur into @conversation_handle
while @@fetch_status = 0
begin
end conversation @conversation_handle with cleanup
fetch next from cur into @conversation_handle
end
close cur
deallocate curset @i = @i + 1
endI run this every hour to clean up the bogus records in the sys.conversation_endpoints DMV.
Without cleaning up the sys.conversation_endpoints DMV the tempdb will slowly start to fill up and throw out of space messages while sp_spaceused shows that the tempdb is empty in the same that id did in the other post I did a while back.
Denny