SQL Server 2008之备份压缩
本文将以SQL Server 2008 的11月CTP测试版为例,为大家详细介绍如何分别在压缩和不压缩的情况下进行全备份(Full)、差异备份(Differential)和事务日志备份(Transactional log),以及怎样在默认设置下启动压缩功能。
首先让我们创建一个名为“MyDB”的数据库,如下所示:
以下是引用片段:
USE [master]
GO
/****** Object: Database [MyDB]
Script Date: 12/10/2007 01:08:14 ******/
IF EXISTS (SELECT name FROM sys.databases WHERE name = N'MyDB')
DROP DATABASE [MyDB]
GO
USE [master]
GO
CREATE DATABASE [MyDB] ON PRIMARY
( NAME = N'MyDB_Data',
FILENAME =
N'F:\Program Files\Microsoft SQL Server\MSSQL10.SQL2008\ MSSQL\DATA\MyDB_Data.mdf' ,
SIZE = 2176KB , MAXSIZE = UNLIMITED, FILEGROWTH = 1024KB )
LOG ON
( NAME = N'MyDB_log',
FILENAME =
N'F:\Program Files\Microsoft SQL Server\MSSQL10.SQL2008\MSSQL\DATA\MyDB_log.LDF' ,
SIZE = 504KB , MAXSIZE = 2048GB , FILEGROWTH = 10%)
GO
ALTER DATABASE [MyDB] SET RECOVERY FULL
GO
接下来,在“MyDB”数据库中创建一个名为“MyTable”的表,如下所示:
以下是引用片段:
USE [MyDB]
GO
IF EXISTS (SELECT * FROM sys.objects
WHERE object_id = OBJECT_ID(N'[dbo].[MyTable]')
AND type in (N'U'))
DROP TABLE [dbo].[MyTable]
GO
USE [MyDB]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[MyTable](
[id] [int] NULL,
[name] [char](100) NULL
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
然后在“MyTable”表中添加10000行数据,如下所示: