Can I convert a non-CDB into a CDB?

Those of you who work with the Multitenant or CDB architecture for a longer time may find this blog post title strange. But as I learned the other week at the German Oracle User Group conference (DOAG 2024), others still have this question: Can I convert a non-CDB into a CDB?

Can I convert a non-CDB into a CDB?

Photo by Jeffery Ho on Unsplash

Can you convert?

Short answer: No.

End-of-blog-post.
Well, of course, not.
Let me explain this a bit more.

When you have a non-CDB database today, you can’t convert it into a CDB (Container Database). This path isn’t possible but there is another path. You won’t convert your non-CDB into a CDB but you will convert your non-CDB into a PDB.

While there is no noncdb_to_cdb.sql script available, there is a noncdb_to_pdb.sql since day 1 of the Multitenant release in Oracle Database 12c.

 

What needs to be done?

Very simple and straight forward. You need to create a CDB at first. Usually you’d do this with the DBCA – and we highly recommend that you use the ADVANCED and CUSTOM DATABASE approach since this is the only way to see the component options screen. It is important that you take care on the three “C”s.

Three “C”s??

  • Components
    Have the matching components installed into your new databases. Matching means, those you have in your source already. Check DBA_REGISTRY in your source database.
  • Character Set
    The default of AL32UTF8 is the best since it allows you to mix different character sets in different PDBs within the same CDB. Just be aware that every new PDB will be created as a clone of the PDB$SEED which automatically inherits the character set of the CDB$ROOT container. If you need a PDB with a different character set created from scratch, you must create a non-CDB with your desired character set, and then convert it into a PDB. Use this one to clone from in the future.
  • COMPATIBLE
    While you can’t downgrade from the CDB architecture into a non-CDB, you can still downgrade a PDB from 23ai to 19c, or from 19c to 12.2.0.1 for instance. But in order to allow this option, your new CDB must be created with the matching COMPATIBLE parameter under which the source operates. Keep in mind that PDBs automatically inherit the COMPATIBLE setting of the CDB$ROOT. Default of a 23ai CDB may vary depending on the release you created it. You need to adjust the default in the Advanced Parameter screen in DBCA at the very end of the dialogue.

 

Where can you learn more about it?

We highly recommend that you watch our two Virtual Classroom Seminars. Especially the first one for this topic, Episode 19, covers exactly those topics.

How do you create the CDB?

What happens during the conversion, and how long will it take?

And everything you wanted to know, plus much more than that.

Episode 19
Move to Oracle Database 23ai – Everything you need to know about Multitenant PART 1
145 min – May 16, 2024
Virtual Classroom Seminar 19 - Oracle 23ai Multitenant Migration
Episode 20
Move to Oracle Database 23ai – Everything you need to know about Multitenant PART 2
100 min – June 28, 2024
Virtual Classroom Seminar 20 - Oracle 23ai Multitenant Migration

 

Can I move my 19c non-CDB?

Of course, you can. This is another question I’ve been asked multiple times at DOAG 2024 conference. AutoUpgrade is the tool of your choice – it does this move for you, regardless whether you upgrade or patch, or simple plugin.

While we recommend for testing using the Refreshable Clone PDBs (yes, this works for non-CDB to PDB), you can just convert a database in-place without moving it. Please make sure that you have a solid and valid backup as well.

This is the simplest and shortest AutoUpgrade config.cfg file telling the tool to plugin your ORCL into CDB1 and converting it to the Multitenant architecture making it a PDB.

upg1.source_home=/u01/app/oracle/product/19
upg1.target_home=/u01/app/oracle/product/19
upg1.sid=ORCL
upg1.target_cdb=CDB1

And of course, I did blog about this before but under a different headline:

 

When should I do this?

For a longer time we recommend you to at least identify a few databases and move them to the CDB architecture now. With Oracle Database 19c onward you will have 3 user-created PDBs included in every Oracle Database license set. Just start now if you haven’t since the non-CDB architecture will be desupported and unavailable from Oracle Database 21c on.

 

Further Links and Information

–Mike