备份数据库的T-SQL语句
--创建设备
sp_addumpdevice 'disk','device1','c:/bak/device1.bak'
sp_addumpdevice 'disk','device1','c:/bak/device1.bak'
--完全备份
backup database demo
to device1
with name = 'full backup'
backup database demo
to device1
with name = 'full backup'
--差异备份
backup database demo
to device1
with DIFFERENTIAL,
name=' 差异1',
description='差异备份',
password='123'
backup database demo
to device1
with DIFFERENTIAL,
name=' 差异1',
description='差异备份',
password='123'
--日志备份
backup log demo
to device2
with name='log1'
backup log demo
to device2
with name='log1'
--文件/文件组备份
backup database demo
filegroup='primary'
--或
file=' 演示数据库_data'
to device2
with name='filegroup backup1'
backup database demo
filegroup='primary'
--或
file=' 演示数据库_data'
to device2
with name='filegroup backup1'
notice:
with name='名称',
description='描述名称'