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. I Count Two Three---hdu5878(打表+二分)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5878 题意:找到第一个>=n的数x, 满足 x = 2a3b5c7d:n<=1e9; 打表 ...

  2. imx6 android5.1 打开 调试串口

    imx6的工板烧录android 5.1的镜像,uboot中能使用debug口,kernel,文件系统中不能使用debug口. 打开kenel和文件系统debug口方法,在uboot的bootargs ...

  3. Swift闭包

    把Swift中的 block 常见的声明和写法作一个总结.以免后续忘了,好查阅. // //  blockDemo.swift //  swiftDemo // //  Created by appl ...

  4. Thinkpad E430 Ubuntu 14.04 无线网卡驱动

    为了重新安装正确的无线网卡的驱动,所以要先弄清楚我的笔记本上的无线网卡的具体的型号.打开终端,用如下命令/方法查看:lspci,找到输出信息中,有关无线网卡的部分.发现型号是:BCM43142 先用有 ...

  5. Shell 小技巧

    Shell 小技巧 ${} 的使用 截断变量 去掉左边 使用 # (最短匹配)或 ## (最长匹配)方法为 ${var#<模式>} var=DUMMY echo ${var#*M} # M ...

  6. Linux 中的零拷贝技术,第 1 部分

    概述 本系列由两篇文章组成,介绍了当前用于 Linux 操作系统上的几种零拷贝技术,简单描述了各种零拷贝技术的实现,以及它们的特点和适用场景.本文是本系列文章的第一部分,主要是介绍一些零拷贝技术的相关 ...

  7. 重新拷贝 新项目 发现不显示 原来是 paramiko 没有装

    proxy pass 端口换成 另一个 跟原来的不冲突 [root@ayibang-server soft_ware]# cp s10day11/demo.* s10ops/[root@ayibang ...

  8. Vue.2.0.5-表单控件绑定

    基础用法 你可以用 v-model 指令在表单控件元素上创建双向数据绑定.它会根据控件类型自动选取正确的方法来更新元素.尽管有些神奇,但 v-model 本质上不过是语法糖,它负责监听用户的输入事件以 ...

  9. linux:/etc/rc.local 不能自动启动问题

    前段时间安装LNMP环境,配置/etc/rc.local的时候配置了启动mysql.nginx.php以及关闭防火墙,可结果重启了七八次还是自启动不了后来终于找到原因了 看下图: /etc/rc.lo ...

  10. c# 访问ftp

    ftp从服务器上获取通信设备吐出的mr数据,该方案估计在通信行业上一个很普遍的一种方案,很奇怪为什么不把这些数据直接存储到数据库中呢,比如hadoop,反而还需要第三方搞网优的软件开发人员从ftp上读 ...