You are on page 1of 57

1

Copyright 2013, Oracle and/or its affiliates. All rights reserved.

The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. The development, release, and timing of any features or functionality described for Oracle's products remains at the sole discretion of Oracle.

Copyright 2013, Oracle and/or its affiliates. All rights reserved.

Oracle Database 12c


Application Development

Plug into the Cloud


Application Development Big Data Consolidation Data Optimization Data Warehousing High Availability

In-Memory
Performance & Scalability Security & Compliance

Copyright 2013, Oracle and/or its affiliates. All rights reserved.

Development in Oracle Database 12c


A rich and powerful development environment

Copyright 2013, Oracle and/or its affiliates. All rights reserved.

Agenda
Temporal Databases SQL PL/SQL and Edition Based Redefinition SQL Developer SQL Translator Application Express Java Application Continuity XML

Copyright 2013, Oracle and/or its affiliates. All rights reserved.

Oracle Database 12c and Temporal Data


Managing the time dimension

Temporal Validity

Flash Back Data Archive


Flashback Query

Copyright 2013, Oracle and/or its affiliates. All rights reserved.

Temporal Applications
Modeling time is hard
History Kept
o pl

Developing applications that understand history is

ye

es

Em

complicated Querying and reporting history data is hard, as schemas evolve The result is history is only tracked for a few key tables
Often raw fact data is tracked but context is not

De

tm ar

ts en

No History

e.g. Sales history is tracked, but not quota rules, or

territories
8 Copyright 2013, Oracle and/or its affiliates. All rights reserved.

Oracle Database 12c Temporal Support


Transaction Time Temporal (Flashback Data Archive)

Valid Time Temporal

Tracks transactional changes to a table over its lifetime Typically used for compliance and auditing Enables the users to see the data as it was at a point in time in the past

Enables user to model & query data for real world validity Typically used for insurance policies, financial markets, trade data & future changes Users can model concepts such as the Life time of an insurance policy

Copyright 2013, Oracle and/or its affiliates. All rights reserved.

Flashback Data Archive


New features in Oracle Database 12c
Complete Schema Evolution

All table and space management DDL is supported on Flashback Archive enabled tables
Now compatible with Oracle E-Business Suite

Import of history into flashback archive enables tables

User Context Tracking


Makes it simpler to determine who made the change

10

Copyright 2013, Oracle and/or its affiliates. All rights reserved.

Valid Time Temporal


Querying Data Validity
VALID TIME rows are stored in the base table itself

By default, queries see all rows in the table

Changes are written to timestamp columns on base table

Valid Time Data read from base table (filtered using SQL)

11

Copyright 2013, Oracle and/or its affiliates. All rights reserved.

Valid Time Temporal


Example
CREATE TABLE customers( custid NUMBER, custname VARCHAR2(30), custaddr1 VARCHAR2(50), custaddr2 VARCHAR2(50), custcity VARCHAR2(50), custstate VARCHAR2(2),

custzip VARCHAR2(20),
start_time TIMESTAMP, end_time TIMESTAMP, PERIOD FOR cust_valid_time (start_time, end_time));

12

Copyright 2013, Oracle and/or its affiliates. All rights reserved.

Valid Time Temporal


Example
custid custname custaddr1 custaddr2 custcity custstate custzip start_time end_time

Acme Inc

123 Any Street

Suite 17

Anytown

CA

99999

01-JAN12

INSERT INTO CUSTOMERS VALUES(1,'Acme Inc.','123 Any Street','Suite 17','Anytown','AS','99999', TO_TIMESTAMP('01JAN-12) ,NULL);

13

Copyright 2013, Oracle and/or its affiliates. All rights reserved.

Valid Time Temporal


Example
custid custname custaddr1 custaddr2 custcity custstate custzip start_time end_time

Acme Inc

123 Any Street

Suite 17

Anytown

CA

99999

01-JAN12

31-May-13

UPDATE customers SET end_time=TO_TIMESTAMP('31-MAY-13) WHERE custid=1;

14

Copyright 2013, Oracle and/or its affiliates. All rights reserved.

Valid Time Temporal


Example
custid custname custaddr1 custaddr2 custcity custstate custzi p start_time end_time

1 1

Acme Inc Acme Inc

123 Any Street 456 Another Street

Suite 17

Anytown Anytown

CA CA

99999 99998

01-JAN-12 01-JUN-13

31-May-13

INSERT INTO CUSTOMERS VALUES(1,'Acme Inc.',456 Another Street', NULL,'Anytown','AS','99998', TO_TIMESTAMP('01-JUN-13) ,NULL);

15

Copyright 2013, Oracle and/or its affiliates. All rights reserved.

Valid Time Temporal


Example
custid custname custaddr1 custaddr2 custcity custstate custzip start_time end_time

1 1

Acme Inc Acme Inc

123 Any Street 456 Another Street

Suite 17

Anytown Anytown

CA CA

99999 99998

01-JAN-12 01-JUN-13

31-May-13

SELECT custaddr1, custaddr2, custcity, custstate, custzip FROM customers WHERE custid=1;

16

Copyright 2013, Oracle and/or its affiliates. All rights reserved.

Valid Time Temporal


Example
custid custname custaddr1 custaddr2 custcity custstate custzip start_time end_time

1 1

Acme Inc Acme Inc

123 Any Street 456 Another Street

Suite 17

Anytown Anytown

CA CA

99999 99998

01-JAN-12 01-JUN-13

31-May-13

EXEC DBMS_FLASHBACK_ARCHIVE.ENABLE_AT_VALID_TIME('CURRENT'); SELECT custid, start_time, end_time FROM customers WHERE custid=1;

17

Copyright 2013, Oracle and/or its affiliates. All rights reserved.

Valid Time Temporal


Example
custid custname custaddr1 custaddr2 custcity custstate custzip start_time end_time

1 1

Acme Inc Acme Inc

123 Any Street 456 Another Street

Suite 17

Anytown Anytown

CA CA

99999 99998

01-JAN-12 01-JUN-13

31-May-13

SELECT custid, start_time, end_time FROM customers AS OF PERIOD FOR cust_valid_time TO_TIMESTAMP('03-JUN-13');

18

Copyright 2013, Oracle and/or its affiliates. All rights reserved.

Temporal with Oracle Database 12c


Minimizing custom Code

Transaction Time Temporal (flashback data archive) maintains history

Valid Time Temporal maintains business validity

19

Copyright 2013, Oracle and/or its affiliates. All rights reserved.

Oracle Database 12c : The Evolution of SQL


A more powerful expressive language
Pattern Matching PL/SQL in With Clause Identity Based Columns 32k Varchar Fetch First

Invisible Columns
Improved Left Outer Join Syntax

20

Copyright 2013, Oracle and/or its affiliates. All rights reserved.

Pattern Matching
Simplified Analysis of Big Data
Scalable discovery of business event

sequences
Select * from Employees MATCH_RECOGNIZE ( PATTERN(X+ Z{2}) )
Ascending Order

Clickstream logs: sessionization, search

behaviour
Financial transactions: fraud detection, double

bottom (W) stock analysis


Telco: dropped calls
Patterns are defined using regular expressions

Medical sensors: automated medical

observations and detections

21

Copyright 2013, Oracle and/or its affiliates. All rights reserved.

SQL Pattern Matching


Example: Find Double Bottom (W)
Find double bottom (W) patterns and report:

Stock price

Beginning and ending date of the pattern


Average Price Increase in the second ascent Modify the search to find only patterns that lasted less than a week
PATTERN (X+ Y+ W+ Z+) DEFINE X AS (price < PREV(price))

days

22

Copyright 2013, Oracle and/or its affiliates. All rights reserved.

SQL Pattern Matching


Example: Find Double Bottom (W)
Find double bottom (W) patterns and report:

Stock price

Beginning and ending date of the pattern


Average Price Increase in the second ascent Modify the search to find only patterns that lasted less than a week
PATTERN (X+ Y+ W+ Z+) DEFINE X AS (price < PREV(price)) Y AS (price > PREV(price))

days

23

Copyright 2013, Oracle and/or its affiliates. All rights reserved.

SQL Pattern Matching


Example: Find Double Bottom (W)
Find double bottom (W) patterns and report:

Stock price

Beginning and ending date of the pattern


Average Price Increase in the second ascent Modify the search to find only patterns that lasted less than a week

days
SELECT first_x, last_z FROM ticker MATCH_RECOGNIZE ( PARTITION BY name ORDER BY time MEASURES FIRST(x.time) AS first_x LAST(z.time) AS last_z ONE ROW PER MATCH PATTERN (X+ Y+ W+ Z+) DEFINE X AS (price < PREV(price)) Y AS (price > PREV(price)) W AS (price < PREV(price)) Z AS (price > PREV(price))

24

Copyright 2013, Oracle and/or its affiliates. All rights reserved.

SQL Pattern Matching


Example: Find Double Bottom (W)
Stock price

First_x 1 13

Last_z 9 19

Find double bottom (W) patterns and report:

Beginning and ending date of the pattern


Average Price Increase in the second ascent Modify the search to find only patterns that lasted less than a week

13

SELECT first_x, last_z FROM ticker MATCH_RECOGNIZE ( PARTITION BY name ORDER BY time MEASURES FIRST(x.time) AS first_x, LAST(z.time) AS last_z ONE ROW PER MATCH PATTERN (X+ Y+ W+ Z+) DEFINE X AS (price < PREV(price)), Y AS (price > PREV(price)), W AS (price < PREV(price)), Z AS (price > PREV(price)))

19

days

25

Copyright 2013, Oracle and/or its affiliates. All rights reserved.

Pattern Matching
if (!q.isEmpty() && (prev.isEmpty() || (eq(q, prev) && gt(q, next)))) { state = "S"; return state; } if (gt(q, prev) && gt(q, next)) { state = "T"; return state; } if (lt(q, prev) && lt(q, next)) { state = "B"; return state; } if (!q.isEmpty() && (next.isEmpty() || (gt(q, prev) && eq(q, next)))) { state = "E"; return state; } if (q.isEmpty() || eq(q, prev)) { state = "F"; return state; } return state; } private boolean eq(String a, String b) { if (a.isEmpty() || b.isEmpty()) { return false; } return a.equals(b); } private boolean gt(String a, String b) { if (a.isEmpty() || b.isEmpty()) { return false; } return Double.parseDouble(a) > Double.parseDouble(b); } private boolean lt(String a, String b) { if (a.isEmpty() || b.isEmpty()) { return false; } return Double.parseDouble(a) < Double.parseDouble(b); } public String getState() { return this.state; } } BagFactory bagFactory = BagFactory.getInstance(); @Override public Tuple exec(Tuple input) throws IOException {

if (lineNext == null) { next = ""; } else { next = lineNext.getQuantity(); }

Finding Double Bottom (W)


SELECT first_x, last_z FROM ticker MATCH_RECOGNIZE ( PARTITION BY name ORDER BY time MEASURES FIRST(x.time) AS first_x, LAST(z.time) AS last_z ONE ROW PER MATCH PATTERN (X+ Y+ W+ Z+) DEFINE X AS (price < PREV(price)), Y AS (price > PREV(price)), W AS (price < PREV(price)), Z AS (price > PREV(price) AND z.time - FIRST(x.time) <= 7 ))

long c = 0; String line = ""; String pbkey = ""; V0Line nextLine; V0Line thisLine; V0Line processLine; V0Line evalLine = null; V0Line prevLine; boolean noMoreValues = false; String matchList = ""; ArrayList<V0Line> lineFifo = new ArrayList<V0Line>(); boolean finished = false; DataBag output = bagFactory.newDefaultBag(); if (input == null) { return null; Copyright 2013, Oracle } if (input.size() == 0) { return null;

250+ Lines of Java and PIG 20x less code, 5x faster

12 Lines of SQL

26

and/or its affiliates. All rights reserved.

New SQL Functionality

PL/SQL in SQL via the with clause


Useful for read only databases Potentially faster for some operations

IDENTITY based columns


Auto incrementing columns
Supports ANSI standard

Increased size for VARCHAR2


Increase from 4000 to 32K

New Row limiting clause

27

Copyright 2013, Oracle and/or its affiliates. All rights reserved.

PL/SQL in SQL
Example
PL/SQL Function embedded in with clause
WITH FUNCTION get_domain(url VARCHAR2) RETURN VARCHAR2 IS pos BINARY_INTEGER; len BINARY_INTEGER; BEGIN pos := INSTR(url, 'www.'); len := INSTR(SUBSTR(url, pos + 4), '.') - 1; RETURN SUBSTR(url, pos + 4, len); END; SELECT DISTINCT get_domain(catalog_url) FROM orders;

28

Copyright 2013, Oracle and/or its affiliates. All rights reserved.

IDENTITY
Example
Create a table where the id column is always populated by Oracle

CREATE TABLE t1 (id NUMBER GENERATED AS IDENTITY, first_name varchar2(30) );

Create a table where the id column is populated by Oracle when not provided

CREATE TABLE t2 (id NUMBER GENERATED BY DEFAULT AS IDENTITY (START WITH 100 INCREMENT BY 10), first_name varchar2(30) );

29

Copyright 2013, Oracle and/or its affiliates. All rights reserved.

32K VARCHAR2/NVARCHAR2
Example
Enable 32k support in the Oracle Database 12c

ALTER SYSTEM set MAX_STRING_SIZE = EXTENDED scope = SPFILE

Create table with 32k varchar2

CREATE TABLE Applicants (id NUMBER GENERATED AS IDENTITY, first_name varchar2(30), last_name varchar2(30), application date, CV varchar2(32767) );

30

Copyright 2013, Oracle and/or its affiliates. All rights reserved.

Row Limit
Example
Select only the first 5 rows

SELECT employee_id, last_name FROM employees ORDER BY employee_id FETCH FIRST 5 ROWS ONLY;
Select the first 5% of rows and those whose salary ties with the lowest of the 5%

SELECT employee_id, last_name, salary FROM employees

ORDER BY salary
FETCH FIRST 5 PERCENT ROWS WITH TIES;

31

Copyright 2013, Oracle and/or its affiliates. All rights reserved.

PL/SQL and Edition Based Redefintion


A Portable high performance transaction language
Invokers Rights Functions Caching

Objects, Not Types, Are Editioned


More Types To Cross SQL/PLSQL Database Triggers on PDBs Implicit Statement Results
BEGIN END;

32

Copyright 2013, Oracle and/or its affiliates. All rights reserved.

Now theres no reason to avoid database PL/SQL


Fifty-year-old wisdom says:
expose the database to client-side code as a PL/SQL API and

securely hide the implementation details the names and structures of the tables, and the SQL statements that manipulate them from the client.
Yet a very large number of customers refuse to do this Excuses:
Patching database PL/SQL causes unacceptable downtime
Cant pass index-by table of records to/from the client Cant provision a private sandbox database for each developer

33

Copyright 2013, Oracle and/or its affiliates. All rights reserved.

These changes demolish the objections


EBR adoption barrier vanishes
Editioned state now per object, not per schema Materialized views, indexes, and virtual columns can now use PL/SQL

functions (new metadata specifies the edition for name resolution)


PL/SQL
Row sets can now be passed between the client and the database index-

by-PL/SQL-tables of records
The multitenant architecture
PDBs can be rapidly and thinly created, and then dropped, using SQL
Easy to write an app to let a developer self-provision his sandbox database

34

Copyright 2013, Oracle and/or its affiliates. All rights reserved.

Oracle SQL Developer


Simplifying development and management in the Oracle Database
Support for Oracle Database 12c

SQL Translation Framework


Data Redaction Support Manage Pluggable Databases APEX Administration Cloud Database Support

35

Copyright 2013, Oracle and/or its affiliates. All rights reserved.

Oracle Database 12c: Pluggable Databases


SQL Developer Release 3.2

36

Copyright 2013, Oracle and/or its affiliates. All rights reserved.

Oracle Database 12c: Pluggable Databases

37

Copyright 2013, Oracle and/or its affiliates. All rights reserved.

Oracle Data Redaction


Example: Partial
Before

After

38

Copyright 2013, Oracle and/or its affiliates. All rights reserved.

Oracle Application Express 4.2


Centralized database development for transaction centric applications
JQuery Support

Mobile Application Support


HTML 5 Charts Oracle Database 12c Support Packaged Apps

39

Copyright 2013, Oracle and/or its affiliates. All rights reserved.

APEX Gant Chant

40

Copyright 2013, Oracle and/or its affiliates. All rights reserved.

Survey Builder Packaged Application

41

Copyright 2013, Oracle and/or its affiliates. All rights reserved.

.NET and Oracle Database 12c

42

Copyright 2013, Oracle and/or its affiliates. All rights reserved.

.NET and Oracle Database 12c


Transaction Guard and Global Data Services Managed ODP.NET Visual Studio Application Lifecycle Management PDBs
View, clone, plug, unplug PDBs from Visual Studio Share PDBs with other developers

Schema Compare
View differences between schemas Generate diff scripts to source control

43

Copyright 2013, Oracle and/or its affiliates. All rights reserved.

Java in Oracle Database 12c

JDBC 4.1 support

Choice of Java6 or Java7


Support for Oracle 12c Features Application Continuity Support for DRCP

44

Copyright 2013, Oracle and/or its affiliates. All rights reserved.

Oracle Database 12c for Java


Java Standards Support
JDBC & UCP Support for JavaSE 7 and JDBC 4.1 Java in the database goes JavaSE 6 & 7; pick at db creation time.

Java in the database got JNDI, Java Logging

Support for New Database Type and New SQL Types


JDBC Support for Pluggable databases through Service Names

32K VARCHAR, NVARCHAR, and RAW


Invisible or Hidden Columns, Implicit Result Set Auto-Increment Columns (IDENTITY columns) PL/SQL Package Types as Parameter
45 Copyright 2013, Oracle and/or its affiliates. All rights reserved.

Oracle Database 12c for Java


Performance & Scalability
Large Scale Java deployment with DRCP Very Large Network Buffers (SDU)

Support for Monitoring of Database Operations

High Availability
Reliable Outcome of In-Flight Work (at Most Once Commit) with Transaction Guard
Masking Database Outage and Resubmission of In-Flight Work with Application

Continuity
Load-Balancing and Failover across Geographies (Worldwide) with Global Data

Service
46 Copyright 2013, Oracle and/or its affiliates. All rights reserved.

When is Application Continuity for Java transparent


If the Application
Uses J2EE or JPA that uses the standard JDBC API Uses UCP or WebLogic Server and return connections to

pool Does not have external actions that cannot be replayed.

47

Copyright 2013, Oracle and/or its affiliates. All rights reserved.

XML in Oracle Database 12c

XQuery Update Support for XQuery-FullText XQuery Performance Improvements

<?XML?>
48 Copyright 2013, Oracle and/or its affiliates. All rights reserved.

Advanced XML Capabilities


XML Application XDK

JDBC
.NET OCI SOAP HTTP FTP WebDav

Files

XMLType XML Schema

Document and Data Centric Access


Native XQuery Engine Flexible XML Indexing Optimized storage for schema-based and schema-less XML

Folders
ACLS Versioning

XQuery
SQL/XML XSLT

Metadata
Events

Document or Message

DOM

49

Copyright 2013, Oracle and/or its affiliates. All rights reserved.

49

Oracle XML DB in Oracle Database 12c

Support for XQuery-Update


Standards based update operations on XML Content

Support for XQuery-Fulltext


Standard based, XML aware full-text searching. Support for document,

fragment and leaf-level searching


Indexing enhancements to support XQuery-Fulltext implementation Significant performance enhancements for XQuery processing Optimizations for offloading parsing and serialization

50

Copyright 2013, Oracle and/or its affiliates. All rights reserved.

In Database Archiving

51

Copyright 2013, Oracle and/or its affiliates. All rights reserved.

In-Database Archiving

Applications typically work with recent data


But often need to retain data for 5 to 10 years

Can potentially improve upgrade times as only data that is active is

modified In-DB Archiving provides the ability to archive infrequently used data within the database
Archived Data is invisible by default

Archived data remains online for historical analysis

52

Copyright 2013, Oracle and/or its affiliates. All rights reserved.

In-Database Archiving
Enable In-Database Archiving on the Sales Table ALTER TABLE SALES ROW ARCHIVAL; Archive the rows with a non zero value (null, -1, 1 etc.) UPDATE SALES set ORA_ARCHIVE_STATE = 1; Modify your session to see all rows including archived versions ALTER SESSION SET ROW ARCHIVAL VISIBILITY = ALL;

53

Copyright 2013, Oracle and/or its affiliates. All rights reserved.

Oracle Application Development Summary

Oracle provides a rich development experience with support for a wide

range of languages and approaches Oracle Database 12c continues to improve on the developers experience by providing improved tools and APIs

54

Copyright 2013, Oracle and/or its affiliates. All rights reserved.

The preceding is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. The development, release, and timing of any features or functionality described for Oracle's products remains at the sole discretion of Oracle.

55

Copyright 2013, Oracle and/or its affiliates. All rights reserved.

56

Copyright 2013, Oracle and/or its affiliates. All rights reserved.

57

Copyright 2013, Oracle and/or its affiliates. All rights reserved.

You might also like