ITPub博客

首页 > 数据库 > Oracle > 由某公司案例进一步掌握rman备份与恢复backup restore recovery系列一

由某公司案例进一步掌握rman备份与恢复backup restore recovery系列一

原创 Oracle 作者:wisdomone1 时间:2015-12-10 00:43:32 0 删除 编辑

结论

1,数据库测试环境为10.2.0.5
2,dba_segments可以反映数据库实时大小的变化
3, v$rman_output记录RMAN客户端连接到数据库形成的数据库会话,经测发现RMAN客户端连接会形成2个会话,在备份会增加到3个会话
4,官方说,RMAN的备份不能跨操作系统平台,但可以跨数据库版本,可见RMAN备份也不能万能的,如果跨平台恢复采用什么技术呢,是EXPDP还是OGG,
   也是我们要考虑的因素


5,如果在RMAN备份后,变更DB_NAME仍可以用于恢复数据库,可见DBID才是确认数据库备份集唯一的标识
6,数据库的0级增量备份等同于全库备份,不过前者是增量备份的基础,而后者不是
7,1级增量备份只会备份数据库变更的数据块,它又分为累积备份或者差异备份


先说累积备份,它只会备份自最近一次0级增量备份后发生变化的数据块


再看差异备份,它只会备份自最近一次0级增量备份或最近一次1级增量备份,发生变化的数据块


而且可以在主备库(DATA GUARD),可以把在备库的1级备份应用到主库的0级备份上,或者在主库把1级备份应用到备库的0级备份上
,可见在DG环境下,备份是可以互用的




8,0级增量备份可以是镜像备份,也可以是备份集,但是1级增量备份只能是备份集


9,经查官方及测试,只能对数据文件,或数据文件镜像或控制文件进行镜像COPY,而不能对整个数据库进行镜像COPY,且镜像COPY某个数据文件,会同时COPY控制文件,所以创建的文件名要是一个变量名称,而不能固定文件名称
RMAN> backup as copy  datafile 1 format '/home/ora10g/nettest/file1_copy';




测试



SQL> select * from v$version where rownum=1;


BANNER
----------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bi


SQL> select sum(bytes/1024/1024/1024) as total_db_gb from dba_segments;


TOTAL_DB_GB
-----------
 .553833008






SQL> show user
USER is "SCOTT"


SQL> create table t_rman(a int);


Table created.


SQL> insert into t_rman select level from dual connect by level<=1000000;


1000000 rows created.


SQL> commit;


Commit complete.


SQL> insert into t_rman select level from dual connect by level<=1000000;


1000000 rows created.


SQL> commit;


Commit complete.


---可见dba_segments是实时反映数据库的大小的
SQL> select sum(bytes/1024/1024/1024) as total_db_gb from dba_segments;


TOTAL_DB_GB
-----------
 .587341309




---为了方便,加大数据量到1G左右
SQL> create table t_rman_2 as select * from t_rman;


Table created.


SQL> create table t_rman_3 as select * from t_rman;


Table created.


SQL> create table t_rman_4 as select * from t_rman;


Table created.




SQL> select sum(bytes/1024/1024/1024) as total_db_gb from dba_segments;


TOTAL_DB_GB
-----------
 1.01141357 


---官方说,RMAN不会备份BFILE的表
SQL> conn scott/system
Connected.
SQL> create table t_bfile(a bfile);


Table created.


SQL> conn scott/system
Connected.


---bfile列查询会报错,不能直接查询
SQL> select * from t_bfile;
SP2-0678: Column or attribute type can not be displayed by SQL*Plus
SQL> select count(*) from t_bfile;


  COUNT(*)
----------
         0


SQL> select file#,name from v$datafile;


     FILE# NAME
---------- --------------------------------------------------
         1 /home/ora10g/asia/asia/system01.dbf
         2 /home/ora10g/asia/asia/undotbs01.dbf
         3 /home/ora10g/asia/asia/sysaux01.dbf
         4 /home/ora10g/asia/asia/users01.dbf


RMAN>  backup datafile 4 format '/home/ora10g/nettest/file4_bak%u_%s.bak';


Starting backup at 07-DEC-15
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=143 devtype=DISK
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00004 name=/home/ora10g/asia/asia/users01.dbf
channel ORA_DISK_1: starting piece 1 at 07-DEC-15
channel ORA_DISK_1: finished piece 1 at 07-DEC-15
piece handle=/home/ora10g/nettest/file4_bak02qo72vs_2.bak tag=TAG20151207T083820 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:35
Finished backup at 07-DEC-15




---学习下v$rman_output
SQL> desc v$rman_output;
 Name                                      Null?    Type
 ----------------------------------------- -------- ----------------------------
 SID                                                NUMBER
 RECID                                              NUMBER
 STAMP                                              NUMBER
 SESSION_RECID                                      NUMBER
 SESSION_STAMP                                      NUMBER
 OUTPUT                                             VARCHAR2(130)
 RMAN_STATUS_RECID                                  NUMBER
 RMAN_STATUS_STAMP                                  NUMBER
 SESSION_KEY                                        NUMBER




SQL> select sid,recid,session_recid from v$rman_output;


       SID      RECID SESSION_RECID
---------- ---------- -------------
       145          1             4
       145          2             4
       145          3             4
       145          4             4
       145          5             4
       145          6             4
       145          7             4
       145          8             4
       145          9             4
       145         10             4
       145         11             4


       SID      RECID SESSION_RECID
---------- ---------- -------------
       145         12             4
       145         13             4
       145         14             4
       145         15             4
       145         16             4


16 rows selected.


SQL> select sid,program,event from v$session where type='USER';


       SID PROGRAM                                          EVENT
---------- ------------------------------------------------ --------------------------------------------------
       159 sqlplus@seconary (TNS V1-V3)                     SQL*Net message to client




[ora10g@seconary 10garch]$ rman target /


Recovery Manager: Release 10.2.0.5.0 - Production on Mon Dec 7 10:55:03 2015


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


connected to target database: ASIA (DBID=1160891135)


RMAN> 


---可会一个RMAN连接会产生2个ORACLE会话
SQL> select sid,program,event from v$session where type='USER';


       SID PROGRAM                                          EVENT
---------- ------------------------------------------------ --------------------------------------------------
       143 rman@seconary (TNS V1-V3)                        SQL*Net message from client
       144 rman@seconary (TNS V1-V3)                        SQL*Net message from client
       159 sqlplus@seconary (TNS V1-V3)                     SQL*Net message to client       


RMAN> backup datafile 4 format '/home/ora10g/nettest/file4_bak%u_%s.bak';


Starting backup at 07-DEC-15
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=145 devtype=DISK
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00004 name=/home/ora10g/asia/asia/users01.dbf
channel ORA_DISK_1: starting piece 1 at 07-DEC-15


---可见开始RMAN备份时,相应会话会增加到3个
SQL> select sid,program,event from v$session where type='USER';


       SID PROGRAM                                          EVENT
---------- ------------------------------------------------ --------------------------------------------------
       143 rman@seconary (TNS V1-V3)                        SQL*Net message from client
       144 rman@seconary (TNS V1-V3)                        SQL*Net message from client
       145 rman@seconary (TNS V1-V3)                        RMAN backup & recovery I/O
       159 sqlplus@seconary (TNS V1-V3)                     SQL*Net message to client


input datafile fno=00004 name=/home/ora10g/asia/asia/users01.dbf
channel ORA_DISK_1: starting piece 1 at 07-DEC-15
channel ORA_DISK_1: finished piece 1 at 07-DEC-15
piece handle=/home/ora10g/nettest/file4_bak03qo7b1h_3.bak tag=TAG20151207T105545 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:26
Finished backup at 07-DEC-15


---可见RMAN备份完,还是之前的3个会话
SQL> select sid,program,event from v$session where type='USER';


       SID PROGRAM                                          EVENT
---------- ------------------------------------------------ --------------------------------------------------
       143 rman@seconary (TNS V1-V3)                        SQL*Net message from client
       144 rman@seconary (TNS V1-V3)                        SQL*Net message from client
       145 rman@seconary (TNS V1-V3)                        SQL*Net message from client
       159 sqlplus@seconary (TNS V1-V3)                     SQL*Net message to client


---可见上述的RMAN会话会在v$rman_output反应记录来,且每个rman会话会对应多条记录,好像还有一个RMAN会话没有存储在V$RMAN_output中
SQL> select sid,recid,session_recid from v$rman_output where sid in (143,144,145) order by 1,2;


       SID      RECID SESSION_RECID
---------- ---------- -------------
       143         20             6
       143         21             6
       143         22             6
       143         23             6
       143         24             6
       143         25             7
       143         26             7
       143         27             7
       143         28             7
       143         29             7
       143         30             7


       SID      RECID SESSION_RECID
---------- ---------- -------------
       143         31             7
       143         32             7
       143         33             7
       143         34             7
       143         35             7
       143         36             7
       143         37             7
       143         38             7
       143         39             7
       143         40             7
       145          1             4


       SID      RECID SESSION_RECID
---------- ---------- -------------
       145          2             4
       145          3             4
       145          4             4
       145          5             4
       145          6             4
       145          7             4
       145          8             4
       145          9             4
       145         10             4
       145         11             4
       145         12             4


       SID      RECID SESSION_RECID
---------- ---------- -------------
       145         13             4
       145         14             4
       145         15             4
       145         16             4
       145         17             4
       145         18             4
       145         19             4


40 rows selected.










---数据库的0级增量备份等同于全库备份,不过前者是增量备份的基础,而后者不是
RMAN> backup incremental level 0 database format '/home/ora10g/nettest/db_incre_level_0_%u_%s.bak';


Starting backup at 07-DEC-15
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=143 devtype=DISK
channel ORA_DISK_1: starting incremental level 0 datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00004 name=/home/ora10g/asia/asia/users01.dbf
input datafile fno=00001 name=/home/ora10g/asia/asia/system01.dbf
input datafile fno=00002 name=/home/ora10g/asia/asia/undotbs01.dbf
input datafile fno=00003 name=/home/ora10g/asia/asia/sysaux01.dbf
channel ORA_DISK_1: starting piece 1 at 07-DEC-15
channel ORA_DISK_1: finished piece 1 at 07-DEC-15
piece handle=/home/ora10g/nettest/db_incre_level_0_04qo7djd_4.bak tag=TAG20151207T113925 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:01:26
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 07-DEC-15
channel ORA_DISK_1: finished piece 1 at 07-DEC-15
piece handle=/home/ora10g/nettest/db_incre_level_0_05qo7dm3_5.bak tag=TAG20151207T113925 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:03
Finished backup at 07-DEC-15




---1级增量备份只会备份数据库变更的数据块,它又分为累积备份或者差异备份


先说累积备份,它只会备份自最近一次0级增量备份后发生变化的数据块


再看差异备份,它只会备份自最近一次0级增量备份或最近一次1级增量备份,发生变化的数据块


而且可以在主备库(DATA GUARD),可以把在备库的1级备份应用到主库的0级备份上,或者在主库把1级备份应用到备库的0级备份上
,可见在DG环境下,备份是可以互用的




---0级增量备份可以是镜像备份,也可以是备份集,但是1级增量备份只能是备份集


---基于上述的测试环境继续,下为0级增量备份后(以备份集方式进行)进行数据库变操作


RMAN> list backup of database;




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


BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
1       Full    458.08M    DISK        00:00:28     07-DEC-15      
        BP Key: 1   Status: AVAILABLE  Compressed: NO  Tag: TAG20151207T083820
        Piece Name: /home/ora10g/nettest/file4_bak02qo72vs_2.bak
  List of Datafiles in backup set 1
  File LV Type Ckp SCN    Ckp Time  Name
  ---- -- ---- ---------- --------- ----
  4       Full 4295373387 07-DEC-15 /home/ora10g/asia/asia/users01.dbf


BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
2       Full    458.08M    DISK        00:00:24     07-DEC-15      
        BP Key: 2   Status: AVAILABLE  Compressed: NO  Tag: TAG20151207T105545
        Piece Name: /home/ora10g/nettest/file4_bak03qo7b1h_3.bak
  List of Datafiles in backup set 2
  File LV Type Ckp SCN    Ckp Time  Name
  ---- -- ---- ---------- --------- ----
  4       Full 4295376855 07-DEC-15 /home/ora10g/asia/asia/users01.dbf


BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
3       Incr 0  873.69M    DISK        00:01:17     07-DEC-15      
        BP Key: 3   Status: AVAILABLE  Compressed: NO  Tag: TAG20151207T113925
        Piece Name: /home/ora10g/nettest/db_incre_level_0_04qo7djd_4.bak
  List of Datafiles in backup set 3
  File LV Type Ckp SCN    Ckp Time  Name
  ---- -- ---- ---------- --------- ----
  1    0  Incr 4295377930 07-DEC-15 /home/ora10g/asia/asia/system01.dbf
  2    0  Incr 4295377930 07-DEC-15 /home/ora10g/asia/asia/undotbs01.dbf
  3    0  Incr 4295377930 07-DEC-15 /home/ora10g/asia/asia/sysaux01.dbf
  4    0  Incr 4295377930 07-DEC-15 /home/ora10g/asia/asia/users01.dbf


SQL> create table t_diff(a int);


Table created.


SQL> insert into t_diff values(1);


1 row created.


SQL> commit;


Commit complete.




RMAN> backup cumulative  incremental level 1 database format '/home/ora10g/nettest/db_incre_level_0_%u_%s.bak';


Starting backup at 07-DEC-15
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=00004 name=/home/ora10g/asia/asia/users01.dbf
input datafile fno=00001 name=/home/ora10g/asia/asia/system01.dbf
input datafile fno=00002 name=/home/ora10g/asia/asia/undotbs01.dbf
input datafile fno=00003 name=/home/ora10g/asia/asia/sysaux01.dbf
channel ORA_DISK_1: starting piece 1 at 07-DEC-15
channel ORA_DISK_1: finished piece 1 at 07-DEC-15
piece handle=/home/ora10g/nettest/db_incre_level_0_06qo7gr9_6.bak tag=TAG20151207T123449 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:55
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 07-DEC-15
channel ORA_DISK_1: finished piece 1 at 07-DEC-15
piece handle=/home/ora10g/nettest/db_incre_level_0_07qo7gt0_7.bak tag=TAG20151207T123449 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:03
Finished backup at 07-DEC-15




RMAN> list backup of database;




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


BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
1       Full    458.08M    DISK        00:00:28     07-DEC-15      
        BP Key: 1   Status: AVAILABLE  Compressed: NO  Tag: TAG20151207T083820
        Piece Name: /home/ora10g/nettest/file4_bak02qo72vs_2.bak
  List of Datafiles in backup set 1
  File LV Type Ckp SCN    Ckp Time  Name
  ---- -- ---- ---------- --------- ----
  4       Full 4295373387 07-DEC-15 /home/ora10g/asia/asia/users01.dbf


BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
2       Full    458.08M    DISK        00:00:24     07-DEC-15      
        BP Key: 2   Status: AVAILABLE  Compressed: NO  Tag: TAG20151207T105545
        Piece Name: /home/ora10g/nettest/file4_bak03qo7b1h_3.bak
  List of Datafiles in backup set 2
  File LV Type Ckp SCN    Ckp Time  Name
  ---- -- ---- ---------- --------- ----
  4       Full 4295376855 07-DEC-15 /home/ora10g/asia/asia/users01.dbf


BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
3       Incr 0  873.69M    DISK        00:01:17     07-DEC-15      
        BP Key: 3   Status: AVAILABLE  Compressed: NO  Tag: TAG20151207T113925
        Piece Name: /home/ora10g/nettest/db_incre_level_0_04qo7djd_4.bak
  List of Datafiles in backup set 3
  File LV Type Ckp SCN    Ckp Time  Name
  ---- -- ---- ---------- --------- ----
  1    0  Incr 4295377930 07-DEC-15 /home/ora10g/asia/asia/system01.dbf
  2    0  Incr 4295377930 07-DEC-15 /home/ora10g/asia/asia/undotbs01.dbf
  3    0  Incr 4295377930 07-DEC-15 /home/ora10g/asia/asia/sysaux01.dbf
  4    0  Incr 4295377930 07-DEC-15 /home/ora10g/asia/asia/users01.dbf


BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------    ---这个就是上述新增的1级累积增量备份集
5       Incr 1  2.76M      DISK        00:00:54     07-DEC-15      
        BP Key: 5   Status: AVAILABLE  Compressed: NO  Tag: TAG20151207T123449
        Piece Name: /home/ora10g/nettest/db_incre_level_0_06qo7gr9_6.bak
  List of Datafiles in backup set 5
  File LV Type Ckp SCN    Ckp Time  Name
  ---- -- ---- ---------- --------- ----
  1    1  Incr 4295379258 07-DEC-15 /home/ora10g/asia/asia/system01.dbf
  2    1  Incr 4295379258 07-DEC-15 /home/ora10g/asia/asia/undotbs01.dbf
  3    1  Incr 4295379258 07-DEC-15 /home/ora10g/asia/asia/sysaux01.dbf
  4    1  Incr 4295379258 07-DEC-15 /home/ora10g/asia/asia/users01.dbf




---现在我们删除所有的数据库备份集,然后开始测试0级增量备份采用镜像备份方式进行
RMAN> delete noprompt backup of database;


using channel ORA_DISK_1


List of Backup Pieces
BP Key  BS Key  Pc# Cp# Status      Device Type Piece Name
------- ------- --- --- ----------- ----------- ----------
1       1       1   1   AVAILABLE   DISK        /home/ora10g/nettest/file4_bak02qo72vs_2.bak
2       2       1   1   AVAILABLE   DISK        /home/ora10g/nettest/file4_bak03qo7b1h_3.bak
3       3       1   1   AVAILABLE   DISK        /home/ora10g/nettest/db_incre_level_0_04qo7djd_4.bak
5       5       1   1   AVAILABLE   DISK        /home/ora10g/nettest/db_incre_level_0_06qo7gr9_6.bak
deleted backup piece
backup piece handle=/home/ora10g/nettest/file4_bak02qo72vs_2.bak recid=1 stamp=897813500
deleted backup piece
backup piece handle=/home/ora10g/nettest/file4_bak03qo7b1h_3.bak recid=2 stamp=897821745
deleted backup piece
backup piece handle=/home/ora10g/nettest/db_incre_level_0_04qo7djd_4.bak recid=3 stamp=897824365
deleted backup piece
backup piece handle=/home/ora10g/nettest/db_incre_level_0_06qo7gr9_6.bak recid=5 stamp=897827689
Deleted 4 objects


---crosscheck试用场景,还要进一步理解,掌握不足
RMAN> crosscheck backup of database;


using channel ORA_DISK_1


RMAN> crosscheck backupset;


using channel ORA_DISK_1
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/home/ora10g/nettest/db_incre_level_0_05qo7dm3_5.bak recid=4 stamp=897824453
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/home/ora10g/nettest/db_incre_level_0_07qo7gt0_7.bak recid=6 stamp=897827746
Crosschecked 2 objects




SQL> select file#,name from v$datafile;


     FILE# NAME
---------- --------------------------------------------------
         1 /home/ora10g/asia/asia/system01.dbf
         2 /home/ora10g/asia/asia/undotbs01.dbf
         3 /home/ora10g/asia/asia/sysaux01.dbf
         4 /home/ora10g/asia/asia/users01.dbf


---经查官方及测试,只能对数据文件,或数据文件镜像或控制文件进行镜像COPY,而不能对整个数据库进行镜像COPY,且镜像COPY某个数据文件,会同时COPY控制文件,所以创建的文件名要是一个变量名称,而不能固定文件名称
RMAN> backup as copy  datafile 1 format '/home/ora10g/nettest/file1_copy';


Starting backup at 07-DEC-15
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
input datafile fno=00001 name=/home/ora10g/asia/asia/system01.dbf
output filename=/home/ora10g/nettest/file1_copy tag=TAG20151207T125850 recid=1 stamp=897829151
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:25
channel ORA_DISK_1: starting datafile copy
copying current control file
RMAN-03009: failure of backup command on ORA_DISK_1 channel at 12/07/2015 12:59:15
ORA-01580: error creating control backup file /home/ora10g/nettest/file1_copy
ORA-27038: created file already exists
Additional information: 1
continuing other job steps, job failed will not be re-run
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
including current SPFILE in backupset
channel ORA_DISK_1: starting piece 1 at 07-DEC-15
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03009: failure of backup command on ORA_DISK_1 channel at 12/07/2015 12:59:18
ORA-19504: failed to create file "/home/ora10g/nettest/file1_copy"
ORA-27038: created file already exists
Additional information: 1




RMAN> backup as copy  datafile 1 format '/home/ora10g/nettest/file1_copy_%u_%s.bak';


Starting backup at 07-DEC-15
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
input datafile fno=00001 name=/home/ora10g/asia/asia/system01.dbf
output filename=/home/ora10g/nettest/file1_copy_0dqo7iet_13.bak tag=TAG20151207T130221 recid=2 stamp=897829361
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:25
channel ORA_DISK_1: starting datafile copy
copying current control file
output filename=/home/ora10g/nettest/file1_copy_0eqo7ifm_14.bak tag=TAG20151207T130221 recid=3 stamp=897829367
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
including current SPFILE in backupset
channel ORA_DISK_1: starting piece 1 at 07-DEC-15
channel ORA_DISK_1: finished piece 1 at 07-DEC-15
piece handle=/home/ora10g/nettest/file1_copy_0fqo7ifn_15.bak tag=TAG20151207T130221 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02
Finished backup at 07-DEC-15


--可见list backup of database只会显示备份集文件,而不会显示镜像COPY文件
RMAN> list backup of database;


--如下 显示镜像COPY文件
RMAN> list copy of database;




List of Datafile Copies
Key     File S Completion Time Ckp SCN    Ckp Time        Name
------- ---- - --------------- ---------- --------------- ----
2       1    A 07-DEC-15       4295379983 07-DEC-15       /home/ora10g/nettest/file1_copy_0dqo7iet_13.bak
1       1    A 07-DEC-15       4295379848 07-DEC-15       /home/ora10g/nettest/file1_copy


RMAN> list copy of datafile 1;




List of Datafile Copies
Key     File S Completion Time Ckp SCN    Ckp Time        Name
------- ---- - --------------- ---------- --------------- ----
2       1    A 07-DEC-15       4295379983 07-DEC-15       /home/ora10g/nettest/file1_copy_0dqo7iet_13.bak
1       1    A 07-DEC-15       4295379848 07-DEC-15       /home/ora10g/nettest/file1_copy




RMAN> backup as copy  datafile 2 format '/home/ora10g/nettest/file2_copy_%u_%s.bak';


Starting backup at 07-DEC-15
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
input datafile fno=00002 name=/home/ora10g/asia/asia/undotbs01.dbf
output filename=/home/ora10g/nettest/file2_copy_0gqo7ijr_16.bak tag=TAG20151207T130458 recid=4 stamp=897829514
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:25
Finished backup at 07-DEC-15


RMAN> backup as copy  datafile 3 format '/home/ora10g/nettest/file3_copy_%u_%s.bak';


Starting backup at 07-DEC-15
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
input datafile fno=00003 name=/home/ora10g/asia/asia/sysaux01.dbf
output filename=/home/ora10g/nettest/file3_copy_0hqo7ilk_17.bak tag=TAG20151207T130556 recid=5 stamp=897829566
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:15
Finished backup at 07-DEC-15


RMAN> backup as copy  datafile 4 format '/home/ora10g/nettest/file4_copy_%u_%s.bak';


Starting backup at 07-DEC-15
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
input datafile fno=00004 name=/home/ora10g/asia/asia/users01.dbf
output filename=/home/ora10g/nettest/file4_copy_0iqo7imq_18.bak tag=TAG20151207T130634 recid=6 stamp=897829613
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:25
Finished backup at 07-DEC-15


---可见0级增量备份也可以是每个数据文件的镜像COPY
RMAN> backup incremental level 1 cumulative database format '/home/ora10g/nettest/db_incre_level_0_%u_%s.bak';


Starting backup at 07-DEC-15
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=00004 name=/home/ora10g/asia/asia/users01.dbf
input datafile fno=00001 name=/home/ora10g/asia/asia/system01.dbf
input datafile fno=00002 name=/home/ora10g/asia/asia/undotbs01.dbf
input datafile fno=00003 name=/home/ora10g/asia/asia/sysaux01.dbf
channel ORA_DISK_1: starting piece 1 at 07-DEC-15
channel ORA_DISK_1: finished piece 1 at 07-DEC-15
piece handle=/home/ora10g/nettest/db_incre_level_0_0jqo7ipo_19.bak tag=TAG20151207T130808 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:02:36
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 07-DEC-15
channel ORA_DISK_1: finished piece 1 at 07-DEC-15
piece handle=/home/ora10g/nettest/db_incre_level_0_0kqo7iuk_20.bak tag=TAG20151207T130808 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02
Finished backup at 07-DEC-15


RMAN> list backup of database;




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


BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
10      Incr 1  1.15G      DISK        00:02:34     07-DEC-15      
        BP Key: 10   Status: AVAILABLE  Compressed: NO  Tag: TAG20151207T130808
        Piece Name: /home/ora10g/nettest/db_incre_level_0_0jqo7ipo_19.bak
  List of Datafiles in backup set 10
  File LV Type Ckp SCN    Ckp Time  Name
  ---- -- ---- ---------- --------- ----
  1    1  Incr 4295380246 07-DEC-15 /home/ora10g/asia/asia/system01.dbf
  2    1  Incr 4295380246 07-DEC-15 /home/ora10g/asia/asia/undotbs01.dbf
  3    1  Incr 4295380246 07-DEC-15 /home/ora10g/asia/asia/sysaux01.dbf
  4    1  Incr 4295380246 07-DEC-15 /home/ora10g/asia/asia/users01.dbf














来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/9240380/viewspace-1869434/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
提供针对oracle初学者及进阶的数据库培训,欢迎大家咨询: 微信: wisdomone 微信公众号: lovedb qq: 305076427 微博: wisdomone9

注册时间:2008-04-04

  • 博文量
    2149
  • 访问量
    11893166