现在,让我们来看看数据库快照在SQL Server 2005中是如何工作的。为此,首先我需要一个源数据库作为快照的来源。下面的脚本将创建一个源数据库:
USE master GO IF EXISTS(SELECT name from sysdatabases where [name] = 'SourceDatabase') DROP DATABASE SourceDatabase GO CREATE DATABASE SourceDatabaseON PRIMARY ( NAME = SourceDatabase_Data, FILENAME = 'C:SQLServerSourceDatabase_Data.mdf' ) LOG ON ( NAME = SourceDatabase_Log, FILENAME = 'C:SQLServerSourceDatabase_Log.ldf' ) GO