首页 » SQL Server » sqlserver base time-point recovery

sqlserver base time-point recovery

backup database oa to disk='d:/oa.bak'
select getdate() 
2011-06-30 14:46:36.653

create table testbtr(id int,name varchar(10));

select getdate() 
2011-06-30 14:47:41.373

declare
@i int
begin
set @i=1
while @i<100
begin
insert into testbtr values(@i,'anbob')
set @i=@i+1
end
end

select getdate() 
2011-06-30 14:48:01.640


delete from testbtr where id >90

select getdate() 
2011-06-30 14:48:18.890


backup log oa to disk='d:/oa.log' 

select getdate() 
2011-06-30 14:48:40.513

RESTORE DATABASE oa from disk='d:/oa.bak' WITH NORECOVERY
------------------
已处理 1160 页,这些页属于数据库 'oa' 的文件 'oa'(位于文件 1 上)。
已处理 1 页,这些页属于数据库 'oa' 的文件 'oa_log'(位于文件 1 上)。
RESTORE DATABASE 操作成功地处理了 1161 页,花费了 1.772 秒(5.363 MB/秒)。


RESTORE LOG oa
    FROM disk='d:\oa.log' WITH RECOVERY,STOPAT='2011-06-30 14:48:01'
-------------------
已处理 9 页,这些页属于数据库 'oa' 的文件 'oa_log'(位于文件 1 上)。
RESTORE LOG 操作成功地处理了 9 页,花费了 0.038 秒(1.805 MB/秒)。

select count(*) from oa..testbtr
--------------------
99

打赏

目前这篇文章有1条评论(Rss)评论关闭。

  1. Krystyna Schill | #1
    2011-12-21 at 07:38

    Thanks very much for enabling all of us the fantastic possibility to read your blog page. Your items are usually very helpful and packed with a lot of good fun for me personally. However even my colleagues love to read your blog posts as they are able to understand a good deal from them. Most of us really respect your in-depth knowledge and we genuinely appreciate you sharing them in your posts.