Oracle Database 12c New Features

Showing posts with label CDB Root. Show all posts
Showing posts with label CDB Root. Show all posts

Connect To Oracle 12c CDB In RAC Environment

DB Name = ora12c
Instance Name = ora12c_1 (node 1) and ora12c_2 (node 2)

To connect to the multitenant container database ora12c instrance ora12c_1.
Execute . oraenv to switch to the appropriate system variable (ORACLE_SID and ORACLE_HOME) or you can set it manually.
[oracle@ora12cn1 ~]$ . oraenv
ORACLE_SID = [ora12c_1] ? ora12c_1
The Oracle base remains unchanged with value /u01/app/oracle
[oracle@ora12cn1 ~]$ sqlplus / as sysdba
SQL*Plus: Release 12.1.0.1.0 Production on Thu Nov 21 14:48:40 2013
Copyright (c) 1982, 2013, Oracle.  All rights reserved.

Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Advanced Analytics and Real Application Testing options

SQL>
SQL> 


Check if the database is a multitenant container database.

SQL> SELECT db.name "DB Name", i.instance_name "Instance Name", db.cdb, i.con_id
  2  FROM gv$database db, gv$instance i
  3  WHERE i.inst_id = db.inst_id;

DB Name   Instance Name    CDB   CON_ID
--------- ---------------- --- ----------
ORA12C    ora12c_1         YES 0


Extracted from Oracle 12c Document, CON_ID = 0 mean CDB. 

About Viewing Information When the Current Container Is the Root

When the current container is the root, a common user can view data dictionary information for the root and for PDBs by querying container data objects. A container data object is a table or view that can contain data pertaining to the following:
  • One or more containers
  • The CDB as a whole
  • One or more containers and the CDB as a whole
Container data objects include V$GV$CDB_, and some Automatic Workload Repository DBA_HIST* views. A common user's CONTAINER_DATA attribute determines which PDBs are visible in container data objects.
In a CDB, for every DBA_ view, there is a corresponding CDB_ view. All CDB_ views are container data objects, but most DBA_ views are not.
Each container data object contains a CON_ID column that identifies the container for each row returned. Table 43-1 describes the meanings of the values in the CON_ID column.

Table 43-1 CON_ID Column in Container Data Objects
Value in CON_ID ColumnDescription
0
The data pertains to the entire CDB
1
The data pertains to the root
2
The data pertains to the seed
3 - 254
The data pertains to a PDB
Each PDB has its own container ID.

Connect To Oracle 12c CDB In RAC Environment

DB Name = ora12c
Instance Name = ora12c_1 (node 1) and ora12c_2 (node 2)

To connect to the multitenant container database ora12c instrance ora12c_1.
Execute . oraenv to switch to the appropriate system variable (ORACLE_SID and ORACLE_HOME) or you can set it manually.
[oracle@ora12cn1 ~]$ . oraenv
ORACLE_SID = [ora12c_1] ? ora12c_1
The Oracle base remains unchanged with value /u01/app/oracle
[oracle@ora12cn1 ~]$ sqlplus / as sysdba
SQL*Plus: Release 12.1.0.1.0 Production on Thu Nov 21 14:48:40 2013
Copyright (c) 1982, 2013, Oracle.  All rights reserved.

Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Advanced Analytics and Real Application Testing options

SQL>
SQL> 


Check if the database is a multitenant container database.

SQL> SELECT db.name "DB Name", i.instance_name "Instance Name", db.cdb, i.con_id
  2  FROM gv$database db, gv$instance i
  3  WHERE i.inst_id = db.inst_id;

DB Name   Instance Name    CDB   CON_ID
--------- ---------------- --- ----------
ORA12C    ora12c_1         YES 0


Extracted from Oracle 12c Document, CON_ID = 0 mean CDB. 

About Viewing Information When the Current Container Is the Root

When the current container is the root, a common user can view data dictionary information for the root and for PDBs by querying container data objects. A container data object is a table or view that can contain data pertaining to the following:
  • One or more containers
  • The CDB as a whole
  • One or more containers and the CDB as a whole
Container data objects include V$GV$CDB_, and some Automatic Workload Repository DBA_HIST* views. A common user's CONTAINER_DATA attribute determines which PDBs are visible in container data objects.
In a CDB, for every DBA_ view, there is a corresponding CDB_ view. All CDB_ views are container data objects, but most DBA_ views are not.
Each container data object contains a CON_ID column that identifies the container for each row returned. Table 43-1 describes the meanings of the values in the CON_ID column.

Table 43-1 CON_ID Column in Container Data Objects
Value in CON_ID ColumnDescription
0
The data pertains to the entire CDB
1
The data pertains to the root
2
The data pertains to the seed
3 - 254
The data pertains to a PDB
Each PDB has its own container ID.