Create Oracle Pluggable Database Manually Using SQL Prompt

We can create a pluggable database in an existing multitenant database either using dbca or manually.

STEPS:

Connect to the container database:(ROOT)

[oracle@localhost ~]$ sqlplus sys/oracle@cdb1 as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Sun Aug 23 10:27:08 2015

Copyright (c) 1982, 2014, Oracle.  All rights reserved.

Connected to:

Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production

With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

SQL> show con_name

CON_NAME
-----------
CDB$ROOT
While creating PDB if you don’t mention FILE_NAME_CONVERT parameter then below error will come
SQL> create pluggable database dbwr admin user ram identified by ram;
create pluggable database dbwr admin user ram identified by ram                                                                        *
ERROR at line 1:
ORA-65016: FILE_NAME_CONVERT must be specified
Create PDB:(correct command)
SQL> create pluggable database dbwr admin user ram identified by ram FILE_NAME_CONVERT=('/home/oracle/app/oracle/oradata/cdb1/pdbseed','/home/oracle/app/oracle/oradata/cdb1/dbwr');


Pluggable database created.


SQL> select con_id,name,open_mode from v$Pdbs;

CON_ID NAME                OPEN_MODE
----------            -------------------
2 PDB$SEED               READ ONLY
3 ORCL                   READ WRITE
4 DBWR                   MOUNTED
-- Open the PDB
SQL> alter pluggable database dbwr open;

Pluggable database altered.



SQL> select con_id,name,open_mode from v$pdbs; 

CON_ID NAME                      OPEN_MODE
----------                       ----------
2 PDB$SEED                           READ ONLY
3 ORCL                               READ WRITE
4 DBWR                               READ WRITE

SQL> alter session set container=dbwr;

Session altered.

SQL> show con_name

CON_NAME
-------------
DBWR

SQL> select file_name from dba_data_files;

FILE_NAME
----------------------------------------------
/home/oracle/app/oracle/oradata/cdb1/dbwr/system01.dbf
/home/oracle/app/oracle/oradata/cdb1/dbwr/sysaux01.dbf

SQL>

Leave a Reply

Your email address will not be published. Required fields are marked *