MSSQL备份

MSSQL的备份
使用逻辑备份集备份:完整备份
第一步:创建一个student 的数据库
create database student
on
(name = student,
filename = 'student.mdf'
)
log on
(name = 'student_log',
filename = 'student_log.ldf'
)
go
第二步:创建一个备份设备
sp_addumpdevice 'disk','student','f:\backup\student_disk_file.bak'
go
第三步:切换恢复模式为完整恢复模式
alter database student set recovery full;
go
第四步: 开始备份完整文件
backup database student
file = 'student'
to disk = 'f:\backup\student_disk_file.bak'
go
第五步:还原文件备份
  restore database student
file='stduy'
from disk='f:\backup\study_disk_file.bak'
with norecovery;
go
差异文件备份是在完整备份的基础上在继续备份。
如上已经有过了完整备份,如下就可备份差异备份了
backup database student
to student_disk_file.bak
with differential;
go
创建仅复制完整备份
backup database student
to disk='f:\backup\student_copy_data.bak'
with copy_only;
go

你可能感兴趣的:(sql,数据库,职场,休闲)