在实际的工作和学习中,许多人的SQL Server 2005数据库日志文件可能会发生损坏,例如硬件故障、计算机非正常重启或关机等等。
在SQL Server 2005的日志文件损坏时,你会发现以下的情况:
◆1、在SQL Server Management Studio中显示数据库处于置疑(suspect)状态。
◆2、事件日志可能会出现如下错误信息:
Could not redo log record (21737:686:9), for transaction ID (0:2334886), on page (1:37527), database 'Test' (database ID 15). Page: LSN = (21735:299:5), type = 2. Log: OpCode = 3, context 19, PrevPageLSN: (21737:615:1). Restore from a backup of the database, or repair the database.
During redoing of a logged operation in database 'Test', an error occurred at log record ID (76116:286:2). Typically, the specific failure is previously logged as an error in the Windows Event Log service. Restore the database from a full backup, or repair the database.
◆3、无法分离数据库
◆4、用CREATE DATABASE DBName ON ( FILENAME = N'DBFile' ) FOR ATTACH_REBUILD_LOG附加数据库时出现提示:The log cannot be rebuilt because the database was not cleanly shut down.
详细的恢复方法:
1、停止数据库服务。
2、将需要恢复的数据库文件复制到另外的位置。

