0
我有一個每天從一臺服務器恢復數據庫的過程。 它恢復了數據庫的數據庫備份文件,如果它找到TLog備份文件,它也會恢復它們。數據庫和日誌恢復作業失敗
該過程現在工作一段時間沒有問題。 今天,它失敗 錯誤消息:
Message
Executed as user: AOI\sa_SqlAgentSrv_PRD. RegQueryValueEx() returned error 2, 'The system cannot find the file specified.' [SQLSTATE 01000] (Message 22001) IF EXISTS (select * from sysdatabases where name = 'SiteDbStandby') ALTER DATABASE SiteDbStandby SET SINGLE_USER WITH ROLLBACK IMMEDIATE
RESTORE DATABASE [SiteDbStandby] FROM DISK = '\\SqlBackup\Databases\SiteDb.bak' WITH NORECOVERY , REPLACE , MOVE 'SiteDb_data' to 'G:\MSSQL10.DB2\MSSQL\DATA\SiteDbStandby_SiteDb_data.mdf' , MOVE 'SiteDb_log' to 'J:\MSSQL10.DB2\MSSQL\DATA\SiteDbStandby_SiteDb_log.ndf' [SQLSTATE 01000] (Message 0) Processed 191216 pages for database 'SiteDbStandby', file 'SiteDb_data' on file 1. [SQLSTATE 01000] (Message 4035) Processed 4 pages for database 'SiteDbStandby', file 'SiteDb_log' on file 1. [SQLSTATE 01000] (Message 4035)
RESTORE DATABASE successfully processed 191220 pages in 20.366 seconds (73.352 MB/sec). [SQLSTATE 01000] (Message 3014)
RESTORE LOG SiteDbStandby FROM DISK = '\\SqlBackup\Logs\SiteDb_20120916_011017.BAK' WITH NORECOVERY
RESTORE LOG SiteDbStandby FROM DISK = '\\SqlBackup\Logs\SiteDb_20120916_021929.BAK' WITH NORECOVERY
RESTORE LOG SiteDbStandby FROM DISK = '\\SqlBackup\Logs\SiteDb_20120916_031349.BAK' WITH NORECOVERY
RESTORE LOG SiteDbStandby FROM DISK = '\\SqlBackup\Logs\SiteDb_20120915_231017.BAK' WITH NORECOVERY
RESTORE LOG SiteDbStandby FROM DISK = '\\SqlBackup\Logs\SiteDb_20120916_001017.BAK' WITH NORECOVERY [SQLSTATE 01000] (Message 0) The log in this backup set begins at LSN 42459000001303500001, which is too recent to apply to the database. An earlier log backup that includes LSN 42459000001302800001 can be restored. [SQLSTATE 42000] (Error 4305) RESTORE LOG is terminating abnormally. [SQLSTATE 42000] (Error 3013). The step failed.
你可以看到,它試圖恢復16.9,從凌晨1點,16.9從2AM日誌文件中,16.9從3AM日誌文件, 日誌文件,然後是23PM的日誌文件15.9,以及12AM的日誌文件16.9。
日誌的恢復順序被搞亂了。
我回頭看了一下這個工作的歷史,我們有大約3周的日常執行歷史。 在每個執行過程中,順序都是正確的。 例如:
Executed as user: AOI\sa_SqlAgentSrv_PRD. RegQueryValueEx() returned error 2, 'The system cannot find the file specified.' [SQLSTATE 01000] (Message 22001) IF EXISTS (select * from sysdatabases where name = 'SiteDbStandby') ALTER DATABASE SiteDbStandby SET SINGLE_USER WITH ROLLBACK IMMEDIATE
RESTORE DATABASE [SiteDbStandby] FROM DISK = '\\SqlBackup\Databases\SiteDb.bak' WITH NORECOVERY , REPLACE , MOVE 'SiteDb_data' to 'G:\MSSQL10.DB2\MSSQL\DATA\SiteDbStandby_SiteDb_data.mdf' , MOVE 'SiteDb_log' to 'J:\MSSQL10.DB2\MSSQL\DATA\SiteDbStandby_SiteDb_log.ndf' [SQLSTATE 01000] (Message 0) Processed 191032 pages for database 'SiteDbStandby', file 'SiteDb_data' on file 1. [SQLSTATE 01000] (Message 4035) Processed 6 pages for database 'SiteDbStandby', file 'SiteDb_log' on file 1. [SQLSTATE 01000] (Message 4035)
RESTORE DATABASE successfully processed 191038 pages in 21.703 seconds (68.768 MB/sec). [SQLSTATE 01000] (Message 3014)
RESTORE LOG SiteDbStandby FROM DISK = '\\SqlBackup\Logs\SiteDb_20120914_231026.BAK' WITH NORECOVERY
RESTORE LOG SiteDbStandby FROM DISK = '\\SqlBackup\Logs\SiteDb_20120915_001019.BAK' WITH NORECOVERY
RESTORE LOG SiteDbStandby FROM DISK = '\\SqlBackup\Logs\SiteDb_20120915_011032.BAK' WITH NORECOVERY
RESTORE LOG SiteDbStandby FROM DISK = '\\SqlBackup\Logs\SiteDb_20120915_021140.BAK' WITH NORECOVERY
RESTORE LOG SiteDbStandby FROM DISK = '\\SqlBackup\Logs\SiteDb_20120915_031053.BAK' WITH NORECOVERY [SQLSTATE 01000] (Message 0) Processed 0 pages for database 'SiteDbStandby', file 'SiteDb_data' on file 1. [SQLSTATE 01000] (Message 4035) Processed 7 pages for database 'SiteDbStandby', file 'SiteDb_log' on file 1. [SQLSTATE 01000] (Message 4035)
RESTORE LOG successfully processed 7 pages in 0.009 seconds (5.588 MB/sec). [SQLSTATE 01000] (Message 3014) Processed 0 pages for database 'SiteDbStandby', file 'SiteDb_data' on file 1. [SQLSTATE 01000] (Message 4035) Processed 0 pages for database 'SiteDbStandby', file 'SiteDb_log' on file 1. [SQLSTATE 01000] (Message 4035)
RESTORE LOG successfully processed 0 pages in 0.009 seconds (0.000 MB/sec). [SQLSTATE 01000] (Message 3014) Processed 0 pages for database 'SiteDbStandby', file 'SiteDb_data' on file 1. [SQLSTATE 01000] (Message 4035) Processed 1229 pages for database 'SiteDbStandby', file 'SiteDb_log' on file 1. [SQLSTATE 01000] (Message 4035)
RESTORE LOG successfully processed 1229 pages in 0.196 seconds (48.965 MB/sec). [SQLSTATE 01000] (Message 3014) Processed 0 pages for database 'SiteDbStandby', file 'SiteDb_data' on file 1. [SQLSTATE 01000] (Message 4035) Processed 3 pages for database 'SiteDbStandby', file 'SiteDb_log' on file 1. [SQLSTATE 01000] (Message 4035)
RESTORE LOG successfully processed 3 pages in 0.013 seconds (1.277 MB/sec). [SQLSTATE 01000] (Message 3014) Processed 0 pages for database 'SiteDbStandby', file 'SiteDb_data' on file 1. [SQLSTATE 01000] (Message 4035) Processed 0 pages for database 'SiteDbStandby', file 'SiteDb_log' on file 1. [SQLSTATE 01000] (Message 4035)
RESTORE LOG successfully processed 0 pages in 0.009 seconds (0.000 MB/sec). [SQLSTATE 01000] (Message 3014)
use master restore database SiteDbStandby with recovery [SQLSTATE 01000] (Message 0)
RESTORE DATABASE successfully processed 0 pages in 4.360 seconds (0.000 MB/sec). [SQLSTATE 01000] (Message 3014) use SiteDbStandby ALTER AUTHORIZATION ON DATABASE::SiteDbStandby TO sa ALTER DATABASE SiteDbStandby SET COMPATIBILITY_LEVEL = 100 [SQLSTATE 01000] (Message 0). The step succeeded.
所以,正確的順序是前一天晚上11點的,當前日,凌晨1點,2AM,和當天的凌晨3點的12AM。
所有日誌都存在於其共享文件夾目錄中。 一切看起來很正常。
你碰巧想到一個想法爲什麼這個工作失敗?
在此先感謝,
Roni。