oracle:rman恢复----通过增量备份来恢复

转载 2015年07月09日 11:20:08

试验计划:先rman进行一个0级备份,插入表相关数据,再进行level 1级增量备份,进行rman恢复

实验环境:归档模式下,oracle10.2.0.1

 

开始试验:

1. rman level 0级备份

复制代码
RMAN> backup incremental level 0 database;

Starting backup at 02-DEC-13
using channel ORA_DISK_1
channel ORA_DISK_1: starting incremental level 0 datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00001 name=/u01/app/oracle/product/10.2.0/db_2/oradata/orcl/system01.dbf
input datafile fno=00003 name=/u01/app/oracle/product/10.2.0/db_2/oradata/orcl/sysaux01.dbf
input datafile fno=00002 name=/u01/app/oracle/product/10.2.0/db_2/oradata/orcl/undotbs01.dbf
input datafile fno=00006 name=/u01/app/oracle/product/10.2.0/db_2/oradata/orcl/yn.dbf
input datafile fno=00004 name=/u01/app/oracle/product/10.2.0/db_2/oradata/orcl/users01.dbf
channel ORA_DISK_1: starting piece 1 at 02-DEC-13
channel ORA_DISK_1: finished piece 1 at 02-DEC-13
piece handle=/u01/app/oracle/flash_recovery_area/ORCL/backupset/2013_12_02/o1_mf_nnnd0_TAG20131202T222739_99s66wc3_.bkp tag=TAG20131202T222739 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:02:06
channel ORA_DISK_1: starting incremental level 0 datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
including current control file in backupset
including current SPFILE in backupset
channel ORA_DISK_1: starting piece 1 at 02-DEC-13
channel ORA_DISK_1: finished piece 1 at 02-DEC-13
piece handle=/u01/app/oracle/flash_recovery_area/ORCL/backupset/2013_12_02/o1_mf_ncsn0_TAG20131202T222739_99s6bvm4_.bkp tag=TAG20131202T222739 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02
Finished backup at 02-DEC-13
复制代码

 

2.插入相关表数据

复制代码
SQL> select * from t1;

    ID NAME
---------- --------------------
     1 first
     2 second

SQL> insert into t1 values(3,'rman3');

1 row created.

SQL> commit;

Commit complete.

SQL> insert into t1 values(4,'rman4');

1 row created.

SQL> commit;

Commit complete.

SQL> alter system switch logfile;

System altered.

SQL> alter system checkpoint;

System altered.

SQL> 
复制代码

3.rman level  0级备份

复制代码
RMAN> backup incremental level 1 database;

Starting backup at 02-DEC-13
using channel ORA_DISK_1
channel ORA_DISK_1: starting incremental level 1 datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00001 name=/u01/app/oracle/product/10.2.0/db_2/oradata/orcl/system01.dbf
input datafile fno=00003 name=/u01/app/oracle/product/10.2.0/db_2/oradata/orcl/sysaux01.dbf
input datafile fno=00002 name=/u01/app/oracle/product/10.2.0/db_2/oradata/orcl/undotbs01.dbf
input datafile fno=00006 name=/u01/app/oracle/product/10.2.0/db_2/oradata/orcl/yn.dbf
input datafile fno=00004 name=/u01/app/oracle/product/10.2.0/db_2/oradata/orcl/users01.dbf
channel ORA_DISK_1: starting piece 1 at 02-DEC-13
channel ORA_DISK_1: finished piece 1 at 02-DEC-13
piece handle=/u01/app/oracle/flash_recovery_area/ORCL/backupset/2013_12_02/o1_mf_nnnd1_TAG20131202T223244_99s6jfdz_.bkp tag=TAG20131202T223244 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:25
channel ORA_DISK_1: starting incremental level 1 datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
including current control file in backupset
including current SPFILE in backupset
channel ORA_DISK_1: starting piece 1 at 02-DEC-13
channel ORA_DISK_1: finished piece 1 at 02-DEC-13
piece handle=/u01/app/oracle/flash_recovery_area/ORCL/backupset/2013_12_02/o1_mf_ncsn1_TAG20131202T223244_99s6k6o1_.bkp tag=TAG20131202T223244 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 02-DEC-13

RMAN> 
复制代码

 

4.查看此时的备份文件、关闭数据库、重启数据库

[root@app 2013_12_02]# ll
?昏. 649132
-rw-r----- 1 oracle oinstall   7176192 12-02 22:29 o1_mf_ncsn0_TAG20131202T222739_99s6bvm4_.bkp
-rw-r----- 1 oracle oinstall   7176192 12-02 22:33 o1_mf_ncsn1_TAG20131202T223244_99s6k6o1_.bkp
-rw-r----- 1 oracle oinstall 649576448 12-02 22:29 o1_mf_nnnd0_TAG20131202T222739_99s66wc3_.bkp
-rw-r----- 1 oracle oinstall    114688 12-02 22:33 o1_mf_nnnd1_TAG20131202T223244_99s6jfdz_.bkp
复制代码
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount
ORACLE instance started.

Total System Global Area  599785472 bytes
Fixed Size            2022632 bytes
Variable Size          251659032 bytes
Database Buffers      343932928 bytes
Redo Buffers            2170880 bytes
Database mounted.

复制代码

 

5.rman恢复

复制代码
RMAN> run {
2> allocate channel c1 type disk;
3> restore database;
4> recover database;
5> sql 'alter database open';
6> }

allocated channel: c1
channel c1: sid=156 devtype=DISK

Starting restore at 02-DEC-13

channel c1: starting datafile backupset restore
channel c1: specifying datafile(s) to restore from backup set
restoring datafile 00001 to /u01/app/oracle/product/10.2.0/db_2/oradata/orcl/system01.dbf
restoring datafile 00002 to /u01/app/oracle/product/10.2.0/db_2/oradata/orcl/undotbs01.dbf
restoring datafile 00003 to /u01/app/oracle/product/10.2.0/db_2/oradata/orcl/sysaux01.dbf
restoring datafile 00004 to /u01/app/oracle/product/10.2.0/db_2/oradata/orcl/users01.dbf
restoring datafile 00006 to /u01/app/oracle/product/10.2.0/db_2/oradata/orcl/yn.dbf
channel c1: reading from backup piece /u01/app/oracle/flash_recovery_area/ORCL/backupset/2013_12_02/o1_mf_nnnd0_TAG20131202T222739_99s66wc3_.bkp
channel c1: restored backup piece 1
piece handle=/u01/app/oracle/flash_recovery_area/ORCL/backupset/2013_12_02/o1_mf_nnnd0_TAG20131202T222739_99s66wc3_.bkp tag=TAG20131202T222739
channel c1: restore complete, elapsed time: 00:00:25
Finished restore at 02-DEC-13

Starting recover at 02-DEC-13
channel c1: starting incremental datafile backupset restore
channel c1: specifying datafile(s) to restore from backup set
destination for restore of datafile 00001: /u01/app/oracle/product/10.2.0/db_2/oradata/orcl/system01.dbf
destination for restore of datafile 00002: /u01/app/oracle/product/10.2.0/db_2/oradata/orcl/undotbs01.dbf
destination for restore of datafile 00003: /u01/app/oracle/product/10.2.0/db_2/oradata/orcl/sysaux01.dbf
destination for restore of datafile 00004: /u01/app/oracle/product/10.2.0/db_2/oradata/orcl/users01.dbf
destination for restore of datafile 00006: /u01/app/oracle/product/10.2.0/db_2/oradata/orcl/yn.dbf
channel c1: reading from backup piece /u01/app/oracle/flash_recovery_area/ORCL/backupset/2013_12_02/o1_mf_nnnd1_TAG20131202T223244_99s6jfdz_.bkp
channel c1: restored backup piece 1
piece handle=/u01/app/oracle/flash_recovery_area/ORCL/backupset/2013_12_02/o1_mf_nnnd1_TAG20131202T223244_99s6jfdz_.bkp tag=TAG20131202T223244
channel c1: restore complete, elapsed time: 00:00:01

starting media recovery
media recovery complete, elapsed time: 00:00:02

Finished recover at 02-DEC-13

sql statement: alter database open
released channel: c1

RMAN> 
复制代码

 

6.查询数据

复制代码
[oracle@app ~]$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.1.0 - Production on Mon Dec 2 22:52:49 2013

Copyright (c) 1982, 2005, Oracle.  All rights reserved.


Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options

SQL> select * from t1;
    id  name
---------------------
     1  first
     2  second
     3  rman3
     4  rman4
复制代码

 

 这里说一个我在进行此试验时,遇到的一个另外问题:

   level 1级备份操作后,进行了drop table t1;我以为利用 level  0+level  1 恢复时,rman只恢复到我level  1备份处,t1表的4条数据还是存在的。

但,当我这样操作后,进行select × from t1 查询时,发现提示该表不存在。 

后来仔细想了想,当我利用recover database时,数据库会自动读取redo或者归档文件来进行drop table t1操作的。


原文链接:http://www.cnblogs.com/greensleeves/p/3454867.html

ORACLE 11G通过SCN做增量备份修复standby库详细过程

背景描述:Oracle 的standby库后台alert报错,如下:ORA-00354: corrupt redo log block header ORA-00353: log corruption...
  • mchdba
  • mchdba
  • 2015年05月18日 20:40
  • 3401

mysql备份还原-基于binlog的增量备份还原

1 简介 基于binlog的恢复需要建立在全量备份恢复基础上。使用mysqldump的全量备份的方法在我前面的文章里有详细介绍,可以参考:http://blog.csdn.net/jesseyoun...
  • JesseYoung
  • JesseYoung
  • 2014年11月17日 16:43
  • 9851

mysql 备份与恢复(全量与增量)

全量备份使用自带的mysqldump命令备份命令mysqldump -u[username] -p[password]  [database] [table] > backup.sql恢复命令mysq...
  • XRYMIBZ
  • XRYMIBZ
  • 2017年04月18日 12:29
  • 1734

Oracle-RMAN增量备份恢复测试记录

  • 2017年12月28日 12:47
  • 230KB
  • 下载

ORACLE RMAN 增量备份完整恢复测试

ORACLE RMAN 增量备份完整恢复测试   创建测试表空间: SQL> create tablespace tablespace1     2  datafile '/db/app/o...
  • zhufuyi
  • zhufuyi
  • 2011年08月16日 23:15
  • 1881

oracle rman 增量备份完整恢复测试

RMAN备份 sql*plus与操作系统命令行切换 linux:用!符号 window:sql>到c:>用host命令,c:>到sql>用exit。 RMAN备份模式:全备、增量备份、冷备、热备。 ...
  • cherish1forever
  • cherish1forever
  • 2013年09月07日 15:49
  • 4081

oracle:rman恢复----通过增量备份来恢复

试验计划:先rman进行一个0级备份,插入表相关数据,再进行level 1级增量备份,进行rman恢复 实验环境:归档模式下,oracle10.2.0.1   开始试验: 1....
  • cuiyan1982
  • cuiyan1982
  • 2016年11月15日 21:58
  • 188

如何使用 RMAN 增量备份恢复 data guard log gap(日志断档)

主库查询最小scn 信息: SQL> col current_scn for 999999999999999 SQL>  SELECT CURRENT_SCN FROM V$DATABASE;    ...
  • royjj
  • royjj
  • 2014年12月22日 15:18
  • 1190

rman异机增量备份恢复

实验环境 a:oraclelinux6.5 ip地址:192.168.6.245 oracle版本:11.2.0.3 建库 b:oraclelinux6.5 ip地址:19...
  • freedompuge
  • freedompuge
  • 2016年07月13日 14:35
  • 1679

Rman 0级和2级增量备份的恢复测试(…

实验目的:测试先做Rman 0级备份,再做2级增量备份的恢复是否可行(未做一级增量备份) C:\Documents and Settings\sn10712>rman target / 恢复管理器: ...
  • babymouse1212
  • babymouse1212
  • 2017年05月02日 10:51
  • 154
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:oracle:rman恢复----通过增量备份来恢复
举报原因:
原因补充:

(最多只允许输入30个字)