- This method can be used from 184.108.40.206 onwards.
- The functionality is natively available in 18c and later.
- 220.127.116.11 and 12.2 require a one-off patch 25802510. The patch is also available in some 12.1/12.2 RU. Please refer to: Bug 25802510 - Create PDB from .xml does not propagate PDB files to standby (Doc ID 25802510.8) for more details.
Close the PDB:
alter pluggable database <pdb_name> close instances=all;
alter pluggable database pdb_test close instances=all;
Unplug the PDB:
alter pluggable database <pdb_name> unplug into '<filename>';
alter pluggable database pdb_test unplug into '/mnt/pdb_test.xml';
Create a copy of PDB datafiles using RMAN:
backup as copy pluggable database <pdb_name> format '<format_spec>'
backup as copy pluggable database pdb_test format '/mnt/datafile/%U';
Copy/Move the XML metadata file and PDB datafiles of the source database created by the RMAN backup to a filesystem accessible to the standby database in a Data Guard configuration. The datafiles can be on a regular filesystem or an ASM disk group. In case of a network filesystem, it can be shared between primary and standby hosts and set read-only.
Set the STANDBY_PDB_SOURCE_FILE_DIRECTORY parameter pointing to the location of the PDB datafiles, e.g.:
alter system set standby_pdb_source_file_directory='<directory>' sid='*' scope=both;
alter system set standby_pdb_source_file_directory='/mnt/racdbb/datafile' sid='*' scope=both;
Copy/Move the XML metadata file and PDB datafiles of the source database created by the RMAN backup to a filesystem accessible to the primary database in a Data Guard configuration. The datafiles can be on a regular filesystem or an ASM disk group.
Plugin the PDB:
create pluggable database <pdb_name> as clone using '<filename>' source_file_directory='<directory>' copy;
create pluggable database pdb_test as clone using '/mnt/racdba/pdb_test.xml' source_file_directory='/mnt/racdba/datafile' copy;
When Standby receives redo corresponding to the plugged in PDB, it will search for its datafiles in the location specified by STANDBY_PDB_SOURCE_FILE_DIRECTORY. Then, the files will be copied from that location to the ASM disk group. Here are samples lines from the standby alert log showing that:
2021-11-18T16:33:09.609489+00:00 Recovery created pluggable database PDB_TEST 2021-11-18T16:33:10.641643+00:00 Recovery attempting to copy datafiles for pdb-PDB_TEST from source dir-/mnt/racdbb/datafile 2021-11-18T16:33:19.962650+00:00 Recovery copied files for tablespace SYSTEM Recovery successfully copied file +DATA/RACDBB/D083CCA609EB63DDE0530101A8C08BEA/DATAFILE/system.292.1088958791 from /mnt/racdbb/datafile/data_D-RACDB_I-1085957449_TS-SYSTEM_FNO-34_110eg082 PDB_TEST(4):Successfully added datafile 38 to media recovery PDB_TEST(4):Datafile #38: '+DATA/RACDBB/D083CCA609EB63DDE0530101A8C08BEA/DATAFILE/system.292.1088958791'