Skip to Main Content

Oracle Database Discussions

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

migrating 19c noncdb to pdb

Mustafa KALAYCIMar 5 2022 — edited Mar 5 2022

Hi,
I am testing noncdb to pdb migration on Oracle Linux (virtual machine) and db version is 19.13 standard edition 2.
I created one noncdb (orcl) and a cdb (CDB) on the same machine with default parameters (general database template) and want to migrate ORCL into CDB db as a pdb but something is bothering me.
as you know, dictionary objects are actually created in cdb$root as shared objects. So, these objects are not exist in a PDB. Let's say DBA_OBJECTS view. I can get source code of dba_objects in cdb$root:

SYS@cdb->show user con_name
USER is "SYS"

CON_NAME
------------------------------
CDB$ROOT

SYS@cdb->select dbms_metadata.get_ddl('VIEW', 'DBA_OBJECTS', 'SYS') from dual;

DBMS_METADATA.GET_DDL('VIEW','DBA_OBJECTS','SYS')
--------------------------------------------------------------------------------

  CREATE OR REPLACE FORCE NONEDITIONABLE VIEW "SYS"."DBA_OBJECTS" ("OWNER", "OB

so far so good, I can get source code of a dict view in cdb$root. Now I create a PDB from seed:

SYS@cdb->create pluggable database pdb admin user admin identified by admin;

Pluggable database created.

SYS@cdb->alter pluggable database pdb open;

Pluggable database altered.

SYS@cdb->alter session set container=pdb;

Session altered.

SYS@cdb->select dbms_metadata.get_ddl('VIEW', 'DBA_OBJECTS', 'SYS') from dual;
ERROR:
ORA-31603: object "DBA_OBJECTS" of type VIEW not found in schema "SYS"
ORA-06512: at "SYS.DBMS_METADATA", line 6731
ORA-06512: at "SYS.DBMS_SYS_ERROR", line 105
ORA-06512: at "SYS.DBMS_METADATA", line 6718
ORA-06512: at "SYS.DBMS_METADATA", line 9734
ORA-06512: at line 1

still good, that is supposed to be since dba_objects doesn't exist in PDB.
Now, I convert ORCL into CDB as PDB. I created it in 2 different ways(create an xml file and use plug in and create pluggable database via dblink). I share dblink version:

SYS@cdb->create pluggable database orcl from orcl@orcl_link;

Pluggable database created.

SYS@cdb->alter session set container=orcl;

Session altered.

SYS@cdb->@?/rdbms/admin/noncdb_to_pdb.sql
-- SUPPRESSED OUTPUT

SYS@cdb->select dbms_metadata.get_ddl('VIEW', 'DBA_OBJECTS', 'SYS') from dual;

DBMS_METADATA.GET_DDL('VIEW','DBA_OBJECTS','SYS')
--------------------------------------------------------------------------------

  CREATE OR REPLACE FORCE NONEDITIONABLE VIEW "SYS"."DBA_OBJECTS" ("OWNER", "OB

I create pdb via db link (there is almost no violations in pdb_plug_in_violations after migrating orcl) then run noncdb_to_pdb.sql as it's supposed to be but after database is open when I tried to get source code of DBA_OBJECTS in orcl pdb, I am able to get a source code! But this sql should have caused an error because this is a pdb.
so migrated noncdb as pdb has it is own data dictionary? I will test but what would happen when I upgrade the CDB? Will changes in data dictionary affect the orcl pdb too?
I have read the docs and didn't see any other action while migrating but it seems this pdb is not exactly a "pure pdb" am I wrong?

Comments

Post Details

Added on Mar 5 2022
2 comments
989 views