由某公司案例進一步掌握rman備份與恢復backup restore recovery系列一

wisdomone1發表於2015-12-10

結論

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/,如需轉載,請註明出處,否則將追究法律責任。

相關文章