oracle 主机 pdb
源端 192.168.5.128 pdb2
目标端 192.168.5.129 pdb2dg

前提条件:
1.源库必须处于归档模式
archive log list;
2.源库需要同步的pdb必须open。

1. 目标库创建REMOTE_RECOVERY_FILE_DEST参数文件,并设置参数

  1. mkdir -p /tmp/fixfpdb
  2. alter system set REMOTE_RECOVERY_FILE_DEST='/tmp/fixfpdb';

2.目标库执行duplicate 同步

  1. duplicate pluggable database fixfpdb as dupfixfpdb to orcl from active database nofilenamecheck;
  2. [oracle@19c_cdb ~]$ rman target sys/Oracle123@192.168.5.128:1521/orcl auxiliary sys/Oracle123
  3. Recovery Manager: Release 19.0.0.0.0 - Production on Thu Apr 22 01:30:58 2021
  4. Version 19.3.0.0.0
  5. Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved.
  6. connected to target database: ORCL (DBID=1575995925)
  7. connected to auxiliary database: ORCL (DBID=1575995925)
  8. RMAN> duplicate pluggable database fixfpdb as dupfixfpdb to orcl from active database nofilenamecheck;
  9. Starting Duplicate PDB at 22-APR-21
  10. using target database control file instead of recovery catalog
  11. allocated channel: ORA_AUX_DISK_1
  12. channel ORA_AUX_DISK_1: SID=382 device type=DISK
  13. current log archived
  14. duplicating Online logs to Oracle Managed File (OMF) location
  15. duplicating Datafiles to Oracle Managed File (OMF) location
  16. contents of Memory Script:
  17. {
  18. set newname for clone datafile 16 to new;
  19. set newname for clone datafile 17 to new;
  20. set newname for clone datafile 18 to new;
  21. set newname for clone datafile 20 to new;
  22. restore
  23. from nonsparse clone foreign pluggable database
  24. "FIXFPDB"
  25. from service '192.168.5.128:1521/orcl' ;
  26. }
  27. executing Memory Script
  28. executing command: SET NEWNAME
  29. executing command: SET NEWNAME
  30. executing command: SET NEWNAME
  31. executing command: SET NEWNAME
  32. Starting restore at 22-APR-21
  33. using channel ORA_AUX_DISK_1
  34. channel ORA_AUX_DISK_1: starting datafile backup set restore
  35. channel ORA_AUX_DISK_1: using network backup set from service 192.168.5.128:1521/orcl
  36. channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
  37. channel ORA_AUX_DISK_1: restoring foreign file 16 to /u01/oracle/oradata/ORCL/AF79DD4522FD0E17E0538105A8C043BD/datafile/o1_mf_system_tovst3j1_.dbf
  38. channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:08
  39. channel ORA_AUX_DISK_1: starting datafile backup set restore
  40. channel ORA_AUX_DISK_1: using network backup set from service 192.168.5.128:1521/orcl
  41. channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
  42. channel ORA_AUX_DISK_1: restoring foreign file 17 to /u01/oracle/oradata/ORCL/AF79DD4522FD0E17E0538105A8C043BD/datafile/o1_mf_sysaux_rfvst3j8_.dbf
  43. channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:07
  44. channel ORA_AUX_DISK_1: starting datafile backup set restore
  45. channel ORA_AUX_DISK_1: using network backup set from service 192.168.5.128:1521/orcl
  46. channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
  47. channel ORA_AUX_DISK_1: restoring foreign file 18 to /u01/oracle/oradata/ORCL/AF79DD4522FD0E17E0538105A8C043BD/datafile/o1_mf_undotbs1_1evst3jg_.dbf
  48. channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:03
  49. channel ORA_AUX_DISK_1: starting datafile backup set restore
  50. channel ORA_AUX_DISK_1: using network backup set from service 192.168.5.128:1521/orcl
  51. channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
  52. channel ORA_AUX_DISK_1: restoring foreign file 20 to /u01/oracle/oradata/ORCL/AF79DD4522FD0E17E0538105A8C043BD/datafile/o1_mf_fixf_qpvst3jj_.dbf
  53. channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:35
  54. Finished restore at 22-APR-21
  55. current log archived
  56. contents of Memory Script:
  57. {
  58. set archivelog destination to '/tmp/fixfpdb';
  59. restore clone force from service '192.168.5.128:1521/orcl'
  60. foreign archivelog from scn 3467857;
  61. }
  62. executing Memory Script
  63. executing command: SET ARCHIVELOG DESTINATION
  64. Starting restore at 22-APR-21
  65. using channel ORA_AUX_DISK_1
  66. channel ORA_AUX_DISK_1: starting archived log restore to user-specified destination
  67. archived log destination=/tmp/fixfpdb
  68. channel ORA_AUX_DISK_1: using network backup set from service 192.168.5.128:1521/orcl
  69. channel ORA_AUX_DISK_1: restoring archived log
  70. archived log thread=1 sequence=24
  71. channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:02
  72. channel ORA_AUX_DISK_1: starting archived log restore to user-specified destination
  73. archived log destination=/tmp/fixfpdb
  74. channel ORA_AUX_DISK_1: using network backup set from service 192.168.5.128:1521/orcl
  75. channel ORA_AUX_DISK_1: restoring archived log
  76. archived log thread=1 sequence=25
  77. channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
  78. Finished restore at 22-APR-21
  79. Performing import of metadata...
  80. Finished Duplicate PDB at 22-APR-21

3.查看已同步的pdb

  1. sqlplus / as sysdba
  2. SQL> show pdbs
  3. CON_ID CON_NAME OPEN MODE RESTRICTED
  4. ---------- ------------------------------ ---------- ----------
  5. 2 PDB$SEED READ ONLY NO
  6. 3 ORCLPDB MOUNTED
  7. 4 PDB1 MOUNTED
  8. 5 DUPFIXFPDB READ WRITE NO
  9. 6 PDB3DG MOUNTED
  10. 10 NOCDB MOUNTED