904 Bedford St, New York NY 10014

(+1) 5184-453-1514

Unplugging a PDB from a CDB- Large Objects

Before plugging a PDB into another CDB, it must first be unplugged. Unplugging translates to disassociating a PDB from a CDB and generating an XML file that describes the PDB being unplugged.

This XML file can be used in the future to plug the PDB into another CDB. Before going down this path, however, consider the previous section that discussed refreshable clones.

This creates another PDB and can be refreshed and switched over. Still, there might be a need to move a PDB offline.

Here are the steps required to unplug a PDB:

1. Close the PDB (which changes its open mode to MOUNTED).

2. Unplug the pluggable database via the ALTER PLUGGABLE DATABASE … UNPLUG command.

First, connect to the root container as the SYS user, and then close the PDB:

$ sqlplus sysuser/Cr4zyPa$$word1 as sysdba

SQL> alter pluggable database mmpdb close immediate;

Next, unplug the PDB. Make sure you specify a directory that exists in your environment for the location of the XML file:

SQL> alter pluggable database mmpdb unplug into ‘/oradata/oracle/dba/ mmpdb.xml’;

The XML file contains metadata regarding the PDB, such as its data files. This XML is required if you want to plug the PDB into another CDB.

Note Once a PDB is unplugged, it must be dropped before it can be plugged back into the original CDB.

Plugging an Unplugged PDB into a CDB

Before a PDB can be plugged into a CDB, it must be compatible with a CDB in terms of data file endianness and compatible database options installed. The character set can be different, which is how you can get a different character set for PDBs in the same CDB. You can verify the compatibility via the DBMS_PDB package. You must provide as input to the package the directory and name of the XML file created when the PDB was unplugged. Here is an example:

SQL> set serveroutput on SQL> declare

hold_var boolean; begin hold_var := dbms_pdb.check_plug_compatibility(pdb_descr_file => ‘/oradata/ oracle/dba/mmpdb.xml’); if hold_var then dbms_output.put_line(‘YES’); else dbms_output.put_line(‘NO’);

If there are no compatibility issues, a YES is displayed by the prior code; a NO is displayed if the PDB is not compatible. You can query the contents of the PDB_PLUG_IN_ VIOLATIONS view for the details on why a PDB is not compatible with a CDB.

Plugging in a PDB is done with the CREATE PLUGGABLE DATABASE command. When you plug a PDB into a CDB, you must provide some key pieces of information, using

these two clauses:

•     USING clause: This clause specifies the location of the XML file created when the PDB was unplugged.

•     COPY FILE_NAME_CONVERT clause: This clause specifies the source of the PDB data files and the location where the PDB data files will be created within the destination CDB.

To plug in a PDB, connect to the CDB as a privileged user, and run the following:

SQL> create pluggable database mmpdb using ‘/oradata/oracle/dba/mmpdb.xml’ copy

file_name_convert = (‘/u01/app/oracle/oradata/cdb19/mmpdb’, ‘/u01/dbfile/mmdb23c/mmpdb’);

You can now open the PDB and begin using it.

Search

Popular Posts

  • Recovery Catalog Versions – RMAN Backups and Reporting
    Recovery Catalog Versions – RMAN Backups and Reporting

    I recommend that you create a recovery catalog for each version of the target databases that you are backing up. Doing so will save you some headaches with compatibility issues and upgrades. I have found it easier to use a recovery catalog when the database version of the rman client is the same version used…

  • Registering a Target Database – RMAN Backups and Reporting
    Registering a Target Database – RMAN Backups and Reporting

    Now, you can register a target database with the recovery catalog. Log in to the target database server. Ensure that you can establish connectivity to the recovery catalog database. For instance, one approach is to populate the TNS_ADMIN/tnsnames.ora file with an entry that points to the remote database. On the target database server, register the…

  • Creating a Recovery Catalog – RMAN Backups and Reporting
    Creating a Recovery Catalog – RMAN Backups and Reporting

    When I use a recovery catalog, I prefer to have a dedicated database that is used only for the recovery catalog. This ensures that the recovery catalog is not affected by any maintenance or downtime required by another application (and vice versa). Listed next are the steps for creating a recovery catalog: 1. Create a…

Tags