o7planning

Database structure and Cloud features in Oracle 12c

  1. Introduction
  2. 4 outstanding features of Oracle 12c
  3. Oracle 12c structure
  4. Work with Oracle through SQLPlus

1. Introduction

In this document, I introduce you structures of Oracle 12c and cloud functions that have newly been introduced in this version.

2. 4 outstanding features of Oracle 12c

Oracle Database 12c has 4 outstanding features:
  • First, it can merge componential 252 Database (is also a product of Oracle) with a container Database, by which optimizes computing resources and reduces the expense of hardware infrastructure. In the previous database, it needs a 20GB memory so that a server can install a maximum of 50 componential Databases. But to new technology of Database 12c, the capacity of resources of memory can be decreased to 6 times.
  • Second, automate the mechanism of optimizing data in order to control the system of storing equipment. The manipulation of moving data to the suitable storing layer is automated with the technology of Data Heat Map: basing on a thermal map which marks the frequency of data accession. This solution of Oracle will help the firm make a decision of moving low - accessing - frequency data to suitable storing equipment (low - accessing - frequency data are stored in the equipment with cheaper storing expense. High - accessing - frequency data are stored in the equipment with higher speed and price).
  • Third, Redaction helps hide sensitive data when data are provided for the last user. An example is code of credit card. Employees working in Human Resources can see the whole numbers of the code of the card while ones in other departments see only the last 4 numbers. This new security function will help organizations and enterprises feel safer when they unify their databases in cloud.
  • Fourth, it helps the firm to discover business opportunities from Big data, including non-structural data (i.e. from social networks) and typical data.

3. Oracle 12c structure

First of all, we need to compare structure of Oracle 11g and 12c
Oracle structure includes:
  1. Oracle software
  2. And Databases
ORACLE 11G
After installing Oracle Database 11g software, you can create one or more Database (Typically, you need to create only one Database). In each Database, you can create one or many SCHEMAs. Each SCHEMA is a system of table and objects like functions, procedure, package, and so on. The structure of Oracle 11g is similar to the following illustrative image:
ORACLE 12C
Oracle 12c has real changes in structure compared to Oracle 11g. Oracle 12c is really a cloud database.
The concept of database in 11g is similar to that of Container Database (CDB) in 12c. Particularly, after installing Oracle 12c you can create one or more Container Database (CDB). (In fact, 1 is enough).
In Oracle 12c, there is a new concept which is CDB$ROOT (or CDB Root). CDB$Root is a special Plugin Database and is a object of CDB. SCHEMAs can be attached with CDB$ROOT or other typical Plugin Databases (PDB) are attached with CDB$ROOT. Each Plugin Database contain 0 or many SCHEMAs.
PDB $ SEED is a template Plugin database which is used as a template (default) to create a new Plugin Database. Inevitably, you can take you can choose any one Plugin Database as template to create a new Plugin Database.

I would mention the commands to create a new plugin from SEED or any one PDB in the following section of this document.
As for the side of storing in hardware, Oracle 12c has a structure as the following image:
Details:
Controlfiles
Every Oracle Database has a control file, which is a small binary file that records the physical structure of the database. The control file includes:
  • The database name
  • Names and locations of associated datafiles and redo log files
  • The timestamp of the database creation
  • The current log sequence number
  • Checkpoint information
The control file must be available for writing by the Oracle Database server whenever the database is open. Without the control file, the database cannot be mounted and recovery is difficult.
datafiles
Database datafiles are physical files stored on disk. These files are used to store data on disk.
tempfiles
Database tempfiles are physical files stored on disk. These files are used to store temporary data on disk.
redo logs
The most crucial structure for recovery operations is the redo log, which consists of two or more preallocated files that store all changes made to the database as they occur. Every instance of an Oracle Database has an associated redo log to protect the database in case of an instance failure.

4. Work with Oracle through SQLPlus

SQL Plus is a simple Console tool that allows you to execute SQL command. Usually, we work with a more visual tool (It is unavailable when you install Oracle) that you need to install additionally. It can be software provided by a third party.
In order to log in SQLPlus, you can log in through CMD:
-- Login to Oracle using the user database 'system', as Database Admin (dba)
-- Note: If you have never logged in with any user, use the syntax:
system/Abc#123 as sysdba

-- If you are connected to a user, you want to switch to another user, using the syntax:
connect username/password

-- Or connect as system database administrator.
connect username/password as sysdba
You are logged in to the Database.
Determining Whether a Database Is a CDB
When installing Oracle 12c, if you choose to install Container Database (CDB) type, your database will be a CDB, otherwise it will be a Non-CDB (As with the model of Oracle 11g)
On SQLPlus, you can check whether your Database is CDB or not.
-- Query the 'View' contains the databases.

SELECT CDB FROM V$DATABASE;
Determining the Current Container ID or Name
-- Show ID of current Container.

SHOW CON_ID


-- Show name of current Container.

SHOW CON_NAME
Viewing Information About the Containers in a Container Database (CDB)
The V$CONTAINERS view provides information about all of the containers in a CDB, including the root and all PDBs. To view this information, the query must be run by a common user whose current container is the root. When the current container is a PDB, this view only shows information about the current PDB.
-- Set display column length (For easy viewing)
-- (Optional).

COLUMN NAME FORMAT A8


-- Query containers.
SELECT NAME, CON_ID, DBID, CON_UID, GUID FROM V$CONTAINERS ORDER BY CON_ID;
Viewing Information About PDBs
The CDB_PDBS view and DBA_PDBS view provide information about the PDBs associated with a CDB, including the status of each PDB. To view this information, the query must be run by a common user whose current container is the root. When the current container is a PDB, all queries on these views return no results.
-- Set display column length (For easy viewing)
-- (Optional).

COLUMN PDB_NAME FORMAT A15


-- Query PDBs
SELECT PDB_ID, PDB_NAME, STATUS FROM DBA_PDBS ORDER BY PDB_ID;