Installing and configuring Oracle Database 12c

1- Introduction

This document is based on:
  • Oracle 12c R1 (Release 1)  (64 bit)

  • Window Server 2012 (64 bit)

2- Download Oracle 12c

Oracle allows you to freely download. You can access the home page of Oracle to download this software.
Please check whether your operating system is 32 bit or 64 bit to download exactly.
After finishing downloading, you have 2 zip files. Decompress them in 2 separate folders or in the same folder.

3- The difference in structure of Oracle 11g and Oracle 12c:

First, we need to understand the structure of Oracle a bit:
The structure of Oracle includes:
  1. Oracle software
  2. And Databases
Oracle 11g and Oracle 12c have some differences in structure. We need to clarify these differences before starting to install.

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 11gOracle 12c is really a cloud database.

The definition 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. 
During the process of installing  Oracle 12C, the installing set will ask whether you create a Plugin or not. There will be two situations as follow:
  1. If you select not to create plugin, the installing set will create a Container Database with Root and SCHEMAs attached with Root.
  2. If you select to create plugin, you need to enter name of plugin. The installing set will create a Container Database with Root, a Plugin attached with Root, and SCHEMAs attached with this Plugin.

4- Installing Oracle 12c on Windows

We will install Oracle software and immediately create a Database named as db12c (or SID = db12c).
Install a database:
Oracle will be install in a user of window, but this user has no right of an Administrator for the reason of security. If your computer has no such a window user, you can create a new window user.
In this step, if the installer asks whether you create Plugin or not, select:
  • Create as Container Database.
Enter name of Plugin Database:
  • pdbdb12c
If you select  "Create as Container Database" your database model is similar to the following illustrative image:
Note: SYSTEM, SYS Schema is always available when you create Container Database or Plugin Database.
To store many kinds of language (including Vietnamese), you should select: Unicode ( AL32UTF8)
  • Character Set: Unicode (AL32UTF8)
Oracle has some users administrating the system (sys, system,...). You need to set up passwords for them. You can set up the same password for all of these users.
And wait until the installation is complete.
In the next step, the installer will create Database named as db11g like the previous step where we named.
Now the installment of Oracle is successful. Parameters relating to database will be synthesized, and you should remember this information.

5- Check the installation and install the expansion

After the successful installation, services of Oracle are automatically started. We can access to Service of Windows to check.
There are 6 services of Oracle, but usually three services are enough for the operation:
  • OracleDBConsole<sid>
  • OracleOra<Sid>_home1TNSListener
  • OracleService<SID>

5.1- SQL Plus

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 the system schema:
Recheck the Database model you have installed:
SYSTEM, SYS is a schema of the system. It is automatically created when you create  Container Database. Enter  system/<password> and you can log in schema system of Container. Schema systems, sys are also available when you create a  Plugin Database.
Check which container you are standing:
SHOW CON_NAME
Standing at Container Database, you can query so as to know the current number of Plugin Database.
SELECT name, pdb  FROM   v$services ORDER BY name;
You are standing at the CDB$ROOT, you want to create a SCHEMA:

Note: When you create a user database in Oracle, a Scheme with the corresponding name would be created.

Create a User database:
-- Create a user database named mytest, and password mytest001
create user mytest identified by mytest001;

-- Grant Database Admin to mytest.
grant dba to mytest;
Note that with Oracle 12c or later, the default name of 'user database' must begin by C##, C or ##, the opposite will be the error message ORA-65096.
ORA-65096: invalid common user or role name

Cause: An attempt was made to create a common user or role with a name that was not valid for common users or roles. In addition to the usual rules for user and role names, common user and role names must start with C## or c## and consist only of ASCII characters.

Action: Specify a valid common user or role name.
When you create a user database, you need to set value for hidden parameter "_oracle_script"=true
-- Login with system user.
connect system/Abc#123

alter session set "_ORACLE_SCRIPT"=true;

-- Create user database named mytest, and password mytest001
create user mytest identified by mytest001;

-- Grant Database Admin to mytest.
grant dba to mytest;

-- Connect to mytest
connect mytest/mytest001

6- Visual tools to work with Oracle

You can install the PL/SQL Developer. A visual tool to work with Oracle.