注册 登录
编程论坛 SQL Server论坛

定点还原

棉花糖ONE 发布于 2007-03-24 15:57, 482 次点击

if object_id('shiyan') is not null
drop table shiyan
go
create table shiyan(id int)
insert into shiyan select 1
union all select 2
union all select 3
select count(*) as c from shiyan
c
-----------
3
backup database data to disk='c:\data.bak' with format --进行完全备份

select * from student

update student set name='cc' where id=1
select getdate() --记录时间标记为1
go
drop table shiyan --删除表
go
select getdate() --记录时间标记为2
select count(*) as c from shiyan --说明表被删除
服务器: 消息 208,级别 16,状态 1,行 1
对象名 'shiyan' 无效。

backup log data to disk='c:\data_log.bak' with format --备份日志

use master
go
restore database data from disk='c:\data.bak' with norecovery --对完全备份进行恢复

restore log data from disk='c:\data_log.bak' with recovery,stopat=' 时间点改成标志1和标志2之间'
--进行时间点恢复

select count(*) as c from shiyan

c
-----------
3

0 回复
1