DBCA silent mode commands in 19c – Part 2

PDB Relocation

Relocating a pdb improves availability when moving them across data centers or from on-premises to cloud. Online block level copies of data files, redo and undo will be shipped to destination PDB until the target PDB is open explicitly*. Applications connected to source PDB will remain active (read/write) until the maintenance window is declared. During the maintenance window, active sessions can exit gracefully within the drain time and Oracle will then terminate the active sessions and reconnects them to the relocated PDB. Staring Oracle 21c, the database can invoke application continuity to failover sessions automatically to the relocated PDB, if such sessions are unlikely to drain in the given drain window.  

* Note that, in the dbca silent method, actions including target PDB opening occurs with no user intervention. The documentation doesn’t indicate a way of providing a drain timeout and hence we could assume it to be the default timeout of 300 seconds (5 minutes). However, during our testing, the drain timeout initiated within 2 minutes.

The Setup

Pre-requisites

The source CDB (PROD)

The target CDB (PROD2)

Also note that the the source database options need to match the target database options or a subset of it.

We will first access a table by connecting to source PDB

Connect string for the source CDB

Initiate PDB relocate

dbca -silent \

-relocatePDB \

-pdbName prodpdb1 \ — New PDB name at target

-sourceDB prod2 \ — Target CDB

-remotePDBName prodpdb1 \ — Source PDB

-remoteDBConnString prod \ — Source connect string (tnsnames)

-sysDBAUserName sys \ — Target SYS user

-remoteDBSYSDBAUserName sys \ — Source SYS user

-dbLinkUsername c##produser \

-dbLinkUserPassword oracle123

Until the drain time,

Drain timeout (about 2 minutes, as per our observation)

Verified post relocation

Additional notes

DBCA, creates a DB link named <target_pdb_name>__CLONE_LINK in the background in order to carryout the relocation. This link needs to be manually dropped if the relocation fails, before reattempting.

By gayan

Leave a Reply

Your email address will not be published. Required fields are marked *