How to create a 12.1 database in silent mode

You can use DBCA to create a container database (CDB) with several pluggable databases (PDB).

To create a CDB with 2 PDBs in silent mode following script can be used (assuming you have created a directory /u01/oradata owned by oracle account):

dbca -silent \
-createDatabase \
-templateName General_Purpose.dbc \
-gdbName cdb12c \
-sid cdb12c \
-createAsContainerDatabase true \
-numberOfPdbs 2 \
-pdbName pdb \
-pdbadminUsername pdba \
-pdbadminPassword oracle12c \
-SysPassword oracle12c \
-SystemPassword oracle12c \
-emConfiguration NONE \
-datafileDestination /u01/oradata \
-storageType FS \
-characterSet AL32UTF8 \
-memoryPercentage 40 \

The output should be similar to:
Copying database files
1% complete
2% complete
8% complete
13% complete
19% complete
27% complete
Creating and starting Oracle instance
29% complete
32% complete
33% complete
34% complete
38% complete
42% complete
43% complete
45% complete
Completing Database Creation
48% complete
51% complete
53% complete
62% complete
70% complete
72% complete
Creating Pluggable Databases
78% complete
83% complete
100% complete
Look at the log file "/u01/app/oracle/cfgtoollogs/dbca/cdb12c/cdb12c2.log" for further details.

Database alert log is more interesting: we can see the seed database created before the 2 PDBs are created:

Completed: create pluggable database PDB$SEED as clone using '/u01/app/oracle/product/12.1.0/db_1/assistants/dbca/templates//pdbseed.xml' source_file_name_convert = ('/ade/b/3593327372/oracle/oradata/seeddata/pdbseed/temp01.dbf','/u01/oradata/cdb12c/pdbseed/pdbseed_temp01.dbf',
'/ade/b/3593327372/oracle/oradata/seeddata/pdbseed/system01.dbf','/u01/oradata/cdb12c/pdbseed/system01.dbf',
'/ade/b/3593327372/oracle/oradata/seeddata/pdbseed/sysaux01.dbf','/u01/oradata/cdb12c/pdbseed/sysaux01.dbf') NOCOPY

Completed: CREATE PLUGGABLE DATABASE pdb1 ADMIN USER pdba IDENTIFIED BY * ROLES=(CONNECT) file_name_convert=('/u01/oradata/cdb12c/pdbseed/system01.dbf','/u01/oradata/cdb12c/pdb1/system01.dbf',
'/u01/oradata/cdb12c/pdbseed/sysaux01.dbf','/u01/oradata/cdb12c/pdb1/sysaux01.dbf','/u01/oradata/cdb12c/pdbseed/pdbseed_temp01.dbf','/u01/oradata/cdb12c/pdb1/temp01.dbf')

Completed: CREATE PLUGGABLE DATABASE pdb2 ADMIN USER pdba IDENTIFIED BY * ROLES=(CONNECT) file_name_convert=('/u01/oradata/cdb12c/pdbseed/system01.dbf','/u01/oradata/cdb12c/pdb2/system01.dbf',
'/u01/oradata/cdb12c/pdbseed/sysaux01.dbf','/u01/oradata/cdb12c/pdb2/sysaux01.dbf','/u01/oradata/cdb12c/pdbseed/pdbseed_temp01.dbf','/u01/oradata/cdb12c/pdb2/temp01.dbf')

We can connect to database instance and see that V$VSERSION has a new colum CON_ID where 0 means “This value is used for rows containing data that pertain to the entire CDB. This value is also used for rows in non-CDBs”.

SQL> set linesize 132
SQL> select * from v$version;

BANNER                                                                     CON_ID
---------------------------------------------------------------------- ----------
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Prod          0
uction

PL/SQL Release 12.1.0.1.0 - Production                                          0
CORE    12.1.0.1.0      Production                                                      0
TNS for Linux: Version 12.1.0.1.0 - Production                                  0
NLSRTL Version 12.1.0.1.0 - Production                                          0

SQL>

We can check the PDBs in the CDB dictionary and in the dynamic views:

SQL>  select pdb_id, con_uid, pdb_name from dba_pdbs order by 1;

    PDB_ID    CON_UID PDB_NAME
---------- ---------- ------------------------------
         2 4061829388 PDB$SEED
         3 3326922969 PDB1
         4 3885478069 PDB2

SQL> select con_id, name from v$pdbs;

    CON_ID NAME
---------- --------------------------------------------------
         2 PDB$SEED
         3 PDB1
         4 PDB2

We can also see datafiles created for each database and note that undo tablespace, control files and redo logs are shared for all databases:

SQL> select con_id, name from v$datafile order by 1;

    CON_ID NAME
---------- --------------------------------------------------
         1 /u01/oradata/cdb12c/users01.dbf
         1 /u01/oradata/cdb12c/sysaux01.dbf
         1 /u01/oradata/cdb12c/undotbs01.dbf
         1 /u01/oradata/cdb12c/system01.dbf
         2 /u01/oradata/cdb12c/pdbseed/system01.dbf
         2 /u01/oradata/cdb12c/pdbseed/sysaux01.dbf
         3 /u01/oradata/cdb12c/pdb1/system01.dbf
         3 /u01/oradata/cdb12c/pdb1/sysaux01.dbf
         3 /u01/oradata/cdb12c/pdb1/pdb1_users01.dbf
         4 /u01/oradata/cdb12c/pdb2/system01.dbf
         4 /u01/oradata/cdb12c/pdb2/sysaux01.dbf

    CON_ID NAME
---------- --------------------------------------------------
         4 /u01/oradata/cdb12c/pdb2/pdb2_users01.dbf

12 rows selected.

SQL>

SQL> select con_id, name from v$controlfile;

    CON_ID NAME
---------- ------------------------------------------------------------
         0 /u01/oradata/cdb12c/control01.ctl
         0 /u01/app/oracle/fast_recovery_area/cdb12c/control02.ctl

SQL>

SQL> select con_id, member from v$logfile;

    CON_ID MEMBER
---------- --------------------------------------------------
         0 /u01/oradata/cdb12c/redo03.log
         0 /u01/oradata/cdb12c/redo02.log
         0 /u01/oradata/cdb12c/redo01.log

SQL>

We can also see default services created for the CDB and each PDB:

$ lsnrctl status

LSNRCTL for Linux: Version 12.1.0.1.0 - Production on 27-JUN-2013 15:35:33

Copyright (c) 1991, 2013, Oracle. All rights reserved.

Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 12.1.0.1.0 - Production
Start Date 27-JUN-2013 15:34:41
Uptime 0 days 0 hr. 0 min. 52 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Log File /u01/app/oracle/diag/tnslsnr/oel6twsf/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oel6twsf.localdomain)(PORT=1521)))
Services Summary...
Service "cdb12c" has 1 instance(s).
Instance "cdb12c", status READY, has 1 handler(s) for this service...
Service "cdb12cXDB" has 1 instance(s).
Instance "cdb12c", status READY, has 1 handler(s) for this service...
Service "pdb1" has 1 instance(s).
Instance "cdb12c", status READY, has 1 handler(s) for this service...
Service "pdb2" has 1 instance(s).
Instance "cdb12c", status READY, has 1 handler(s) for this service...
The command completed successfully

About these ads
Post a comment or leave a trackback: Trackback URL.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: