日期:2014-05-16 浏览次数:20498 次
通过下面的脚本可以计算出数据库从上次完整备份之数据的更改率,在Pual之前还没有人写过类似的代码。
根据运行的结果,我们可以知道数据库的数据自上次完整备份之后的数据修改程度,如果更概率非常大的情况下,我们可以直接选择完整备份,而省掉差异备份,如果更改率非常小则可以选择差异备份。(当然如果数据库小的话即使数据更改很小也不需要差异备份)
即使不需要调整你的备份计划你也可以对数据库的状况有一个深刻的了解。
/*=====================================================================
File: SQLskillsDIFForFULL.sql
Summary: This script creates a system-wideSP SQLskillsDIFForFILL that works out what percentage of a database haschanged since the previous full database backup.
Date: April 2008
SQL Server Versions:
10.0.1300.13 (SS2008 February CTP -CTP-6)
9.00.3054.00 (SS2005 SP2)
------------------------------------------
Copyright (C) 2008 Paul S. Randal All rights reserved. You may alter this code for your own*non-commercial* purposes. You may republish altered code as long as you givedue credit. THIS CODE AND INFORMATION ARE PROVIDED"AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR PLIED,INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OFMERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
============================================================================*/
-- Create thefunction in MSDB
--
USE msdb;
GO
IF EXISTS(SELECT*FROMsys.objectsWHERE NAME=