sql语句示例:
use master
go
if DB_ID('dy_news') is not null
drop database dy_news
go
create database dy_news
on
(
name = 'dy_news_data',
filename = 'E:databasedy_news.mdf'
)
LOG ON
(
name = 'dy_news_log',
filename = 'E:databasedy_news.ldf'
)
GO
--修改用户状态为multi_user
alter database dy_news set multi_user
--备份数据库
backup database dy_news
to disk = 'e:dy_news.bak'
with format
--增大了IO缓冲区的备份
backup database dy_news
to disk = 'e:dy_news.bak'
with format,
buffercount=10,
maxtransfersize=4194304
--增大IO缓冲区、压缩完整备份
backup database dy_news
to disk = 'e:dy_news.bak'
with format,
buffercount=10,
maxtransfersize=4194304,
compression
注意,compression选项必须sql server 2008 R2以上才支持。
否则,会提示'compression' 不是可以识别的 BACKUP 选项。
例子: