SQLServerWiki

“The Only Thing That Is Constant Is Change”

Up-gradation From SQL Server 2000 to 2005 Failure with Access Violation (AV)

Posted by database-wiki on March 6, 2011

Problem Description:

=========================================================================================================================================================

Up-gradation From SQL Server 2000 to 2005 Failure with Access Violation (AV).

Cause:

=========================================================================================================================================================

A basic definition of an AV is an attempt to access a memory address that is not accessible to the program’s virtual address space. The typical cause is that the memory address is not actually

Committed memory, but it could also be that the memory address is part of a region that is marked NO_ACCESS or READY_ONLY. The first 64 KB of the virtual address space of any Windows

Process is automatically marked NO_ACCESS. This means that any attempt by a thread to access a memory address of 0 – 65536 results in AV. This is specifically done in windows to catch any

NULL pointers in programs. Memory regions marked READ_ONLY cause an AV to occur if a thread attempts to write at a memory address in that region.

So entire sequence is:

1.       The exception is handled and the stack dump is produced.

2.       Any active transactions are rolled back.

3.       Any other resources associated with the query or the connection are destroyed.

4.       An error message is sent back to the client application.

5.       The connection is closed.

Stack Dump log:

=========================================================================================================================================================

2008-09-09 11:51:00.45 Server      Microsoft SQL Server 2005 – 9.00.1399.06 (Intel X86)

                Oct 14 2005 00:33:37

                Copyright (c) 1988-2005 Microsoft Corporation

                Developer Edition on Windows NT 5.2 (Build 3790: Service Pack 1)

2008-09-09 11:51:00.45 Server      (c) 2005 Microsoft Corporation.

2008-09-09 11:51:00.45 Server      All rights reserved.

2008-09-09 11:51:00.45 Server      Server process ID is 5796.

.

.

2008-09-09 11:51:02.98 spid5s      Starting up database ‘master’.

2008-09-09 11:51:03.46 spid5s      1 transactions rolled back in database ‘master’ (1). This is an informational message only. No user action is required.

2008-09-09 11:51:03.46 spid5s      Recovery is writing a checkpoint in database ‘master’ (1). This is an informational message only. No user action is required.

2008-09-09 11:51:03.54 spid5s      Converting database ‘master’ from version 539 to the current version 611.

2008-09-09 11:51:03.54 spid5s      Database ‘master’ running the upgrade step from version 539 to version 551.

2008-09-09 11:51:03.56 spid6s      Error: 946, Severity: 14, State: 1.

2008-09-09 11:51:03.56 spid6s      Cannot open database ‘master’ version 539. Upgrade the database to the latest version.

2008-09-09 11:51:03.56 spid6s      System Task Aggregate global counters produced an error that was not handled.  Major: 9, Minor: 46, Severity:14, State:1

2008-09-09 11:51:04.37 spid5s      Using ‘dbghelp.dll’ version ‘4.0.5’

2008-09-09 11:51:04.46 spid5s      ***Stack Dump being sent to H:\Program Files\Microsoft SQL Server\MSSQL$SQLDEV13\LOG\SQLDump0042.txt

2008-09-09 11:51:04.46 spid5s      SqlDumpExceptionHandler: Process 5 generated fatal exception c0000005 EXCEPTION_ACCESS_VIOLATION. SQL Server is terminating this process.

2008-09-09 11:51:04.46 spid5s      * *******************************************************************************

2008-09-09 11:51:04.46 spid5s      *

2008-09-09 11:51:04.46 spid5s      * BEGIN STACK DUMP:

2008-09-09 11:51:04.46 spid5s      *   09/09/08 11:51:04 spid 5

2008-09-09 11:51:04.46 spid5s      *

2008-09-09 11:51:04.46 spid5s      *

2008-09-09 11:51:04.46 spid5s      *   Exception Address = 010C12E4 Module(sqlservr+000C12E4)

The exception address is very important for you in making a quick determination about whether this problem may be a SQL Server issue. The name of the module associated with the exception address instruction is listed next to the module Module(sqlservr+000C12E4). In this case, you can see that the instruction address where the exception occurred is SQLSERVR.EXE and so it a problem of SQL Server.

If the module name is not SQLSERVR.EXE? it could still be a SQL Server bug.

In this particular  issue, I see that the AV occurred when readying the memory address 00000000

2008-09-09 11:51:04.46 spid5s      *   Exception Code    = c0000005 EXCEPTION_ACCESS_VIOLATION

2008-09-09 11:51:04.46 spid5s      *   Access Violation occurred reading address 00000000

Remember first 64KB is marked NO_ACCESS. My bet is a NULL pointer problem because of the address 0x00 in the dump. Probably the code was attempting to access a member of a class or structure that is a offset 0x00 within the structure, but the pointer that the code is using the NULL.

2008-09-09 11:51:05.60 spid5s      External dump process return code 0x20000001.External dump process returned no errors.2008-09-09 11:51:05.60 spid5s      Error: 928, Severity: 20, State: 1.

2008-09-09 11:51:05.60 spid5s      During upgrade, database raised exception 2905, severity 25, state 1, address 023D8F92. Use the exception number to determine the cause.

2008-09-09 11:51:05.60 spid6s      Error: 946, Severity: 14, State: 1.

2008-09-09 11:51:05.60 spid6s      Cannot open database ‘master’ version 539. Upgrade the database to the latest version.

2008-09-09 11:51:05.60 spid6s      System Task Aggregate global counters produced an error that was not handled.  Major: 9, Minor: 46, Severity:14, State:1

An AV has been raised during Master database upgradation process

and the dump is at H:\Program Files\Microsoft SQL Server\MSSQL$SQLDEV13\LOG\SQLDump0042.txt

Root Cause:

=========================================================================================================================================================

we were getting SID from there, it seems 28 bytes

01 05 00 00 00 00 00 05 15 00 00 00 8e 33 25 06 2b 06 c2 50 bf 45 6a 4e 1f 04 00 00

To understand to which login this SID Belong we collected Master database backup from you for our analysis.

So the Up-upgrade has failed because of an invalid remote login mapping and that was residing in the database.

To find such invalid remote login mappings, use following query

===============================================================

select * from sysremotelogins r where

r.sid is not null

and not exists (select * from syslogins l where l.sid = r.sid)

This did not return any values for us from the backup

To find such invalid linked login mappings, use following query

===============================================================

select * from sysoledbusers o where

o.loginsid is not null

and not exists (select * from syslogins l where l.sid = o.loginsid)

This gave use a invalid Linked server login mapping.

 srvid  sid                                                         xstatus xdate1                   xdate2                   name  password                            dbid   language   isrpcinmap ishqoutmap selfoutmap

—— ———————————————————– ——- ———————— ———————— —– ———————————– —— ———- ———- ———- ———-

1      0x0105000000000005150000008E3325062B06C250BF456A4E1F040000  64      2005-03-30 13:59:40.163  2005-03-30 13:59:40.163  sa    0xCA15615F1DA3F158F6328E0164A637A2  1      NULL       0          1          0

Select * from sysxlogins x where

x.srvid is not null and x.sid is not null and

not exists (select * from syslogins l where l.sid = x.sid)

Also gives us the same output so it looks like we have an rogue record in linked server , This can be eliminated by removing the linked server entry or by directly deleting it from sysxlogins.

During testing phase at our end we have found this kind of issue and a bug has been filed for the same , But we have moved ahead and since supportability of sql server 2000 is about to end the possibility of fixing the bug is low.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: