Friday, March 13, 2015

CREATE PLUGGABLE DATABASE and PDB_FILE_NAME_CONVERT

Firstly Chapter 43 of the Oracle 12c Database Administration guide, has lots of good info regarding views for CDBs/PDBs and some sql*plus commands, so worth book-marking:


Viewing Information About CDBs and PDBs with SQL*Plus

I was specifically looking to see how I could tell which container my current session is in (show con_name). So starting from the root contain as sysdba:


SQL> show con_name
CON_NAME
------------------------------
CDB$ROOT


SQL> show user
USER is "SYS"


I set the PDB_FILE_NAME_CONVERT parameter in my session:


SQL> ALTER SESSION SET PDB_FILE_NAME_CONVERT='/u01/oradata/cdborcl/pdbseed/','/u01/oradata/cdborcl/pdb2/';
Session altered.


and now, as per the example in




I create a new PLUGGABLE DATABASE using  


SQL> CREATE PLUGGABLE DATABASE pdb2 ADMIN USER pdb_adm IDENTIFIED BY qwe123;
Pluggable database created.


which is automatically registered as a new service


[oracle@ora12c66 oradata]$ lsnrctl status


LSNRCTL for Linux: Version 12.1.0.1.0 - Production on 13-MAR-2015 18:17:16


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


Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 12.1.0.1.0 - Production
Start Date                12-MAR-2015 12:38:48
Uptime                    1 days 5 hr. 38 min. 28 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/product/12.1.0/db_1/network/admin/listener.ora
Listener Log File         /u01/diag/tnslsnr/ora12c66/listener/alert/log.xml
Listening Endpoints Summary...
 (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
 (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ora12c66)(PORT=1521)))
 (DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=ora12c66)(PORT=5500))(Security=(my_wallet_directory=/u01/admin/cdborcl/xdb_wallet))(Presentation=HTTP)(Session=RAW))
Services Summary...
Service "cdborcl" has 1 instance(s).
 Instance "cdborcl", status READY, has 1 handler(s) for this service...
Service "cdborclXDB" has 1 instance(s).
 Instance "cdborcl", status READY, has 1 handler(s) for this service...
Service "pdb1" has 1 instance(s).
 Instance "cdborcl", status READY, has 1 handler(s) for this service...
Service "pdb2" has 1 instance(s).
 Instance "cdborcl", status READY, has 1 handler(s) for this service...
The command completed successfully


and at the OS level


[oracle@ora12c66 oradata]$ tree
.
└── cdborcl
   ├── control01.ctl
   ├── pdb1
   │   ├── example01.dbf
   │   ├── pdb1_temp01.dbf
   │   ├── SAMPLE_SCHEMA_users01.dbf
   │   ├── sysaux01.dbf
   │   └── system01.dbf
   ├── pdb2
   │   ├── pdbseed_temp01.dbf
   │   ├── sysaux01.dbf
   │   └── system01.dbf
   ├── pdbseed
   │   ├── pdbseed_temp01.dbf
   │   ├── sysaux01.dbf
   │   └── system01.dbf
   ├── redo01.log
   ├── redo02.log
   ├── redo03.log
   ├── sysaux01.dbf
   ├── system01.dbf
   ├── temp01.dbf
   ├── undotbs01.dbf

   └── users01.dbf

No comments:

Post a Comment