Oracle 12C joins a very innovative feature, pluggable database, that enables database (PDB) pull-out capabilities on the "container" (CDB) to improve system resource utilization and simplify the management and migration of large-area databases.
now let's try
The operations of the CDB and PDB for pluggable databases are:
Basic information:
Root container (CDB): CUP
Pluggable Database (PDB): TEA
To start the root container:
[Email protected] ~]$
Export Oracle_sid=cup
[Email protected] ~]$
Sqlplus/as sysdba
Sql*plus:release 12.1.0.2.0 Production on Wed Jan 21 16:00:06 2015
Copyright (c) 1982, Oracle. All rights reserved.
Connected to an idle instance.
Sql>
Startup
-----does not start all pluggable databases directly, if you want to start all pluggable databases, execute the command: Alter pluggable database all open
ORACLE instance started.
Total System Global area 767557632 bytes
Fixed Size 2929112 bytes
Variable Size 574623272 bytes
Database buffers 184549376 bytes
Redo buffers 5455872 bytes
Database mounted.
Database opened.
To Stop the root container:
Sql>
Shutdown Immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
See if the CDB is created, if there is a display name:
Sql>
select name,cdb from V$database;
NAME CDB
--------- ---
CUP YES
Sql>
show parameter service;
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
Service_names String Cup
look at the container name, which has 3 containers: the root container, the seed container, and the container you created:
Sql>
select Con_id,name from V$containers;
con_id NAME
---------- ------------------------------
1 cdb$root
---root container
2 Pdb$seed
---seed container, readable only
3 TEA
---Pluggable databases that you create yourself
Sql>
select file_name from Dba_data_files;
file_name
--------------------------------------------------------------------------------
/oracle/app/oradata/cup/datafile/o1_mf_system_bch07kvz_.dbf
/oracle/app/oradata/cup/datafile/o1_mf_sysaux_bch020oo_.dbf
/oracle/app/oradata/cup/datafile/o1_mf_undotbs1_bch0d2on_.dbf
/oracle/app/oradata/cup/datafile/o1_mf_users_bch0d15n_.dbf
Sql>
select file_name from Cdb_data_files;
file_name
--------------------------------------------------------------------------------
/oracle/app/oradata/cup/datafile/o1_mf_system_bch07kvz_.dbf
/oracle/app/oradata/cup/datafile/o1_mf_sysaux_bch020oo_.dbf
/oracle/app/oradata/cup/datafile/o1_mf_undotbs1_bch0d2on_.dbf
/oracle/app/oradata/cup/datafile/o1_mf_users_bch0d15n_.dbf
To create a public user:
Sql>
Create User C # #eric identified by Gao;
User created.
Sql>
Conn C # #eric/gao
ERROR:
Ora-01045:user C # #ERIC lacks CREATE SESSION privilege; Logon denied
----have no permissions, we can give it permission individually, or we can assign roles to it.
Warning:you is no longer connected to ORACLE.
Sql>
Conn/as sysdba
Connected.
Sql>
Grant DBA to C # #eric Container=all;
---to its DBA role, with a role scope covering all containers
Grant succeeded.
Sql>
Conn C # #eric/gao
Connected.
---connection succeeded
To switch containers:
Start the container database that you created first:
Sql>
Alter pluggable database tea open; ---Start the PDB database first
Sql>
ALTER session Set container = Tea;
Session altered.
Sql>
Show Con_name
---View the name of the container you are currently in
Con_name
------------------------------
TEA
to turn off pluggable databases:
Sql>
Alter pluggable database tea close immediate;
Pluggable database altered. Article reference from: Http://blog.chinaunix.net/uid-20802110-id-4773654.html jackson198574
Oracle 12C new Features-pluggable database feature