[[email protected] ~]$ sqlplus/as sysdbasql*plus:release 12.1.0.2.0 Production on Sat Mar 5 19:57:04 2016Copyright (c) 1982, Oracle. All rights reserved. Connected to:oracle Database 12c Enterprise Edition Release 12.1.0.2.0-64bit productionwith The partitioning, OLAP, Adva nced Analytics and Real application testing optionssql> show Con_namecon_name------------------------------cdb$ Rootsql> select name,cdb from v$database;--->>> check if a db is Cdbname CDB------------ORCL yessql>---> >> Check the status of the PDB sql> SELECT con_id,name,open_mode,restricted from V$pdbs; con_id NAME open_mode RES-----------------------------------------------------2 pdb$seed READ only NO 3 PN1 Moun TED 4 PN2 mountedsql>--->>> check the available servicessql> SELECT con_id,name,open_mode,restricted from V$pdbs within a PDB ; con_id NAME open_mode RES-----------------------------------------------------2 pdb$seed READ only NO 3 PN1 Moun TED 4 PN2 mountedsql> ShowCon_name Con_name------------------------------cdb$rootsql> alter session set CONTAINER=PN1; Session altered. sql> Alter pluggable database PN1 open; Pluggable database altered. Sql> SELECT con_id,name,open_mode,restricted from V$pdbs; con_id NAME open_mode RES-----------------------------------------------------3 PN1 READ WRITE nosql> Set lines 100sql> col name format a20sql> Col network_name format a20sql> col pdb format A20sql>select service_id,name, Network_name,global_service,pdb,enabled from Dba_services; service_id NAME network_name GLO PDB ENA--------------------------------------------------------------------- -------6 pn1pn1 NO PN1 nosql>--->>> view service status from CDB:sql> alter session set Container=cdb$roo T Session altered. Sql> Select service_id, name,pdb from V$services; service_id NAME PDB--------------------------------------------------0 pn2pn2 6 pn1pn1 3 orclxdbcdb$root 4 ORCL Cdb$roo T 1 Sys$backgroundCdb$root 2 sys$userscdb$root6 rows selected. Sql>
Some common query commands for CDB and PDB