904 Bedford St, New York NY 10014

(+1) 5184-453-1514

Refreshable Clone- Large Objects

In creating a clone, it is a copy as of that point in time. A refreshable clone can sync back to the source PDB. This makes this clone useful for testing upgrades, making changes, and even switching the roles of a sourcing PDB and its refreshable clone. This can be useful for resources and possible load balancing between CDBs.

The option to use for this refreshable clone is REFRESH MODE with values of MANUAL or EVERY minutes. The refreshable clone must be in a closed state or open in read-only mode for refreshes. You need to have a database link even if it is in the same

CDB. Without setting minutes, the default of 60 minutes will be used.

SQL> create pluggable database mmpdb_refresh from mmpdb@mmpdb_connect refresh mode every 120 minutes;

Cloning from a Non-CDB Database

When migrating from a database prior to 21c, you might need to create the PDB from a non-CDB if the database was not created as a container. There are three ways of creating a PDB from an existing non-CDB:

•     Using the DBMS_PDB package to generate metadata and then create PDB with a CREATE PLUGGABLE DATABASE statement

•     Data Pump

•     GoldenGate replication

The following example uses the DBMS_PDB package to create a PDB from a non-CDB. For details on Data Pump and GoldenGate, see the Oracle Database Utilities Guide documentation.

When using the DBMS_PDB package to convert a non-CDB to a PDB, the non-CDB must be Oracle 12c or higher. To upgrade to a 23c CDB, the non-CDB needs to be 19c.

SQL> startup mount;

SQL> alter database open read only;

Then, run the DBMS_PDB package to create an XML file that describes the structure of the non-CDB database:

SQL> begin dbms_pdb.describe(pdb_descr_file => ‘/oradata/oracle/ncdb.xml’); end; /

After the XML file is created, shut down the non-CDB database:

SQL> shutdown immediate;

Next, set your Oracle OS variables, and connect to the CDB database that will house the non-CDB as a PDB:

$ sqlplus / as sysdba

Now, you can optionally check to see if the non-CDB is compatible with the CDB in which it will be plugged. When you run this code, provide the directory and name of the XML file that was created previously:

SQL> set serveroutput on SQL> declare hold_var boolean; begin hold_var := dbms_pdb.check_plug_compatibility (pdb_descr_file => ‘/oradata/oracle/ ncdb.xml’); if hold_var then dbms_output.put_line (‘YES’); else dbms_output.put_line(‘NO’); end if; end; /

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 details on why a PDB is not compatible with a CDB.

Next, use the following SQL to create a PDB from the non-CDB. You must specify details such as the name and location of the previously created XML file, the location of the non-CDB data files, and the location where you want the new data files created:

SQL> CREATE PLUGGABLE DATABASE pdb23c USING ‘/oradata/oracle/ncdb.xml’

COPY

FILE_NAME_CONVERT = (‘/u01/oradb/db19c/’, ‘/u01/oradb/mmdb23/pdb23c/’);

If successful, you should see this:

Pluggable database created.

Now, connect as SYS to the newly created PDB as SYS:

$ sqlplus sys/Cr4zyPa$$word1@’mm23c:1521/pdb23c’ as sysdba

As a last step, run the following script:

SQL> @?/rdbms/admin/noncdb_to_pdb.sql

You should now be able to 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