Skip to main content
Skip table of contents

CLI cookbook: attaching, detaching, or linking a CDB

This topic describes how to attach, detach, or link a CDB using the command-line interface.

A CDB is not automatically detached when you detach the last PDB of the CDB. The CDB still remains in an inactive state which in turn prevents you from removing the environment. Therefore, you must detach the CDB in order to remove the environment.

You can perform detach or attach operations only via Command-Line Interface (CLI).

CDB CLI detach

Perform the following steps to detach a CDB.

You can detach a CDB only when there are no PDBs linked and the CDB does not have any vPDBs.

  1. Login to the engine via SSH with a Delphix admin account.

    CODE
    $ ssh admin@YOUR_ENGINE
  2. Select the CDB dSource database to be detached.

    CODE
    dvde.dcenter> cd database
    dvde.dcenter database> select CDOMLOSR421F
    dvde.dcenter database 'CDOMLOSR421F'>
  3. Detach the CDB dSource using the detachSource command.

    CODE
    dvde.dcenter database 'CDOMLOSR421F'> detachSource
    dvde.dcenter database 'CDOMLOSR421F' detachSource *> set source=CDOMLOSR421F
    dvde.dcenter database 'CDOMLOSR421F' detachSource *> commit
        Dispatched job JOB-45
        DB_DETACH_SOURCE job started for "Untitled/CDOMLOSR421F".    
        DB_DETACH_SOURCE job for "Untitled/CDOMLOSR421F" completed successfully.

You must attach the CDB back before performing the following operations: linking a new PDB, attaching a PDB, provisioning a vPDB, or attaching a converted PDB. Failure to do this will either result in an error due to duplicated object or will create a second CDB that will duplicate the space used for the CDB.

You can not perform an attach operation for PDBs that have already been detached from the primary CDB and are required to be attached to a standby CDB if the standby CDB is not already linked or attached. You must link the CDB manually before performing the PDB attach operation.

Perform the following steps to link a CDB.

  1. Login to the engine via SSH with a Delphix admin account.

    CODE
    $ ssh admin@YOUR_ENGINE
  2. Select the CDB dSource database to be linked.

    CODE
    dvde.dcenter> cd database
    dvde.dcenter database> link
    dvde.dcenter database link *>
  3. Link the CDB dSource using the link command.

    CODE
    dvde.dcenter database link *> set name=mycdb
    dvde.dcenter database link *> set group=Untitled
    dvde.dcenter database link *> edit linkData
    dvde.dcenter database link linkData *> set type=OracleLinkFromExternal
    dvde.dcenter database link linkData *> set syncStrategy.config=CDOMSHSR6706
    dvde.dcenter database link linkData *> set environmentUser=oracle
    dvde.dcenter database link linkData *> set linkNow=true
    dvde.dcenter database link linkData *> commit
        `ORACLE_DB_CONTAINER-23
        Dispatched job JOB-171
        \DB_LINK job started for "Untitled/mycdb".
        Obtaining information from source database "Untitled/mycdb".
        Creating new TimeFlow for dSource "Untitled/mycdb".    
        Request to SnapSync container database "Untitled/mycdb" after attaching it will be ignored.  
        Action: Direct SnapSync of container database is not allowed. Container
                   database SnapSync will be taken when SnapSync of corresponding
                   pluggable database is taken.    
        The dSource"mycdb" as successfully linked from source database "Untitled/mycdb".    
        DB_LINK job for "Untitled/mycdb" completed successfully.

CDB CLI Attach

Perform the following steps to attach a CDB.

  1. Ensure the new source environment has been fully discovered by the Delphix Engine.

  2. Login to the engine via SSH with a Delphix admin account.

    CODE
    $ ssh admin@YOUR_ENGINE
  3. Select the CDB dSource database to be attached.

    CODE
    dvde.dcenter> cd database
    dvde.dcenter database> select CDOMLOSR421F
    dvde.dcenter database 'CDOMLOSR421F'>
  4. Attach the CDB dSource to the correct source CDB in the new environment using the attachSource command.

When attaching a CDB linkNow=true command is ignored, then the CDBs can not be snapshotted directly. CDB snapshots will be taken when PDB requires a snapshot of the CDB.

CODE
dvde.dcenter database 'CDOMLOSR421F'> attachSource
dvde.dcenter database 'CDOMLOSR421F' attachSource *> edit attachData
dvde.dcenter database 'CDOMLOSR421F' attachSource attachData *> set type=OracleAttachData
dvde.dcenter database 'CDOMLOSR421F' attachSource attachData *> set config=CDOMLOSR421F
dvde.dcenter database 'CDOMLOSR421F' attachSource attachData *> set environmentUser=oracle
dvde.dcenter database 'CDOMLOSR421F' attachSource *> commit
    CDOMLOSR421F    
    Dispatched job JOB-46    
    DB_ATTACH_SOURCE job started for "Untitled/CDOMLOSR421F".
        Starting validation of attach parameters for database "CDOMLOSR421F".    
    Obtaining information from source database "Untitled/CDOMLOSR421F".    
    The dSource "CDOMLOSR421F" was successfully linked from source database "Untitled/CDOMLOSR421F".
JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.