以下情形會使 SQL 7.0 版重建一個新的 1 MB 實體交易記錄檔:
-
刪除 LDF 檔之前,Microsoft SQL Server 必須正確無誤的關閉,以確保資料庫的一致性。
-
SQL Server 7.0 只有在碰到主記錄檔以及記錄沒有散佈在多個 LDF 檔的情況下,才會重建 LDF。
-
若使用者 LDF 或 TEMPDB LDF 實體交易記錄檔被刪除或重新命名,SQL Server 7.0 會加以重建,並在 ERRORLOG 中,加上一行"unable to activate"(無法啟動)。
結論
若要測試此功能,請停止 SQL Server,重新命名 pubs_log.ldf 與 northwnd_log.ldf 檔。重新啟動伺服器,並請注意新的 LDF 檔已經建在 DATA 目錄下。同時,錯誤記錄檔中會有下列標記:
錯誤記錄檔範例:
2000-01-18 09:57:26.71 spid6 Opening file c:\mssql7\DATA\msdblog.ldf.
2000-01-18 09:57:26.72 spid7 File c:\mssql7\DATA\pubs_log.ldf does not exist - unable to activate.
2000-01-18 09:57:26.72 spid7 Attempting to rebuild primary log file for database pubs.
2000-01-18 09:57:26.82 spid7 Creating file C:\MSSQL7\DATA\pubs_log.LDF.
2000-01-18 09:57:26.87 spid8 File C:\MSSQL7\DATA\northwnd.ldf does not exist - unable to activate.
2000-01-18 09:57:26.87 spid8 Attempting to rebuild primary log file for database Northwind.
2000-01-18 09:57:26.99 spid8 Creating file C:\MSSQL7\DATA\Northwind_log.LDF.
2000-01-18 09:57:27.28 spid8 Closing file C:\MSSQL7\DATA\Northwind_log.LDF.
2000-01-18 09:57:27.44 spid8 Opening file C:\MSSQL7\DATA\Northwind_log.LDF.
2000-01-18 09:57:27.44 spid7 Closing file C:\MSSQL7\DATA\pubs_log.LDF.
2000-01-18 09:57:27.47 spid7 Opening file C:\MSSQL7\DATA\pubs_log.LDF.
其他相關資訊
本文件是根據 Microsoft Knowledgebase 文件編號 Q251628 翻譯的. 若要參考原始英文文件內容, 請至以下網址:
http://support.microsoft.com/support/kb/articles/Q251/6/28.asp