SQL Server Q&A

As a software engineer, I focus on .NET, especially asp.net, C#, WCF and so on, and I am also very interested in Search Engine Optimization.

Entries for December, 2009

FIX: When Excel 2007 tries to connect to an OLAP cube on a server that is running SQL Server 2005, the connection fails

Symptoms
When Microsoft Office Excel 2007 tries to connect to an OLAP cube on a server that is running Microsoft SQL Server 2005, the connection fails.
Resolution
This problem occurs because SQL Server 2008 installs the Msolap100.dll, and this file checks for the SQL Server 2008 only value DBPROP_MSMD_SUBQUERIES. When the value is not present, the Msolap100.dll fails and prevents Excel 2007 from connecting to the server.

FIX: When you delete a maintenance plan in a restored SQL Server 2008 database, the maintenance plan is deleted on the server from which the database was originally backed up

Symptoms
Consider the following scenario. You create a maintenance plan in an instance of Microsoft SQL Server 2008. You perform a full backup for the MSDB database.You restore the MSDB database to another instance of SQL Server 2008. You delete the maintenance plan in the second instance by using SQL Server Management Studio.In this scenario, the original maintenance plan in the first instance is deleted unexpectedly. When you refresh the maintenance plans folder in SQL Server Management Studio in the second instance, the maintenance plan is not deleted from the second instance.
Resolution
A maintenance plan is aSQL Server Integration Services (SSIS) package that is stored as XML in the MSDB database. A maintenance plan contains a list of connection strings that use the actual name of the server. Therefore, if you restore the MSDB database of a server to another server, the maintenance plan connection strings still point to the original server.

FIX: The SQL Server engine in SQL Server 2005 and in SQL Server 2008 may consume large amounts of memory during the setup configuration phase

Symptoms
During the setup or patching of a server that is running Microsoft SQL Server 2005 or Microsoft SQL Server 2008, the SQL Server engine (SQLServr.exe) process consumes significant physical random access memory (RAM) of more than 4 gigabytes (GB).
Note This problem is more relevant on Non-Uniform Memory Access (NUMA) systems or on systems that are configured to use large memory pages.
Resolution
Cumulative update informationSQL Server 2005 To resolve this problem, install this cumulative update package for SQL Server 2005 Service Pack 3.
Note Starting with this cumulative update, the SQL Server hotfix.exe instructs the SQL Server engine to start a minimized configuration by using the -f command line parameter.This reduces the required memory footprint.
The fix for this issue was first released in Cumulative Update 3. For more information about how to obtain this cumulative update package for SQL Server 2005 Service Pack 3, click the following article number to view the article in the Microsoft Knowledge Base:
967909?(http://support.microsoft.com/kb/967909/) Cumulative update package 3 for SQL Server 2005 Service Pack 3Note Because the builds are cumulative, each new fix release contains all the hotfixes and all the security fixes that were included with the previous SQL Server 2005 Service Pack 3 fix release. We recommend that you consider applying the most recent fix release that contains this hotfix. For more information, click the following article number to view the article in the Microsoft Knowledge Base:
960598?(http://support.microsoft.com/kb/960598/) The SQL Server 2005 builds that were released after SQL Server 2005 Service Pack 3 was released Microsoft SQL Server 2005 hotfixes are created for specific SQL Server service packs. You must apply a SQL Server 2005 Service Pack 3 hotfix to an installation of SQL Server 2005 Service Pack 3. By default, any hotfix that is provided in a SQL Server service pack is included in the next SQL Server service pack.The release version of SQL Server 2008Important You must install this cumulative update package if your computer is running the release version of SQL Server 2008.
The fix for this issue was first released in Cumulative Update 5 for SQL Server 2008. For more information about how to obtain this cumulative update package for SQL Server 2008, click the following article number to view the article in the Microsoft Knowledge Base:
969531?(http://support.microsoft.com/kb/969531/) Cumulative update package 5 for SQL Server 2008Note Because the builds are cumulative, each new fix release contains all the hotfixes and all the security fixes that were included with the previous SQL Server 2008 fix release. We recommend that you consider applying the most recent fix release that contains this hotfix. For more information, click the following article number to view the article in the Microsoft Knowledge Base:
956909?(http://support.microsoft.com/kb/956909/) The SQL Server 2008 builds that were released after SQL Server 2008 was releasedSQL Server 2008 Service Pack 1Important You must install this cumulative update package if your computer is running SQL Server 2008 Service Pack 1.
The fix for this issue was also released in Cumulative Update3 for SQL Server 2008 Service Pack 1. For more information about this cumulative update package, click the following article number to view the article in the Microsoft Knowledge Base:
971491?(http://support.microsoft.com/kb/971491/LN/) Cumulative update package 3 for SQL Server 2008 Service Pack 1Note Because the builds are cumulative, each new fix release contains all the hotfixes and all the security fixes that were included with the previous SQL Server 2008 fix release. Microsoft recommends that you consider applying the most recent fix release that contains this hotfix. For more information, click the following article number to view the article in the Microsoft Knowledge Base:
970365?(http://support.microsoft.com/kb/970365/LN/) The SQL Server 2008 builds that were released after SQL Server 2008 Service Pack 1 was releasedMicrosoft SQL Server 2008hotfixes are created for specific SQL Server service packs. You must apply a SQL Server 2008 Service Pack 1 hotfix to an installation of SQL Server 2008 Service Pack 1. By default, any hotfix that is provided in a SQL Server service pack is included in the next SQL Server service pack.

FIX: The Shared Memory protocol for an instance of SQL Server 2008 is always enabled and the VIA protocol for the instance is always disabled after you repair the instance

Symptoms
After you repair an instance of Microsoft SQL Server 2008, the Shared Memory protocol for the instance is always enabled. Additionally, the VIA protocol for the instance is always disabled.
You can use several methods to run the repair operation. For example, you can repair an instance by using theAdd or Remove Programs item in Control Panel.
Resolution
Service pack informationTo resolve this problem, obtain the latest service pack for SQL Server 2008. For more information, click the following article number to view the article in the Microsoft Knowledge Base:
968382?(http://support.microsoft.com/kb/968382/) How to obtain the latest service pack for SQL Server 2008

FIX: The memory usage increases gradually when you frequently back up or restore a database in SQL Server 2008

Symptoms
When you frequently back up or restore a database in Microsoft SQL Server 2008, the memory usage increases gradually. Additionally, the size of the procedure cache grows at a steady rate.
You can see this problem by running the following statements.

SELECT p.plan_handle,CONVERT (varchar, GETDATE(), 126) AS runtime, LEFT (p.cacheobjtype + ‘ (‘ + p.objtype + ‘)’, 35) AS cacheobjtype,p.usecounts, p.size_in_bytes / 1024 AS size_in_kb, stat.total_worker_time/1000 AS tot_cpu_ms, stat.total_elapsed_time/1000 AS tot_duration_ms, stat.total_physical_reads, stat.total_logical_writes, stat.total_logical_reads, LEFT (CASE WHEN pa.value=32767 THEN ‘ResourceDb’ ELSE ISNULL (DB_NAME (CONVERT (sysname, pa.value)), CONVERT (sysname,pa.value))END, 40) AS dbname,sql.objectid, CONVERT (nvarchar(50), CASE WHEN sql.objectid IS NULL THEN NULL ELSE REPLACE (REPLACE (sql.[text],CHAR(13), ‘ ‘), CHAR(10), ”)END) AS procname, REPLACE (REPLACE (SUBSTRING (sql.[text], stat.statement_start_offset/2 + 1, CASE WHEN stat.statement_end_offset = -1 THEN LEN (CONVERT(nvarchar(max), sql.[text])) ELSE stat.statement_end_offset/2 – stat.statement_start_offset/2 + 1END), CHAR(13), ‘ ‘), CHAR(10), ‘ ‘) AS stmt_textFROM sys.dm_exec_cached_plans p OUTER APPLY sys.dm_exec_plan_attributes (p.plan_handle) pa INNER JOIN sys.dm_exec_query_stats stat ON p.plan_handle = stat.plan_handle OUTER APPLY sys.dm_exec_sql_text (p.plan_handle) AS sqlWHERE pa.attribute = ‘dbid’ ORDER BY p.plan_handle DESCIn the result, you may find that there are many records in which the values of the stmt_text column resemble the following:
select @media_set_id = media_set_id from msdb.dbo.backupmediaset where media_uuid = N’{7C5DCC4D-3065-47F3-AA5F-2C498DFF27F8}
insert msdb.dbo.backupmediaset (media_uuid, media_family_count, software_name, software_vendor_id, MTF_major_version, mirror_count, is_password_protected, is_compressed) values (N’{7C5DCC4D-3065-47F3-AA5F-2C498DFF27F8}’, 1, @param0, 4608, 1, 1, 0, 1)
select @media_set_id = @@identity end select @media_count = media_count from msdb.dbo.backupmediafamily where media_set_id = @media_set_id and family_sequence_number = 1These operations are the read operations and the write operations to the msdb backup history tables.
Resolution
The procedure cache grows because the backup statements or the restore statements are not fully parameterized. Each statement results in a prepared statement in the cache that is never reused.

FIX: The default instance name is set incorrectly to SQLEXPRESS when you install SQL Server 2008 Express

Symptoms
When you install Microsoft SQL Server 2008 Express, the default instance name is set incorrectly to SQLEXPRESS.
Resolution
This problem occurs because of a bug in SQL Server 2008 Setup.