基于时间点恢复数据库stopat
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的更多相关文章
- 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 ...
- 【Oracle】rman基于时间点恢复
rman基于时间点恢复 场景: 由于某研究的误操作,导致财务模块的数据丢失,如何使用rman基于时间点恢复数据. 思路 1.克隆数据库的虚拟机,直接对数据库的数据进行恢复 RMAN> shutd ...
- 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 ...
- mysqlbinlog基于时间点恢复
基于时间点恢复 /data/mysq/mysqlbin.000026 #mysqlbinlog文件,恢复如下内容: 注意:按照时间点恢复时,可能同一个时间点有其他的操作,要结合上下文的时间选取~ # ...
- 13. ClustrixDB 基于时间点恢复
在不太可能发生灾难的情况下,可以在特定数据库.表或整个集群上执行ClustrixDB集群的某个时间点恢复.应该非常小心地处理这一问题. 先决条件 在你可以使用时间点恢复之前,你的集群应该有几个先决条件 ...
- xtrabackup全量备份+binlog基于时间点恢复
1.通过xtrabackup的备份恢复数据库. 2.找到start-position和binlog名称 cat xtrabackup_info 3.导出mysqlbinlog为sql文件,并确定恢复的 ...
- 1.MongoDB 2.7主从复制(master –> slave)环境基于时间点的恢复
(一)MongoDB恢复概述 对于任何类型的数据库,如果要将数据库恢复到过去的任意时间点,否需要有过去某个时间点的全备+全备之后的重做日志,MongoDB也不例外.使用全备将数据库恢复到固定时刻,然后 ...
- mysql 开发进阶篇系列 43 逻辑备份与恢复(mysqldump 的基于时间和位置的不完全恢复)
一. 概述 在上篇讲到了逻辑备份,使用mysqldump工具来备份一个库,并使用完全恢复还原了数据库.在结尾也讲到了误操作是不能用完全恢复的.解决办法是:我们需要恢复到误操作之前的状态,然后跳过误操作 ...
- Oracle 基于用户管理恢复的处理
================================ -- Oracle 基于用户管理恢复的处理 --================================ Oracle支持多种 ...
随机推荐
- Android笔记:Socket通讯常见问题
经验证的socket通讯问题 1.如果是模拟器和本机PC直接通讯,需要使用本机IP地址 而不是 10.0.2.2 如本机的静态地址为192.168.1.2 则直接使用该地址 2.接收和连接代码不能在 ...
- sqlserver 视图能否有变量
不能,sqlserver 视图一般不能有变量,也不能带存储过程
- Java学习-022-Properties 文件数据写入
Properties 配置文件写入主要通过 Properties.setProperty 和 Properties.store 两个方法,此文以一个简单的 properties 文件写入源码做示例. ...
- LeetCode Shortest Word Distance III
原题链接在这里:https://leetcode.com/problems/shortest-word-distance-iii/ 题目: This is a follow up of Shortes ...
- EncodingAESKey
关键字:EncodingAESKey 公众平台消息体签名及加解密方案概述 1.新增消息体签名验证,用于公众平台和公众账号验证消息体的正确性 2.针对推送给微信公众账号的普通消息和事件消息,以及推送给设 ...
- Inside Flask - app.py - 1
Inside Flask - app.py - 1 除 werkzeug 和 jinja2 等依赖库外,app.py 是在 Flask 的 __init__.py 中导入的第一个 Flask 自身的模 ...
- python使用zlib实现压缩与解压字符串
命令 字符串:使用zlib.compress可以压缩字符串.使用zlib.decompress可以解压字符串. 数据流:压缩:compressobj,解压:decompressobj 案例 >& ...
- SQL Update实现使用一个表的数据更新另一张表
表结构 功能 SQL Serevr Access 表结构
- 查找文件并执行的shell命令
来由 经常我们需要找到某类文件, 并对进行处理. 例如找到.svn文件夹, 然后删除掉. 如果不使用shell,你可以选择手动删除, 前提是没有几个此类文件, 但是svn信息文件很多, 不能采用手动删 ...
- interblock corruption & intrablock corruption
interblock corruption: corruption blocks rather than within the block itself. can only be logical co ...