1207catalog copy的数据文件作为0级备份2

[20151207]catalog copy的数据文件作为0级备份补充.txt

--  前一阵子写了1篇blog,使用热备份模式备份的文件是否可以作为0级备份。
--  以及使用backpup as copy备份的数据文件是否可以作为0级备份.
--  链接:http://blog.itpub.net/267265/viewspace-1832475/

--  当时困惑的是使用catalog datafilecopy '/home/oracle/backup/datafile_4_USERS.dbf' level 0 ;作为0级。
--- 不知道那里能看出来这个copy备份作为1级备份呢?

-- 实际上通过v$datafile_copy视图就可以知道?还是通过例子来说明:

1.环境:
SCOTT@book> @ &r/ver1

PORT_STRING                    VERSION        BANNER
------------------------------ -------------- --------------------------------------------------------------------------------
x86_64/Linux 2.4.xx            11.2.0.4.0     Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production

RMAN> list backup ;

using target database control file instead of recovery catalog
specification does not match any backup in the repository

RMAN> list copy ;

specification does not match any datafile copy in the repository
specification does not match any control file copy in the repository
specification does not match any archived log in the repository

--我删除了全部备份以及archivelog。

2.建立backup as copy备份:

RMAN> backup as copy datafile "/mnt/ramdisk/book/example01.dbf" format "/home/oracle/backup/example_%U.dbf";

Starting backup at 2015-12-07 08:20:08
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
input datafile file number=00005 name=/mnt/ramdisk/book/example01.dbf
output file name=/home/oracle/backup/example_data_D-BOOK_I-1337401710_TS-EXAMPLE_FNO-5_01qo71tp.dbf tag=TAG20151207T082008 RECID=2 STAMP=897812410
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01
Finished backup at 2015-12-07 08:20:10

RMAN> list copy ;

specification does not match any control file copy in the repository
specification does not match any archived log in the repository
List of Datafile Copies
=======================

Key     File S Completion Time     Ckp SCN    Ckp Time
------- ---- - ------------------- ---------- -------------------
2       5    A 2015-12-07 08:20:10 13212703957 2015-12-07 08:20:09
        Name: /home/oracle/backup/example_data_D-BOOK_I-1337401710_TS-EXAMPLE_FNO-5_01qo71tp.dbf
        Tag: TAG20151207T082008

SCOTT@book> select file#, tag, incremental_level, name from v$datafile_copy where deleted='NO' order by 1;
     FILE# TAG                              INCREMENTAL_LEVEL NAME
---------- -------------------------------- ----------------- ------------------------------------------------------------
         5 TAG20151207T082008                                 /home/oracle/backup/example_data_D-BOOK_I-1337401710_TS-EXAM
                                                              PLE_FNO-5_01qo71tp.dbf

3.改成0级备份:
RMAN> catalog datafilecopy '/home/oracle/backup/example_data_D-BOOK_I-1337401710_TS-EXAMPLE_FNO-5_01qo71tp.dbf' level 0 tag 'inc0';

cataloged datafile copy
datafile copy file name=/home/oracle/backup/example_data_D-BOOK_I-1337401710_TS-EXAMPLE_FNO-5_01qo71tp.dbf RECID=3 STAMP=897812572

RMAN> list copy ;

specification does not match any control file copy in the repository
specification does not match any archived log in the repository
List of Datafile Copies
=======================

Key     File S Completion Time     Ckp SCN    Ckp Time
------- ---- - ------------------- ---------- -------------------
3       5    A 2015-12-07 08:22:52 13212703957 2015-12-07 08:20:09
        Name: /home/oracle/backup/example_data_D-BOOK_I-1337401710_TS-EXAMPLE_FNO-5_01qo71tp.dbf
        Tag: INC0

--查看视图v$datafile_copy。
SCOTT@book> select file#, tag, incremental_level, name from v$datafile_copy where deleted='NO' order by 1;
     FILE# TAG                              INCREMENTAL_LEVEL NAME
---------- -------------------------------- ----------------- ------------------------------------------------------------
         5 INC0                                             0 /home/oracle/backup/example_data_D-BOOK_I-1337401710_TS-EXAM
                                                              PLE_FNO-5_01qo71tp.dbf

--当时主要精力查询含有RMAN以及BACKUP字串的视图,忽略了还要查询包含COPY字串的视图。
--可以发现通过这个视图可以确定backup as copy的备份以及修改为0级备份。

4.还可以不断应用日志:

SCOTT@book> select file#, tag, incremental_level, name ,CHECKPOINT_CHANGE#  from v$datafile_copy where deleted='NO' order by 1;
       FILE# TAG                              INCREMENTAL_LEVEL NAME                                               CHECKPOINT_CHANGE#
------------ -------------------------------- ----------------- -------------------------------------------------- ------------------
           5 INC0                                             0 /home/oracle/backup/example_data_D-BOOK_I-13374017        13212705401
                                                                10_TS-EXAMPLE_FNO-5_01qo71tp.dbf

--RMAN> backup incremental level 1 for recover of copy with tag 'inc0' datafile "/mnt/ramdisk/book/example01.dbf";
RMAN> backup incremental level 1 for recover of copy with tag 'inc0' datafile 5;

Starting backup at 2015-12-07 08:56:47
using channel ORA_DISK_1
channel ORA_DISK_1: starting incremental level 1 datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00005 name=/mnt/ramdisk/book/example01.dbf
channel ORA_DISK_1: starting piece 1 at 2015-12-07 08:56:47
channel ORA_DISK_1: finished piece 1 at 2015-12-07 08:56:48
piece handle=/u01/app/oracle/fast_recovery_area/BOOK/backupset/2015_12_07/o1_mf_nnnd1_INC0_c69pbhf2_.bkp tag=INC0 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 2015-12-07 08:56:48

SCOTT@book> select file#, tag, incremental_level, name ,CHECKPOINT_CHANGE#  from v$datafile_copy where deleted='NO' order by 1;
       FILE# TAG                              INCREMENTAL_LEVEL NAME                                               CHECKPOINT_CHANGE#
------------ -------------------------------- ----------------- -------------------------------------------------- ------------------
           5 INC0                                             0 /home/oracle/backup/example_data_D-BOOK_I-13374017        13212705401
                                                                10_TS-EXAMPLE_FNO-5_01qo71tp.dbf

-- 奇怪并没有变化CHECKPOINT_CHANGE#。

RMAN> list backup;
List of Backup Sets
===================
BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ -------------------
8       Incr 1  32.00K     DISK        00:00:00     2015-12-07 08:56:47
        BP Key: 8   Status: AVAILABLE  Compressed: NO  Tag: INC0
        Piece Name: /u01/app/oracle/fast_recovery_area/BOOK/backupset/2015_12_07/o1_mf_nnnd1_INC0_c69pbhf2_.bkp
  List of Datafiles in backup set 8
  File LV Type Ckp SCN    Ckp Time            Name
  ---- -- ---- ---------- ------------------- ----
  5    1  Incr 13212705949 2015-12-07 08:56:47 /mnt/ramdisk/book/example01.dbf

-- 实际上增加1个1级备份,以这个copy备份为基础。看了一些文档发现要不断应用日志,执行的是如下:
RUN {
  RECOVER COPY OF DATABASE WITH TAG 'incr_update';
  BACKUP INCREMENTAL LEVEL 1 FOR RECOVER OF COPY WITH TAG 'incr_update' DATABASE;
}

正确的应该是:

RMAN> recover copy of datafile 5;

Starting recover at 2015-12-07 08:59:52
using channel ORA_DISK_1
channel ORA_DISK_1: starting incremental datafile backup set restore
channel ORA_DISK_1: specifying datafile copies to recover
recovering datafile copy file number=00005 name=/home/oracle/backup/example_data_D-BOOK_I-1337401710_TS-EXAMPLE_FNO-5_01qo71tp.dbf
channel ORA_DISK_1: reading from backup piece /u01/app/oracle/fast_recovery_area/BOOK/backupset/2015_12_07/o1_mf_nnnd1_INC0_c69pbhf2_.bkp
channel ORA_DISK_1: piece handle=/u01/app/oracle/fast_recovery_area/BOOK/backupset/2015_12_07/o1_mf_nnnd1_INC0_c69pbhf2_.bkp tag=INC0
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
Finished recover at 2015-12-07 08:59:53

SCOTT@book> select file#, tag, incremental_level, name ,CHECKPOINT_CHANGE#  from v$datafile_copy where deleted='NO' order by 1;
       FILE# TAG                              INCREMENTAL_LEVEL NAME                                               CHECKPOINT_CHANGE#
------------ -------------------------------- ----------------- -------------------------------------------------- ------------------
           5 INC0                                             0 /home/oracle/backup/example_data_D-BOOK_I-13374017        13212705949
                                                                10_TS-EXAMPLE_FNO-5_01qo71tp.dbf

--这样inc0就变化了。如下执行不存在1级会不应用的的。

RMAN> RECOVER COPY OF datafile 5 WITH TAG 'inc0';

Starting recover at 2015-12-07 09:05:05
using channel ORA_DISK_1
no copy of datafile 5 found to recover
Finished recover at 2015-12-07 09:05:05

RMAN> recover copy of datafile 5;

Starting recover at 2015-12-07 09:08:37
using channel ORA_DISK_1
no copy of datafile 5 found to recover
Finished recover at 2015-12-07 09:08:37

--必须存在1级备份才会应用:

RMAN> backup incremental level 1 for recover of copy with tag 'inc0' datafile 5;

Starting backup at 2015-12-07 09:08:42
using channel ORA_DISK_1
channel ORA_DISK_1: starting incremental level 1 datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00005 name=/mnt/ramdisk/book/example01.dbf
channel ORA_DISK_1: starting piece 1 at 2015-12-07 09:08:42
channel ORA_DISK_1: finished piece 1 at 2015-12-07 09:08:43
piece handle=/u01/app/oracle/fast_recovery_area/BOOK/backupset/2015_12_07/o1_mf_nnnd1_INC0_c69q0tmf_.bkp tag=INC0 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 2015-12-07 09:08:43

RMAN> recover copy of datafile 5;

Starting recover at 2015-12-07 09:08:45
using channel ORA_DISK_1
channel ORA_DISK_1: starting incremental datafile backup set restore
channel ORA_DISK_1: specifying datafile copies to recover
recovering datafile copy file number=00005 name=/home/oracle/backup/example_data_D-BOOK_I-1337401710_TS-EXAMPLE_FNO-5_01qo71tp.dbf
channel ORA_DISK_1: reading from backup piece /u01/app/oracle/fast_recovery_area/BOOK/backupset/2015_12_07/o1_mf_nnnd1_INC0_c69q0tmf_.bkp
channel ORA_DISK_1: piece handle=/u01/app/oracle/fast_recovery_area/BOOK/backupset/2015_12_07/o1_mf_nnnd1_INC0_c69q0tmf_.bkp tag=INC0
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
Finished recover at 2015-12-07 09:08:46

时间: 2024-10-22 14:47:03

1207catalog copy的数据文件作为0级备份2的相关文章

1112catalog copy的数据文件作为0级备份

[20151112]catalog copy的数据文件作为0级备份.txt --使用热备份模式备份的文件是否可以作为0级备份呢? --以前学习rman这部分内容时候有点混乱,无法理解为什么使用rman backup as copy 的数据文件与0级备份的数据文件存在那些不同. --是否使用热备份以及backpup as copy备份的数据文件是否可以作为0级备份. --通过例子来说明: 1.测试环境: SYS@book> @ &r/ver1 PORT_STRING              

[20151116]rman 全备份以及增量0级备份.txt

[20151116]rman 全备份以及增量0级备份.txt --前一阵子写了一篇将as copy作为增量0级备份的帖子,今天对比全备份以及增量0级备份的不同. 1.测试环境: SCOTT@book> @ &r/ver1 PORT_STRING                    VERSION        BANNER ------------------------------ -------------- --------------------------------------

0级备份和全备份的本质区别

准备:将测试环境的users表空间只读 测试: 1.数据库0级别备份 RMAN> backup incremental level 0 database tag 'levle0' format '/home/oracle/guo/%U'; Starting backup at 23-MAY-15 using channel ORA_DISK_1 channel ORA_DISK_1: starting incremental level 0 datafile backup set channel

[20161101]rman备份与数据文件变化7.txt

[20161101]rman备份与数据文件变化7.txt --//想象一下,如果备份文件时间很长,而这个时候数据文件大小发生了变化,oracle的备份如何解决这个问题呢? --//去年已经测试了建立备份集的情况,一直想做一次image copy的测试,一直脱,主要原因自己不想做这个测试.... --//而且当时的测试很乱,自己主要一边做一边想.... --//链接: http://blog.itpub.net/267265/viewspace-2127386/ http://blog.itpub

[20171123]rman备份与数据文件变化6.txt

[20171123]rman备份与数据文件变化6.txt --//想象一下,如果备份文件时间很长,而这个时候数据文件大小发生了变化,oracle的备份如何解决这个问题呢? --//去年已经测试了建立备份集的情况,一直想做一次image copy的测试,一直脱,主要原因自己不想做这个测试.... --//而且当时的测试很乱,自己主要一边做一边想.... --//链接: http://blog.itpub.net/267265/viewspace-2127386/ http://blog.itpub

ORACLE 只读数据文件备份与恢复

      第一章 只读数据文件备份与恢复 BLOG文档结果图:       只读数据文件是只读表空间的数据文件,其数据块包括文件头在内不允许更改(少数管理性命令除外). 将表空间设置为只读状态的命令: SQL> alter tablespace TBS_READ read only;   Tablespace altered.   将表空间重新设置为常规的读/写状态的命令: SQL> alter tablespace TBS_READ read write;   Tablespace alt

如何不使用rman工具恢复被rm删除的数据文件

朋友一时兴起使用了rm**,删除了oracle数据文件后找我帮忙,我在帮朋友恢复数据库时,遇到了当recover时,报错不能找到28739号归档日志,这样我就不能同步scn,更不能打开数据库了.这是归档日志不连续的典型案例,我最后告诉他要做好心理准备.事情还没有完,这个真实案例引发了我的思考,如果当时在朋友没有做rman拯救措施的情况下,可不可能不使用rman即可恢复数据文件呢!最后我找到了答案:) 案例 1.系统solaris SunOS TJLT-YDWG6 5.9 Generic_1223

[20151218]数据文件的unrecover与增量备份

[20151218]数据文件的unrecover与增量备份.txt --前一阵子我给别人演示truncate的不完全恢复,结果非常难堪的遇到无法恢复的情况. --问题是我建立的数据库按照这个链接建立的. http://blog.itpub.net/267265/viewspace-1845062/ --而这样建立的数据库表空间example的属性NOLOGGING. CREATE TABLESPACE EXAMPLE DATAFILE   '/mnt/ramdisk/book/example01

数据文件丢失如何恢复

摘要: 数据文件丢失如何恢复,内容来自以下讨论: http://www.itpub.net/348275.html 数据库归档模式,新建表空间testtbs, 数据文件testtbs.dbf关闭数据库删除数据文件testtbs.dbf启动数据库 提示:ORA-01157: 无法标识/锁定数据文件 2 - 请参阅 DBWR 跟踪文件ORA-01110: 数据文件 2: 'D:ORACLEORADATAHAHATESTTBS.DBF' 此数据文件没有做任何备份, 请问这种情况怎么恢复 操作如下: S