免费注册 查看新帖 |

Chinaunix

广告
  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2883 | 回复: 8
打印 上一主题 下一主题

oracle 10g rman增量合并测试的疑问 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2006-11-15 18:50 |只看该作者 |倒序浏览
oracle 10g rman增量合并测试

rman0级备份数据库:

oracle@linux:/free/oracle> rman target /

Recovery Manager: Release 10.2.0.1.0 - Production on 星期二 11月 14 18:56:48 2006

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

connected to target database: ORCL (DBID=1132959697)

RMAN> backup as compressed backupset incremental level 0 database;

Starting backup at 14-11月-06
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=158 devtype=DISK
channel ORA_DISK_1: starting compressed incremental level 0 datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00001 name=/free/oracle/oradata/orcl/system01.dbf
input datafile fno=00003 name=/free/oracle/oradata/orcl/sysaux01.dbf
input datafile fno=00005 name=/free/oracle/oradata/orcl/exitgogodb.dbf
input datafile fno=00002 name=/free/oracle/oradata/orcl/undotbs01.dbf
input datafile fno=00004 name=/free/oracle/oradata/orcl/users01.dbf
channel ORA_DISK_1: starting piece 1 at 14-11月-06
channel ORA_DISK_1: finished piece 1 at 14-11月-06
piece handle=/free/oracle/flash_recovery_area/ORCL/backupset/2006_11_14/o1_mf_nnnd0_TAG20061114T185913_2om8d3bo_.bkp tag=TAG20061114T185913 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:03:55
Finished backup at 14-11月-06

Starting Control File and SPFILE Autobackup at 14-11月-06
piece handle=/free/oracle/orabak/c-1132959697-20061114-13 comment=NONE
Finished Control File and SPFILE Autobackup at 14-11月-06

RMAN> quit


Recovery Manager complete.
oracle@linux:/free/oracle> ls
admin createtablespace.pl flash_recovery_area oradata product
change.log create_tablespaces.sh orabak oraInventory
oracle@linux:/free/oracle> sqlplus "/as sysdba"

SQL*Plus: Release 10.2.0.1.0 - Production on 星期二 11月 14 19:09:07 2006
Copyright (c) 1982, 2005, Oracle. All rights reserved.

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

继续添加测试数据:

SQL> create table gaojf456 as select * from tab;

Table created.

SQL> insert into gaojf456 select * from tab;

3644 rows created.

SQL> /

3644 rows created.

SQL> /

3644 rows created.

SQL> /

3644 rows created.

SQL> /

3644 rows created.

SQL> /

3644 rows created.

SQL> insert into gaojf456 select * from gaojf456;

25508 rows created.

SQL> /

51016 rows created.

SQL> /

102032 rows created.

SQL> /

204064 rows created.

SQL> commit;

Commit complete.

SQL> /

Commit complete.

SQL> quit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options

rman执行1级备份,增量合并:

oracle@linux:/free/oracle> rman target /

Recovery Manager: Release 10.2.0.1.0 - Production on 星期二 11月 14 19:10:26 2006

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

connected to target database: ORCL (DBID=1132959697)

RMAN> backup incremental level 1 for recover of copy with tag TAG20061114T185913 database;

Starting backup at 14-11月-06
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=152 devtype=DISK
no parent backup or copy of datafile 1 found
no parent backup or copy of datafile 3 found
no parent backup or copy of datafile 5 found
no parent backup or copy of datafile 2 found
no parent backup or copy of datafile 4 found
channel ORA_DISK_1: starting datafile copy
input datafile fno=00001 name=/free/oracle/oradata/orcl/system01.dbf
output filename=/free/oracle/flash_recovery_area/ORCL/datafile/o1_mf_system_2om935mk_.dbf tag=TAG20061114T185913 recid=51 stamp=606510752
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:01:05
channel ORA_DISK_1: starting datafile copy
input datafile fno=00003 name=/free/oracle/oradata/orcl/sysaux01.dbf
output filename=/free/oracle/flash_recovery_area/ORCL/datafile/o1_mf_sysaux_2om95594_.dbf tag=TAG20061114T185913 recid=52 stamp=606510785
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:36
channel ORA_DISK_1: starting datafile copy
input datafile fno=00005 name=/free/oracle/oradata/orcl/exitgogodb.dbf
output filename=/free/oracle/flash_recovery_area/ORCL/datafile/o1_mf_exitgogo_2om968y7_.dbf tag=TAG20061114T185913 recid=53 stamp=606510809
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:25
channel ORA_DISK_1: starting datafile copy
input datafile fno=00002 name=/free/oracle/oradata/orcl/undotbs01.dbf
output filename=/free/oracle/flash_recovery_area/ORCL/datafile/o1_mf_undotbs1_2om9731b_.dbf tag=TAG20061114T185913 recid=54 stamp=606510821
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:07
channel ORA_DISK_1: starting datafile copy
input datafile fno=00004 name=/free/oracle/oradata/orcl/users01.dbf
output filename=/free/oracle/flash_recovery_area/ORCL/datafile/o1_mf_users_2om97b5n_.dbf tag=TAG20061114T185913 recid=55 stamp=606510826
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01
Finished backup at 14-11月-06

Starting Control File and SPFILE Autobackup at 14-11月-06
piece handle=/free/oracle/orabak/c-1132959697-20061114-14 comment=NONE
Finished Control File and SPFILE Autobackup at 14-11月-06
RMAN> quit

Recovery Manager complete.

以下操作继续添加测试数据,然后执行一级备份,步骤省略!

最后查看rman备份

RMAN> list backup;
List of Backup Sets
===================

BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
34 Incr 0 106.10M DISK 00:03:46 14-11月-06
BP Key: 34 Status: AVAILABLE Compressed: YES Tag: TAG20061114T185913
Piece Name: /free/oracle/flash_recovery_area/ORCL/backupset/2006_11_14/o1_mf_nnnd0_TAG20061114T185913_2om8d3bo_.bkp
List of Datafiles in backup set 34
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- ---------- ----
1 0 Incr 553409 14-11月-06 /free/oracle/oradata/orcl/system01.dbf
2 0 Incr 553409 14-11月-06 /free/oracle/oradata/orcl/undotbs01.dbf
3 0 Incr 553409 14-11月-06 /free/oracle/oradata/orcl/sysaux01.dbf
4 0 Incr 553409 14-11月-06 /free/oracle/oradata/orcl/users01.dbf
5 0 Incr 553409 14-11月-06 /free/oracle/oradata/orcl/exitgogodb.dbf

BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
35 Full 6.80M DISK 00:00:01 14-11月-06
BP Key: 35 Status: AVAILABLE Compressed: NO Tag: TAG20061114T190310
Piece Name: /free/oracle/orabak/c-1132959697-20061114-13
Control File Included: Ckp SCN: 553495 Ckp time: 14-11月-06
SPFILE Included: Modification time: 14-11月-06

BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
36 Full 6.80M DISK 00:00:02 14-11月-06
BP Key: 36 Status: AVAILABLE Compressed: NO Tag: TAG20061114T191347
Piece Name: /free/oracle/orabak/c-1132959697-20061114-14
Control File Included: Ckp SCN: 554106 Ckp time: 14-11月-06
SPFILE Included: Modification time: 14-11月-06

BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
37 Incr 1 15.58M DISK 00:00:05 14-11月-06
BP Key: 37 Status: AVAILABLE Compressed: NO Tag: TAG20061114T191650
Piece Name: /free/oracle/flash_recovery_area/ORCL/backupset/2006_11_14/o1_mf_nnnd1_TAG20061114T191650_2om9f6gk_.bkp
List of Datafiles in backup set 37
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- ---------- ----
1 1 Incr 554289 14-11月-06 /free/oracle/oradata/orcl/system01.dbf
2 1 Incr 554289 14-11月-06 /free/oracle/oradata/orcl/undotbs01.dbf
3 1 Incr 554289 14-11月-06 /free/oracle/oradata/orcl/sysaux01.dbf
4 1 Incr 554289 14-11月-06 /free/oracle/oradata/orcl/users01.dbf
5 1 Incr 554289 14-11月-06 /free/oracle/oradata/orcl/exitgogodb.dbf

BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
38 Full 6.80M DISK 00:00:01 14-11月-06
BP Key: 38 Status: AVAILABLE Compressed: NO Tag: TAG20061114T191659
Piece Name: /free/oracle/orabak/c-1132959697-20061114-15
Control File Included: Ckp SCN: 554296 Ckp time: 14-11月-06
SPFILE Included: Modification time: 14-11月-06

BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
39 Incr 1 31.73M DISK 00:00:06 14-11月-06
BP Key: 39 Status: AVAILABLE Compressed: NO Tag: TAG20061114T191844
Piece Name: /free/oracle/flash_recovery_area/ORCL/backupset/2006_11_14/o1_mf_nnnd1_TAG20061114T191844_2om9jr17_.bkp
List of Datafiles in backup set 39
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- ---------- ----
1 1 Incr 554456 14-11月-06 /free/oracle/oradata/orcl/system01.dbf
2 1 Incr 554456 14-11月-06 /free/oracle/oradata/orcl/undotbs01.dbf
3 1 Incr 554456 14-11月-06 /free/oracle/oradata/orcl/sysaux01.dbf
4 1 Incr 554456 14-11月-06 /free/oracle/oradata/orcl/users01.dbf
5 1 Incr 554456 14-11月-06 /free/oracle/oradata/orcl/exitgogodb.dbf

BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
40 Full 7.08M DISK 00:00:02 14-11月-06
BP Key: 40 Status: AVAILABLE Compressed: NO Tag: TAG20061114T191852
Piece Name: /free/oracle/orabak/c-1132959697-20061114-16
Control File Included: Ckp SCN: 554463 Ckp time: 14-11月-06
SPFILE Included: Modification time: 14-11月-06

BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
41 Incr 1 60.94M DISK 00:00:10 14-11月-06
BP Key: 41 Status: AVAILABLE Compressed: NO Tag: TAG20061114T192249
Piece Name: /free/oracle/flash_recovery_area/ORCL/backupset/2006_11_14/o1_mf_nnnd1_TAG20061114T192249_2om9rgjb_.bkp
List of Datafiles in backup set 41
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- ---------- ----
1 1 Incr 554705 14-11月-06 /free/oracle/oradata/orcl/system01.dbf
2 1 Incr 554705 14-11月-06 /free/oracle/oradata/orcl/undotbs01.dbf
3 1 Incr 554705 14-11月-06 /free/oracle/oradata/orcl/sysaux01.dbf
4 1 Incr 554705 14-11月-06 /free/oracle/oradata/orcl/users01.dbf
5 1 Incr 554705 14-11月-06 /free/oracle/oradata/orcl/exitgogodb.dbf

BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
42 Full 7.08M DISK 00:00:02 14-11月-06
BP Key: 42 Status: AVAILABLE Compressed: NO Tag: TAG20061114T192305
Piece Name: /free/oracle/orabak/c-1132959697-20061114-17
Control File Included: Ckp SCN: 554715 Ckp time: 14-11月-06
SPFILE Included: Modification time: 14-11月-06

RMAN> quit

然后关闭数据库,删除所有数据文件,用rman恢复。

RMAN> restore database;

Starting restore at 14-11月-06
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=157 devtype=DISK

channel ORA_DISK_1: restoring datafile 00001
input datafile copy recid=51 stamp=606510752 filename=/free/oracle/flash_recovery_area/ORCL/datafile/o1_mf_system_2om935mk_.dbf
destination for restore of datafile 00001: /free/oracle/oradata/orcl/system01.dbf
channel ORA_DISK_1: copied datafile copy of datafile 00001
output filename=/free/oracle/oradata/orcl/system01.dbf recid=56 stamp=606511723
channel ORA_DISK_1: restoring datafile 00002
input datafile copy recid=54 stamp=606510821 filename=/free/oracle/flash_recovery_area/ORCL/datafile/o1_mf_undotbs1_2om9731b_.dbf
destination for restore of datafile 00002: /free/oracle/oradata/orcl/undotbs01.dbf
channel ORA_DISK_1: copied datafile copy of datafile 00002
output filename=/free/oracle/oradata/orcl/undotbs01.dbf recid=57 stamp=606511734
channel ORA_DISK_1: restoring datafile 00003
input datafile copy recid=52 stamp=606510785 filename=/free/oracle/flash_recovery_area/ORCL/datafile/o1_mf_sysaux_2om95594_.dbf
destination for restore of datafile 00003: /free/oracle/oradata/orcl/sysaux01.dbf
channel ORA_DISK_1: copied datafile copy of datafile 00003
output filename=/free/oracle/oradata/orcl/sysaux01.dbf recid=58 stamp=606511764
channel ORA_DISK_1: restoring datafile 00004
input datafile copy recid=55 stamp=606510826 filename=/free/oracle/flash_recovery_area/ORCL/datafile/o1_mf_users_2om97b5n_.dbf
destination for restore of datafile 00004: /free/oracle/oradata/orcl/users01.dbf
channel ORA_DISK_1: copied datafile copy of datafile 00004
output filename=/free/oracle/oradata/orcl/users01.dbf recid=59 stamp=606511770
channel ORA_DISK_1: restoring datafile 00005
input datafile copy recid=53 stamp=606510809 filename=/free/oracle/flash_recovery_area/ORCL/datafile/o1_mf_exitgogo_2om968y7_.dbf
destination for restore of datafile 00005: /free/oracle/oradata/orcl/exitgogodb.dbf
channel ORA_DISK_1: copied datafile copy of datafile 00005
output filename=/free/oracle/oradata/orcl/exitgogodb.dbf recid=60 stamp=606511788
Finished restore at 14-11月-06

RMAN> recover database;

Starting recover at 14-11月-06
using channel ORA_DISK_1
channel ORA_DISK_1: starting incremental datafile backupset restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
destination for restore of datafile 00001: /free/oracle/oradata/orcl/system01.dbf
destination for restore of datafile 00002: /free/oracle/oradata/orcl/undotbs01.dbf
destination for restore of datafile 00003: /free/oracle/oradata/orcl/sysaux01.dbf
destination for restore of datafile 00004: /free/oracle/oradata/orcl/users01.dbf
destination for restore of datafile 00005: /free/oracle/oradata/orcl/exitgogodb.dbf
channel ORA_DISK_1: reading from backup piece /free/oracle/flash_recovery_area/ORCL/backupset/2006_11_14/o1_mf_nnnd1_TAG20061114T192249_2om9rgjb_.bkp
channel ORA_DISK_1: restored backup piece 1
piece handle=/free/oracle/flash_recovery_area/ORCL/backupset/2006_11_14/o1_mf_nnnd1_TAG20061114T192249_2om9rgjb_.bkp tag=TAG20061114T192249
channel ORA_DISK_1: restore complete, elapsed time: 00:00:17

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

Finished recover at 14-11月-06

RMAN>


可以看到rman在recover数据库的时候用到了最后一次rman一级备份的文件,按照oracle10g增量合并的原理来说,应该是只要一个0级的备份加上日志即可,
但是上面的测试却是rman的levle 0+最后的level 1+归档日志。

感觉有点与oracle选出的增量合并不太吻合!请大家指点一二!

论坛徽章:
0
2 [报告]
发表于 2006-11-16 13:14 |只看该作者
增量合并是10G才提出的new feature,有意思.我也测试一下:
RMAN> show all;

RMAN configuration parameters are:
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 7 DAYS;
CONFIGURE BACKUP OPTIMIZATION OFF; # default
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP OFF;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/u01/app/oracle/backup/test3/%F.bck';
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/app/oracle/product/10.2.0/db_1/dbs/snapcf_test3.f'; # default


RMAN> list backup;

RMAN> list copy;

specification does not match any archive log in the recovery catalog


RMAN> RUN {                                            
2>   backup as compressed backupset                                         
3>   incremental level 1   
4>   for recover of copy  
5>   with tag WEEKLY_LEVEL_0                        
6>   (database);  
7>   sql 'alter system archive log current';      
8> }


Starting backup at 12-NOV-06
using channel ORA_DISK_1
no parent backup or copy of datafile 1 found
no parent backup or copy of datafile 3 found
no parent backup or copy of datafile 2 found
no parent backup or copy of datafile 4 found
no parent backup or copy of datafile 5 found
no parent backup or copy of datafile 6 found
channel ORA_DISK_1: starting datafile copy
input datafile fno=00001 name=/u01/app/oracle/oradata/test3/system01.dbf
output filename=/u01/app/oracle/flash_recovery_area/TEST3/datafile/o1_mf_system_2ofqsgtz_.dbf tag=WEEKLY_LEVEL_0 recid=65 stamp=606329149
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:26
channel ORA_DISK_1: starting datafile copy
input datafile fno=00003 name=/u01/app/oracle/oradata/test3/sysaux01.dbf
output filename=/u01/app/oracle/flash_recovery_area/TEST3/datafile/o1_mf_sysaux_2ofqt35h_.dbf tag=WEEKLY_LEVEL_0 recid=66 stamp=606329167
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:15
channel ORA_DISK_1: starting datafile copy
input datafile fno=00002 name=/u01/app/oracle/oradata/test3/undotbs01.dbf
output filename=/u01/app/oracle/flash_recovery_area/TEST3/datafile/o1_mf_undotbs1_2ofqtlcz_.dbf tag=WEEKLY_LEVEL_0 recid=67 stamp=606329172
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:03
channel ORA_DISK_1: starting datafile copy
input datafile fno=00004 name=/u01/app/oracle/oradata/test3/users01.dbf
output filename=/u01/app/oracle/flash_recovery_area/TEST3/datafile/o1_mf_users_2ofqtodr_.dbf tag=WEEKLY_LEVEL_0 recid=68 stamp=606329175
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:03
channel ORA_DISK_1: starting datafile copy
input datafile fno=00005 name=/u01/app/oracle/oradata/test3/idx01.dbf
output filename=/u01/app/oracle/flash_recovery_area/TEST3/datafile/o1_mf_idx_2ofqtrhz_.dbf tag=WEEKLY_LEVEL_0 recid=69 stamp=606329178
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:03
channel ORA_DISK_1: starting datafile copy
input datafile fno=00006 name=/u01/app/oracle/oradata/test3/test01.dbf
output filename=/u01/app/oracle/flash_recovery_area/TEST3/datafile/o1_mf_test_2ofqtvlv_.dbf tag=WEEKLY_LEVEL_0 recid=70 stamp=606329179
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01
channel ORA_DISK_1: starting compressed 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 12-NOV-06
channel ORA_DISK_1: finished piece 1 at 12-NOV-06
piece handle=/u01/app/oracle/flash_recovery_area/TEST3/backupset/2006_11_12/o1_mf_ncsn1_TAG20061112T164529_2ofqty32_.bkp tag=TAG20061112T164529 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:03
Finished backup at 12-NOV-06

sql statement: alter system archive log current

RMAN> list backup;

List of Backup Sets
===================

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
80      Incr 1  1.06M      DISK        00:00:02     12-NOV-06      
        BP Key: 80   Status: AVAILABLE  Compressed: YES  Tag: TAG20061112T164529
        Piece Name: /u01/app/oracle/flash_recovery_area/TEST3/backupset/2006_11_12/o1_mf_ncsn1_TAG20061112T164529_2ofqty32_.bkp
  Control File Included: Ckp SCN: 565502       Ckp time: 12-NOV-06
  SPFILE Included: Modification time: 12-NOV-06

RMAN> list copy;


List of Datafile Copies
Key     File S Completion Time Ckp SCN    Ckp Time        Name
------- ---- - --------------- ---------- --------------- ----
65      1    A 12-NOV-06       565473     12-NOV-06       /u01/app/oracle/flash_recovery_area/TEST3/datafile/o1_mf_system_2ofqsgtz_.dbf
67      2    A 12-NOV-06       565496     12-NOV-06       /u01/app/oracle/flash_recovery_area/TEST3/datafile/o1_mf_undotbs1_2ofqtlcz_.dbf
66      3    A 12-NOV-06       565485     12-NOV-06       /u01/app/oracle/flash_recovery_area/TEST3/datafile/o1_mf_sysaux_2ofqt35h_.dbf
68      4    A 12-NOV-06       565498     12-NOV-06       /u01/app/oracle/flash_recovery_area/TEST3/datafile/o1_mf_users_2ofqtodr_.dbf
69      5    A 12-NOV-06       565500     12-NOV-06       /u01/app/oracle/flash_recovery_area/TEST3/datafile/o1_mf_idx_2ofqtrhz_.dbf
70      6    A 12-NOV-06       565502     12-NOV-06       /u01/app/oracle/flash_recovery_area/TEST3/datafile/o1_mf_test_2ofqtvlv_.dbf

List of Archived Log Copies
Key     Thrd Seq     S Low Time  Name
------- ---- ------- - --------- ----
76      1    55      A 12-NOV-06 /u01/app/oracle/arch/test3/arch011_55_602911897.dbf

论坛徽章:
0
3 [报告]
发表于 2006-11-16 13:16 |只看该作者

======================================================================================
SQLPLUS:
SQL> create table test_objects as select * from all_objects;

Table created.

SQL> select count(*) from test_objects;

  COUNT(*)
----------
      4565
======================================================================================

RMAN> RUN {                                            
2>   backup as compressed backupset                                         
3>   incremental level 1   
4>   for recover of copy  
5>   with tag WEEKLY_LEVEL_0                        
6>   (database);  
7>   sql 'alter system archive log current';      
8> }
   

Starting backup at 12-NOV-06
using channel ORA_DISK_1
channel ORA_DISK_1: starting compressed incremental level 1 datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00001 name=/u01/app/oracle/oradata/test3/system01.dbf
input datafile fno=00003 name=/u01/app/oracle/oradata/test3/sysaux01.dbf
input datafile fno=00002 name=/u01/app/oracle/oradata/test3/undotbs01.dbf
input datafile fno=00004 name=/u01/app/oracle/oradata/test3/users01.dbf
input datafile fno=00005 name=/u01/app/oracle/oradata/test3/idx01.dbf
input datafile fno=00006 name=/u01/app/oracle/oradata/test3/test01.dbf
channel ORA_DISK_1: starting piece 1 at 12-NOV-06
channel ORA_DISK_1: finished piece 1 at 12-NOV-06
piece handle=/u01/app/oracle/flash_recovery_area/TEST3/backupset/2006_11_12/o1_mf_nnnd1_TAG20061112T165018_2ofr2bz5_.bkp tag=TAG20061112T165018 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:35
channel ORA_DISK_1: starting compressed 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 12-NOV-06
channel ORA_DISK_1: finished piece 1 at 12-NOV-06
piece handle=/u01/app/oracle/flash_recovery_area/TEST3/backupset/2006_11_12/o1_mf_ncsn1_TAG20061112T165018_2ofr3hfo_.bkp tag=TAG20061112T165018 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:03
Finished backup at 12-NOV-06

sql statement: alter system archive log current


======================================================================================
SQL> insert /*+ append */ into test_objects select * from all_objects;

4565 rows created.

SQL> select count(*) from test_objects;

  COUNT(*)
----------
      9130
======================================================================================

RMAN> recover copy of database with tag WEEKLY_LEVEL_0;


Starting recover at 12-NOV-06
using channel ORA_DISK_1
no copy of datafile 1 found to recover
no copy of datafile 2 found to recover
no copy of datafile 3 found to recover
no copy of datafile 4 found to recover
no copy of datafile 5 found to recover
no copy of datafile 6 found to recover
Finished recover at 12-NOV-06

论坛徽章:
0
4 [报告]
发表于 2006-11-16 13:17 |只看该作者

RMAN> RUN {                                            
2>   backup as compressed backupset                                         
3>   incremental level 1   
4>   for recover of copy  
5>   with tag WEEKLY_LEVEL_0                        
6>   (database);  
7>   sql 'alter system archive log current';      
8> }


Starting backup at 12-NOV-06
using channel ORA_DISK_1
channel ORA_DISK_1: starting compressed incremental level 1 datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00001 name=/u01/app/oracle/oradata/test3/system01.dbf
input datafile fno=00003 name=/u01/app/oracle/oradata/test3/sysaux01.dbf
input datafile fno=00002 name=/u01/app/oracle/oradata/test3/undotbs01.dbf
input datafile fno=00004 name=/u01/app/oracle/oradata/test3/users01.dbf
input datafile fno=00005 name=/u01/app/oracle/oradata/test3/idx01.dbf
input datafile fno=00006 name=/u01/app/oracle/oradata/test3/test01.dbf
channel ORA_DISK_1: starting piece 1 at 12-NOV-06
channel ORA_DISK_1: finished piece 1 at 12-NOV-06
piece handle=/u01/app/oracle/flash_recovery_area/TEST3/backupset/2006_11_12/o1_mf_nnnd1_TAG20061112T165444_2ofrbo4m_.bkp tag=TAG20061112T165444 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:26
channel ORA_DISK_1: starting compressed 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 12-NOV-06
channel ORA_DISK_1: finished piece 1 at 12-NOV-06
piece handle=/u01/app/oracle/flash_recovery_area/TEST3/backupset/2006_11_12/o1_mf_ncsn1_TAG20061112T165444_2ofrchdx_.bkp tag=TAG20061112T165444 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02
Finished backup at 12-NOV-06

sql statement: alter system archive log current


RMAN> recover copy of database with tag WEEKLY_LEVEL_0;


Starting recover at 12-NOV-06
using channel ORA_DISK_1
channel ORA_DISK_1: starting incremental datafile backupset restore
channel ORA_DISK_1: specifying datafile copies to recover
recovering datafile copy fno=00001 name=/u01/app/oracle/flash_recovery_area/TEST3/datafile/o1_mf_system_2ofqsgtz_.dbf
recovering datafile copy fno=00002 name=/u01/app/oracle/flash_recovery_area/TEST3/datafile/o1_mf_undotbs1_2ofqtlcz_.dbf
recovering datafile copy fno=00003 name=/u01/app/oracle/flash_recovery_area/TEST3/datafile/o1_mf_sysaux_2ofqt35h_.dbf
recovering datafile copy fno=00004 name=/u01/app/oracle/flash_recovery_area/TEST3/datafile/o1_mf_users_2ofqtodr_.dbf
recovering datafile copy fno=00005 name=/u01/app/oracle/flash_recovery_area/TEST3/datafile/o1_mf_idx_2ofqtrhz_.dbf
recovering datafile copy fno=00006 name=/u01/app/oracle/flash_recovery_area/TEST3/datafile/o1_mf_test_2ofqtvlv_.dbf
channel ORA_DISK_1: reading from backup piece /u01/app/oracle/flash_recovery_area/TEST3/backupset/2006_11_12/o1_mf_nnnd1_TAG20061112T165444_2ofrbo4m_.bkp
channel ORA_DISK_1: restored backup piece 1
piece handle=/u01/app/oracle/flash_recovery_area/TEST3/backupset/2006_11_12/o1_mf_nnnd1_TAG20061112T165444_2ofrbo4m_.bkp tag=TAG20061112T165444
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
Finished recover at 12-NOV-06

RMAN> list backup;


List of Backup Sets
===================

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
80      Incr 1  1.06M      DISK        00:00:02     12-NOV-06      
        BP Key: 80   Status: AVAILABLE  Compressed: YES  Tag: TAG20061112T164529
        Piece Name: /u01/app/oracle/flash_recovery_area/TEST3/backupset/2006_11_12/o1_mf_ncsn1_TAG20061112T164529_2ofqty32_.bkp
  Control File Included: Ckp SCN: 565502       Ckp time: 12-NOV-06
  SPFILE Included: Modification time: 12-NOV-06

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
81      Incr 1  1.02M      DISK        00:00:25     12-NOV-06      
        BP Key: 81   Status: AVAILABLE  Compressed: YES  Tag: TAG20061112T165018
        Piece Name: /u01/app/oracle/flash_recovery_area/TEST3/backupset/2006_11_12/o1_mf_nnnd1_TAG20061112T165018_2ofr2bz5_.bkp
  List of Datafiles in backup set 81
  File LV Type Ckp SCN    Ckp Time  Name
  ---- -- ---- ---------- --------- ----
  1    1  Incr 565666     12-NOV-06 /u01/app/oracle/oradata/test3/system01.dbf
  2    1  Incr 565666     12-NOV-06 /u01/app/oracle/oradata/test3/undotbs01.dbf
  3    1  Incr 565666     12-NOV-06 /u01/app/oracle/oradata/test3/sysaux01.dbf
  4    1  Incr 565666     12-NOV-06 /u01/app/oracle/oradata/test3/users01.dbf
  5    1  Incr 565666     12-NOV-06 /u01/app/oracle/oradata/test3/idx01.dbf
  6    1  Incr 565666     12-NOV-06 /u01/app/oracle/oradata/test3/test01.dbf

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
82      Incr 1  1.06M      DISK        00:00:02     12-NOV-06      
        BP Key: 82   Status: AVAILABLE  Compressed: YES  Tag: TAG20061112T165018
        Piece Name: /u01/app/oracle/flash_recovery_area/TEST3/backupset/2006_11_12/o1_mf_ncsn1_TAG20061112T165018_2ofr3hfo_.bkp
  Control File Included: Ckp SCN: 565683       Ckp time: 12-NOV-06
  SPFILE Included: Modification time: 12-NOV-06

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
83      Incr 1  968.00K    DISK        00:00:24     12-NOV-06      
        BP Key: 83   Status: AVAILABLE  Compressed: YES  Tag: TAG20061112T165444
        Piece Name: /u01/app/oracle/flash_recovery_area/TEST3/backupset/2006_11_12/o1_mf_nnnd1_TAG20061112T165444_2ofrbo4m_.bkp
  List of Datafiles in backup set 83
  File LV Type Ckp SCN    Ckp Time  Name
  ---- -- ---- ---------- --------- ----
  1    1  Incr 565890     12-NOV-06 /u01/app/oracle/oradata/test3/system01.dbf
  2    1  Incr 565890     12-NOV-06 /u01/app/oracle/oradata/test3/undotbs01.dbf
  3    1  Incr 565890     12-NOV-06 /u01/app/oracle/oradata/test3/sysaux01.dbf
  4    1  Incr 565890     12-NOV-06 /u01/app/oracle/oradata/test3/users01.dbf
  5    1  Incr 565890     12-NOV-06 /u01/app/oracle/oradata/test3/idx01.dbf
  6    1  Incr 565890     12-NOV-06 /u01/app/oracle/oradata/test3/test01.dbf

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
84      Incr 1  1.06M      DISK        00:00:01     12-NOV-06      
        BP Key: 84   Status: AVAILABLE  Compressed: YES  Tag: TAG20061112T165444
        Piece Name: /u01/app/oracle/flash_recovery_area/TEST3/backupset/2006_11_12/o1_mf_ncsn1_TAG20061112T165444_2ofrchdx_.bkp
  Control File Included: Ckp SCN: 565903       Ckp time: 12-NOV-06
  SPFILE Included: Modification time: 12-NOV-06

RMAN> list copy;


List of Datafile Copies
Key     File S Completion Time Ckp SCN    Ckp Time        Name
------- ---- - --------------- ---------- --------------- ----
82      1    A 12-NOV-06       565890     12-NOV-06       /u01/app/oracle/flash_recovery_area/TEST3/datafile/o1_mf_system_2ofqsgtz_.dbf
78      2    A 12-NOV-06       565890     12-NOV-06       /u01/app/oracle/flash_recovery_area/TEST3/datafile/o1_mf_undotbs1_2ofqtlcz_.dbf
81      3    A 12-NOV-06       565890     12-NOV-06       /u01/app/oracle/flash_recovery_area/TEST3/datafile/o1_mf_sysaux_2ofqt35h_.dbf
79      4    A 12-NOV-06       565890     12-NOV-06       /u01/app/oracle/flash_recovery_area/TEST3/datafile/o1_mf_users_2ofqtodr_.dbf
80      5    A 12-NOV-06       565890     12-NOV-06       /u01/app/oracle/flash_recovery_area/TEST3/datafile/o1_mf_idx_2ofqtrhz_.dbf
77      6    A 12-NOV-06       565890     12-NOV-06       /u01/app/oracle/flash_recovery_area/TEST3/datafile/o1_mf_test_2ofqtvlv_.dbf

List of Archived Log Copies
Key     Thrd Seq     S Low Time  Name
------- ---- ------- - --------- ----
76      1    55      A 12-NOV-06 /u01/app/oracle/arch/test3/arch011_55_602911897.dbf
77      1    56      A 12-NOV-06 /u01/app/oracle/arch/test3/arch011_56_602911897.dbf
78      1    57      A 12-NOV-06 /u01/app/oracle/arch/test3/arch011_57_602911897.dbf

论坛徽章:
0
5 [报告]
发表于 2006-11-16 13:19 |只看该作者
关闭数据库,删除所有的datafiles

RMAN> startup mount;

Oracle instance started
database mounted

Total System Global Area     104857600 bytes

Fixed Size                     2018872 bytes
Variable Size                 83886536 bytes
Database Buffers              16777216 bytes
Redo Buffers                   2174976 bytes

RMAN> restore database;

Starting restore at 12-NOV-06
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=57 devtype=DISK

channel ORA_DISK_1: restoring datafile 00001
input datafile copy recid=82 stamp=606329742 filename=/u01/app/oracle/flash_recovery_area/TEST3/datafile/o1_mf_system_2ofqsgtz_.dbf
destination for restore of datafile 00001: /u01/app/oracle/oradata/test3/system01.dbf
channel ORA_DISK_1: copied datafile copy of datafile 00001
output filename=/u01/app/oracle/oradata/test3/system01.dbf recid=83 stamp=606329909
channel ORA_DISK_1: restoring datafile 00002
input datafile copy recid=78 stamp=606329742 filename=/u01/app/oracle/flash_recovery_area/TEST3/datafile/o1_mf_undotbs1_2ofqtlcz_.dbf
destination for restore of datafile 00002: /u01/app/oracle/oradata/test3/undotbs01.dbf
channel ORA_DISK_1: copied datafile copy of datafile 00002
output filename=/u01/app/oracle/oradata/test3/undotbs01.dbf recid=84 stamp=606329914
channel ORA_DISK_1: restoring datafile 00003
input datafile copy recid=81 stamp=606329742 filename=/u01/app/oracle/flash_recovery_area/TEST3/datafile/o1_mf_sysaux_2ofqt35h_.dbf
destination for restore of datafile 00003: /u01/app/oracle/oradata/test3/sysaux01.dbf
channel ORA_DISK_1: copied datafile copy of datafile 00003
output filename=/u01/app/oracle/oradata/test3/sysaux01.dbf recid=85 stamp=606329926
channel ORA_DISK_1: restoring datafile 00004
input datafile copy recid=79 stamp=606329742 filename=/u01/app/oracle/flash_recovery_area/TEST3/datafile/o1_mf_users_2ofqtodr_.dbf
destination for restore of datafile 00004: /u01/app/oracle/oradata/test3/users01.dbf
channel ORA_DISK_1: copied datafile copy of datafile 00004
output filename=/u01/app/oracle/oradata/test3/users01.dbf recid=86 stamp=606329931
channel ORA_DISK_1: restoring datafile 00005
input datafile copy recid=80 stamp=606329742 filename=/u01/app/oracle/flash_recovery_area/TEST3/datafile/o1_mf_idx_2ofqtrhz_.dbf
destination for restore of datafile 00005: /u01/app/oracle/oradata/test3/idx01.dbf
channel ORA_DISK_1: copied datafile copy of datafile 00005
output filename=/u01/app/oracle/oradata/test3/idx01.dbf recid=87 stamp=606329934
channel ORA_DISK_1: restoring datafile 00006
input datafile copy recid=77 stamp=606329742 filename=/u01/app/oracle/flash_recovery_area/TEST3/datafile/o1_mf_test_2ofqtvlv_.dbf
destination for restore of datafile 00006: /u01/app/oracle/oradata/test3/test01.dbf
channel ORA_DISK_1: copied datafile copy of datafile 00006
output filename=/u01/app/oracle/oradata/test3/test01.dbf recid=88 stamp=606329936
Finished restore at 12-NOV-06

RMAN> recover database;

Starting recover at 12-NOV-06
using channel ORA_DISK_1

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

Finished recover at 12-NOV-06

[ 本帖最后由 numenhuang 于 2006-11-16 13:20 编辑 ]

论坛徽章:
0
6 [报告]
发表于 2006-11-16 13:27 |只看该作者
个人简单小结:
1. rman的增量合并是基于datafile copy和incremental backup之上的.如果执行backup incremental时候,没有datafile copy存在,则系统自动作一次datafile copy.所以在这种情况下 backup incremental level 0就可有可无了. datafile copy就是作为level 0的backup.

2. 增量备份做好以后,通过执行recover copy of database with tag 将增量备份记录的change应用到datafile copy中去.这样在recover的时候就不需要增量备份,只需要datafile copy和archived logs.

论坛徽章:
0
7 [报告]
发表于 2006-11-16 13:59 |只看该作者
顶!

论坛徽章:
0
8 [报告]
发表于 2006-11-16 17:01 |只看该作者
谢谢分享,支持

论坛徽章:
0
9 [报告]
发表于 2006-11-17 14:40 |只看该作者
原帖由 numenhuang 于 2006-11-16 13:27 发表
个人简单小结:
1. rman的增量合并是基于datafile copy和incremental backup之上的.如果执行backup incremental时候,没有datafile copy存在,则系统自动作一次datafile copy.所以在这种情况下 backup incremental  ...




恩,

其实以后执行此命令只用执行backup incremental level 1即可,后面的部分其实是没用的,经过测试,即使每次都执行后面的for字句,也不会自动的合并增量到level 0的备份。

最后还要执行recover copy of database with tag level_0;才能把每次的增量合并到level 0中。
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP