You are on page 1of 4

PLUG A NON_CDB DATABASE AS PDB

CREATE A NON_CDB DATABASE - ORCL2

[oracle@DB12c cdb2]$ . oraenv


ORACLE_SID = [cdb2] ? cdb2
The Oracle base remains unchanged with value /u02/app/oracle

[oracle@DB12c cdb2]$ dbca

Screen 1
=> Create database
=> CLick Next

Screen 2
GLobal Database Name : orcl2
Deselect "Create as Container Database"
Admin password : oracle_4U
=> Click Next

Screen 3
=> Click Finish

[oracle@DB12c cdb2]$ . oraenv


ORACLE_SID = [cdb2] ? orcl2
The Oracle base remains unchanged with value /u02/app/oracle

[oracle@DB12c cdb2]$ sqlplus / as sysdba


SQL*Plus: Release 12.1.0.1.0 Production on Fri Jun 13 16:35:02 2014
Copyright (c) 1982, 2013, Oracle. All rights reserved.

SQL> shu immediate


Database closed.
Database dismounted.

SQL> startup mount


alter database ORACLE instance started.
Total System Global Area 730714112 bytes
Fixed Size 2292672 bytes
Variable Size 301990976 bytes
Database Buffers 419430400 bytes
Redo Buffers 7000064 bytes
read only;
Database mounted.

SQL> alter database open read only;


Database altered.

SQL> exec dbms_pdb.describe


('/u02/app/oracle/oradata/ORCL2/xmlorcl2.xml')
PL/SQL procedure successfully completed.

SQL> shutdown immediate


Database closed.
Database dismounted.
ORACLE instance shut down.

SQL> exit

[oracle@DB12c oradata]$ . oraenv


ORACLE_SID = [orcl2] ? cdb2
The Oracle base remains unchanged with value /u02/app/oracle

[oracle@DB12c oradata]$ sqlplus / as sysdba


SQL*Plus: Release 12.1.0.1.0 Production on Fri Jun 13 16:40:39 2014
Copyright (c) 1982, 2013, Oracle. All rights reserved.

SQL> create pluggable database PDB_ORCL2 using


2 '/u02/app/oracle/oradata/ORCL2/xmlorcl2.xml' NOCOPY;
create pluggable database PDB_ORCL2 using
ERROR at line 1:
ORA-27038: created file already exists
ORA-01119: error in creating database file
'/u02/app/oracle/oradata/ORCL2/datafile/o1_mf_temp_9soplhyk_.tmp'

SQL> !rm /u02/app/oracle/oradata/ORCL2/datafile/o1_mf_temp_9soplhyk_.tmp


SQL> create pluggable database PDB_ORCL2 using
2 '/u02/app/oracle/oradata/ORCL2/xmlorcl2.xml' NOCOPY;
Pluggable database created.

SQL> exit

[oracle@DB12c oradata]$ sqlplus sys/oracle_4U@localhost:1521/pdb_orcl2 as


sysdba
SQL*Plus: Release 12.1.0.1.0 Production on Fri Jun 13 16:44:07 2014
Copyright (c) 1982, 2013, Oracle. All rights reserved.

SQL> show con_name


CON_NAME
------------------------------
PDB_ORCL2

SQL> @$ORACLE_HOME/rdbms/admin/noncdb_to_pdb.sql
SQL> SET SERVEROUTPUT ON
SQL> SET FEEDBACK 1
SQL> SET NUMWIDTH 10
SQL> SET LINESIZE 80
SQL> SET TRIMSPOOL ON
SQL> SET TAB OFF
SQL> SET PAGESIZE 100
...
...
...

SQL> alter pluggable database pdb_orcl2 open;


Pluggable database altered.

SQL> EXIT

$ sqlplus sys/oracle_4U@localhost:1521/PDB_ORCL2 as SYSDBA


Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.0.2 -
64bit Production
SQL> select count(empno) from scott.emp;
COUNT(EMPNO)
------------
14

SQL> EXIT

You might also like