How To Move a PDB to Another CDB?

Hello,

  1. Connect to the remote CDB and prepare it for relocating.

export ORACLE_SID=cdb1

sqlplus / as sysdba
SHOW con_name;

2. Create a user in the remote database for use with the database link

CREATE USER c##remote_clone_user IDENTIFIED BY remote_clone_user CONTAINER=ALL;
GRANT CREATE SESSION, CREATE PLUGGABLE DATABASE TO c##remote_clone_user CONTAINER=ALL;
GRANT SYSOPER TO c##remote_clone_user CONTAINER=ALL;

3. Check the remote CDB is in local undo mode and archivelog mode.

SELECT property_name, property_value
FROM database_properties
WHERE property_name = ‘LOCAL_UNDO_ENABLED’;

SELECT log_mode
FROM v$database;

4. Connect to the local CDB and prepare it for relocating.

export ORACLE_SID=orcl

sqlplus / as sysdba

5. Check the local CDB is in local undo mode and archivelog mode.

SELECT property_name, property_value
FROM database_properties
WHERE property_name = ‘LOCAL_UNDO_ENABLED’;

SELECT log_mode
FROM v$database;

6. In 19c, the DBCA -relocatePDB command has been introduced. You can user up to 3 PDBs per CDB Without Licensing Multitenant.

export ORACLE_SID=cdb

dbca -silent \
-relocatePDB \
-pdbName crm \
-sourceDB cdb \
-remotePDBName crm \
-remoteDBConnString localhost:1521/orcl \
-remoteDBSYSDBAUserName sys \
-remoteDBSYSDBAUserPassword oracle \
-dbLinkUsername c##remote_clone_user \
-dbLinkUserPassword remote_clone_user

CREATE PLUGGABLE DATABASE crm ADMIN USER pdbadmin IDENTIFIED BY oracle
FILE_NAME_CONVERT = (‘/oradata/CDB/pdbseed/’, ‘/oradata/CDB/crm/’);

alter pluggable database crm open;

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s