904 Bedford St, New York NY 10014

(+1) 5184-453-1514

Cloning the Seed Database- Large Objects

The CREATE PLUGGABLE DATABASE statement can be used to create a PDB by copying the seed database’s data files. To do this, first, connect to the root container database as the SYS user (or a common user with create PDB privileges):$ sqlplus sysuser/ Cr4zyPa$$word1@mmdb23c as sysdba.

The following SQL statement creates a pluggable database named SALESPDB:

SQL> create pluggable database salespdb

admin user salesadm identified by “Cr4zyPa$$word1” file_name_convert = (‘/u01/app/oracle/oradata/mmdb23/pdbseed’, ‘/u01/app/oracle/oradata/mmdb23/salespdb’);

After running the prior code, you should see some output similar to this:

Pluggable database created.

Here’s a simplified statement when using standard files and ASM:

SQL> create pluggable database salespdb admin user salesadm identified by “Cr4zyPa$$word1”;

Pluggable database created.

Cloning an Existing PDB

You can create a PDB from an existing PDB within the currently connected (local) CDB, or you can create a PDB as a copy of a PDB from a remote CDB. Creating a copy is useful for test environments or needing to troubleshoot problems in production. These two techniques are detailed in the next two sections.

Local

In this example, an existing PDB (SALESPDB) is used to create a new PDB (SALESPDB2). First, connect to the root container, and place the existing source PDB in read-only mode:

$ sqlplus sysuser/Cr4zyPa$$word1@mmdb23c as sysdba

SQL> create pluggable database salespdb2 from salespdb;

You can also do this from a snapshot:

SQL> alter pluggable database mmpdb snapshot mmpdb1_623;

SQL> create pluggable database mmpdb_copy from mmpdb using snapshot mmpdb1_623;

Remote

You can also create a PDB as a clone of a remote PDB. First, you need to create a database link from the CDB to the PDB that will serve as the source for the clone.

Both the local user and the user specified in the database link must have the CREATE PLUGGABLE DATABASE privilege.

This example shows a local connection as SYS to the root container. This is the database in which the new PDB will be created:

$ sqlplus sysuser/Cr4zyPa$$word1@mmdb23 as sysdba

In this database, create a database link to the PDB in the remote CDB. The remote CDB contains a PDB named mmpdb, with a user that has been created with the CREATE PLUGGABLE DATABASE privilege granted to it. This is the user that will be used in the database link:

SQL> create database link mmpdb_connect

connect to pdbcloneuser identified by “Cr4zyPa$$word1” using ‘mm23c:1521/mmpdb’;

Next, connect to the remote database that contains the PDB that will be cloned:

$ sqlplus sysuser/Cr4zyPa$$word1@mm23c:1521/mmpdb as sysdba

SQL> create pluggable database mmpdb_clone from mmpdb@mmpdb_connect;

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