Databases 15 min read

Mastering Oracle 12cR2 CREATE DATABASE: Scripts, Pitfalls, and Version Differences

This guide walks through creating an Oracle 12cR2 container database with CREATE DATABASE, explains OMF vs non‑OMF options, details the catcdb.sql/perl changes, resolves common Perl module errors, compares 10g/11g syntax differences, and provides practical fixes such as blocksize adjustments.

dbaplus Community
dbaplus Community
dbaplus Community
Mastering Oracle 12cR2 CREATE DATABASE: Scripts, Pitfalls, and Version Differences

Oracle 12cR2 CREATE DATABASE Overview

Since the release of Oracle 12cR2, the new multitenant architecture (CDB) has attracted DBA attention. The CREATE DATABASE statement changed significantly, introducing seed databases and, in 12.2, local and shared undo modes.

Using CREATE DATABASE with OMF

The official documentation lists two approaches: Oracle Managed Files (OMF) and non‑OMF. For simplicity the article demonstrates the OMF style, which yields a clearer statement.

CREATE DATABASE newcdb
USER SYS IDENTIFIED BY sys_password
USER SYSTEM IDENTIFIED BY system_password
EXTENT MANAGEMENT LOCAL
DEFAULT TABLESPACE users
DEFAULT TEMPORARY TABLESPACE temp
UNDO TABLESPACE undotbs1
ENABLE PLUGGABLE DATABASE
SEED
SYSTEM DATAFILES SIZE 125M AUTOEXTEND ON NEXT 10M MAXSIZE UNLIMITED
SYSAUX DATAFILES SIZE 100M;

The highlighted SEED clause creates a template PDB for fast provisioning.

catcdb.sql vs catcdb.pl in 12.2

In earlier releases the data‑dictionary initialization required running catalog.sql and catproc.sql. Oracle 12.2 replaces these with a single catcdb.sql script, which internally invokes a Perl script catcdb.pl. The Perl script introduces new module dependencies.

First Issue – Missing Term/ReadKey.pm

Running @?/rdbms/admin/catcdb.sql prompts for two parameters. Without them the script fails with:

Can't locate Term/ReadKey.pm in @INC ... at /U01/app/oracle/product/12.2/rdbms/admin/catcdb.pl line 30.
BEGIN failed--compilation aborted at /U01/app/oracle/product/12.2/rdbms/admin/catcdb.pl line 30.

Solution: add the Oracle‑provided Perl directory to PATH:

export PATH=$ORACLE_HOME/bin:$ORACLE_HOME/OPatch:$ORACLE_HOME/perl/bin:$ORACLE_HOME/jdk/bin:$PATH

Second Issue – Missing util.pm

The script also cannot find util.pm. Searching the Oracle home reveals several Util.pm files but no lowercase version. The correct module is located at:

/U01/app/oracle/product/12.2/perl/lib/5.22.0/x86_64-linux-thread-multi/Hash/Util.pm

Modify catcdb.pl to use the proper case:

use Util qw(trim splitToArray);

Running the Fixed Script

After adjusting the module path and case, execute the script from the Hash directory:

SQL> host perl -I $ORACLE_HOME/rdbms/admin -I $ORACLE_HOME/rdbms/admin/catcdb.pl --logDirectory $ORACLE_HOME/rdbms/admin --logFilename catcdb.pl
Enter value for 1: /U01/app/oracle/product/12.2/rdbms/admin
Enter value for 2: /U01/app/oracle/product/12.2/rdbms/admin/catcdb.pl
Enter new password for SYS: ****
Enter new password for SYSTEM: ****
Enter temporary tablespace name: temp
...

The script then calls the underlying catalog.sql and catproc.sql scripts.

Comparing CREATE DATABASE in 10g, 11g, and 12c

For reference the article provides full statements for 11g and 10g. Key differences include:

Redo log group definitions – 11g uses two members per group, 10g uses one.

Presence of MAXINSTANCES in 10g (absent in 11g).

Default tablespace syntax – 10g’s DEFAULT TABLESPACE tbs_1 lacks full details.

Blocksize specification – 11g includes BLOCKSIZE 512, 10g omits it.

Removing the BLOCKSIZE clause from the 11g script allows it to run on a 10g database.

Checking Blocksize in the Database

The blocksize can be queried from the internal view:

SQL> select max(lebsz) from x$kccle;
MAX(LEBSZ)
----------
512

Conclusion

The article demonstrates how to create a CDB in Oracle 12cR2, troubleshoot Perl‑related errors, and understand version‑specific syntax variations. Paying attention to small details such as module case sensitivity and blocksize settings can save considerable time when migrating or upgrading databases.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

SQLOracleCDBperl12cCREATE DATABASE
dbaplus Community
Written by

dbaplus Community

Enterprise-level professional community for Database, BigData, and AIOps. Daily original articles, weekly online tech talks, monthly offline salons, and quarterly XCOPS&DAMS conferences—delivered by industry experts.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.