create database newtestdb

use newtestdb
go

drop table t1
go

create table t1 (
id int not null identity(1,1) primary key
,vdate datetime default (getdate())
,name varchar(32)
)

backup database newtestdb to disk='c:\newtestdb_ful.bak'
insert into t1 (name) values ('aa')

insert into t1 (name) values ('bb')
backup log newtestdb to disk='c:\newtestdb_1.trn' --2016-05-18 13:42:30.767
select getdate()

insert into t1 (name) values ('cc')
backup log newtestdb to disk='c:\newtestdb_2.trn' --2016-05-18 13:43:59.707
select getdate()

insert into t1 (name) values ('dd')
backup log newtestdb to disk='c:\newtestdb_3.trn' --2016-05-18 13:45:05.310
select getdate()

insert into t1 (name) values ('ee')
backup log newtestdb to disk='c:\newtestdb_4.trn' --2016-05-18 13:46:29.783
select getdate()

insert into t1 (name) values ('ff')
backup log newtestdb to disk='c:\newtestdb_5.trn' --2016-05-18 13:47:21.833
select getdate()

--恢复到dd
use master
go
restore database newtestdb from disk='c:\newtestdb_ful.bak' with replace,norecovery;
/*
Processed 344 pages for database 'newtestdb', file 'newtestdb' on file 1.
Processed 6 pages for database 'newtestdb', file 'newtestdb_log' on file 1.
RESTORE DATABASE successfully processed 350 pages in 0.025 seconds (109.179 MB/sec).
*/
restore log newtestdb from disk='c:\newtestdb_1.trn' with replace,norecovery,stopat='2016-05-18 13:45:09.310';
/*
Processed 0 pages for database 'newtestdb', file 'newtestdb' on file 1.
Processed 7 pages for database 'newtestdb', file 'newtestdb_log' on file 1.
This backup set contains records that were logged before the designated point in time. The database is being left in the restoring state so that more roll forward can be performed.
RESTORE LOG successfully processed 7 pages in 0.008 seconds (6.103 MB/sec).
*/
restore log newtestdb from disk='c:\newtestdb_2.trn' with replace,norecovery,stopat='2016-05-18 13:45:09.310';
/*
Processed 0 pages for database 'newtestdb', file 'newtestdb' on file 1.
Processed 1 pages for database 'newtestdb', file 'newtestdb_log' on file 1.
This backup set contains records that were logged before the designated point in time. The database is being left in the restoring state so that more roll forward can be performed.
RESTORE LOG successfully processed 1 pages in 0.006 seconds (0.325 MB/sec).
*/
restore log newtestdb from disk='c:\newtestdb_3.trn' with replace,norecovery,stopat='2016-05-18 13:45:09.310';
/*
Processed 0 pages for database 'newtestdb', file 'newtestdb' on file 1.
Processed 1 pages for database 'newtestdb', file 'newtestdb_log' on file 1.
This backup set contains records that were logged before the designated point in time. The database is being left in the restoring state so that more roll forward can be performed.
RESTORE LOG successfully processed 1 pages in 0.006 seconds (0.325 MB/sec).
*/
restore log newtestdb from disk='c:\newtestdb_4.trn' with replace,norecovery,stopat='2016-05-18 13:45:09.310';
/*
Processed 0 pages for database 'newtestdb', file 'newtestdb' on file 1.
Processed 1 pages for database 'newtestdb', file 'newtestdb_log' on file 1.
RESTORE LOG successfully processed 1 pages in 0.004 seconds (0.488 MB/sec).
*/
restore log newtestdb from disk='c:\newtestdb_5.trn' with replace,norecovery,stopat='2016-05-18 13:45:09.310';
/*
Msg 4305, Level 16, State 1, Line 57
The log in this backup set begins at LSN 34000000022700001, which is too recent to apply to the database. An earlier log backup that includes LSN 34000000022500002 can be restored.
Msg 3013, Level 16, State 1, Line 57
RESTORE LOG is terminating abnormally.
*/

restore database newtestdb with replace,recovery;
/*
RESTORE DATABASE successfully processed 0 pages in 0.086 seconds (0.000 MB/sec).
*/

--成功恢复至dd

select * from newtestdb.dbo.t1

id vdate name
1 2016-05-18 13:41:44.500 aa
2 2016-05-18 13:42:26.767 bb
3 2016-05-18 13:43:57.707 cc
4 2016-05-18 13:45:05.290 dd

基于时间点恢复数据库stopat的更多相关文章

  1. 7.5 Point-in-Time (Incremental) Recovery Using the Binary Log 使用binay log 基于时间点恢复

    7.5 Point-in-Time (Incremental) Recovery Using the Binary Log 使用binay log 基于时间点恢复 7.5.1 Point-in-Tim ...

  2. 【Oracle】rman基于时间点恢复

    rman基于时间点恢复 场景: 由于某研究的误操作,导致财务模块的数据丢失,如何使用rman基于时间点恢复数据. 思路 1.克隆数据库的虚拟机,直接对数据库的数据进行恢复 RMAN> shutd ...

  3. 7.5.1 Point-in-Time Recovery Using Event Times 使用Event Times 基于时间点恢复

    7.5.1 Point-in-Time Recovery Using Event Times 使用Event Times 基于时间点恢复 表明开始和结束时间用于恢复, 指定 --start-datet ...

  4. mysqlbinlog基于时间点恢复

    基于时间点恢复 /data/mysq/mysqlbin.000026 #mysqlbinlog文件,恢复如下内容: 注意:按照时间点恢复时,可能同一个时间点有其他的操作,要结合上下文的时间选取~ # ...

  5. 13. ClustrixDB 基于时间点恢复

    在不太可能发生灾难的情况下,可以在特定数据库.表或整个集群上执行ClustrixDB集群的某个时间点恢复.应该非常小心地处理这一问题. 先决条件 在你可以使用时间点恢复之前,你的集群应该有几个先决条件 ...

  6. xtrabackup全量备份+binlog基于时间点恢复

    1.通过xtrabackup的备份恢复数据库. 2.找到start-position和binlog名称 cat xtrabackup_info 3.导出mysqlbinlog为sql文件,并确定恢复的 ...

  7. 1.MongoDB 2.7主从复制(master –> slave)环境基于时间点的恢复

    (一)MongoDB恢复概述 对于任何类型的数据库,如果要将数据库恢复到过去的任意时间点,否需要有过去某个时间点的全备+全备之后的重做日志,MongoDB也不例外.使用全备将数据库恢复到固定时刻,然后 ...

  8. mysql 开发进阶篇系列 43 逻辑备份与恢复(mysqldump 的基于时间和位置的不完全恢复)

    一. 概述 在上篇讲到了逻辑备份,使用mysqldump工具来备份一个库,并使用完全恢复还原了数据库.在结尾也讲到了误操作是不能用完全恢复的.解决办法是:我们需要恢复到误操作之前的状态,然后跳过误操作 ...

  9. Oracle 基于用户管理恢复的处理

    ================================ -- Oracle 基于用户管理恢复的处理 --================================ Oracle支持多种 ...

随机推荐

  1. MVC 中的 ViewModel

    此文章总结自:http://rachelappel.com/use-viewmodels-to-manage-data-amp-organize-code-in-asp.net-mvc-applica ...

  2. CentOS 6.3下PostgreSQL 的安装与配置

    一.简介 PostgreSQL 是一种非常复杂的对象-关系型数据库管理系统(ORDBMS),也是目前功能最强大,特性最丰富和最复杂的自由软件数据库系统.有些特性甚至连商业数据库都不具备.这个起源于伯克 ...

  3. Dancing Stars on Me---hdu5533(判断是否为正多边形)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5533 题意:平面图中 有n个点给你每个点的坐标,判断是否能通过某种连线使得这些点所组成的n边形为 正n ...

  4. 面向对象世界里转转七(Liskov替换原则)

    前言:Liskov替换原则是关于继承机制的应用原则,是实现开放封闭原则的具体规范,违反了Liskov原则必然意味着违反了开放封闭原则.因此,有必要对面向对象的继承机制及其基本原则做以探索,来进一步了解 ...

  5. HTML-003-模拟IDE代码展开收起功能简单示例

    当先我们在日常的编程开发工作中使用编程工具(例如 Eclipse.Sublime 等等)都有相应的代码折叠展开功能,如下图所示,极大的方便了我们的编码工作.

  6. android studio配置AndroidAnnotations

    现在很多人都使用Android studio开发工具代替eclipse了,当然的 在eclipse使用的好的一些开发框架也会对应的在android studio上面使用. 参考文档:http://bl ...

  7. IntelliJ IDEA gradle 创建 Java web 应用

    1.如下图,第一步很简单的,File->New->Project 2.在左边栏目找到Gradle,然后在右边勾选Java 和web 两个选项,next.如果只是Java项目就只选java就 ...

  8. UIImage 调整图片大小

    -(UIImage *)scaleToSize:(UIImage *)img size:(CGSize)size { UIGraphicsBeginImageContext(size); [img d ...

  9. Java Final, Finally, Finalize

    Final is a Keyword, final can be used in three different ways: final variable final method final cla ...

  10. nginx源码学习----内存池

    最近在进行监控平台的设计,之前一直觉得C/C++中最棘手的部分是内存的管理上,远不止new/delete.malloc/free这么简单.随着代码量的递增,程序结构复杂度的提高.各种内存方面的问题悄然 ...