实验:基于cancel的不全然恢复

实验环境查看

lsnrctl status

select open_mode from v$database;

  --监听与数据库状态

show parameter recovery;

select flashback_on from v$database;

archive log list;

  --闪回与归档的配置

1)准备环境:RMAN全库备份

RMAN> backup as compressed backupset full database;

       --压缩备份

       --backup full database ;备份集备份

Starting backup at 20-MAR-13

using target database control file instead of recovery catalog

allocated channel: ORA_DISK_1

channel ORA_DISK_1: SID=45 device type=DISK

channel ORA_DISK_1: starting compressed full datafile backup set

channel ORA_DISK_1: specifying datafile(s) in backup set

input datafile file number=00001 name=/u01/app/oracle/oradata/ORA11GR2/system01.dbf

input datafile file number=00002 name=/u01/app/oracle/oradata/ORA11GR2/sysaux01.dbf

input datafile file number=00003 name=/u01/app/oracle/oradata/ORA11GR2/undotbs01.dbf

input datafile file number=00005 name=/u01/app/oracle/oradata/ORA11GR2/example01.dbf

input datafile file number=00004 name=/u01/app/oracle/oradata/ORA11GR2/users01.dbf

channel ORA_DISK_1: starting piece 1 at 20-MAR-13

channel ORA_DISK_1: finished piece 1 at 20-MAR-13

piece handle=/u01/app/FRA/ORA11GR2/backupset/2013_03_20/o1_mf_nnndf_TAG20130320T151949_8nlrrrfm_.bkp tag=TAG20130320T151949 comment=NONE

channel ORA_DISK_1: backup set complete, elapsed time: 00:02:17

channel ORA_DISK_1: starting compressed full datafile backup set

channel ORA_DISK_1: specifying datafile(s) in backup set

including current control file in backup set

including current SPFILE in backup set

channel ORA_DISK_1: starting piece 1 at 20-MAR-13

channel ORA_DISK_1: finished piece 1 at 20-MAR-13

piece handle=/u01/app/FRA/ORA11GR2/backupset/2013_03_20/o1_mf_ncsnf_TAG20130320T151949_8nlrx2qs_.bkp tag=TAG20130320T151949 comment=NONE

channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01

Finished backup at 20-MAR-13

2)创建測试数据

SYS@ORA11GR2>create table scott.t1 as select 1 as id from dual;

Table created.

SYS@ORA11GR2>alter system archive log current;

System altered.

SYS@ORA11GR2>create table scott.t2 as select 2 as id from dual;

Table created.

SYS@ORA11GR2>alter system archive log current;

System altered.

SYS@ORA11GR2>create table scott.t3 as select 3 as id from dual;

Table created.

SYS@ORA11GR2>alter system archive log current;

System altered.

SYS@ORA11GR2>

SYS@ORA11GR2>select table_name,tablespace_name from dba_tables where owner='SCOTT' AND table_name LIKE 'T_';

TABLE_NAME                   TABLESPACE_NAME

------------------------- ------------------------------

T3                             USERS

T2                             USERS

T1                             USERS

完毕測试数据构造后。查看生成的归档日志

ls /u01/app/oracle/fast_recovery_area/PROD/archivelog/2014_10_08

ls -lrt

3)删除全部数据文件和在线数据文件

在sqlplus里面删除:

SYS@PROD>select name from v$datafile;

NAME

--------------------

/u01/app/oracle/oradata/PROD/datafile/o1_mf_system_b2251bs1_.dbf

/u01/app/oracle/oradata/PROD/datafile/o1_mf_sysaux_b2251bvo_.dbf

/u01/app/oracle/oradata/PROD/datafile/o1_mf_undotbs1_b2251bw5_.dbf

/u01/app/oracle/oradata/PROD/datafile/o1_mf_users_b2251byw_.dbf

/u01/app/oracle/oradata/PROD/datafile/o1_mf_example_b2257d0c_.dbf

/u01/app/oracle/oradata/PROD/datafile/tbs_move_01.dbf

SYS@PROD>select member from v$logfile;

MEMBER

----------------------------------------------------------------------------------------------------------------------------------

/u01/app/oracle/oradata/PROD/onlinelog/o1_mf_3_b22567o2_.log

/u01/app/oracle/fast_recovery_area/PROD/onlinelog/o1_mf_3_b2256827_.log

/u01/app/oracle/oradata/PROD/onlinelog/o1_mf_2_b2255zsg_.log

/u01/app/oracle/fast_recovery_area/PROD/onlinelog/o1_mf_2_b22560gb_.log

/u01/app/oracle/oradata/PROD/onlinelog/o1_mf_1_b2255npg_.log

/u01/app/oracle/fast_recovery_area/PROD/onlinelog/o1_mf_1_b2255nxl_.log

SYS@PROD>!rm /u01/app/oracle/oradata/PROD/datafile/*.dbf;

SYS@PROD>!rm /u01/app/oracle/oradata/PROD/onlinelog/*.log;

SYS@PROD>!rm /u01/app/oracle/fast_recovery_area/PROD/onlinelog/*.log;

在OS里面删除:

[oracle@ocmu ORA11GR2]$ pwd

/u01/app/oracle/oradata/ORA11GR2

[oracle@ocmu ORA11GR2]$ ls

control01.ctl  example01.dbf  redo02.log  sysaux01.dbf  temp01.dbf     users01.dbf

control02.ctl  redo01.log     redo03.log  system01.dbf  undotbs01.dbf

[oracle@ocmu ORA11GR2]$ rm *.log

[oracle@ocmu ORA11GR2]$ ls

control01.ctl  example01.dbf  system01.dbf  undotbs01.dbf

control02.ctl  sysaux01.dbf   temp01.dbf    users01.dbf

[oracle@ocmu ORA11GR2]$

4)数据库启动到mount模式

SYS@ORA11GR2>shutdown abort;

ORACLE instance shut down.

SYS@ORA11GR2>startup mount;

ORACLE instance started.

Total System Global Area  841162752 bytes

Fixed Size                  1339768 bytes

Variable Size             532680328 bytes

Database Buffers          301989888 bytes

Redo Buffers                5152768 bytes

Database mounted.

SYS@ORA11GR2>

5)RMAN还原数据库

RMAN> restore database;

Starting restore at 20-MAR-13

using target database control file instead of recovery catalog

allocated channel: ORA_DISK_1

channel ORA_DISK_1: SID=18 device type=DISK

channel ORA_DISK_1: starting datafile backup set restore

channel ORA_DISK_1: specifying datafile(s) to restore from backup set

channel ORA_DISK_1: restoring datafile 00001 to /u01/app/oracle/oradata/ORA11GR2/system01.dbf

channel ORA_DISK_1: restoring datafile 00002 to /u01/app/oracle/oradata/ORA11GR2/sysaux01.dbf

channel ORA_DISK_1: restoring datafile 00003 to /u01/app/oracle/oradata/ORA11GR2/undotbs01.dbf

channel ORA_DISK_1: restoring datafile 00004 to /u01/app/oracle/oradata/ORA11GR2/users01.dbf

channel ORA_DISK_1: restoring datafile 00005 to /u01/app/oracle/oradata/ORA11GR2/example01.dbf

channel ORA_DISK_1: reading from backup piece /u01/app/FRA/ORA11GR2/backupset/2013_03_20/o1_mf_nnndf_TAG20130320T151949_8nlrrrfm_.bkp

channel ORA_DISK_1: piece handle=/u01/app/FRA/ORA11GR2/backupset/2013_03_20/o1_mf_nnndf_TAG20130320T151949_8nlrrrfm_.bkp tag=TAG20130320T151949

channel ORA_DISK_1: restored backup piece 1

channel ORA_DISK_1: restore complete, elapsed time: 00:03:26

Finished restore at 20-MAR-13

RMAN>

6)基于cancel恢复

SYS@ORA11GR2>recover database until cancel;

   --在sqlplus中完毕

ORA-00279: change 883460 generated at 03/20/2013 15:19:50 needed for thread 1

ORA-00289: suggestion :

/u01/app/FRA/ORA11GR2/archivelog/2013_03_20/o1_mf_1_8_8nlrzy8w_.arc

ORA-00280: change 883460 for thread 1 is in sequence #8

Specify log: {<RET>=suggested | filename | AUTO | CANCEL}

--应用sequence #8为8。名字为o1_mf_1_8_8nlrzy8w_.arc的归档日志文件,直接按回车键

ORA-00279: change 884069 generated at 03/20/2013 15:23:42 needed for thread 1

ORA-00289: suggestion :

/u01/app/FRA/ORA11GR2/archivelog/2013_03_20/o1_mf_1_9_8nls091w_.arc

ORA-00280: change 884069 for thread 1 is in sequence #9

ORA-00278: log file

'/u01/app/FRA/ORA11GR2/archivelog/2013_03_20/o1_mf_1_8_8nlrzy8w_.arc' no longer

needed for this recovery

Specify log: {<RET>=suggested | filename | AUTO | CANCEL}

--应用sequence #9为9的这个归档日志文件。直接按回车键

ORA-00279: change 884101 generated at 03/20/2013 15:23:53 needed for thread 1

ORA-00289: suggestion :

/u01/app/FRA/ORA11GR2/archivelog/2013_03_20/o1_mf_1_10_8nls0os6_.arc

ORA-00280: change 884101 for thread 1 is in sequence #10

ORA-00278: log file

'/u01/app/FRA/ORA11GR2/archivelog/2013_03_20/o1_mf_1_9_8nls091w_.arc' no longer

needed for this recovery

Specify log: {<RET>=suggested | filename | AUTO | CANCEL}

cancel

  --手动输入cancel结束恢复。无论后面有没有可恢复文件。都会结束。

Media recovery cancelled.

SYS@ORA11GR2>

SYS@ORA11GR2>alter database open resetlogs;

Database altered.

SYS@ORA11GR2>

7)检查

SYS@ORA11GR2>select table_name,tablespace_name from dba_tables where owner='SCOTT' AND table_name LIKE 'T_';

TABLE_NAME                   TABLESPACE_NAME

------------------------- ------------------------------

T2                             USERS

T1                             USERS

SYS@ORA11GR2>

注 应用了两个归档日志。第三个归档日志cancel了。从结果中也能够看到。恢复以后的数据库中。仅仅

 存在T1,T2两张表,它们俩的重做日志就在前两个归档中,T3表的全部重做条目都在第三个归档中,

 因为採取了cancel,所以,T3表并未恢复

基于cancel的不全然恢复的更多相关文章

  1. oracle数据库全然恢复和不全然恢复以及运行用户管理辈分恢复

    比較全然恢复和不全然恢复: 一.全然恢复:将数据库恢复到当前最新状态,包含直至请求恢复时进行的全部已提交的数据更改 二.不全然恢复:将数据库恢复到请求恢复操作之前指定的过去时间点 一.全然恢复过程 以 ...

  2. 【RMAN】TSPITR--RMAN表空间基于时间点的自动恢复

    [RMAN]TSPITR--RMAN表空间基于时间点的自动恢复 一.1  BLOG文档结构图 一.2  前言部分 一.2.1  导读 各位技术爱好者,看完本文后,你可以掌握如下的技能,也可以学到一些其 ...

  3. 基于从库+binlog方式恢复数据

    基于从库+binlog方式恢复数据 将bkxt从库的全备份在rescs5上恢复一份,恢复到6306端口,用cmdb操作 恢复全备后执行如下操作 set global read_only=OFF; st ...

  4. 基于全备份+binlog方式恢复数据

    基于全备份+binlog方式恢复数据 将bkxt从库的全备份在rescs5上恢复一份,用cmdb操作 恢复全备后执行如下操作 set global read_only=OFF; stop slave; ...

  5. MySQL基于mysqldump及lvmsnapshot备份恢复

    一.备份对象 数据 配置文件 代码:存储过程,存储函数,触发器 跟复制相关的配置 二进制日志文件 二.备份工具 mysqldump:逻辑备份工具 InnoDB热备.MyISAM温备.Aria温备 备份 ...

  6. MySQL 5.7 基于复制线程SQL_Thread加快恢复的尝试

    1. MySQL 数据恢复常用办法 MySQL恢复的方法一般有三种: 1. 官方推荐的基于全备+binlog , 通常做法是先恢复最近一次的全备,然后通过mysqlbiinlog --start-po ...

  7. MySQL基于LVM快照的备份恢复(临时)

    目录1.数据库全备份2.准备LVM卷3.数据恢复到LVM卷4.基于LVM快照备份数据5.数据灾难恢复6.总结 写在前面:测试环境中已安装有mysql 5.5.36数据库,但数据目录没有存放在LVM卷, ...

  8. 转 基于MySQL MEB的备份恢复

    几种备份方式的介绍 mysqlbackup是一个热备份工具.也就是说它不像mysqldump那样给表上一个全局锁,由于mysqldump上了这个锁,所以就造成客户端只能对 数据库进行读操作不能写,这也 ...

  9. XDB基于Library的备份及恢复

    基于standalone全备份 语句: xdb backup --federation xhive://localhost:1235 --standalone --file E:\xdbData\xD ...

随机推荐

  1. HDU1518 Square 【剪枝】

    Square Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Su ...

  2. 编写 Matlab mexFunction (C mex)

    资料一 MATLAB的MEX文件编写和调试 1. MEX的编写格式 写MEX程序其实就是写一个DLL程序,所以你可以使用C,C++,Fortran等多种编程语言来写. 编写MEX程序的编辑器可以使用M ...

  3. iPhone应用提交流程:如何将App程序发布到App Store-转

    对于刚加入iOS应用开发行列的开发者来说,终于经过艰苦的Coding后完成了第一个应用后最重要的历史时刻就是将应用程序提交到iTunes App Store.Xcode 4.2开发工具已经把App提交 ...

  4. python测试开发django-5.模板templates

    前言 html是一个静态的语言,里面没法传一些动态参数,也就是一个写死的html页面.如果想实现在一个固定的html样式,传入不同的参数,这就可以用django的模板传参来解决. 模板参数 先在hel ...

  5. inline

    inline 大学在教科书上学习过inline函数,定义为inline函数之后,会省去函数调用的开销,直接嵌套汇编代码,取代函数调用,提高效率.工作后项目中也很少用到inline来定义函数,近几天在研 ...

  6. vim/vi 命令详解

    在工作中,要对服务器上的文件进行的修改,可以使用ssh远程登录到服务器上,并且使用vi进行快速的编辑即可,在没有图形界面的环境下,要编辑文件,vi是最佳选择! vi命令是Linux中最经典的文本编辑器 ...

  7. 附6 hystrix metrics and monitor

    一.基本方式 hystrix为每一个commandKey提供了计数器 二.实现流程 https://raw.githubusercontent.com/wiki/Netflix/Hystrix/ima ...

  8. C++ Jsoncpp源代码编译与解析Json

    1.Json 数据表示方式介绍 这个可以看之前的一个文章里面有说明:Java解析(读取)Json数据 2.C++ Jsoncpp 2.1 Jsoncpp介绍 (1)JsonCpp主要包含三种类型的cl ...

  9. scala 学习笔记十 元组

    1.元组初始化 2.元组作为函数返回值 3.元组拆包 上面168行 ,单个val后面跟着一个由五个标识符构成的元组,表示对ff返回的元组进行拆包 上面174行,将整个元组捕获到单个val或var中,那 ...

  10. Oracle Agile PLM Web Services 的实现

    Oracle 的产品Agile PLM内置了许多Web Services,其他系统可以通过Web Servcies实现对Agile PLM系统资源的访问.快速学会使用的方法,是去Oracle的官网下载 ...