To duplicate a CDB:
- Complete the planning tasks described in Planning to Duplicate a Database with the following change:
In Making Backups Accessible to the Duplicate Instance and Making Disk Backups Accessible Without Shared Disk, note the following adjustment:
Use the PLUGGABLE DATABASE syntax of the BACKUP command to copy only the backups of a specific PDB.
The following command transfers the backup files for the entire CDB:
BACKUP COPY OF DATABASE;
The following command transfers only the backup files for the PDB pdb3:
BACKUP COPY OF PLUGGABLE DATABASE pdb3;
- Ensure that the prerequisites for the selected duplication technique are met.
- Prepare the auxiliary instance as described in Preparing the Auxiliary Instance, with the following changes:
- You must create the auxiliary instance as a CDB. To do so, start the instance with the following declaration in the initialization parameter file:
enable_pluggable_database=TRUE
- When instructed to create an initialization parameter file for the auxiliary instance, you must copy the file from the source database. This ensures that the auxiliary instance is also a CDB. After copying, perform the following steps:
Modify the DB_NAME parameter
Modify the various destination/location parameters
- When instructed to connect to the necessary instances, connect to the root as a user with SYSDBA or SYSBACKUP privilege. On both instances, the password for the user performing the duplication must be the same.
- Start RMAN and connect to the root as a user with the SYSDBA or SYSBACKUP privilege.
- Place source database in proper state (if necessary).
- Configure RMAN channels (if necessary).
- Use the DUPLICATE command to duplicate the source CDB.
RMAN enables you to duplicate PDBs with the DUPLICATE command. You can duplicate a single PDB, a set of PDBs, or a set of tablespaces within a PDB. You must be logged in to the root of the CDB as a user who is granted the SYSDBA or SYSBACKUP privilege.
To duplicate PDBs, you must create the auxiliary instance as a CDB. To do so, start the auxiliary instance with the declaration enable_pluggable_database=TRUE in the initialization parameter file. When you duplicate one or more PDBs, RMAN also duplicates the root (CDB$ROOT) and the CDB seed (PDB$SEED). The resulting duplicate database is a fully functional CDB that contains the root, the CDB seed, and the duplicated PDBs.
Table 25-3 describes the options that you can use to duplicate PDBs or tablespaces within PDBs.
DUPLICATE Option | Explanation |
PLUGGABLE DATABASE pdb_name | Duplicates the specified PDBs in the CDB. Use a comma-delimited list to duplicate multiple PDBs. |
SKIP PLUGGABLE DATABASE pdb_name | Duplicates all the PDBs in the CDB, except the PDBs specified by pdb_name. Use a comma-delimited list to specify multiple PDBs that must be excluded. |
TABLESPACE pdb_name:tablespace_name | Duplicates specified tablespaces within a PDB. The tablespace name must be prefixed with the name of the PDB that contains the tablespace. If you omit the name of the PDB, root is taken as the default. |
SKIP TABLESPACE pdb_name:tablespace_name | Duplicates all tablespaces in the CDB except the specified tablespaces in the specified PDB. |
To duplicate a PDB:
- Complete the planning tasks described in Planning to Duplicate a Database with the following change:
In Making Backups Accessible to the Duplicate Instance and Making Disk Backups Accessible Without Shared Disk, note the following adjustment:
Use the PLUGGABLE DATABASE syntax of the BACKUP command to copy only the backups of a specific PDB.
For example, the following command transfers only the backups files for the PDB pdb3:
BACKUP COPY OF PLUGGABLE DATABASE pdb3;
- Ensure that the prerequisites for the selected duplication technique are met.
- Prepare the auxiliary instance as described in Preparing the Auxiliary Instance, with the following changes:
- You must create the auxiliary instance as a CDB. To do so, start the instance with the following declaration in the initialization parameter file:
enable_pluggable_database=TRUE
- When instructed to create an initialization parameter file for the auxiliary instance, you must copy the file from the source database. This ensures that the auxiliary instance is also a CDB. After copying, perform the following steps:
Modify the DB_NAME parameter
Modify the various destination/location parameters
- When instructed to connect to the necessary instances, connect to the root as a user with SYSDBA or SYSBACKUP privilege. On both instances, the password for the user performing the duplication must be the same.
- Start RMAN and connect to the root as a user with the SYSDBA or SYSBACKUP privilege.
- Place source database in proper state (if necessary).
- Configure RMAN channels (if necessary).
- Duplicate the PDB by using the DUPLICATE … PLUGGABLE DATABASE command.
Examples: Duplicating PDBs
To duplicate the PDB pdb1 to the CDB cdb1, use the following command:
DUPLICATE DATABASE TO cdb1 PLUGGABLE DATABASE pdb1;
To duplicate the PDBs pdb1, pdb3, and pdb4 to the database cdb1, use the following command:
DUPLICATE DATABASE TO cdb1 PLUGGABLE DATABASE pdb1,pdb3,pdb4;
To duplicate all the PDBs in the CDB, except the PDB pdb3, use the following command:
DUPLICATE DATABASE TO cdb1 SKIP PLUGGABLE DATABASE pdb3;
(三)Duplicating Tablespaces Within a PDB
To duplicate tablespaces within a PDB:
- Ensure that you have completed Steps 1 to 4 in Duplicating PDBs.
- Run the DUPLICATE command with the TABLESPACE option described in Table 25-3.
The following are some examples of duplicating tablespaces contained in PDBs:
To duplicate the users tablespace that is part of PDB pdb1, use the following command:
DUPLICATE DATABASE TO cdb1 TABLESPACE pdb1:users;
To duplicate the PDB pdb1 and the users tablespace in PDB pdb2, use the following command:
DUPLICATE DATABASE TO cdb1 PLUGGABLE DATABASE pdb1 TABLESPACE pdb2:users;