Sql-Server
SqlServer2005,恢復比備份慢得多 - 這是意料之中的嗎?
我的備份/恢復變得緩慢(不同的故事),但查看備份和恢復的持續時間,我發現備份在幾秒鐘內完成,而恢復在幾分鐘內完成。這對我來說是一個驚喜 - 有什麼建議嗎?所有評論都非常感謝!
丹麥安德斯
設置如下:我將“生產”數據庫備份到本地硬碟上的文件,然後將備份分別恢復到“測試”和“單元測試”數據庫。
備份/恢復腳本:
BACKUP DATABASE [Onsdagspool.Prod] TO DISK = N'C:\_UnderBackup\DataBackup\Onsdagspool.Prod.bak' WITH NOFORMAT, INIT, NAME = N'Onsdagspool.Prod-Full Database Backup', SKIP, NOREWIND, NOUNLOAD, STATS = 10 RESTORE DATABASE [Onsdagspool.Test] FROM DISK = N'C:\_UnderBackup\DataBackup\Onsdagspool.Prod.bak' WITH FILE = 1, NOUNLOAD, REPLACE, STATS = 10 RESTORE DATABASE [Onsdagspool.UnitTest] FROM DISK = N'C:\_UnderBackup\DataBackup\Onsdagspool.Prod.bak' WITH FILE = 1, NOUNLOAD, REPLACE, STATS = 10
在備份/恢復過程的輸出下方:
Processed 4056 pages for database 'Onsdagspool.Prod', file 'ASPNETDB_8406dd98c17 54e1881b70937978ae08c_DAT' on file 1. 100 percent processed. Processed 2 pages for database 'Onsdagspool.Prod', file 'ASPNETDB_TMP_log' on fi le 1. BACKUP DATABASE successfully processed 4058 pages in 3.266 seconds (10.176 MB/se c). 10 percent processed. 20 percent processed. 30 percent processed. 40 percent processed. 50 percent processed. 60 percent processed. 70 percent processed. 80 percent processed. 90 percent processed. 100 percent processed. Processed 4056 pages for database 'Onsdagspool.Test', file 'ASPNETDB_8406dd98c17 54e1881b70937978ae08c_DAT' on file 1. Processed 2 pages for database 'Onsdagspool.Test', file 'ASPNETDB_TMP_log' on fi le 1. RESTORE DATABASE successfully processed 4058 pages in 240.773 seconds (0.138 MB/ sec). 10 percent processed. 20 percent processed. 30 percent processed. 40 percent processed. 50 percent processed. 60 percent processed. 70 percent processed. 80 percent processed. 90 percent processed. 100 percent processed. Processed 4056 pages for database 'Onsdagspool.UnitTest', file 'ASPNETDB_8406dd9 8c1754e1881b70937978ae08c_DAT' on file 1. Processed 2 pages for database 'Onsdagspool.UnitTest', file 'ASPNETDB_TMP_log' o n file 1. RESTORE DATABASE successfully processed 4058 pages in 240.656 seconds (0.138 MB/ sec).
預期的。假設備份是罕見的災難場景 - 恢復是正常操作。
加。恢復實際上做了更多的工作;)
是的。備份只是一個字節複製操作(從 MDF/NDF/LDF 文件複製到 BAK 文件中)。恢復是另一個方向的類似副本(從 BAK 到相應的 MDF/NDF/LDF 文件)加上執行恢復。執行恢復取決於要處理的日誌的大小,並且相對較慢。並且,作為獎勵,還原可能必須調整數據庫文件的大小並將它們初始化為 0,這可能是另一個耗時的操作。所以你有它,恢復總是比相應的備份慢(硬體等方面的基本差異)。