我的备份/恢复变得缓慢(另当别论),但查看备份和恢复的持续时间,我发现备份在几秒钟内完成,而恢复在几分钟内完成。这对我来说是个惊喜 - 有什么建议吗?非常感谢大家的评论!
安德斯,丹麦
设置如下:我将“生产”数据库备份到本地硬盘上的文件,然后分别将备份恢复到“测试”和“unittest”数据库。
备份/恢复脚本:
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).
答案1
预期。备份被认为是罕见的灾难场景 - 恢复是常规操作。
另外,恢复实际上做了更多的工作;)
答案2
是的。备份只是一个字节复制操作(从 MDF/NDF/LDF 文件复制到 BAK 文件)。恢复是类似的反向复制(从 BAK 复制到相应的 MDF/NDF/LDF 文件)加运行恢复。运行恢复取决于要处理的日志的大小,并且相对较慢。此外,恢复可能必须调整数据库文件的大小并对其进行 0 初始化,这可能是另一个耗时的操作。所以,恢复将总是比相应的备份慢(硬件等方面的差异)。