数据库中有关差异备份的恢复问题
2007-05-19 09:42:28 来源:WEB开发网核心提示: 具体的备份号可以从下面得到:(你可以认真研究一下backupfile,backupset,backmediaset,backupmediafamily几个表,可以发现规律)selectbackup_start_dateas备份时间,positionas备份号,casetypewhen
具体的备份号可以从下面得到:(你可以认真研究一下backupfile,backupset,backmediaset,backupmediafamily几个表,可以发现规律)
select backup_start_date as 备份时间,position as 备份号,
case type when 'D' then '完整备份' when 'I' then '差异备份' end as 备份类型
from msdb..backupset where database_name='test'
and media_set_id in
(select distinct media_set_id from msdb..backupmediafamily
where physical_device_name='c: est.bak')
order by position
如果还不行的话,可以给我留言~
---执行下面的序列:
create database test
go
use test
go
create table test..t(a int)
insert test..t select 1
backup database test to disk='c: est.bak'
insert test..t select 2
backup database test to disk='c: est.bak'
insert test..t select 3
insert test..t select 4
backup database test to disk='c: est.bak' with differential
delete test..t
go
--下面开始恢复:
restore database test from disk='c: est.bak' with file=2,norecovery --对应你最后一次的完整备份
restore database test from disk='c: est.bak' with file=3 --对应你要还原的差异备份
go
select * from test
更多精彩
赞助商链接