创建备份设备
use master
go
exec sp_addumpdevice ‘disk‘,‘data123‘,‘d:\123.bak‘
备份数据
backup database data1 to disk=‘d:\123.bak‘
备份日志
backup log data1 to disk=‘d:\123.bak‘
查看备份情况
restore headeronly from disk=‘d:\123.bak‘
还原完整数据及日志
restore database data1 from disk=‘d:\123.bak‘ with file=1,replace,norecovery
restore log data1 from disk=‘d:\123.bak‘ with file=2,replace,norecovery
restore log data1 from disk=‘d:\123.bak‘ with file=3,replace,orecovery
覆盖备份(init意为初始化不加参数为追加备份)
backup database data1 to disk=‘d:\123.bak‘ with init
按时间点还原完整数据及日志
restore database data1 from disk=‘d:\123.bak‘ with file=1,replace,norecovery
restore log data1 from disk=‘d:\123.bak‘ with file=2,recovery,stopat=‘2015-03-10 20:30:35.100‘
时间: 2024-10-29 19:08:02