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 June, 2010

FIX: Indexed View May Cause a Handled Access Violation in CIndex::SetLevel1Names

Symptoms
A query based on an indexed view may cause a handled access violation exception in the CIndex::SetLevel1Names function and end the connection of the client
that submitted the query. Additionally, messages similar to the following are written
to the SQL Server error log:

2002-12-30 13:17:01.99 spid51 Using ‘dbghelp.dll’ version ‘4.0.5′
*Stack Dump being sent to C:\Program Files\Microsoft SQL Server\MSSQL\log\SQL00001.dmp
2002-12-30 13:17:01.99 spid51 Error: 0, Severity: 19, State: 0
2002-12-30 13:17:01.99 spid51 SqlDumpExceptionHandler: Process 51 generated fatal exception c0000005 EXCEPTION_ACCESS_VIOLATION. SQL Server is terminating this process..
Resolution
Service pack informationTo resolve this problem, obtain the latest service pack for Microsoft SQL Server 2000. For additional information, click the following article number to view the article in the Microsoft Knowledge Base:
290211?(http://support.microsoft.com/kb/290211/) How to obtain the latest SQL Server 2000 service pack
Hotfix information The English version of this fix has the file attributes (or later) that are listed in the following table. The dates and times for these files are listed in coordinated universal time (UTC). When you view the file information, it is converted to local time. To find the difference between UTC and local time, use the Time Zone tab in the Date and Time tool in Control Panel.

DateTimeVersionSizeFile name————————————————————————-17-Jan-200220:452000.80.568.029,244 bytesDbmslpcn.dll30-Aug-200213:08786,432 bytesDistmdl.ldf30-Aug-200213:082,359,296 bytesDistmdl.mdf11-Dec-200209:50180 bytesDrop_repl_hotfix.sql02-Jul-200207:352000.80.650.0107,088 bytesImpprov.dll11-Dec-200209:501,402 bytesInst_repl_hotfix.sql19-Jul-200208:56774,516 bytesInstdist.sql20-Aug-200208:242000.80.679.0111,172 bytesLogread.exe15-Dec-200215:212000.80.717.090,692 bytesMsgprox.dll06-Apr-200218:082000.80.606.062,024 bytesOdsole70.dll02-Jan-200217:5918,185 bytesQfe356326.sql20-Aug-200208:472000.80.679.0135,748 bytesQrdrsvc.exe26-Aug-200214:492000.80.679.0406,088 bytesRdistcom.dll03-Oct-200117:36437,302 bytesReplcom.sql20-Aug-200208:332000.80.679.0152,136 bytesReplmerg.exe25-Nov-200213:431,004,990 bytesReplmerg.sql15-Dec-200215:212000.80.717.0221,768 bytesReplprov.dll15-Dec-200215:212000.80.717.0303,688 bytesReplrec.dll03-Oct-200117:36986,906 bytesReplsys.sql03-Oct-200117:36881,228 bytesRepltran.sql26-Aug-200214:492000.80.679.0283,208 bytesRinitcom.dll16-Sep-200214:31390,045 bytesSecurityhotfix.sql26-Aug-200214:492000.80.679.028,672 bytesSqlagent.dll26-Aug-200210:392000.80.679.0311,872 bytesSqlagent.exe28-Aug-200208:322000.80.679.049,152 bytesSqlagent.rll26-Aug-200214:492000.80.679.053,824 bytesSqlcmdss.dll28-Aug-200208:402000.80.679.012,288 bytesSqlcmdss.rll24-Oct-200209:372000.80.695.0176,696 bytesSqlmap70.dll27-Dec-200221:392000.80.721.07,471,185 bytesSqlservr.exe01-Nov-200210:562000.80.698.045,644 bytesSqlvdi.dll17-Jan-200220:452000.80.568.029,244 bytesSsmslpcn.dll19-Dec-200216:552000.80.719.082,492 bytesSsnetlib.dll19-Dec-200218:092000.80.720.025,148 bytesSsnmpn70.dll06-Apr-200218:082000.80.606.070,208 bytesXplog70.dll06-Apr-200218:082000.80.606.053,828 bytesXpqueue.dll06-Apr-200218:082000.80.606.0156,228 bytesXprepl.dll11-Jul-200217:002000.80.658.0279,104 bytesXpstar.dll16-Sep-200215:122000.80.686.098,872 bytesXpweb70.dll NOTE: Because of file dependencies, the most recent hotfix or feature that contains the files may also contain additional files.

FIX: Index Tuning Wizard Execution May Generate Floating Point Exception

Symptoms
When you run the Index Tuning Wizard, this error message may occur:

Server: Msg 3628, Level 16, State 1, Line 2
A floating point exception occurred in the user process. Current transaction is canceled.
Resolution
When a double was out of range from an underflow or overflow, the Index Tuning Wizard incorrectly converted the number into the maximum or minimum float value.

FIX: Index Scans on Frequently Modified Table May Return Incorrect Results

Symptoms
Under rare conditions where connections concurrently modify and read data on a particular page, a query that performs a range scan on the page may return rows that do not qualify for the specified range. The end result is that a query may return extra rows that should not qualify for the query.
This problem may affect the distribution agents in transactional replication. When the Distribution Agent receives unexpected rows while querying the MSrepl_commands table it causes an access violation (AV) exception in Distrib.exe that shuts down the agent. The following text may appear in the ReplExceptDist.log:

Microsoft SQL Server Replication: Exception Stack Dump…An exception was caughtin DISTRIB.EXE* Exception Address = 7801166c* Exception Code = c0000005********************************************************Module Name Return Address LocationMSVCRT 00403a45 wcsncpy + 14distrib 0040104c 00403a45distrib 77e97d08 0040104cKERNEL32 00000000
Resolution
To resolve this problem, obtain the latest service pack for Microsoft SQL Server 2000. For additional information, click the following article number to view the article in theMicrosoft Knowledge Base:
290211?(http://support.microsoft.com/kb/290211/EN-US/) INF: How to Obtain the Latest SQL Server 2000 Service Pack
HotfixNOTE: The following hotfix was created prior to Microsoft SQL Server 2000 Service Pack 2. The English version of this fix should have the following file attributes or later:

VersionFile nameDescription————————————————8.00.468Sqlservr.exeSP1-based hotfix Hotfix build 468 is designed to be applied to a server that is running SQL Server 2000 Service Pack 1.
NOTE: Due to file dependencies, the most recent hotfix or feature that contains the preceding files may also contain additional files.

FIX: Improved SQL Manager Robustness for Odd Length Buffer

Symptoms
An access violation (AV) exception may occur when SQL Server tries to free the relevant memory block. The following is a sample short stack dump that you may see in the error log:

* Short Stack Dump* 0040A829 Module(sqlservr+0000A829) (CVariableInfo::CVarBlock::PvbJoin+00000035)* 0040A782 Module(sqlservr+0000A782) (CVariableInfo::PviRelease+00000056)* 0040A72C Module(sqlservr+0000A72C) (CVarPageMgr::Release+00000014)* 00401B52 Module(sqlservr+00001B52) (CMemObj::Free+0000001E)* 00401AFD Module(sqlservr+00001AFD) (CMemThread::Free+00000044)* 00401B26 Module(sqlservr+00001B26) (commondelete+0000001B)* 00560988 Module(sqlservr+00160988) (CSql::~CSql+00000021)* 0053E4B9 Module(sqlservr+0013E4B9) (CSqlMgr::DerefSql+00000065)* 0053EAC8 Module(sqlservr+0013EAC8) (CCompPlan::~CCompPlan+00000051)* 0053EA4B Module(sqlservr+0013EA4B) (CCompPlan::`vector deleting destructor’+0000000B)* 00440B4F Module(sqlservr+00040B4F) (CCacheObject::Release+000000D8)* 005D2F4F Module(sqlservr+001D2F4F) (CCache::FRemoveOne+00000316)* 0081AB31 Module(sqlservr+0041AB31) (BPool::ReplenishFreeList+00000144)* 0040AFAB Module(sqlservr+0000AFAB) (BPool::HelpLazyWriter+00000037)* 004306F5 Module(sqlservr+000306F5) (BPool::ReadAhead+00000074)* 00431A6D Module(sqlservr+00031A6D) (SDES::ReadAhead+0000006D)* 00521D63 Module(sqlservr+00121D63) (UnorderedPageSupplier::AddToQueue+00000546)* 00521938 Module(sqlservr+00121938) (UnorderedPageSupplier::GetNextPage+0000006C)* 00405810 Module(sqlservr+00005810) (SDES::GetBiDi+0000019C)* 0043362A Module(sqlservr+0003362A) (RowsetSS::FetchNextRow+000000B0)* 00433506 Module(sqlservr+00033506) (CQScanRowset::GetRowWithPrefetch+00000040)* 00521769 Module(sqlservr+00121769) (CQScanTableScan::GetRow+0000005F)* 0042C876 Module(sqlservr+0002C876) (CRowPrefetchDelayMgr::PopulateBuffer+0000001F)* 0042C334 Module(sqlservr+0002C334) (CRowPrefetchDelayMgr::GetRowUnordered+0000001E)* 0042C247 Module(sqlservr+0002C247) (CRowPrefetchDelayMgr::GetRow+0000001B)* 0042C22B Module(sqlservr+0002C22B) (CQScanRangePrefetchDelay::GetRow+00000014)* 0042D02F Module(sqlservr+0002D02F) (CQScanNLJoin::GetRow+0000010B)* 006D58CB Module(sqlservr+002D58CB) (CQScanConcat::GetRow+0000001C)* 005285B0 Module(sqlservr+001285B0) (CQScanSort::BuildSortTable+00000047)* 00528560 Module(sqlservr+00128560) (CQScanSort::Open+00000032)* 0041D92F Module(sqlservr+0001D92F) (CQueryScan::Startup+0000010D)* 0041925F Module(sqlservr+0001925F) (CStmtQuery::ErsqExecuteQuery+0000026B)* 00432F55 Module(sqlservr+00032F55) (CStmtSelect::XretExecute+00000229)* 0040F403 Module(sqlservr+0000F403) (CMsqlExecContext::ExecuteStmts+000002D9)* 0040EA95 Module(sqlservr+0000EA95) (CMsqlExecContext::Execute+000001B6)* 00410159 Module(sqlservr+00010159) (CSQLSource::Execute+00000331)* 005F74B6 Module(sqlservr+001F74B6) (CStmtExecStr::XretExecute+0000032E)* 0040F403 Module(sqlservr+0000F403) (CMsqlExecContext::ExecuteStmts+000002D9)* 0040EA95 Module(sqlservr+0000EA95) (CMsqlExecContext::Execute+000001B6)* 00410159 Module(sqlservr+00010159) (CSQLSource::Execute+00000331)* 00429DD3 Module(sqlservr+00029DD3) (execrpc+000004CB)* 0042904D Module(sqlservr+0002904D) (execute_rpc+00000019)* 00410FCE Module(sqlservr+00010FCE) (process_commands+00000210)* 41073379 Module(UMS+00003379) (ProcessWorkRequests+0000024A)* 41073071 Module(UMS+00003071) (ThreadStartRoutine+000000BD)* 7800A27B Module(MSVCRT+0000A27B) (beginthread+000000CE)* 77E5758A Module(KERNEL32+0000758A) (SetFilePointer+0000018A)
Resolution
SQL Server works with double-byte Unicode data internally; therefore, SQL Manager assumes an even length buffer.However, under some unexpected situations the buffer length can become an odd number. For example, this behavior might occur with an invalid Tabular Data Stream (TDS) language event. When the buffer length becomes an odd number, SQL Manager cannot allocate a sufficient memory block. This leads to a potential memory scratch and can cause the access violation that is described in the “Symptoms” section when the relevant memory block is freed later.

FIX: General network error when you try to back up or restore a SQL Server database on a computer that is running Windows Server 2003

Symptoms
When you try to back up a Microsoft SQL Sever database on a computer that is running Microsoft Windows Server 2003, you may receive an error message that is similar to the following:

Processed <Number of Pages> pages for database ‘<databaseName>’, file ‘<databaseName>’ on file 1.
100 percent backed up.
[Microsoft][ODBC SQL Server Driver][DBNETLIB]ConnectionRead (WrapperRead()).
Server: Msg 11, Level 16, State 1, Line 0
General network error. Check your network documentation.
Processed 1 pages for database ‘<databaseName>’, file ‘<fileName>’ on file 1. However, the backup device file is created successfully and the backup data is valid.
A similar problem may also occur when try to restore a SQL Server database on a computer that is running Microsoft Windows Server 2003, and you may receive an error message that is similar to the following:

Processed <Number of Pages> pages for database ‘<databaseName>’, file ‘<fileName>’ on file 1.
[Microsoft][ODBC SQL Server Driver][DBNETLIB]ConnectionRead (WrapperRead()).
Server: Msg 11, Level 16, State 1, Line 0
General network error. Check your network documentation.
Processed 1 pages for database ‘<databaseName>’, file ‘<fileName>’ on file 1.
ODBC: Msg 0, Level 16, State 1
Communication link failure Generally, the backup device file is still created. However, the file may not be valid depending on when the failure occurred. Also, when this problem occurs, an error such as the following is typically logged in the SQL Server error log:

2004-05-26 09:44:16.77 backup BACKUP failed to complete the command backup database testdb to disk=’c:\temp\testdb.bak’ with init, stats=10Note This problem may occur when the SQL Server connection uses the Named Pipes Net-Library.
When the Sqlmaint.exe utility runs the RESTORE VERIFYONLY command, you may notice an error message that is similar to the following in the SQL Server error log:

BackupDiskFile::OpenMedia: Backup device ‘C:\MSSQL\db_200401261900.BAK’ failed to open. Operating system error = 32(The process cannot access the file because it is being used by another process.).Also, you may notice an error message that is similar to the following in the SQL Server maintenance plan output file:

Microsoft SQL-DMO (ODBC SQLState: 42000)] Error 3201: [Microsoft][ODBC SQL Server Driver][SQL Server]Cannot open backup device ‘C:\MSSQL\db_200401261900.BAK’. Device error or device off-line. See the SQL Server error log for more details. [Microsoft][ODBC SQL Server Driver][SQL Server]VERIFY DATABASE is terminating abnormally. End of maintenance plan ‘ABC Maintenance Plan’ on 1/26/2004 7:00:08 PM SQLMAINT.EXE Process Exit Code: 1 (Failed)”
Resolution
A supported hotfix is available from Microsoft. However, this hotfix is intended to correct only the problem that is described in this article. Apply this hotfix only to systems that are experiencing this specific problem. This hotfix might receive additional testing. Therefore, if you are not severely affected by this problem, we recommend that you wait for the next software update that contains this hotfix.
If the hotfix is available for download, there is a “Hotfix download available” section at the top of this Knowledge Base article. If this section does not appear, contact Microsoft Customer Service and Support to obtain the hotfix.
Note If additional issues occur or if any troubleshooting is required, you might have to create a separate service request. The usual support costs will apply to additional support questions and issues that do not qualify for this specific hotfix. For a complete list of Microsoft Customer Service and Support telephone numbers or tocreate a separate service request, visit the following Microsoft Web site:
http://support.microsoft.com/contactus/?ws=support(http://support.microsoft.com/contactus/?ws=support)Note The “Hotfix download available” form displays the languages for which the hotfix is available. If you do not see your language, it is because a hotfix is not available for that language. The English version of this hotfix has the file attributes (or later) that are listed in the following table. The dates and times for these files are listed in coordinated universal time (UTC). When you view the file information, it is converted to local time. To find the difference between UTC and local time, use the Time Zone tab in the Date and Time tool in Control Panel.

DateTimeVersionSizeFile name———————————————-09-17-20032000.85.1022.42 28,672 bytes dbnmpntw.dll Note Because of file dependencies, the most recent hotfix or feature that contains these files may also contain additional files.
Note For a list of all the hotfixes available for MDAC 2.8, click the following article number to view the article in the Microsoft Knowledge Base:
839801?(http://support.microsoft.com/kb/839801/) FIX: Hotfixes are available for MDAC 2.8

FIX: Extended Stored Procedure “xp_logevent” Generates an Access Violation When Given Too Large a Parameter

Symptoms
Any string that is longer than 8000 bytes that is given as a second parameter to the xp_logevent stored procedure, causes the following error message to occur:

ODBC: Msg 0, Level 19, State 1
SqlDumpExceptionHandler: Process 51 generated fatal exception c0000005
EXCEPTION_ACCESS_VIOLATION. SQL Server is terminating this process.
ODBC: Msg 0, Level 20, State 1
Stored function ‘xp_logevent’ in the library ‘xplog70.dll’ generated an
access violation. SQL Server is terminating process 51.
Resolution
To resolve this problem, obtain the latest service pack for SQL Server 2000. For additional information, click the following article number to view the article in theMicrosoft Knowledge Base:
290211?(http://support.microsoft.com/kb/290211/EN-US/) INF: How to Obtain the Latest SQL Server 2000 Service Pack