Sie sind auf Seite 1von 15

Oracle 12c Release 2 New Features -

Part 1
There is a lot of excitement about Oracle upcoming Release of 12c i.e. 12c Release 2. I thought of
collating the information available on the web and put it all together to bring some awareness about what is coming in 12c
Release 2. Have published Part-2 which contains a lot of information about other 12cR2 new features.

Before we begin with 12c Release 2, lets recollect what major New Features were present in Oracle 12c R1. I wanted to
start with this as many of us are still using 11G and are in transition phase to upgrade the databases to 12c.

Some of the highlights of 12c Release 1 New Features are as follows:-

1. SQL and PL/SQL


Enhancements in SQL and Pl/SQL are as follows:

1) Can drop an Index online.

DROP INDEX ONLINE.

2) Can drop an constraint online.

DROP CONSTRAINT ONLINE .

3) Can Set unused columns online

SET UNUSED COLUMN ONLINE.

4) Make an index visible of invisible to Optimizer.

ALTER INDEX VISIBLE / INVISIBLE .

5) Can Create Multiple indexes on Same Columns.

6) Can Make an Column Visible / Invisible.

SET COLINVISIBLE ON
CREATE TABLE INV (COL1 NUMBER,CL2 NUMBER INVISIBLE);

7) 12c onwards now you can have an identity for a columns where the data in the column is auto generated.

CREATE TABLE IDEN (COL1 NUMBER GENERATED ALWAYS AS IDENTITY (START WITH 1000 INCREMENT BY
10));

8) VARCHAR2 is now 32676 bytes.

9) New Read Privilege, Select access can lock FOR UPDATE.

10) New Join syntax, Lateral Clause for inline Views called Lateral Views.

select * from emp e, (select * from dept d where e.deptno=d.deptno)

ORA-00904 - e.deptno Invalid Identifier.

select * from emp e, LATERAL(select * from dept d where e.deptno=d.deptno)

Definition: A lateral view is a view that references columns from a table that is not inside the view.
The above Statement Succeeds with the usage of LATERAL Keyword.

11) Top-N Query

select * from ..... fetch first 10 rows only

select * from ..... offset 10 rows fetch first 10 rows only

select * from ..... offset 10 rows fetch first 0.1 percent rows only

select * from ..... offset 10 rows fetch first 0.1 percent rows with ties

12) Can now move Partition and sub-partition online.

13) Truncate table cascade.

14) Session level Sequences

CREATE SEQUENCE my_seq START WITH 1 INCREMENT BY 1 SESSION;

ALTER SEQUENCE my_seq GLOBAL|SESSION;

15) Now developer can Create a Function or Procedure within a SQL inside WITH Clause.

WITH
PROCEDURE|FUNCTION test1 (…)
BEGIN
<logic>
END;

SELECT <reference_your_function|procedure_here> FROM table_name;


/

16) dbms_sql.return_result , returns formatted results in SQLPLUS.

17) In-Database-Archiving - This option enables to mark records in a table as not active(called later archive
records). As default archive records are not visible in Oracle sessions. The records can be later compressed
or deleted.
The reason to add such option was to keep both versions of records (active and not active) in the same
table instead of making backup(not active) on tape and delete them(not active) from a table.
CREATE TABLE test_tbl( id NUMBER) ROW ARCHIVAL;

2. OPTIMIZER
1) Partial Join Evaluation.
This is a useful feature which gets automatically used by Oracle 12c Optimizer, In Pre-Release to 12c we used IN
or EXISTS operator to to accomplish the same but 12c onwards we can use regular joins which can evaluated partially
once it finds the information it is looking for.

Ref : http://blog.dbi-services.com/partial-join-evaluation-in-oracle-12c/

2) Null accepting semi-joins


3) Scalar Subquery Unnesting

4) Multi-Table Left Outer Join

5) Adaptive Query Optimization

1. Adaptive Plans
2. Adaptive Parallel Distribution Methods
3. Adaptive Statistics

6) Hybrid Histograms

7) Online statistics gathering


- When an index is created
- CTAS
- IAS

8) Session level statistics on Global Temporary Tables

9) Automatic column group detection.

10) Real Time ADDM

3. DBA - Administration
There has been significant enhancement of features in Administration as well. Few of the useful ones are as follows:

1) Online Datafile Movement.

2) Index Compression- 1x to 3x greater.

3) DDL Logging.

4) Temporary Undo.

5) Table level Recovery in RMAN

6) Restricting PGA Size

7) 12c DB upgrade Enhancements, like running upgrades in parallel.

8) Restore/Recover Data files over the network using DB Service.

9) Gathering Stats concurrently on multiple tables

SQL> ALTER SYSTEM SET JOB_QUEUE_PROCESSES=4;

SQL> EXEC DBMS_STATS.SET_GLOBAL_PREFS('CONCURRENT', 'ALL');

SQL> EXEC DBMS_STATS.GATHER_SCHEMA_STATS('SCOTT');

10) Data Redaction: This new feature enables to easily prevent the display of sensitive data to end-users by
performing redaction in each application. It’s very simple to implement and very efficient. Data are
modified on the-fly right before results are returned to applications.

11) Oracle Caching mode: It enables to force caching of all segments into buffer cache automatically(when
the segments are accessed).
ALTER DATABASE FORCE FULL DATABASE CACHING;

12) Automatic BIG Table Caching.

13) Zone Maps: For full table access, zone maps allow I/O pruning of data based on the physical location of the data
on disk, acting like an anti-index.

There are many other new features introduced in Oracle 12C Release 1, but with new release of Oracle 12c i.e. Oracle
12c Release 2 more new features have been introduced and are interesting.

12c Release 2 New Feature


***Database for the Cloud***
1. SQL and PL/SQL
1) With 12c Release 2 Table and column names can be up to 128 characters long up from 30 characters.

2) Oracle have now introduced Oracle LIVE-SQL. You can create your own login and use the same, this don't require a
database to run your queries. It is a very good tool for developers to test many functionalities of oracle without having a
database.

https://livesql.oracle.com

2. DBA-Administration
1) Pluggable Databases: With the release of 12c you could only get 252 pluggable database per managed database
instance. Oracle now increased that number dramatically to 4096.

 Hot Cloning: In 12c R1 pluggable databases offered us with the opportunity to clone databases and put them
elsewhere which was really helpful. Now Oracle has gone even further and with Release 2 onwards you can get a running
database cloned towards a new instance, without shutting it down or losing data.

 Tenant Relocation: Tenant(PDB) can now be relocated online, then unplug/plug operation introduced in 12c
Release 1.
2) Application Container: Most Pluggable Databases share application objects mostly code and metadata. Oracle 12c
R2 introduced something called as Application Container to add this as a feature.
This fulfils the cloud objective, As in previous release even with the addition of the pluggable databases we still needed to
update the applications in all the separate databases. Now one can have their own separate database / pluggable
database and share completely the same application logic.
It really makes management easier; all you need to do is to apply updates to the shared application container.

- Shared Application Objects i.e. Code , Metadata and Data.


- Updates can be applied to application Container.

3) SQL in Silicon- Super Server: Adds co-processors to all 32 cores of the SPARC M7 that offload and accelerate
important data functions, dramatically improving efficiency and performance of database applications. Critical functions
accelerated by these new co-processors include memory de-compression, memory scan, range scan, filtering, and join
assist. Offloading these functions to co-processors greatly increases the efficiency of each CPU core, lowers memory
utilization. This enables

- 3x Faster Joins.
- 10x Faster Expressions
- 60X Faster JSON.

4) In-Memory with Oracle Database Release 2:


1) In Oracle DB R1, Analytic and OLTP of same data were preset in same database where as release 2 onwards
the Analytics can be offloaded to active data guard standby.

2) Dynamic data movement from storage and memory.

3) Sharding : Sharding is an application-managed scaling technique using many independent databases. The data is split
into multiple databases (called shards). Each database holds a subset of the data, this can be either be range or hash.
You can also split the shards into multiple shards as the data volume or access to this data grows. Shards then can be
replicated for availability and scalability reasons.
Sharding be really nicely used for applications that require extreme scalability.

4) Oracle now increased that number of pluggable database in one CDB to 4096.

5) AWR reports are now available on Active Data Guard standby databases.

I will share the new features of Oracle 12c Release 2 in much details in Part-2 of this post.

3. SOME OTHER FEATURE WHICH MIGHT BE OF YOUR INTEREST


1) Reading Alert Log from SQLPLUS:- In Oracle 11g release, Oracle did some improvement in diagnosability
Infrastructure, Starting from 11g, There is a fixed table X$DBGALERTEXT, when you query it, Oracle reads
the log.xml from alert directory (which contains all the data what alert.log does), parses it and returns the details back as
rows.

SQL> select message_text from X$DBGALERTEXT where rownum <= 20;

SQL> select lpad(' ',lvl,' ')||logical_file file_name from X$DBGDIREXT where rownum
<=20;

2) To Write Custom Message/Error we can use below command:-

EXEC dbms_system.ksdwrt(2, 'ORA-00900: Custom message in alert log.');

Oracle 12c Release 2 New Features -


Part 2
As promised, this is my second instalment of Oracle 12cR2 i.e. 12.2.0.1 Release. In Part 1, i have
recapped few of the 12c R1 Features along to some highlights on what was coming. Part 3 will contain other useful
new features and will also be my last instalment to New Features Blogging.

In this Part i will try to highlight most of the 12cR2 features which i found to be most awaited ones for DBA's .

I will divide this post in sections like Admin, Backup/Recovery, Performance/Tuning, Grid, RAC, and Network...
The post is not intended to collate all the new features, If you want to read about all of that which have changed in this
release probably you might want to read the New Features Guide:

http://docs.oracle.com/database/122/NEWFT/GUID-6213395A-CFDD-4D42-8970-F8FA062CC4FA.htm#NEWFT-GUID-
6213395A-CFDD-4D42-8970-F8FA062CC4FA

Section 1 : SQL
1. Sqlplus Command Line:
1.1 History :

Starting this release you can set the History environment variable to on and get this history of last 100 executed queries
by default.

SQL> set history on


SQL> set history 100

SQL> show history


History is ON and set to "100"

SQL> history
1 show history
2 show user
3 desc dual
* 4 select * from dual;

SQL> set history off

SQL> set history off

2. Globalization Support:
With the new Oracle Database 12c Release 2 (12.2) ability to declare collations for columns, you can declare a column
to always be compared in a case-insensitive way. Oracle Database supports case-insensitive collations, such
as BINARY_CI or GENERIC_M_CI.

This feature can help developers declare data as case-insensitive and do not have to add explicit uppercasing operations
to SQL statements or create function based indexes.

Example:

At table level you can define collation like :-

CREATE TABLE emp


(
empno VARCHAR2(5) PRIMARY KEY,
ename VARCHAR2(50),
)
DEFAULT COLLATION BINARY_CI ;

Or at column level you can modify it like :

ALTER TABLE emp ADD gender VARCHAR2(1) COLLATE BINARY_CI;


For other columns the collation is inherited from the table. Also another important point to remember is the default
collation of the table can be changed anytime.

Section 2 : Administration And Availability


2.1 Sharding:
Sharding is a data tier architecture in which data is horizontally partitioned across independent databases. Each
database in a shard is hosted on a dedicated server with its own local resources like memory/cpu/disk and flash and bring
them in a one virtual pool makes up a single virtual database or Sharded Database.

Following is an illustration of how a table will look in a Sharded database architecture.

I will add more specific contents to each topic here in upcoming blogs when I am done with my test cases on the same. I
am in process of evaluating the same and will come up with best practises and other advantages and disadvantages as
well...

Interestingly I would also like to evaluate this technology against other No-Sql databases which uses Sharding.

2.2 Quarantined Objects:


Object quarantine enables an Oracle database to function even when there are corrupted, unrecoverable
objects. The V$QUARANTINE view contains information about quarantined objects.

Object quarantine isolates an object that has raised an error and monitors the object for impacts on the
system.

Example: This query shows the resources that are currently quarantined.

COLUMN OBJECT FORMAT A10


COLUMN ADDRESS FORMAT A10
COLUMN BYTES FORMAT 999999999
COLUMN ERROR FORMAT A20
COLUMN TIMESTAMP FORMAT A20
SELECT OBJECT, ADDRESS, BYTES, ERROR, TIMESTAMP FROM V$QUARANTINE;

OBJECT ADDRESS BYTES ERROR TIMESTAMP


---------- ---------- ---------- --------------------------------
session 0000000078 9528 ORA-00600: internal 11-Nov-16 01.17.42.2

The above columns contains below information:

Object : The name of the resource is “session.”


Address : The start address of the memory region being quarantined is 0000000078.
Bytes : The resource is using 9528 bytes of memory in quarantine.
Error : The message of the error that caused the resource to be placed in quarantine is “ORA-00600 internal error
code.”
Timestamp : The timestamp shows the date and time of the error.

2.3 Partitioning Enhancements

2.3.1 New alter table to partitioned table


In 12.2 there is a single “alter table .. modify ..” command to transform a regular table into a partitioned one. The “alter
table” includes the partition type and key clauses to alters the table.

The conversion of table can be done in online and offline mode. Below example represents Online operation to convert a
non-partition table to partition one.

Example:

ALTER TABLE emp MODIFY


PARTITION BY RANGE (emp_no) INTERVAL (80)
( PARTITION Part1 VALUES LESS THAN (100),
PARTITION Part2 VALUES LESS THAN (500)
) ONLINE
UPDATE INDEXES
( IDX1_SAL LOCAL,
IDX2_EMP_NO GLOBAL PARTITION BY RANGE (emp_no)
( PARTITION allothers VALUES LESS THAN (MAXVALUE))
);

2.3.2 New Automatic List Partitioning


Automatic List partitioning is a nice feature which enable creation of on demand list partition on frequently modified table.

Example:

CREATE TABLE emp_List_auto


(
emp_id NUMBER(5),
emp_name VARCHAR2(30),
dept_name VARCHAR2(20),
)
PARTITION BY LIST (dept_name) AUTOMATIC
(PARTITION P_D_Name VALUES ('IT')
);

2.4 In-Memory option


2.4.1 Standby Database
Oracle 12c introduced the in-memory option in release 1 , however the same was not available in active standby. In
Release 2 Active Standby's can be configured to use in-memory, allowing us to configure in-memory column store for
reports and analytic.

2.4.2 In-Memory – Dynamic Resizing


In 12c Release 1 In-Memory Column store was static and incase the same was required to change , database restart was
required. In 12.2 we can increase the In-Memory column store size dynamically but the same can't be reduced
dynamically.

2.5 Dictionary with long identifiers


It was so annoying that object and column names were limited to 30 bytes which might was not be a major concern for all
time Oracle Developers/DBA's but for Companies / DBA's involved in Migration projects to migrate the SQL-
Server/Sybase databases to Oracle had challenges with this Limit but not anymore, 128 bytes is the new limit!.

2.6 PDB Characterset


With 12c R2 we can set a different characterset per PDB with a Pre-Requisite for the root container to use AL32UTF8
which is the super-set of all others characterset and is also default characterset with 12cR2 release onwards.

Section 3. Flashback Pluggable Database


In Database 12.2, flashback can be done on the PDB level with an prerequisite of database been put into local undo
mode which also means that each PDB has its own undo tablespace.

Example:

Altering the database to enable local undo, require instance shutdown-startup.

SQL> alter database local undo on;

Database altered.

SQL> select flashback_on from v$database;

FLASHBACK_ON
------------------
YES

SQL> alter pluggable database pdb1 close immediate;

Pluggable database altered.

SQL> flashback pluggable database pdb1 to timestamp systimestamp - interval '20' minute;
Flashback complete.

SQL> alter pluggable database pdb1 open resetlogs;

Pluggable database altered.

Section 4: Networking

Database Resident Connection Pooling:

Like Shared Server and Dedicated Server Architecture, DRCP is yet another connection management
framework which enables less utilization of resources and giving performance benefits. Majorly for applications
which use connection pooling.

When the first request is received from a client, the Connection Broker picks an available pooled server and
hands off the client connection to the pooled server. If no pooled servers are available,

the Connection Broker creates one. If the pool has reached its maximum size, the client request is placed on
the wait queue until a pooled server is available. Releasing database resources involves releasing the pooled
server to the pool.

For instance, when a client requires database access, the connection broker picks up a server process from
the pool and hands it off to the client. The client is directly connected to the server process until the request is
served. After the server has finished, the server process is released into the pool. The connection from the
client is restored to the broker. Session memory is allocated from the PGA.
Section 5 : Analytics

Analytic Views
Oracle describes Analytic views to provide a fast and efficient way to create analytic queries of data stored in existing
database tables and views. The diagram depicts the pictorial representation of Analytic view.
The model is made up of three objects.

 Dimension Attribute - Defines a dimension along with the hierarchical levels also multiple hierarchies are
possible.
 Hierarchy - Defines the hierarchical structure of a dimension with parent/child.
 Analytic View - Brings together the hierarchies and defines the measures.

Section 6 : Security
Internal tablespace encryption

Now it is possible to encrypt internal tablespace i.e. system, sysaux, undo as well.

Section 7 : Performance and Tuning


6.1 SQL Tuning
6.1.1 New Initialization Parameters to controls for adaptive plans and adaptive statistics

The OPTIMIZER_ADAPTIVE_PLANS initialization parameter enables (default) or disables adaptive plans.


The OPTIMIZER_ADAPTIVE_STATISTICS initialization parameter enables or disables (default) adaptive statistics.

6.1.2 Cursor-Duration Temporary Tables

Complex queries sometimes process the same query block multiple times. To avoid this scenario, Oracle Database can
create temporary tables for the query results and store them in memory for the duration of the cursor called Cursor
Duration Temp Tables. For complex operations this optimization enhances the materialization of intermediate results
from repetitively used subqueries which improve performance and optimize I/O.
When the database uses cursor-duration temporary tables, the keyword CURSOR DURATION MEMORY appears in the
execution plan.

For More information refer to Oracle Documentation:-

https://docs.oracle.com/database/122/TGSQL/query-transformations.htm#TGSQL-GUID-C1AE164B-E99F-418A-9B2A-
1ADB036048DF

6.1.3 Expression tracking


SQL statements commonly include expressions such as (+) or (-) in the query including internal or user
defined functions. The Expression Statistics Store (ESS) maintains usage information about expressions
identified during compilation and captured during execution.

6.1.4 Creating a Database Operation

Using this feature enables DBA or privileged user to monitor a session and find details about the operation
going on.

Creating a database operation involves supplying a name and defining its beginning and end times.

Start a database operation by using the DBMS_SQL_MONITOR.BEGIN_OPERATION function, and end it by using
the DBMS_SQL_MONITOR.END_OPERATION procedure.

To begin the operation in a different session, specify the combination of SID and SERIAL#.

Example:

COL DBOP_NAME FORMAT a10


COL STATUS FORMAT a10
COL ID FORMAT 999

SELECT DBOP_NAME, DBOP_EXEC_ID AS ID, STATUS, CPU_TIME, BUFFER_GETS


FROM V$SQL_MONITOR WHERE DBOP_NAME IS NOT NULL ORDER BY
DBOP_EXEC_ID;DBOP_NAME ID STATUS CPU_TIME GETS
---------- -- ---------- -------- ----
sh_count 1 EXECUTING 24997 65

Summary
I have tried to jotted down the new Oracle 12.2 Features. Hope you find this article useful. I am still in process
of going through documentation and will soon start testing the same. There are still a lot of other features like
SQL, Hot Cloning, Rman, Performance Tuning and Security which can be useful in day to day DBA/
Development. I will come up with detailed discussions on few of the important features in my next Blog.
Oracle 12c Release 2 New Features-
Part 3
In my previous post Part-2 i only highlighted the most useful features but in this post i will target all other new
features which brings in significant difference to this release.

1. Architecture
1.1 Read/Write and Read-Only Instances
Starting with Oracle 12.2.0.1 , a new initialization parameter has been introduced which can open the database in Read
Only Mode. In past only standby databases were capable of doing so but with 12cR2 DBA can set
the INSTANCE_MODE initialization parameter to READ_ONLY, Default being READ_WRITE.

1.2 Process Monitor Process (PMON) Group


The PMON group includes PMON, Cleanup Main Process (CLMN), and Cleanup Helper Processes (CLnn). These
processes are responsible for the monitoring and cleanup of other processes.

2. Maximizing Availability
2.1 Restore Point :
Restore points can now be created in PDB's called PDB Restore Points. These restore points are specific to
PDB's.

2.2 Flashback Database


As like Restore point PDB's , now a DBA can rewind the database at PDB level to previous point in time
without impacting CDB or other PDB's.

2.3 Sparse Backups


This is a most interesting feature to support Oracle Clone DB also know as Snapshot databases and compete Delphix Technology.
Oracle has played smart by adding this feature called Sparse Backups.

You must be wondering what's Sparse Backup , its nothing but taking level 1 backup on Clone/Snapshot DB i.e. backing
up only changed data.

To know more about Clone DB which works on copy on write technology read Oracle Documentation. There is also a
whitepaper which gives more insights about the same.

http://www.oracle.com/technetwork/server-storage/hardware-solutions/o13-022-rapid-cloning-db-1919816.pdf

Unlike the base database, sparse databases are read-write databases.

RMAN restores sparse data files from sparse backups and then recovers them from archive and redo logs. You can perform a complete
or a point-in-time recovery on sparse data files.

2.4 Oracle 12c GoldenGate Database Enhancement


In Oracle 12cR2 Oracle have added significant enhancement to GG that enhances its replication capabilities. Couple of them i liked
the most are:
- A new view GG_LAG is introduced to view end to end Lag information.

- Automated remote trail file recovery by pump automatically handles when a target system is restored to a previous point in time.
This feature also handles most cases where target trail files are deleted or corrupted by automatically regenerating the missing target
trail data when the source trail data is available, and by intelligently skipping any duplicate transactions when applying the change
data.

For more information please go through Oracle Documentation:

http://docs.oracle.com/database/122/HAOVW/ha-features.htm#HAOVW11979

3. Oracle SQL Enhancement


3.1 Join Groups
Join Group is an object that specifies frequently joined columns from the same table or different tables. Such columns
typically contain values of compatible data types that fall in similar ranges. When you create a join group it gets created
in Oracle In-Memory Column Store which contains special metadata for the columns, which enables the database to
optimize join queries for the columns.

Syntax:

CREATE INMEMORY JOIN GROUP Emp_Grp (EMP(dept_id), Dept(dept_id));

4. Other New Features


- There has been introduction to In-Memory column store for Standby Databases.

- DBA's Can now generate AWR reports at PDB Level.

- In SQL Language , Developer can write Query to convert Structure Data into Json format.

- PDB Lockdown Profiles are another good introductions.

- Using In-Memory Column Store with ADO.

- Application Containers, If you have a real use case these Application containers will come real handy when designing
the application with multiple depended PDB's accessing common objects.

Summary
This was my last installment to Oracle 12c Release 2 New Feature Topic. I leave rest of the features for you to go through
and get more insights on..

In my upcoming blogs i will start Blogging about practical use and use cases of these new features.