Duplicating CDBs and PDBs

Duplicating CDBs

To duplicate a CDB:

  1. 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;

  1. Ensure that the prerequisites for the selected duplication technique are met.
  2. Prepare the auxiliary instance as described in Preparing the Auxiliary Instance, with the following changes:
  1. 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

  1. 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

  1. 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.
  1. Start RMAN and connect to the root as a user with the SYSDBA or SYSBACKUP privilege.
  2. Place source database in proper state (if necessary).
  3. Configure RMAN channels (if necessary).
  4. Use the DUPLICATE command to duplicate the source CDB.

Duplicating PDBs

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:

  1. 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;

  1. Ensure that the prerequisites for the selected duplication technique are met.
  2. Prepare the auxiliary instance as described in Preparing the Auxiliary Instance, with the following changes:
  1. 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

  1. 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

  1. 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.
  1. Start RMAN and connect to the root as a user with the SYSDBA or SYSBACKUP privilege.
  2. Place source database in proper state (if necessary).
  3. Configure RMAN channels (if necessary).
  4. 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:

  1. Ensure that you have completed Steps 1 to 4 in Duplicating PDBs.
  2. 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;

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值