BUG: Access Violation Backing Up Tran Log After Error 5042 (230700)



The information in this article applies to:

  • Microsoft SQL Server 7.0

This article was previously published under Q230700
BUG #: 55484 (SQLBUG_70)

SYMPTOMS

If you attempt to remove a log file from tempdb, but are unable to do so because the log file is not empty, the following 5042 error occurs:
Server: Msg 5042, Level 16, State 2, Line 5
The file 'templog_1' cannot be removed because it is not empty.
File 'C:\TEMP\TEMPLOG_1.LDF' modified in sysaltfiles. Delete old file after restarting SQL Server.
If you attempt to truncate the transaction log for tempdb (using code similar to the following):
     Backup tran tempdb with no_log
				

-and-

if you do no shut down SQL Server before doing as the 5042 error instructs, a 5019 error occurs and you are disconnected from SQL Server with this message:
Server: Msg 5019, Level 16, State 1, Line 5
Could not find entry in sysaltfiles for file 'templog_1'.
ODBC: Msg 0, Level 19, State 1
SqlDumpExceptionHandler: Process 7 generated fatal exception c0000005 EXCEPTION_ACCESS_VIOLATION. SQL Server is terminating this process.
In addition, an error 0 followed by a stack dump is written to the SQL Server errorlog:
Error: 0, Severity: 19, State: 0
SqlDumpExceptionHandler: Process 7 generated fatal exception c0000005 EXCEPTION_ACCESS_VIOLATION. SQL Server is terminating this process.
Short Stack Dump:
     0x00823039 Module(debugSR+423039) (XDES::Commit+2f)
     0x00793fce Module(debugSR+393fce) (FileMgr::ShrinkFile+2e5)
     0x00831d8f Module(debugSR+431d8f) (PerformLogTruncation+22c)
     0x00893a29 Module(debugSR+493a29) (BackupEntry::TruncateLog+254)
     0x00544705 Module(debugSR+144705) (CStmtDumpXact::XretExecute+63)
     0x004fbd20 Module(debugSR+fbd20) (CMsqlExecContext::ExecuteStmts+197)
     0x004fb96b Module(debugSR+fb96b) (CMsqlExecContext::Execute+27f)
     0x0051febf Module(debugSR+11febf) (CSQLSource::Execute+4cc)
     0x00836371 Module(debugSR+436371) (language_exec+771)
     0x41061253 Module(opends60+1253) (execute_event+659)
     0x4106144e Module(opends60+144e) (process_commands+f3)
     0x410929ea Module(ums+29ea) (ProcessWorkRequests+ed)
     0x410933e6 Module(ums+33e6) (ThreadStartRoutine+139)
     0x7800bee4 Module(MSVCRT+bee4) (beginthread+ce)
     0x77f04f3e Module(KERNEL32+4f3e) (lstrcmpiW+be)
     0x00000000 Module(debugSR+ffc00000)
				

WORKAROUND

In order to avoid the exception, do as the text for the 5042 error instructs, shut down and restart SQL Server.

If the access violation (AV) does occur, however, you can still cycle SQL Server which rebuilds the virtual sysfiles table in tempdb so that it again matches master..sysaltfiles. Doing so also effectively removes the desired log file, although you still need to explicitly delete it from the disk.

STATUS

Microsoft has confirmed this to be a problem in SQL Server 7.0.

Modification Type:MajorLast Reviewed:10/16/2002
Keywords:kbBug KB230700