DBA Hub

📋Steps in this guide1/5

Multitenant : Migrate a Non-Container Database (CDB) to a Pluggable Database (PDB) in Oracle Database 12c Release 1 (12.1)

Learn now to start converting your existing regular databases into pluggable databases in Oracle Database 12c Release 1 (12.1).

oracle 12cconfigurationintermediate
by OracleDba
13 views
1

Clone a Remote Non-CDB

The 12.1.0.2 patchset introduced the ability to create a PDB as a clone of a remote non-CDB. This is discussed in a separate article here .
2

Using DBMS_PDB

The package allows you to generate an XML metadata file from a non-CDB 12c database, effectively allowing it to be describe it the way you do when unplugging a PDB database. This allows the non-CDB to be plugged in as a PDB into an existing CDB. Typically, any feature used in the PDB must be present in the root container of the destination CDB prior to the migration. The following example assumes this to be the case. Cleanly shutdown the non-CDB and start it in read-only mode. Describe the non-DBC using the procedure. This procedure creates an XML file in the same way that the unplug operation does for a PDB. Shutdown the non-CDB database. Connect to an existing CDB and create a new PDB using the file describing the non-CDB database. Remember to configure the parameter to convert the existing files to the new location. Switch to the PDB container and run the "$ORACLE_HOME/rdbms/admin/noncdb_to_pdb.sql" script to clean up the new PDB, removing any items that should not be present in a PDB. You can see an example of the output produced by this script here . Startup the PDB and check the open mode. The non-CDB has now been converted to a PDB. You should backup the PDB before you start to use it.

Code/Command (click line numbers to comment):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
export ORACLE_SID=db12c
sqlplus / as sysdba

SHUTDOWN IMMEDIATE;
STARTUP OPEN READ ONLY;

BEGIN
  DBMS_PDB.DESCRIBE(
    pdb_descr_file => '/tmp/db12c.xml');
END;
/

export ORACLE_SID=db12c
sqlplus / as sysdba

SHUTDOWN IMMEDIATE;

export ORACLE_SID=cdb1
sqlplus / as sysdba

CREATE PLUGGABLE DATABASE pdb6 USING '/tmp/db12c.xml'
  COPY
  FILE_NAME_CONVERT = ('/u01/app/oracle/oradata/db12c/', '/u01/app/oracle/oradata/cdb1/pdb6/');

ALTER SESSION SET CONTAINER=pdb6;

@$ORACLE_HOME/rdbms/admin/noncdb_to_pdb.sql

ALTER SESSION SET CONTAINER=pdb6;
ALTER PLUGGABLE DATABASE OPEN;

SELECT name, open_mode FROM v$pdbs;

NAME                           OPEN_MODE
------------------------------ ----------
PDB6                           READ WRITE

1 row selected.

SQL>
3

Using Data Pump (expdb, impdp)

A simple option is to export the data from the non-CDB and import it into a newly created PDB directly. Provided the import is connecting using a service pointing to the relevant PDB, this is no different to any other data transfer using data pump. If the non-CDB is version 11.2.0.3 onward, you can consider using Transport Database, as described here . If the non-CDB is pre-11.2.0.3, then you can still consider using transportable tablespaces.
4

Using Replication

Another alternative is to use a replication product like Golden Gate to replicate the data from the non-container database to a pluggable database.
5

Patching Considerations

If your instances are not at the same patch level, you will get PDB violations visible in the view. If the destination is at a higher patch level than the source, simply run the utility on the destination instance in the normal way. It will determine what work needs to be done. If the destination is at a lower patch level than the source, you will need to run a operation, as described here . For more information see: Hope this helps. Regards Tim...

Code/Command (click line numbers to comment):

1
2
cd $ORACLE_HOME/OPatch
./datapatch -verbose

Comments (0)

Please to add comments

No comments yet. Be the first to comment!