INF: Recovering from Full Transaction Log in User DatabaseID: Q101479
|
With SQL Server versions earlier than 4.2aK7, database recovery at SQL Server startup requires that a CHECKPOINT record be written to each database. Should the transaction log of a user database become so full that a checkpoint record cannot be written the database owning the full transaction log will be marked suspect by the recovery process. This document describes the procedure to recover a database which has been marked as suspect due to this problem.
The following documented procedure should ONLY be used for dumping the
log of a full USER database. Do NOT use it for any other reason!
Remember, if the log fills up at runtime, you can issue a DUMP TRAN
WITH NO_LOG without going through any of the following procedure. This
procedure cannot be used to recover a master database.
The correct procedure for dumping the log in a full USER database is:
Start SQL Server as usual. The database that has the full transaction log will be marked suspect by recovery. Make a note of the user defined options that were set for this database as they will have to be reset when this procedure has been completed. These options can be examined by issuing the SP_HELPDB stored procedure and specifying the desired database as the first parameter.
/* allow updates to system tables */
sp_configure 'allow', 1
go
/* causes sp_configure to take effect */
reconfigure with override
go
begin tran
go
/* status 4112 = 0x1010=>(single user | no checkpoint on recovery) */
update master..sysdatabases
set status = 4112 where name = "<database name>"
go
commit tran
go
shutdown
go
dump tran <database name> with no_log
go
sp_dboption <database name>, 'no chkpt', false
go
sp_dboption <database name>, 'single', false
go
use <database name>
go
checkpoint
go
sp_configure 'allow', 0
go
reconfigure with override
go
Additional query words: 4.20 Transact-SQL 3414
Keywords : kbother SSrvAdmin
Version : 4.20
Platform : OS/2
Issue type :
Last Reviewed: March 17, 1999