sql数据库备份与日志文件备份,常用sql语句:
复制代码 代码示例:
--完全备份
backup database demo
to nwdevice02
with name = 'fullbak'
--日志备份
backup log demo
to nwdevice02
with name = 'log1'
--restore full backup
restore database demo
from nwdevice02
with file=1,norecovery
--restore log backup
restore log demo
from nwdevice02
with file=4,recovery
--完全备份
backup database demo
to nwdevice
with name='完全备份'
--差异备份
backup database demo
to nwdevice
with differential,
name = '差异备份1'
--日志备份 log1
backup log demo
to nwdevice
with name='日志1'
--日志备份 log2
backup log demo
to nwdevice
with name='日志2'
--还原完全备份
restore database demo
from nwdevice
with norecovery --相当于第二项(选项)
file = 1
--还原差异
restore database demo
from nwdevice
with recovery,
file= 2
/* 第一完全备,第二次差异备份*/
--还原日志
restore log demo
from nwdevice
with file= 2,
norecovery
restore log demo
from nwdevice
with file= 3,
recovery