Bo's Oracle Station

查看: 1690|回复: 0

活动第23/24次(2018-06-02星期六上下午)

[复制链接]

1005

主题

1469

帖子

1万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
12012
发表于 2018-6-2 09:51:03 | 显示全部楼层 |阅读模式
做recovery catalog的流程:
  1. --SYS
  2. select * from  dba_tablespaces;

  3. create tablespace rcat datafile size 50M autoextend on  maxsize 3G;

  4. create user u87 identified by oracle_4U default tablespace rcat
  5.   quota unlimited on rcat;
  6.   
  7. grant recovery_catalog_owner to u87;
复制代码
  1. --U87
  2. select  * from tab;
复制代码
是空的。
  1. [oracle@station87 admin]$ rman catalog  u87/oracle_4U@orcl90

  2. Recovery Manager: Release 11.2.0.1.0 - Production on Sat Jun 2 09:38:41 2018

  3. Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.


  4. connected to recovery catalog database

  5. RMAN>
  6. RMAN> create catalog ;

  7. recovery catalog created

  8. RMAN>
复制代码
  1. --U87
  2. select * from tab;
复制代码
就有了142个空的表和视图以及一些程序。这些就叫资料档案库。
  1. --U87
  2. select  * from db;
复制代码
空的。

  1. [oracle@station87 admin]$ rman   target  / catalog  u87/oracle_4U@orcl90

  2. Recovery Manager: Release 11.2.0.1.0 - Production on Sat Jun 2 09:42:55 2018

  3. Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

  4. connected to target database: ORCL (DBID=1359978017)
  5. connected to recovery catalog database

  6. RMAN> register database;

  7. database registered in recovery catalog
  8. starting full resync of recovery catalog
  9. full resync complete

  10. RMAN>
复制代码

a.png

这是目标数据库的控制文件:

b.png

这是复制了目标数据库控制文件信息后的CATALOG机器上U87的自己的表:

c.png

结论:本地的V$...变成远程的RC...,但是在RC...中为了保持多个注册数据库备份信息的唯一性,备份集号会重新编号:
d.png

  1. [oracle@station87 admin]$ rman   target  / catalog  u87/oracle_4U@orcl90

  2. Recovery Manager: Release 11.2.0.1.0 - Production on Sat Jun 2 09:42:55 2018

  3. Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

  4. connected to target database: ORCL (DBID=1359978017)
  5. connected to recovery catalog database

  6. RMAN> register database;

  7. database registered in recovery catalog
  8. starting full resync of recovery catalog
  9. full resync complete

  10. RMAN> exit


  11. Recovery Manager complete.
  12. [oracle@station87 admin]$ rman   target  / catalog  u87/oracle_4U@orcl90

  13. Recovery Manager: Release 11.2.0.1.0 - Production on Sat Jun 2 09:52:45 2018

  14. Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

  15. connected to target database: ORCL (DBID=1359978017)
  16. connected to recovery catalog database

  17. RMAN> resync catalog;

  18. starting full resync of recovery catalog
  19. full resync complete

  20. RMAN> list backup;


  21. List of Backup Sets
  22. ===================


  23. BS Key  Size       Device Type Elapsed Time Completion Time
  24. ------- ---------- ----------- ------------ ---------------
  25. 77      23.50M     DISK        00:00:06     22-NOV-13      
  26.         BP Key: 88   Status: AVAILABLE  Compressed: NO  Tag: 1D_WHOLE_FULL
  27.         Piece Name: +FRA/orcl/backupset/2013_11_22/annnf0_1d_whole_full_0.261.832198953

  28.   List of Archived Logs in backup set 77
  29.   Thrd Seq     Low SCN    Low Time  Next SCN   Next Time
  30.   ---- ------- ---------- --------- ---------- ---------
  31.   1    6       838362     22-NOV-13 846906     22-NOV-13

  32. BS Key  Type LV Size       Device Type Elapsed Time Completion Time
  33. ------- ---- -- ---------- ----------- ------------ ---------------
  34. 78      Full    69.00M     DISK        00:00:59     22-NOV-13      
  35.         BP Key: 89   Status: AVAILABLE  Compressed: NO  Tag: 1D_WHOLE_FULL
  36.         Piece Name: +FRA/orcl/backupset/2013_11_22/nnndf0_1d_whole_full_0.264.832198977
  37.   List of Datafiles in backup set 78
  38.   File LV Type Ckp SCN    Ckp Time  Name
  39.   ---- -- ---- ---------- --------- ----
  40.   5       Full 847289     22-NOV-13 +DATA/orcl/datafile/example.265.832197353

  41. BS Key  Type LV Size       Device Type Elapsed Time Completion Time
  42. ------- ---- -- ---------- ----------- ------------ ---------------
  43. 79      Full    88.20M     DISK        00:01:18     22-NOV-13      
  44.         BP Key: 90   Status: AVAILABLE  Compressed: NO  Tag: 1D_WHOLE_FULL
  45.         Piece Name: +FRA/orcl/backupset/2013_11_22/nnndf0_1d_whole_full_0.265.832198999
  46.   List of Datafiles in backup set 79
  47.   File LV Type Ckp SCN    Ckp Time  Name
  48.   ---- -- ---- ---------- --------- ----
  49.   3       Full 847302     22-NOV-13 +DATA/orcl/datafile/undotbs1.258.832197065

  50. BS Key  Type LV Size       Device Type Elapsed Time Completion Time
  51. ------- ---- -- ---------- ----------- ------------ ---------------
  52. 80      Full    3.27M      DISK        00:01:09     22-NOV-13      
  53.         BP Key: 91   Status: AVAILABLE  Compressed: NO  Tag: 1D_WHOLE_FULL
  54.         Piece Name: +FRA/orcl/backupset/2013_11_22/nnndf0_1d_whole_full_0.266.832199027
  55.   List of Datafiles in backup set 80
  56.   File LV Type Ckp SCN    Ckp Time  Name
  57.   ---- -- ---- ---------- --------- ----
  58.   4       Full 847418     22-NOV-13 +DATA/orcl/datafile/users.259.832197065

  59. BS Key  Type LV Size       Device Type Elapsed Time Completion Time
  60. ------- ---- -- ---------- ----------- ------------ ---------------
  61. 81      Full    374.35M    DISK        00:02:08     22-NOV-13      
  62.         BP Key: 92   Status: AVAILABLE  Compressed: NO  Tag: 1D_WHOLE_FULL
  63.         Piece Name: +FRA/orcl/backupset/2013_11_22/nnndf0_1d_whole_full_0.263.832198971
  64.   List of Datafiles in backup set 81
  65.   File LV Type Ckp SCN    Ckp Time  Name
  66.   ---- -- ---- ---------- --------- ----
  67.   2       Full 847220     22-NOV-13 +DATA/orcl/datafile/sysaux.257.832197065

  68. BS Key  Type LV Size       Device Type Elapsed Time Completion Time
  69. ------- ---- -- ---------- ----------- ------------ ---------------
  70. 82      Full    587.40M    DISK        00:02:25     22-NOV-13      
  71.         BP Key: 93   Status: AVAILABLE  Compressed: NO  Tag: 1D_WHOLE_FULL
  72.         Piece Name: +FRA/orcl/backupset/2013_11_22/nnndf0_1d_whole_full_0.262.832198965
  73.   List of Datafiles in backup set 82
  74.   File LV Type Ckp SCN    Ckp Time  Name
  75.   ---- -- ---- ---------- --------- ----
  76.   1       Full 847210     22-NOV-13 +DATA/orcl/datafile/system.256.832197063

  77. BS Key  Size       Device Type Elapsed Time Completion Time
  78. ------- ---------- ----------- ------------ ---------------
  79. 83      6.12M      DISK        00:00:00     22-NOV-13      
  80.         BP Key: 94   Status: AVAILABLE  Compressed: NO  Tag: 1D_WHOLE_FULL
  81.         Piece Name: +FRA/orcl/backupset/2013_11_22/annnf0_1d_whole_full_0.268.832199115

  82.   List of Archived Logs in backup set 83
  83.   Thrd Seq     Low SCN    Low Time  Next SCN   Next Time
  84.   ---- ------- ---------- --------- ---------- ---------
  85.   1    7       846906     22-NOV-13 848069     22-NOV-13

  86. BS Key  Type LV Size       Device Type Elapsed Time Completion Time
  87. ------- ---- -- ---------- ----------- ------------ ---------------
  88. 84      Full    9.36M      DISK        00:00:02     22-NOV-13      
  89.         BP Key: 95   Status: AVAILABLE  Compressed: NO  Tag: TAG20131122T222515
  90.         Piece Name: +FRA/orcl/autobackup/2013_11_22/s_832199115.269.832199117
  91.   SPFILE Included: Modification time: 22-NOV-13
  92.   SPFILE db_unique_name: ORCL
  93.   Control File Included: Ckp SCN: 848078       Ckp time: 22-NOV-13

  94. BS Key  Type LV Size       Device Type Elapsed Time Completion Time
  95. ------- ---- -- ---------- ----------- ------------ ---------------
  96. 85      Full    608.25M    SBT_TAPE    00:01:51     01-JUN-18      
  97.         BP Key: 96   Status: AVAILABLE  Compressed: NO  Tag: TAG20180601T114101
  98.         Handle: 09t4bo6e_1_1   Media: station87-000001
  99.   List of Datafiles in backup set 85
  100.   File LV Type Ckp SCN    Ckp Time  Name
  101.   ---- -- ---- ---------- --------- ----
  102.   1       Full 1013462    01-JUN-18 +DATA/orcl/datafile/system.256.832197063
  103.   3       Full 1013462    01-JUN-18 +DATA/orcl/datafile/undotbs1.258.832197065

  104. BS Key  Type LV Size       Device Type Elapsed Time Completion Time
  105. ------- ---- -- ---------- ----------- ------------ ---------------
  106. 86      Full    462.00M    SBT_TAPE    00:01:54     01-JUN-18      
  107.         BP Key: 97   Status: AVAILABLE  Compressed: NO  Tag: TAG20180601T114101
  108.         Handle: 0at4bo6e_1_1   Media: station87-000002
  109.   List of Datafiles in backup set 86
  110.   File LV Type Ckp SCN    Ckp Time  Name
  111.   ---- -- ---- ---------- --------- ----
  112.   2       Full 1013463    01-JUN-18 +DATA/orcl/datafile/sysaux.257.832197065
  113.   4       Full 1013463    01-JUN-18 +DATA/orcl/datafile/users.259.832197065
  114.   5       Full 1013463    01-JUN-18 +DATA/orcl/datafile/example.265.832197353

  115. BS Key  Type LV Size       Device Type Elapsed Time Completion Time
  116. ------- ---- -- ---------- ----------- ------------ ---------------
  117. 87      Full    9.38M      SBT_TAPE    00:00:31     01-JUN-18      
  118.         BP Key: 98   Status: AVAILABLE  Compressed: NO  Tag: TAG20180601T114257
  119.         Handle: c-1359978017-20180601-00   Media: station87-000001
  120.   SPFILE Included: Modification time: 01-JUN-18
  121.   SPFILE db_unique_name: ORCL
  122.   Control File Included: Ckp SCN: 1013510      Ckp time: 01-JUN-18

  123. RMAN> exit


  124. Recovery Manager complete.
  125. [oracle@station87 admin]$ rman target  /

  126. Recovery Manager: Release 11.2.0.1.0 - Production on Sat Jun 2 09:55:19 2018

  127. Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

  128. connected to target database: ORCL (DBID=1359978017)

  129. RMAN> list backup;

  130. using target database control file instead of recovery catalog

  131. List of Backup Sets
  132. ===================


  133. BS Key  Size       Device Type Elapsed Time Completion Time
  134. ------- ---------- ----------- ------------ ---------------
  135. 1       23.50M     DISK        00:00:06     22-NOV-13      
  136.         BP Key: 1   Status: AVAILABLE  Compressed: NO  Tag: 1D_WHOLE_FULL
  137.         Piece Name: +FRA/orcl/backupset/2013_11_22/annnf0_1d_whole_full_0.261.832198953

  138.   List of Archived Logs in backup set 1
  139.   Thrd Seq     Low SCN    Low Time  Next SCN   Next Time
  140.   ---- ------- ---------- --------- ---------- ---------
  141.   1    6       838362     22-NOV-13 846906     22-NOV-13

  142. BS Key  Type LV Size       Device Type Elapsed Time Completion Time
  143. ------- ---- -- ---------- ----------- ------------ ---------------
  144. 2       Full    69.00M     DISK        00:00:59     22-NOV-13      
  145.         BP Key: 2   Status: AVAILABLE  Compressed: NO  Tag: 1D_WHOLE_FULL
  146.         Piece Name: +FRA/orcl/backupset/2013_11_22/nnndf0_1d_whole_full_0.264.832198977
  147.   List of Datafiles in backup set 2
  148.   File LV Type Ckp SCN    Ckp Time  Name
  149.   ---- -- ---- ---------- --------- ----
  150.   5       Full 847289     22-NOV-13 +DATA/orcl/datafile/example.265.832197353

  151. BS Key  Type LV Size       Device Type Elapsed Time Completion Time
  152. ------- ---- -- ---------- ----------- ------------ ---------------
  153. 3       Full    88.20M     DISK        00:01:18     22-NOV-13      
  154.         BP Key: 3   Status: AVAILABLE  Compressed: NO  Tag: 1D_WHOLE_FULL
  155.         Piece Name: +FRA/orcl/backupset/2013_11_22/nnndf0_1d_whole_full_0.265.832198999
  156.   List of Datafiles in backup set 3
  157.   File LV Type Ckp SCN    Ckp Time  Name
  158.   ---- -- ---- ---------- --------- ----
  159.   3       Full 847302     22-NOV-13 +DATA/orcl/datafile/undotbs1.258.832197065

  160. BS Key  Type LV Size       Device Type Elapsed Time Completion Time
  161. ------- ---- -- ---------- ----------- ------------ ---------------
  162. 4       Full    3.27M      DISK        00:01:09     22-NOV-13      
  163.         BP Key: 4   Status: AVAILABLE  Compressed: NO  Tag: 1D_WHOLE_FULL
  164.         Piece Name: +FRA/orcl/backupset/2013_11_22/nnndf0_1d_whole_full_0.266.832199027
  165.   List of Datafiles in backup set 4
  166.   File LV Type Ckp SCN    Ckp Time  Name
  167.   ---- -- ---- ---------- --------- ----
  168.   4       Full 847418     22-NOV-13 +DATA/orcl/datafile/users.259.832197065

  169. BS Key  Type LV Size       Device Type Elapsed Time Completion Time
  170. ------- ---- -- ---------- ----------- ------------ ---------------
  171. 5       Full    374.35M    DISK        00:02:08     22-NOV-13      
  172.         BP Key: 5   Status: AVAILABLE  Compressed: NO  Tag: 1D_WHOLE_FULL
  173.         Piece Name: +FRA/orcl/backupset/2013_11_22/nnndf0_1d_whole_full_0.263.832198971
  174.   List of Datafiles in backup set 5
  175.   File LV Type Ckp SCN    Ckp Time  Name
  176.   ---- -- ---- ---------- --------- ----
  177.   2       Full 847220     22-NOV-13 +DATA/orcl/datafile/sysaux.257.832197065

  178. BS Key  Type LV Size       Device Type Elapsed Time Completion Time
  179. ------- ---- -- ---------- ----------- ------------ ---------------
  180. 6       Full    587.40M    DISK        00:02:25     22-NOV-13      
  181.         BP Key: 6   Status: AVAILABLE  Compressed: NO  Tag: 1D_WHOLE_FULL
  182.         Piece Name: +FRA/orcl/backupset/2013_11_22/nnndf0_1d_whole_full_0.262.832198965
  183.   List of Datafiles in backup set 6
  184.   File LV Type Ckp SCN    Ckp Time  Name
  185.   ---- -- ---- ---------- --------- ----
  186.   1       Full 847210     22-NOV-13 +DATA/orcl/datafile/system.256.832197063

  187. BS Key  Size       Device Type Elapsed Time Completion Time
  188. ------- ---------- ----------- ------------ ---------------
  189. 7       6.12M      DISK        00:00:00     22-NOV-13      
  190.         BP Key: 7   Status: AVAILABLE  Compressed: NO  Tag: 1D_WHOLE_FULL
  191.         Piece Name: +FRA/orcl/backupset/2013_11_22/annnf0_1d_whole_full_0.268.832199115

  192.   List of Archived Logs in backup set 7
  193.   Thrd Seq     Low SCN    Low Time  Next SCN   Next Time
  194.   ---- ------- ---------- --------- ---------- ---------
  195.   1    7       846906     22-NOV-13 848069     22-NOV-13

  196. BS Key  Type LV Size       Device Type Elapsed Time Completion Time
  197. ------- ---- -- ---------- ----------- ------------ ---------------
  198. 8       Full    9.36M      DISK        00:00:02     22-NOV-13      
  199.         BP Key: 8   Status: AVAILABLE  Compressed: NO  Tag: TAG20131122T222515
  200.         Piece Name: +FRA/orcl/autobackup/2013_11_22/s_832199115.269.832199117
  201.   SPFILE Included: Modification time: 22-NOV-13
  202.   SPFILE db_unique_name: ORCL
  203.   Control File Included: Ckp SCN: 848078       Ckp time: 22-NOV-13

  204. BS Key  Type LV Size       Device Type Elapsed Time Completion Time
  205. ------- ---- -- ---------- ----------- ------------ ---------------
  206. 9       Full    608.25M    SBT_TAPE    00:01:51     01-JUN-18      
  207.         BP Key: 9   Status: AVAILABLE  Compressed: NO  Tag: TAG20180601T114101
  208.         Handle: 09t4bo6e_1_1   Media: station87-000001
  209.   List of Datafiles in backup set 9
  210.   File LV Type Ckp SCN    Ckp Time  Name
  211.   ---- -- ---- ---------- --------- ----
  212.   1       Full 1013462    01-JUN-18 +DATA/orcl/datafile/system.256.832197063
  213.   3       Full 1013462    01-JUN-18 +DATA/orcl/datafile/undotbs1.258.832197065

  214. BS Key  Type LV Size       Device Type Elapsed Time Completion Time
  215. ------- ---- -- ---------- ----------- ------------ ---------------
  216. 10      Full    462.00M    SBT_TAPE    00:01:54     01-JUN-18      
  217.         BP Key: 10   Status: AVAILABLE  Compressed: NO  Tag: TAG20180601T114101
  218.         Handle: 0at4bo6e_1_1   Media: station87-000002
  219.   List of Datafiles in backup set 10
  220.   File LV Type Ckp SCN    Ckp Time  Name
  221.   ---- -- ---- ---------- --------- ----
  222.   2       Full 1013463    01-JUN-18 +DATA/orcl/datafile/sysaux.257.832197065
  223.   4       Full 1013463    01-JUN-18 +DATA/orcl/datafile/users.259.832197065
  224.   5       Full 1013463    01-JUN-18 +DATA/orcl/datafile/example.265.832197353

  225. BS Key  Type LV Size       Device Type Elapsed Time Completion Time
  226. ------- ---- -- ---------- ----------- ------------ ---------------
  227. 11      Full    9.38M      SBT_TAPE    00:00:31     01-JUN-18      
  228.         BP Key: 11   Status: AVAILABLE  Compressed: NO  Tag: TAG20180601T114257
  229.         Handle: c-1359978017-20180601-00   Media: station87-000001
  230.   SPFILE Included: Modification time: 01-JUN-18
  231.   SPFILE db_unique_name: ORCL
  232.   Control File Included: Ckp SCN: 1013510      Ckp time: 01-JUN-18

  233. RMAN>
复制代码

作为动词的CATALOG,去注册备份片,然后同步远程两个CATALOG;

a.png

备份recovery catalog:
  1. [oracle@station90 ~]$ expdp system/oracle_4U directory=dir1  dumpfile=u87.dmp schemas=u87
复制代码
恢复recovery catalog:
  1. [oracle@station90 ~]$ impdp system/oracle_4U directory=dir1 dumpfile=u87.dmp
复制代码

11.2.0.3的rman客户端建的catalog,如果要导入11.2.0.1的rman客户端建的catalog,需要把后者upgrade catalog:
  1. [oracle@station90 ~]$ rman  catalog u87/oracle_4U

  2. Recovery Manager: Release 11.2.0.3.0 - Production on Sat Jun 2 11:05:28 2018

  3. Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

  4. connected to recovery catalog database
  5. PL/SQL package U87.DBMS_RCVCAT version 11.02.00.01 in RCVCAT database is not current
  6. PL/SQL package U87.DBMS_RCVMAN version 11.02.00.01 in RCVCAT database is not current

  7. RMAN> upgrade catalog;

  8. recovery catalog owner is U87
  9. enter UPGRADE CATALOG command again to confirm catalog upgrade

  10. RMAN> upgrade catalog;

  11. recovery catalog upgraded to version 11.02.00.03
  12. DBMS_RCVMAN package upgraded to version 11.02.00.03
  13. DBMS_RCVCAT package upgraded to version 11.02.00.03

  14. RMAN>
复制代码

  1. Recovery Manager complete.
  2. [oracle@station90 ~]$ rman  catalog u870/oracle_4U

  3. Recovery Manager: Release 11.2.0.3.0 - Production on Sat Jun 2 11:07:49 2018

  4. Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

  5. connected to recovery catalog database

  6. RMAN> import  catalog u87/oracle_4U@orcl;

  7. Starting import catalog at 2018-06-02:11:07:53
  8. connected to source recovery catalog database
  9. import validation complete
  10. database unregistered from the source recovery catalog
  11. Finished import catalog at 2018-06-02:11:07:59

  12. RMAN>
复制代码
两个CATALOG之间复制数据,加上"NO UNREGISTER":
  1. [oracle@station90 ~]$ rman  catalog u87/oracle_4U

  2. Recovery Manager: Release 11.2.0.3.0 - Production on Sat Jun 2 11:09:32 2018

  3. Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

  4. connected to recovery catalog database

  5. RMAN> import  catalog u870/oracle_4U@orcl  no unregister;

  6. Starting import catalog at 2018-06-02:11:09:53
  7. connected to source recovery catalog database
  8. import validation complete
  9. Finished import catalog at 2018-06-02:11:09:55

  10. RMAN>
复制代码




  1. [oracle@station87 ~]$ rman target / catalog u87/oracle_4U@orcl90

  2. Recovery Manager: Release 11.2.0.1.0 - Production on Sat Jun 2 11:09:24 2018

  3. Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

  4. connected to target database: ORCL (DBID=1359978017)
  5. connected to recovery catalog database

  6. RMAN> list backup;


  7. List of Backup Sets
  8. ===================


  9. BS Key  Size
  10. ------- ----------
  11. 881     494.50K

  12.   List of Archived Logs in backup set 881
  13.   Thrd Seq     Low SCN    Low Time  Next SCN   Next Time
  14.   ---- ------- ---------- --------- ---------- ---------
  15.   1    27      1066478    02-JUN-18 1066773    02-JUN-18

  16.   Backup Set Copy #1 of backup set 881
  17.   Device Type Elapsed Time Completion Time Compressed Tag
  18.   ----------- ------------ --------------- ---------- ---
  19.   DISK        00:00:01     02-JUN-18       NO         TAG20180602T102520

  20.     List of Backup Pieces for backup set 881 Copy #1
  21.     BP Key  Pc# Status      Piece Name
  22.     ------- --- ----------- ----------
  23.     884     1   AVAILABLE   /home/oracle/0ht4e84g_1_1

  24.   Backup Set Copy #2 of backup set 881
  25.   Device Type Elapsed Time Completion Time Compressed Tag
  26.   ----------- ------------ --------------- ---------- ---
  27.   DISK        00:00:01     02-JUN-18       NO         TAG20180602T102520

  28.     List of Backup Pieces for backup set 881 Copy #2
  29.     BP Key  Pc# Status      Piece Name
  30.     ------- --- ----------- ----------
  31.     887     1   AVAILABLE   /home/oracle/xxxx

  32. BS Key  Size       Device Type Elapsed Time Completion Time
  33. ------- ---------- ----------- ------------ ---------------
  34. 882     261.00K    DISK        00:00:00     02-JUN-18      
  35.         BP Key: 885   Status: AVAILABLE  Compressed: NO  Tag: TAG20180602T102541
  36.         Piece Name: /home/oracle/0jt4e855_1_1

  37.   List of Archived Logs in backup set 882
  38.   Thrd Seq     Low SCN    Low Time  Next SCN   Next Time
  39.   ---- ------- ---------- --------- ---------- ---------
  40.   1    28      1066773    02-JUN-18 1066782    02-JUN-18
  41.   1    29      1066782    02-JUN-18 1067019    02-JUN-18
  42.   1    30      1067019    02-JUN-18 1067073    02-JUN-18

  43. BS Key  Type LV Size       Device Type Elapsed Time Completion Time
  44. ------- ---- -- ---------- ----------- ------------ ---------------
  45. 883     Full    9.36M      DISK        00:00:01     02-JUN-18      
  46.         BP Key: 886   Status: AVAILABLE  Compressed: NO  Tag: TAG20180602T102542
  47.         Piece Name: +FRA/orcl/autobackup/2018_06_02/s_977739942.278.977739943
  48.   SPFILE Included: Modification time: 02-JUN-18
  49.   SPFILE db_unique_name: ORCL
  50.   Control File Included: Ckp SCN: 1067084      Ckp time: 02-JUN-18

  51. BS Key  Type LV Size       Device Type Elapsed Time Completion Time
  52. ------- ---- -- ---------- ----------- ------------ ---------------
  53. 947     Full    3.31M      SBT_TAPE    00:00:46     02-JUN-18      
  54.         BP Key: 953   Status: AVAILABLE  Compressed: NO  Tag: TAG20180602T104700
  55.         Handle: 0lt4e9d4_1_1   Media: station87-000003
  56.   List of Datafiles in backup set 947
  57.   File LV Type Ckp SCN    Ckp Time  Name
  58.   ---- -- ---- ---------- --------- ----
  59.   4       Full 1068770    02-JUN-18 +DATA/orcl/datafile/users.259.832197065

  60. BS Key  Type LV Size       Device Type Elapsed Time Completion Time
  61. ------- ---- -- ---------- ----------- ------------ ---------------
  62. 948     Full    9.38M      SBT_TAPE    00:00:41     02-JUN-18      
  63.         BP Key: 954   Status: AVAILABLE  Compressed: NO  Tag: TAG20180602T104750
  64.         Handle: c-1359978017-20180602-02   Media: station87-000003
  65.   SPFILE Included: Modification time: 02-JUN-18
  66.   SPFILE db_unique_name: ORCL
  67.   Control File Included: Ckp SCN: 1068808      Ckp time: 02-JUN-18

  68. BS Key  Type LV Size       Device Type Elapsed Time Completion Time
  69. ------- ---- -- ---------- ----------- ------------ ---------------
  70. 949     Full    3.31M      SBT_TAPE    00:00:26     02-JUN-18      
  71.         BP Key: 955   Status: AVAILABLE  Compressed: NO  Tag: TAG20180602T105056
  72.         Handle: 0nt4e9kg_1_1   Media: station87-000003
  73.   List of Datafiles in backup set 949
  74.   File LV Type Ckp SCN    Ckp Time  Name
  75.   ---- -- ---- ---------- --------- ----
  76.   4       Full 1069050    02-JUN-18 +DATA/orcl/datafile/users.259.832197065

  77. BS Key  Type LV Size       Device Type Elapsed Time Completion Time
  78. ------- ---- -- ---------- ----------- ------------ ---------------
  79. 950     Full    9.38M      SBT_TAPE    00:00:27     02-JUN-18      
  80.         BP Key: 956   Status: AVAILABLE  Compressed: NO  Tag: TAG20180602T105132
  81.         Handle: c-1359978017-20180602-03   Media: station87-000003
  82.   SPFILE Included: Modification time: 02-JUN-18
  83.   SPFILE db_unique_name: ORCL
  84.   Control File Included: Ckp SCN: 1069085      Ckp time: 02-JUN-18

  85. RMAN> exit


  86. Recovery Manager complete.
  87. [oracle@station87 ~]$ rman target / catalog u870/oracle_4U@orcl90

  88. Recovery Manager: Release 11.2.0.1.0 - Production on Sat Jun 2 11:09:36 2018

  89. Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

  90. connected to target database: ORCL (DBID=1359978017)
  91. connected to recovery catalog database

  92. RMAN> list backup;


  93. List of Backup Sets
  94. ===================


  95. BS Key  Size
  96. ------- ----------
  97. 639     494.50K

  98.   List of Archived Logs in backup set 639
  99.   Thrd Seq     Low SCN    Low Time  Next SCN   Next Time
  100.   ---- ------- ---------- --------- ---------- ---------
  101.   1    27      1066478    02-JUN-18 1066773    02-JUN-18

  102.   Backup Set Copy #1 of backup set 639
  103.   Device Type Elapsed Time Completion Time Compressed Tag
  104.   ----------- ------------ --------------- ---------- ---
  105.   DISK        00:00:01     02-JUN-18       NO         TAG20180602T102520

  106.     List of Backup Pieces for backup set 639 Copy #1
  107.     BP Key  Pc# Status      Piece Name
  108.     ------- --- ----------- ----------
  109.     642     1   AVAILABLE   /home/oracle/0ht4e84g_1_1

  110.   Backup Set Copy #2 of backup set 639
  111.   Device Type Elapsed Time Completion Time Compressed Tag
  112.   ----------- ------------ --------------- ---------- ---
  113.   DISK        00:00:01     02-JUN-18       NO         TAG20180602T102520

  114.     List of Backup Pieces for backup set 639 Copy #2
  115.     BP Key  Pc# Status      Piece Name
  116.     ------- --- ----------- ----------
  117.     645     1   AVAILABLE   /home/oracle/xxxx

  118. BS Key  Size       Device Type Elapsed Time Completion Time
  119. ------- ---------- ----------- ------------ ---------------
  120. 640     261.00K    DISK        00:00:00     02-JUN-18      
  121.         BP Key: 643   Status: AVAILABLE  Compressed: NO  Tag: TAG20180602T102541
  122.         Piece Name: /home/oracle/0jt4e855_1_1

  123.   List of Archived Logs in backup set 640
  124.   Thrd Seq     Low SCN    Low Time  Next SCN   Next Time
  125.   ---- ------- ---------- --------- ---------- ---------
  126.   1    28      1066773    02-JUN-18 1066782    02-JUN-18
  127.   1    29      1066782    02-JUN-18 1067019    02-JUN-18
  128.   1    30      1067019    02-JUN-18 1067073    02-JUN-18

  129. BS Key  Type LV Size       Device Type Elapsed Time Completion Time
  130. ------- ---- -- ---------- ----------- ------------ ---------------
  131. 641     Full    9.36M      DISK        00:00:01     02-JUN-18      
  132.         BP Key: 644   Status: AVAILABLE  Compressed: NO  Tag: TAG20180602T102542
  133.         Piece Name: +FRA/orcl/autobackup/2018_06_02/s_977739942.278.977739943
  134.   SPFILE Included: Modification time: 02-JUN-18
  135.   SPFILE db_unique_name: ORCL
  136.   Control File Included: Ckp SCN: 1067084      Ckp time: 02-JUN-18

  137. BS Key  Type LV Size       Device Type Elapsed Time Completion Time
  138. ------- ---- -- ---------- ----------- ------------ ---------------
  139. 705     Full    3.31M      SBT_TAPE    00:00:46     02-JUN-18      
  140.         BP Key: 711   Status: AVAILABLE  Compressed: NO  Tag: TAG20180602T104700
  141.         Handle: 0lt4e9d4_1_1   Media: station87-000003
  142.   List of Datafiles in backup set 705
  143.   File LV Type Ckp SCN    Ckp Time  Name
  144.   ---- -- ---- ---------- --------- ----
  145.   4       Full 1068770    02-JUN-18 +DATA/orcl/datafile/users.259.832197065

  146. BS Key  Type LV Size       Device Type Elapsed Time Completion Time
  147. ------- ---- -- ---------- ----------- ------------ ---------------
  148. 706     Full    9.38M      SBT_TAPE    00:00:41     02-JUN-18      
  149.         BP Key: 712   Status: AVAILABLE  Compressed: NO  Tag: TAG20180602T104750
  150.         Handle: c-1359978017-20180602-02   Media: station87-000003
  151.   SPFILE Included: Modification time: 02-JUN-18
  152.   SPFILE db_unique_name: ORCL
  153.   Control File Included: Ckp SCN: 1068808      Ckp time: 02-JUN-18

  154. BS Key  Type LV Size       Device Type Elapsed Time Completion Time
  155. ------- ---- -- ---------- ----------- ------------ ---------------
  156. 707     Full    3.31M      SBT_TAPE    00:00:26     02-JUN-18      
  157.         BP Key: 713   Status: AVAILABLE  Compressed: NO  Tag: TAG20180602T105056
  158.         Handle: 0nt4e9kg_1_1   Media: station87-000003
  159.   List of Datafiles in backup set 707
  160.   File LV Type Ckp SCN    Ckp Time  Name
  161.   ---- -- ---- ---------- --------- ----
  162.   4       Full 1069050    02-JUN-18 +DATA/orcl/datafile/users.259.832197065

  163. BS Key  Type LV Size       Device Type Elapsed Time Completion Time
  164. ------- ---- -- ---------- ----------- ------------ ---------------
  165. 708     Full    9.38M      SBT_TAPE    00:00:27     02-JUN-18      
  166.         BP Key: 714   Status: AVAILABLE  Compressed: NO  Tag: TAG20180602T105132
  167.         Handle: c-1359978017-20180602-03   Media: station87-000003
  168.   SPFILE Included: Modification time: 02-JUN-18
  169.   SPFILE db_unique_name: ORCL
  170.   Control File Included: Ckp SCN: 1069085      Ckp time: 02-JUN-18

  171. RMAN>
复制代码
虚拟专用CATALOG的配置过程:
先创建三个catalog用户:

  1. create user u100 identified by oracle_4U default tablespace rcat
  2. quota unlimited on rcat;

  3. grant recovery_catalog_owner to u100;


  4. create user v101 identified by oracle_4U default tablespace rcat
  5. quota unlimited on rcat;

  6. grant recovery_catalog_owner to v101;

  7. create user v102 identified by oracle_4U default tablespace rcat
  8. quota unlimited on rcat;

  9. grant recovery_catalog_owner to v102;
复制代码
让u100去注册两个target数据库:

  1. [oracle@station90 ~]$ rman target / catalog u100/oracle_4U@rcat

  2. Recovery Manager: Release 12.1.0.2.0 - Production on Sat Jun 2 11:24:08 2018

  3. Copyright (c) 1982, 2014, Oracle and/or its affiliates.  All rights reserved.

  4. connected to target database: EMREP (DBID=4188960434)
  5. connected to recovery catalog database

  6. RMAN> register database;

  7. database registered in recovery catalog
  8. starting full resync of recovery catalog
  9. full resync complete

  10. RMAN>
复制代码
  1. [oracle@station87 ~]$ rman target / catalog u100/oracle_4U@rcat  

  2. Recovery Manager: Release 11.2.0.1.0 - Production on Sat Jun 2 11:24:04 2018

  3. Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

  4. connected to target database: ORCL (DBID=1359978017)
  5. connected to recovery catalog database

  6. RMAN> register database;

  7. database registered in recovery catalog
  8. starting full resync of recovery catalog
  9. full resync complete
复制代码

顺便查看一下 U100、V101和V102的db表的情况:
  1. [oracle@station90 ~]$ sqlplus /nolog

  2. SQL*Plus: Release 12.1.0.2.0 Production on Sat Jun 2 11:25:05 2018

  3. Copyright (c) 1982, 2014, Oracle.  All rights reserved.

  4. SQL> conn u100/oracle_4U@rcat
  5. Connected.
  6. SQL> select  * from db;

  7.     DB_KEY        DB_ID REG_DB_UNIQUE_NAME             CURR_DBINC_KEY S
  8. ---------- ---------- ------------------------------ -------------- -
  9.         77 1359978017 ORCL                                         78 N
  10.          1 4188960434 EMREP                                          2 N

  11. SQL> conn v101/oracle_4U@rcat
  12. Connected.
  13. SQL> select  * from db;
  14. select        * from db
  15.                *
  16. ERROR at line 1:
  17. ORA-00942: table or view does not exist


  18. SQL> conn v102/oracle_4U@rcat
  19. Connected.
  20. SQL> select  * from db;
  21. select        * from db
  22.                *
  23. ERROR at line 1:
  24. ORA-00942: table or view does not exist


  25. SQL>
复制代码

从U100开始分(1Z0-053书上3-28幻灯的3b分支):
  1. [oracle@station90 ~]$ rman catalog u100/oracle_4U@rcat

  2. Recovery Manager: Release 12.1.0.2.0 - Production on Sat Jun 2 11:30:59 2018

  3. Copyright (c) 1982, 2014, Oracle and/or its affiliates.  All rights reserved.

  4. connected to recovery catalog database


  5. RMAN> grant catalog for database 4188960434 to v101;

  6. Grant succeeded.

  7. RMAN> grant catalog for database 1359978017 to v102;

  8. Grant succeeded.

  9. RMAN>
复制代码
顺便查看一下 U100、V101和V102的db表的情况:

  1. [oracle@station90 ~]$ sqlplus /nolog

  2. SQL*Plus: Release 12.1.0.2.0 Production on Sat Jun 2 11:32:52 2018

  3. Copyright (c) 1982, 2014, Oracle.  All rights reserved.

  4. SQL> conn u100/oracle_4U@rcat
  5. Connected.
  6. SQL> select  * from db;

  7.     DB_KEY        DB_ID REG_DB_UNIQUE_NAME             CURR_DBINC_KEY S
  8. ---------- ---------- ------------------------------ -------------- -
  9.         77 1359978017 ORCL                                         78 N
  10.          1 4188960434 EMREP                                          2 N

  11. SQL> conn v101/oracle_4U@rcat
  12. Connected.
  13. SQL> select  * from db;

  14.     DB_KEY        DB_ID REG_DB_UNIQUE_NAME             CURR_DBINC_KEY S
  15. ---------- ---------- ------------------------------ -------------- -
  16.          1 4188960434 EMREP                                          2 N

  17. SQL> conn v102/oracle_4U@rcat
  18. Connected.
  19. SQL> select  * from db;

  20.     DB_KEY        DB_ID REG_DB_UNIQUE_NAME             CURR_DBINC_KEY S
  21. ---------- ---------- ------------------------------ -------------- -
  22.         77 1359978017 ORCL                                         78 N

  23. SQL>
复制代码

开始用V101和V102:
  1. [oracle@station90 ~]$ rman catalog v101/oracle_4U@rcat

  2. Recovery Manager: Release 12.1.0.2.0 - Production on Sat Jun 2 11:35:42 2018

  3. Copyright (c) 1982, 2014, Oracle and/or its affiliates.  All rights reserved.

  4. connected to recovery catalog database
  5. RMAN-07540: Cleanup is required for the VPC user schema

  6. RMAN> create virtual catalog;

  7. found eligible base catalog owned by U100
  8. found ineligible base catalog owned by U90
  9. created virtual catalog against base catalog owned by U100

  10. RMAN> exit


  11. Recovery Manager complete.
  12. [oracle@station90 ~]$ rman catalog v102/oracle_4U@rcat

  13. Recovery Manager: Release 12.1.0.2.0 - Production on Sat Jun 2 11:35:55 2018

  14. Copyright (c) 1982, 2014, Oracle and/or its affiliates.  All rights reserved.

  15. connected to recovery catalog database
  16. RMAN-07540: Cleanup is required for the VPC user schema

  17. RMAN> create virtual catalog;

  18. found ineligible base catalog owned by U90
  19. found eligible base catalog owned by U100
  20. created virtual catalog against base catalog owned by U100

  21. RMAN>
复制代码
  1. [oracle@station90 ~]$ rman target / catalog v101/oracle_4U@rcat

  2. Recovery Manager: Release 12.1.0.2.0 - Production on Sat Jun 2 11:37:53 2018

  3. Copyright (c) 1982, 2014, Oracle and/or its affiliates.  All rights reserved.

  4. connected to target database: EMREP (DBID=4188960434)
  5. connected to recovery catalog database
  6. RMAN-07540: Cleanup is required for the VPC user schema

  7. RMAN> backup tablespace users;

  8. Starting backup at 2018-06-02:11:38:00
  9. allocated channel: ORA_DISK_1
  10. channel ORA_DISK_1: SID=417 device type=DISK
  11. channel ORA_DISK_1: starting full datafile backup set
  12. channel ORA_DISK_1: specifying datafile(s) in backup set
  13. input datafile file number=00004 name=/u01/app/oracle/oradata/emrep/users01.dbf
  14. channel ORA_DISK_1: starting piece 1 at 2018-06-02:11:38:08
  15. channel ORA_DISK_1: finished piece 1 at 2018-06-02:11:38:09
  16. piece handle=/u01/app/oracle/fast_recovery_area/EMREP/backupset/2018_06_02/o1_mf_nnndf_TAG20180602T113807_fk44907x_.bkp tag=TAG20180602T113807 comment=NONE
  17. channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
  18. Finished backup at 2018-06-02:11:38:09

  19. RMAN> exit


  20. Recovery Manager complete.
  21. exit[oracle@station90 ~]$ rman target / catalog u100/oracle_4U@rcat

  22. Recovery Manager: Release 12.1.0.2.0 - Production on Sat Jun 2 11:38:25 2018

  23. Copyright (c) 1982, 2014, Oracle and/or its affiliates.  All rights reserved.

  24. connected to target database: EMREP (DBID=4188960434)
  25. connected to recovery catalog database

  26. RMAN> list backup of tablespace users;


  27. List of Backup Sets
  28. ===================


  29. BS Key  Type LV Size       Device Type Elapsed Time Completion Time   
  30. ------- ---- -- ---------- ----------- ------------ -------------------
  31. 307     Full    1.34M      DISK        00:00:01     2018-06-02:11:38:08
  32.         BP Key: 308   Status: AVAILABLE  Compressed: NO  Tag: TAG20180602T113807
  33.         Piece Name: /u01/app/oracle/fast_recovery_area/EMREP/backupset/2018_06_02/o1_mf_nnndf_TAG20180602T113807_fk44907x_.bkp
  34.   List of Datafiles in backup set 307
  35.   File LV Type Ckp SCN    Ckp Time            Name
  36.   ---- -- ---- ---------- ------------------- ----
  37.   4       Full 4985341    2018-06-02:11:38:08 /u01/app/oracle/oradata/emrep/users01.dbf

  38. RMAN>

复制代码
  1. [oracle@station87 ~]$ rman target / catalog v102/oracle_4U@rcat

  2. Recovery Manager: Release 11.2.0.1.0 - Production on Sat Jun 2 11:36:44 2018

  3. Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

  4. connected to target database: ORCL (DBID=1359978017)
  5. connected to recovery catalog database

  6. RMAN> backup tablespace users;

  7. Starting backup at 02-JUN-18
  8. allocated channel: ORA_SBT_TAPE_1
  9. channel ORA_SBT_TAPE_1: SID=77 device type=SBT_TAPE
  10. channel ORA_SBT_TAPE_1: Oracle Secure Backup
  11. allocated channel: ORA_SBT_TAPE_2
  12. channel ORA_SBT_TAPE_2: SID=19 device type=SBT_TAPE
  13. channel ORA_SBT_TAPE_2: Oracle Secure Backup
  14. channel ORA_SBT_TAPE_1: starting full datafile backup set
  15. channel ORA_SBT_TAPE_1: specifying datafile(s) in backup set
  16. input datafile file number=00004 name=+DATA/orcl/datafile/users.259.832197065
  17. channel ORA_SBT_TAPE_1: starting piece 1 at 02-JUN-18
  18. channel ORA_SBT_TAPE_1: finished piece 1 at 02-JUN-18
  19. piece handle=0pt4ecb4_1_1 tag=TAG20180602T113708 comment=API Version 2.0,MMS Version 10.3.0.2
  20. channel ORA_SBT_TAPE_1: backup set complete, elapsed time: 00:00:55
  21. Finished backup at 02-JUN-18

  22. Starting Control File and SPFILE Autobackup at 02-JUN-18
  23. piece handle=c-1359978017-20180602-04 comment=API Version 2.0,MMS Version 10.3.0.2
  24. Finished Control File and SPFILE Autobackup at 02-JUN-18

  25. RMAN> exit


  26. Recovery Manager complete.
  27. exit[oracle@station87 ~]$ rman target / catalog u100/oracle_4U@rcat

  28. Recovery Manager: Release 11.2.0.1.0 - Production on Sat Jun 2 11:39:14 2018

  29. Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

  30. connected to target database: ORCL (DBID=1359978017)
  31. connected to recovery catalog database

  32. RMAN> list backup of tablespace users;


  33. List of Backup Sets
  34. ===================


  35. BS Key  Type LV Size       Device Type Elapsed Time Completion Time
  36. ------- ---- -- ---------- ----------- ------------ ---------------
  37. 219     Full    3.31M      SBT_TAPE    00:00:46     02-JUN-18      
  38.         BP Key: 227   Status: AVAILABLE  Compressed: NO  Tag: TAG20180602T104700
  39.         Handle: 0lt4e9d4_1_1   Media: station87-000003
  40.   List of Datafiles in backup set 219
  41.   File LV Type Ckp SCN    Ckp Time  Name
  42.   ---- -- ---- ---------- --------- ----
  43.   4       Full 1068770    02-JUN-18 +DATA/orcl/datafile/users.259.832197065

  44. BS Key  Type LV Size       Device Type Elapsed Time Completion Time
  45. ------- ---- -- ---------- ----------- ------------ ---------------
  46. 221     Full    3.31M      SBT_TAPE    00:00:26     02-JUN-18      
  47.         BP Key: 229   Status: AVAILABLE  Compressed: NO  Tag: TAG20180602T105056
  48.         Handle: 0nt4e9kg_1_1   Media: station87-000003
  49.   List of Datafiles in backup set 221
  50.   File LV Type Ckp SCN    Ckp Time  Name
  51.   ---- -- ---- ---------- --------- ----
  52.   4       Full 1069050    02-JUN-18 +DATA/orcl/datafile/users.259.832197065

  53. BS Key  Type LV Size       Device Type Elapsed Time Completion Time
  54. ------- ---- -- ---------- ----------- ------------ ---------------
  55. 320     Full    3.31M      SBT_TAPE    00:00:46     02-JUN-18      
  56.         BP Key: 323   Status: AVAILABLE  Compressed: NO  Tag: TAG20180602T113708
  57.         Handle: 0pt4ecb4_1_1   Media: station87-000003
  58.   List of Datafiles in backup set 320
  59.   File LV Type Ckp SCN    Ckp Time  Name
  60.   ---- -- ---- ---------- --------- ----
  61.   4       Full 1072634    02-JUN-18 +DATA/orcl/datafile/users.259.832197065

  62. RMAN>
复制代码


另外一种实现 虚拟专用catalog的做法是:


先创建三个catalog用户:

  1. create user u200 identified by oracle_4U default tablespace rcat
  2. quota unlimited on rcat;

  3. grant recovery_catalog_owner to u200;


  4. create user v201 identified by oracle_4U default tablespace rcat
  5. quota unlimited on rcat;

  6. grant recovery_catalog_owner to v201;

  7. create user v202 identified by oracle_4U default tablespace rcat
  8. quota unlimited on rcat;

  9. grant recovery_catalog_owner to v202;
复制代码
  1. [oracle@station90 ~]$ rman catalog u200/oracle_4U@rcat

  2. Recovery Manager: Release 12.1.0.2.0 - Production on Sat Jun 2 11:44:48 2018

  3. Copyright (c) 1982, 2014, Oracle and/or its affiliates.  All rights reserved.

  4. connected to recovery catalog database

  5. RMAN> create catalog;

  6. recovery catalog created

  7. RMAN> grant register database to v201;

  8. Grant succeeded.

  9. RMAN> grant register database to v202;

  10. Grant succeeded.

  11. RMAN>
复制代码

两个虚拟用户出动:

  1. [oracle@station90 ~]$ rman catalog v201/oracle_4U@rcat

  2. Recovery Manager: Release 12.1.0.2.0 - Production on Sat Jun 2 11:46:09 2018

  3. Copyright (c) 1982, 2014, Oracle and/or its affiliates.  All rights reserved.

  4. connected to recovery catalog database
  5. RMAN-07540: Cleanup is required for the VPC user schema

  6. RMAN> create virtual catalog;  

  7. found eligible base catalog owned by U200
  8. found ineligible base catalog owned by U100
  9. found ineligible base catalog owned by U90
  10. created virtual catalog against base catalog owned by U200

  11. RMAN> exit


  12. Recovery Manager complete.
  13. [oracle@station90 ~]$ rman catalog v202/oracle_4U@rcat

  14. Recovery Manager: Release 12.1.0.2.0 - Production on Sat Jun 2 11:46:38 2018

  15. Copyright (c) 1982, 2014, Oracle and/or its affiliates.  All rights reserved.

  16. connected to recovery catalog database
  17. RMAN-07540: Cleanup is required for the VPC user schema

  18. RMAN> create virtual catalog;  

  19. found ineligible base catalog owned by U90
  20. found ineligible base catalog owned by U100
  21. found eligible base catalog owned by U200
  22. created virtual catalog against base catalog owned by U200

  23. RMAN>
复制代码

V201去注册emrep:
  1. [oracle@station90 ~]$ rman target / catalog v201/oracle_4U@rcat

  2. Recovery Manager: Release 12.1.0.2.0 - Production on Sat Jun 2 11:47:47 2018

  3. Copyright (c) 1982, 2014, Oracle and/or its affiliates.  All rights reserved.

  4. connected to target database: EMREP (DBID=4188960434)
  5. connected to recovery catalog database
  6. RMAN-07540: Cleanup is required for the VPC user schema

  7. RMAN> register database;

  8. database registered in recovery catalog
  9. starting full resync of recovery catalog
  10. full resync complete

  11. RMAN> exit


  12. Recovery Manager complete.
  13. [oracle@station90 ~]$ rman target / catalog u200/oracle_4U@rcat

  14. Recovery Manager: Release 12.1.0.2.0 - Production on Sat Jun 2 11:48:18 2018

  15. Copyright (c) 1982, 2014, Oracle and/or its affiliates.  All rights reserved.

  16. connected to target database: EMREP (DBID=4188960434)
  17. connected to recovery catalog database

  18. RMAN> list backup;


  19. List of Backup Sets
  20. ===================


  21. BS Key  Type LV Size       Device Type Elapsed Time Completion Time   
  22. ------- ---- -- ---------- ----------- ------------ -------------------
  23. 84      Full    1.34M      DISK        00:00:01     2018-06-02:11:38:08
  24.         BP Key: 85   Status: AVAILABLE  Compressed: NO  Tag: TAG20180602T113807
  25.         Piece Name: /u01/app/oracle/fast_recovery_area/EMREP/backupset/2018_06_02/o1_mf_nnndf_TAG20180602T113807_fk44907x_.bkp
  26.   List of Datafiles in backup set 84
  27.   File LV Type Ckp SCN    Ckp Time            Name
  28.   ---- -- ---- ---------- ------------------- ----
  29.   4       Full 4985341    2018-06-02:11:38:08 /u01/app/oracle/oradata/emrep/users01.dbf

  30. RMAN>
复制代码

V202去注册orcl:

  1. [oracle@station87 ~]$ rman target / catalog v202/oracle_4U@rcat

  2. Recovery Manager: Release 11.2.0.1.0 - Production on Sat Jun 2 11:48:42 2018

  3. Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

  4. connected to target database: ORCL (DBID=1359978017)
  5. connected to recovery catalog database

  6. RMAN> register database;

  7. database registered in recovery catalog
  8. starting full resync of recovery catalog
  9. full resync complete

  10. RMAN> exit


  11. Recovery Manager complete.
  12. [oracle@station87 ~]$ rman target / catalog u200/oracle_4U@rcat

  13. Recovery Manager: Release 11.2.0.1.0 - Production on Sat Jun 2 11:49:14 2018

  14. Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

  15. connected to target database: ORCL (DBID=1359978017)
  16. connected to recovery catalog database

  17. RMAN> list backup;


  18. List of Backup Sets
  19. ===================


  20. BS Key  Size
  21. ------- ----------
  22. 234     494.50K

  23.   List of Archived Logs in backup set 234
  24.   Thrd Seq     Low SCN    Low Time  Next SCN   Next Time
  25.   ---- ------- ---------- --------- ---------- ---------
  26.   1    27      1066478    02-JUN-18 1066773    02-JUN-18

  27.   Backup Set Copy #1 of backup set 234
  28.   Device Type Elapsed Time Completion Time Compressed Tag
  29.   ----------- ------------ --------------- ---------- ---
  30.   DISK        00:00:01     02-JUN-18       NO         TAG20180602T102520

  31.     List of Backup Pieces for backup set 234 Copy #1
  32.     BP Key  Pc# Status      Piece Name
  33.     ------- --- ----------- ----------
  34.     243     1   AVAILABLE   /home/oracle/0ht4e84g_1_1

  35.   Backup Set Copy #2 of backup set 234
  36.   Device Type Elapsed Time Completion Time Compressed Tag
  37.   ----------- ------------ --------------- ---------- ---
  38.   DISK        00:00:01     02-JUN-18       NO         TAG20180602T102520

  39.     List of Backup Pieces for backup set 234 Copy #2
  40.     BP Key  Pc# Status      Piece Name
  41.     ------- --- ----------- ----------
  42.     246     1   AVAILABLE   /home/oracle/xxxx

  43. BS Key  Size       Device Type Elapsed Time Completion Time
  44. ------- ---------- ----------- ------------ ---------------
  45. 235     261.00K    DISK        00:00:00     02-JUN-18      
  46.         BP Key: 244   Status: AVAILABLE  Compressed: NO  Tag: TAG20180602T102541
  47.         Piece Name: /home/oracle/0jt4e855_1_1

  48.   List of Archived Logs in backup set 235
  49.   Thrd Seq     Low SCN    Low Time  Next SCN   Next Time
  50.   ---- ------- ---------- --------- ---------- ---------
  51.   1    28      1066773    02-JUN-18 1066782    02-JUN-18
  52.   1    29      1066782    02-JUN-18 1067019    02-JUN-18
  53.   1    30      1067019    02-JUN-18 1067073    02-JUN-18

  54. BS Key  Type LV Size       Device Type Elapsed Time Completion Time
  55. ------- ---- -- ---------- ----------- ------------ ---------------
  56. 236     Full    9.36M      DISK        00:00:01     02-JUN-18      
  57.         BP Key: 245   Status: AVAILABLE  Compressed: NO  Tag: TAG20180602T102542
  58.         Piece Name: +FRA/orcl/autobackup/2018_06_02/s_977739942.278.977739943
  59.   SPFILE Included: Modification time: 02-JUN-18
  60.   SPFILE db_unique_name: ORCL
  61.   Control File Included: Ckp SCN: 1067084      Ckp time: 02-JUN-18

  62. BS Key  Type LV Size       Device Type Elapsed Time Completion Time
  63. ------- ---- -- ---------- ----------- ------------ ---------------
  64. 237     Full    3.31M      SBT_TAPE    00:00:46     02-JUN-18      
  65.         BP Key: 247   Status: AVAILABLE  Compressed: NO  Tag: TAG20180602T104700
  66.         Handle: 0lt4e9d4_1_1   Media: station87-000003
  67.   List of Datafiles in backup set 237
  68.   File LV Type Ckp SCN    Ckp Time  Name
  69.   ---- -- ---- ---------- --------- ----
  70.   4       Full 1068770    02-JUN-18 +DATA/orcl/datafile/users.259.832197065

  71. BS Key  Type LV Size       Device Type Elapsed Time Completion Time
  72. ------- ---- -- ---------- ----------- ------------ ---------------
  73. 238     Full    9.38M      SBT_TAPE    00:00:41     02-JUN-18      
  74.         BP Key: 248   Status: AVAILABLE  Compressed: NO  Tag: TAG20180602T104750
  75.         Handle: c-1359978017-20180602-02   Media: station87-000003
  76.   SPFILE Included: Modification time: 02-JUN-18
  77.   SPFILE db_unique_name: ORCL
  78.   Control File Included: Ckp SCN: 1068808      Ckp time: 02-JUN-18

  79. BS Key  Type LV Size       Device Type Elapsed Time Completion Time
  80. ------- ---- -- ---------- ----------- ------------ ---------------
  81. 239     Full    3.31M      SBT_TAPE    00:00:26     02-JUN-18      
  82.         BP Key: 249   Status: AVAILABLE  Compressed: NO  Tag: TAG20180602T105056
  83.         Handle: 0nt4e9kg_1_1   Media: station87-000003
  84.   List of Datafiles in backup set 239
  85.   File LV Type Ckp SCN    Ckp Time  Name
  86.   ---- -- ---- ---------- --------- ----
  87.   4       Full 1069050    02-JUN-18 +DATA/orcl/datafile/users.259.832197065

  88. BS Key  Type LV Size       Device Type Elapsed Time Completion Time
  89. ------- ---- -- ---------- ----------- ------------ ---------------
  90. 240     Full    9.38M      SBT_TAPE    00:00:27     02-JUN-18      
  91.         BP Key: 250   Status: AVAILABLE  Compressed: NO  Tag: TAG20180602T105132
  92.         Handle: c-1359978017-20180602-03   Media: station87-000003
  93.   SPFILE Included: Modification time: 02-JUN-18
  94.   SPFILE db_unique_name: ORCL
  95.   Control File Included: Ckp SCN: 1069085      Ckp time: 02-JUN-18

  96. BS Key  Type LV Size       Device Type Elapsed Time Completion Time
  97. ------- ---- -- ---------- ----------- ------------ ---------------
  98. 241     Full    3.31M      SBT_TAPE    00:00:46     02-JUN-18      
  99.         BP Key: 251   Status: AVAILABLE  Compressed: NO  Tag: TAG20180602T113708
  100.         Handle: 0pt4ecb4_1_1   Media: station87-000003
  101.   List of Datafiles in backup set 241
  102.   File LV Type Ckp SCN    Ckp Time  Name
  103.   ---- -- ---- ---------- --------- ----
  104.   4       Full 1072634    02-JUN-18 +DATA/orcl/datafile/users.259.832197065

  105. BS Key  Type LV Size       Device Type Elapsed Time Completion Time
  106. ------- ---- -- ---------- ----------- ------------ ---------------
  107. 242     Full    9.38M      SBT_TAPE    00:00:36     02-JUN-18      
  108.         BP Key: 252   Status: AVAILABLE  Compressed: NO  Tag: TAG20180602T113806
  109.         Handle: c-1359978017-20180602-04   Media: station87-000003
  110.   SPFILE Included: Modification time: 02-JUN-18
  111.   SPFILE db_unique_name: ORCL
  112.   Control File Included: Ckp SCN: 1072682      Ckp time: 02-JUN-18

  113. RMAN>
复制代码

一个备份集下面开多个备份片(控制单个备份片的大小):
  1. RMAN> run {
  2. 2> allocate channel c1 DEVICE TYPE 'SBT_TAPE' PARMS  'ENV=(OB_MEDIA_FAMILY=station87)'  maxpiecesize 200M;                           
  3. 3> backup tag '2T_SYSTEM_INCR0'  copies 1 incremental level 0  tablespace system;
  4. 4> release channel c1;
  5. 5> }
复制代码

磁盘份数备份:
  1. RMAN> run {
  2. 2> allocate channel c1 device type  disk format '/home/oracle/dir1/%U','/home/oracle/dir2/%U';
  3. 3> backup tag '3D_USERS_INCR0' copies 2  incremental level 0 tablespace users force ;
  4. 4> release channel c1;
  5. 5> }

  6. allocated channel: c1
  7. channel c1: SID=8 device type=DISK

  8. Starting backup at 2018-06-08:00:38:35
  9. channel c1: starting incremental level 0 datafile backup set
  10. channel c1: specifying datafile(s) in backup set
  11. input datafile file number=00004 name=+DATA/orcl/datafile/users.259.832197065
  12. channel c1: starting piece 1 at 2018-06-08:00:38:35
  13. channel c1: finished piece 1 at 2018-06-08:00:38:36 with 2 copies and tag 3D_USERS_INCR0
  14. piece handle=/home/oracle/dir1/24t4t00b_1_1 comment=NONE
  15. piece handle=/home/oracle/dir2/24t4t00b_1_2 comment=NONE
  16. channel c1: backup set complete, elapsed time: 00:00:01
  17. Finished backup at 2018-06-08:00:38:36

  18. Starting Control File and SPFILE Autobackup at 2018-06-08:00:38:36
  19. piece handle=+FRA/orcl/autobackup/2018_06_08/s_978223116.276.978223117 comment=NONE
  20. Finished Control File and SPFILE Autobackup at 2018-06-08:00:38:39

  21. released channel: c1

  22. RMAN>
复制代码

永久排除某个表空间在全库备份之外:
  1. RMAN> configure exclude for tablespace users;

  2. Tablespace USERS will be excluded from future whole database backups
  3. new RMAN configuration parameters are successfully stored

  4. RMAN> show all;

  5. RMAN configuration parameters for database with db_unique_name ORCL are:
  6. CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 1 DAYS;
  7. CONFIGURE BACKUP OPTIMIZATION ON;
  8. CONFIGURE DEFAULT DEVICE TYPE TO 'SBT_TAPE';
  9. CONFIGURE CONTROLFILE AUTOBACKUP ON;
  10. CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default
  11. CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE SBT_TAPE TO '%F'; # default
  12. CONFIGURE DEVICE TYPE DISK PARALLELISM 8 BACKUP TYPE TO BACKUPSET;
  13. CONFIGURE DEVICE TYPE 'SBT_TAPE' PARALLELISM 2 BACKUP TYPE TO BACKUPSET;
  14. CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE 'SBT_TAPE' TO 2;
  15. CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
  16. CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
  17. CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE SBT_TAPE TO 1; # default
  18. CONFIGURE CHANNEL 1 DEVICE TYPE 'SBT_TAPE' PARMS  'ENV=(OB_MEDIA_FAMILY=station87)';
  19. CONFIGURE CHANNEL 2 DEVICE TYPE 'SBT_TAPE' PARMS  'ENV=(OB_MEDIA_FAMILY=station87)';
  20. CONFIGURE MAXSETSIZE TO UNLIMITED; # default
  21. CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
  22. CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
  23. CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default
  24. CONFIGURE EXCLUDE FOR TABLESPACE 'USERS';
  25. CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
  26. CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/app/oracle/product/11.2.0/dbhome_1/dbs/snapcf_orcl.f'; # default

  27. RMAN>
复制代码
(顺便提下:在通道不够的时候,份数备份会pending等待资源,等上一轮释放,下一轮会执行:
Screenshot.png


取消exclude:
  1. RMAN> CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE 'SBT_TAPE' clear;

  2. old RMAN configuration parameters:
  3. CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE 'SBT_TAPE' TO 2;
  4. RMAN configuration parameters are successfully reset to default value

  5. RMAN> show all;

  6. RMAN configuration parameters for database with db_unique_name ORCL are:
  7. CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 1 DAYS;
  8. CONFIGURE BACKUP OPTIMIZATION ON;
  9. CONFIGURE DEFAULT DEVICE TYPE TO 'SBT_TAPE';
  10. CONFIGURE CONTROLFILE AUTOBACKUP ON;
  11. CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default
  12. CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE SBT_TAPE TO '%F'; # default
  13. CONFIGURE DEVICE TYPE DISK PARALLELISM 8 BACKUP TYPE TO BACKUPSET;
  14. CONFIGURE DEVICE TYPE 'SBT_TAPE' PARALLELISM 2 BACKUP TYPE TO BACKUPSET;
  15. CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
  16. CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE SBT_TAPE TO 1; # default
  17. CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
  18. CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE SBT_TAPE TO 1; # default
  19. CONFIGURE CHANNEL 1 DEVICE TYPE 'SBT_TAPE' PARMS  'ENV=(OB_MEDIA_FAMILY=station87)';
  20. CONFIGURE CHANNEL 2 DEVICE TYPE 'SBT_TAPE' PARMS  'ENV=(OB_MEDIA_FAMILY=station87)';
  21. CONFIGURE MAXSETSIZE TO UNLIMITED; # default
  22. CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
  23. CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
  24. CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default
  25. CONFIGURE EXCLUDE FOR TABLESPACE 'USERS';
  26. CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
  27. CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/app/oracle/product/11.2.0/dbhome_1/dbs/snapcf_orcl.f'; # default

  28. RMAN> CONFIGURE EXCLUDE FOR TABLESPACE 'USERS' clear;

  29. Tablespace USERS will be included in future whole database backups
  30. old RMAN configuration parameters are successfully deleted

  31. RMAN>

复制代码
压缩备份:
例子:SYSAUX表空间原有560M,不压缩备份436M(完成时间00:01:00),BASIC压缩86.5M(00:00:53)

  1. [oracle@station87 ~]$ rman target /

  2. Recovery Manager: Release 11.2.0.1.0 - Production on Fri Jun 8 01:06:43 2018

  3. Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

  4. connected to target database: ORCL (DBID=1359978017)

  5. RMAN> backup  tag '1T_SYSAUX_INCR0' incremental level 0 tablespace sysaux;

  6. Starting backup at 2018-06-08:01:07:06
  7. using target database control file instead of recovery catalog
  8. allocated channel: ORA_SBT_TAPE_1
  9. channel ORA_SBT_TAPE_1: SID=79 device type=SBT_TAPE
  10. channel ORA_SBT_TAPE_1: Oracle Secure Backup
  11. allocated channel: ORA_SBT_TAPE_2
  12. channel ORA_SBT_TAPE_2: SID=138 device type=SBT_TAPE
  13. channel ORA_SBT_TAPE_2: Oracle Secure Backup
  14. channel ORA_SBT_TAPE_1: starting incremental level 0 datafile backup set
  15. channel ORA_SBT_TAPE_1: specifying datafile(s) in backup set
  16. input datafile file number=00002 name=+DATA/orcl/datafile/sysaux.257.832197065
  17. channel ORA_SBT_TAPE_1: starting piece 1 at 2018-06-08:01:07:17
  18. channel ORA_SBT_TAPE_1: finished piece 1 at 2018-06-08:01:08:22
  19. piece handle=2ct4t1m5_1_1 tag=1T_SYSAUX_INCR0 comment=API Version 2.0,MMS Version 10.3.0.2
  20. channel ORA_SBT_TAPE_1: backup set complete, elapsed time: 00:01:05
  21. Finished backup at 2018-06-08:01:08:22

  22. Starting Control File and SPFILE Autobackup at 2018-06-08:01:08:22
  23. piece handle=c-1359978017-20180608-07 comment=API Version 2.0,MMS Version 10.3.0.2
  24. Finished Control File and SPFILE Autobackup at 2018-06-08:01:09:07

  25. RMAN> list backup;


  26. List of Backup Sets
  27. ===================


  28. BS Key  Type LV Size       Device Type Elapsed Time Completion Time   
  29. ------- ---- -- ---------- ----------- ------------ -------------------
  30. 65      Incr 0  436.25M    SBT_TAPE    00:01:00     2018-06-08:01:08:17
  31.         BP Key: 71   Status: AVAILABLE  Compressed: NO  Tag: 1T_SYSAUX_INCR0
  32.         Handle: 2ct4t1m5_1_1   Media: station87-000008
  33.   List of Datafiles in backup set 65
  34.   File LV Type Ckp SCN    Ckp Time            Name
  35.   ---- -- ---- ---------- ------------------- ----
  36.   2    0  Incr 1155660    2018-06-08:01:07:17 +DATA/orcl/datafile/sysaux.257.832197065

  37. BS Key  Type LV Size       Device Type Elapsed Time Completion Time   
  38. ------- ---- -- ---------- ----------- ------------ -------------------
  39. 66      Full    10.00M     SBT_TAPE    00:00:39     2018-06-08:01:09:01
  40.         BP Key: 72   Status: AVAILABLE  Compressed: NO  Tag: TAG20180608T010822
  41.         Handle: c-1359978017-20180608-07   Media: station87-000008
  42.   SPFILE Included: Modification time: 2018-06-08:01:07:07
  43.   SPFILE db_unique_name: ORCL
  44.   Control File Included: Ckp SCN: 1155709      Ckp time: 2018-06-08:01:08:22

  45. RMAN> show all;

  46. RMAN configuration parameters for database with db_unique_name ORCL are:
  47. CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 1 DAYS;
  48. CONFIGURE BACKUP OPTIMIZATION ON;
  49. CONFIGURE DEFAULT DEVICE TYPE TO 'SBT_TAPE';
  50. CONFIGURE CONTROLFILE AUTOBACKUP ON;
  51. CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default
  52. CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE SBT_TAPE TO '%F'; # default
  53. CONFIGURE DEVICE TYPE DISK PARALLELISM 8 BACKUP TYPE TO BACKUPSET;
  54. CONFIGURE DEVICE TYPE 'SBT_TAPE' PARALLELISM 2 BACKUP TYPE TO BACKUPSET;
  55. CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
  56. CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE SBT_TAPE TO 1; # default
  57. CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
  58. CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE SBT_TAPE TO 1; # default
  59. CONFIGURE CHANNEL 1 DEVICE TYPE 'SBT_TAPE' PARMS  'ENV=(OB_MEDIA_FAMILY=station87)';
  60. CONFIGURE CHANNEL 2 DEVICE TYPE 'SBT_TAPE' PARMS  'ENV=(OB_MEDIA_FAMILY=station87)';
  61. CONFIGURE MAXSETSIZE TO UNLIMITED; # default
  62. CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
  63. CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
  64. CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default
  65. CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
  66. CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/app/oracle/product/11.2.0/dbhome_1/dbs/snapcf_orcl.f'; # default

  67. RMAN> backup tag '2TC_SYSAUX_INCR0' as compressed backupset  incremental level 0 tablespace sysaux;   

  68. Starting backup at 2018-06-08:01:12:06
  69. using channel ORA_SBT_TAPE_1
  70. using channel ORA_SBT_TAPE_2
  71. channel ORA_SBT_TAPE_1: starting compressed incremental level 0 datafile backup set
  72. channel ORA_SBT_TAPE_1: specifying datafile(s) in backup set
  73. input datafile file number=00002 name=+DATA/orcl/datafile/sysaux.257.832197065
  74. channel ORA_SBT_TAPE_1: starting piece 1 at 2018-06-08:01:12:07
  75. channel ORA_SBT_TAPE_1: finished piece 1 at 2018-06-08:01:13:02
  76. piece handle=2et4t1v7_1_1 tag=2TC_SYSAUX_INCR0 comment=API Version 2.0,MMS Version 10.3.0.2
  77. channel ORA_SBT_TAPE_1: backup set complete, elapsed time: 00:00:55
  78. Finished backup at 2018-06-08:01:13:02

  79. Starting Control File and SPFILE Autobackup at 2018-06-08:01:13:02
  80. piece handle=c-1359978017-20180608-08 comment=API Version 2.0,MMS Version 10.3.0.2
  81. Finished Control File and SPFILE Autobackup at 2018-06-08:01:13:47

  82. RMAN> list backup tag '2TC_SYSAUX_INCR0';


  83. List of Backup Sets
  84. ===================


  85. BS Key  Type LV Size       Device Type Elapsed Time Completion Time   
  86. ------- ---- -- ---------- ----------- ------------ -------------------
  87. 67      Incr 0  86.50M     SBT_TAPE    00:00:53     2018-06-08:01:13:00
  88.         BP Key: 73   Status: AVAILABLE  Compressed: YES  Tag: 2TC_SYSAUX_INCR0
  89.         Handle: 2et4t1v7_1_1   Media: station87-000008
  90.   List of Datafiles in backup set 67
  91.   File LV Type Ckp SCN    Ckp Time            Name
  92.   ---- -- ---- ---------- ------------------- ----
  93.   2    0  Incr 1155986    2018-06-08:01:12:07 +DATA/orcl/datafile/sysaux.257.832197065

  94. RMAN>
复制代码

RMAN加密备份:
先做TDE:
  1. SQL> select  * from v$encryption_wallet;

  2. WRL_TYPE
  3. --------------------
  4. WRL_PARAMETER
  5. --------------------------------------------------------------------------------
  6. STATUS
  7. ------------------
  8. file
  9. /u01/app/oracle/admin/orcl/wallet
  10. CLOSED
复制代码
  1. [oracle@station87 ~]$ ls -l /u01/app/oracle/admin/orcl/wallet/                                 
  2. ls: /u01/app/oracle/admin/orcl/wallet/: No such file or directory
  3. [oracle@station87 ~]$ mkdir -p /u01/app/oracle/admin/orcl/wallet/
复制代码
  1. [oracle@station87 ~]$ sqlplus /nolog

  2. SQL*Plus: Release 11.2.0.1.0 Production on Fri Jun 8 01:34:55 2018

  3. Copyright (c) 1982, 2009, Oracle.  All rights reserved.

  4. SQL> conn / as sysdba
  5. Connected.
  6. SQL> alter system set encryption key identified by "oracle123";

  7. System altered.

  8. SQL> select  * from v$encryption_wallet;

  9. WRL_TYPE
  10. --------------------
  11. WRL_PARAMETER
  12. --------------------------------------------------------------------------------
  13. STATUS
  14. ------------------
  15. file
  16. /u01/app/oracle/admin/orcl/wallet
  17. OPEN


  18. SQL>
复制代码
  1. [oracle@station87 ~]$ ls -l /u01/app/oracle/admin/orcl/wallet/
  2. total 4
  3. -rw-r--r-- 1 oracle asmadmin 1573 Jun  8 01:35 ewallet.p12
复制代码
  1. SQL*Plus: Release 11.2.0.1.0 Production on Fri Jun 8 01:37:17 2018

  2. Copyright (c) 1982, 2009, Oracle.  All rights reserved.

  3. SQL> conn / as sysdba
  4. Connected.
  5. SQL> alter system set encryption wallet close identified by "oracle123";

  6. System altered.

  7. SQL> alter system set encryption wallet open identified by "oracle123";

  8. System altered.

  9. SQL>
复制代码
  1. RMAN> show all;

  2. RMAN configuration parameters for database with db_unique_name ORCL are:
  3. CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 1 DAYS;
  4. CONFIGURE BACKUP OPTIMIZATION ON;
  5. CONFIGURE DEFAULT DEVICE TYPE TO 'SBT_TAPE';
  6. CONFIGURE CONTROLFILE AUTOBACKUP ON;
  7. CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default
  8. CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE SBT_TAPE TO '%F'; # default
  9. CONFIGURE DEVICE TYPE DISK PARALLELISM 8 BACKUP TYPE TO BACKUPSET;
  10. CONFIGURE DEVICE TYPE 'SBT_TAPE' PARALLELISM 2 BACKUP TYPE TO BACKUPSET;
  11. CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
  12. CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE SBT_TAPE TO 1; # default
  13. CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
  14. CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE SBT_TAPE TO 1; # default
  15. CONFIGURE CHANNEL 1 DEVICE TYPE 'SBT_TAPE' PARMS  'ENV=(OB_MEDIA_FAMILY=station87)';
  16. CONFIGURE CHANNEL 2 DEVICE TYPE 'SBT_TAPE' PARMS  'ENV=(OB_MEDIA_FAMILY=station87)';
  17. CONFIGURE MAXSETSIZE TO UNLIMITED; # default
  18. CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
  19. CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
  20. CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default
  21. CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
  22. CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/app/oracle/product/11.2.0/dbhome_1/dbs/snapcf_orcl.f'; # default

  23. RMAN> CONFIGURE ENCRYPTION FOR DATABASE on;

  24. new RMAN configuration parameters:
  25. CONFIGURE ENCRYPTION FOR DATABASE ON;
  26. new RMAN configuration parameters are successfully stored

  27. RMAN>
复制代码

更换主密钥:

c.png


双重加密:
  1. RMAN> set encryption on identified by "mysql1234" ;   

  2. executing command: SET encryption

  3. RMAN> backup tag '4TEDUAL_USERS_INCR0' incremental level 0 tablespace users;

  4. Starting backup at 2018-06-08:02:03:40
  5. using channel ORA_SBT_TAPE_1
  6. using channel ORA_SBT_TAPE_2
  7. channel ORA_SBT_TAPE_1: starting incremental level 0 datafile backup set
  8. channel ORA_SBT_TAPE_1: specifying datafile(s) in backup set
  9. input datafile file number=00004 name=+DATA/orcl/datafile/users.259.978227903
  10. channel ORA_SBT_TAPE_1: starting piece 1 at 2018-06-08:02:03:40
  11. channel ORA_SBT_TAPE_1: finished piece 1 at 2018-06-08:02:04:45
  12. piece handle=2kt4t4vs_1_1 tag=4TEDUAL_USERS_INCR0 comment=API Version 2.0,MMS Version 10.3.0.2
  13. channel ORA_SBT_TAPE_1: backup set complete, elapsed time: 00:01:05
  14. Finished backup at 2018-06-08:02:04:45

  15. Starting Control File and SPFILE Autobackup at 2018-06-08:02:04:45

复制代码

恢复时候,故意关掉TDE,只提供"mysql1234":

  1. RMAN> set decryption identified by "qwertyu","dsfydsfdsf","mysql1234";

  2. executing command: SET decryption

  3. RMAN> restore tablespace users;

  4. Starting restore at 2018-06-08:02:10:36
  5. using channel ORA_DISK_1
  6. using channel ORA_DISK_2
  7. using channel ORA_DISK_3
  8. using channel ORA_DISK_4
  9. using channel ORA_DISK_5
  10. using channel ORA_DISK_6
  11. using channel ORA_DISK_7
  12. using channel ORA_DISK_8
  13. using channel ORA_SBT_TAPE_1
  14. using channel ORA_SBT_TAPE_2

  15. channel ORA_SBT_TAPE_1: starting datafile backup set restore
  16. channel ORA_SBT_TAPE_1: specifying datafile(s) to restore from backup set
  17. channel ORA_SBT_TAPE_1: restoring datafile 00004 to +DATA/orcl/datafile/users.259.978227903
  18. channel ORA_SBT_TAPE_1: reading from backup piece 2kt4t4vs_1_1
  19. channel ORA_SBT_TAPE_1: piece handle=2kt4t4vs_1_1 tag=4TEDUAL_USERS_INCR0
  20. channel ORA_SBT_TAPE_1: restored backup piece 1
  21. channel ORA_SBT_TAPE_1: restore complete, elapsed time: 00:00:45
  22. Finished restore at 2018-06-08:02:11:22

  23. RMAN>
复制代码



回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|手机版|Bo's Oracle Station   

GMT+8, 2024-3-29 10:02 , Processed in 0.043786 second(s), 27 queries .

快速回复 返回顶部 返回列表