Académique Documents
Professionnel Documents
Culture Documents
Oracle Disclaimer: The following is intended to outline Oracle's 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.
(Thanks: Kay Cavender, Michelle Kolbe, Lori Lorusso, Andy Mendelsohn, Debbie Migliore, Maria Colgan, Penny Avril, Deba Chatterjee, Dan Koloski, Jagan Athreya, Werner De Gruyter, Julian Dontcheff, Jacob & Lucas Niemiec)
Monday:
The Best 12c Database Features 10:30 - 11:00 AM Rolta Booth #1701
Enter to Win an iPad Air
Tuesday:
Innovation, Big Data & IOT Brief 3:15 3:35 PM Rolta Booth #1701
Enter to Win an iPad Air
Wednesday:
All Booth Presentations at Rolta Booth # 1701 in Moscone South Vendor Hall
Richs Overview
@richniemiec
Goals
Non-Goals
Overview 12c
Know the Oracle!
Start Me Up Using Memory Target, & The Buffer Cache
Multiple indexes on the same Column (12c) & Invisible Indexes (11g)
Adaptive Execution Plans (12c) & Adaptive Cursor Sharing & Bind Peeking (11g)
Runaway query Management (12c)
Online Move Partition (12c) & Interval Partitioning (11g)
Partial Indexes for Partitioned Table (12c)
Pluggable Databases (12c)
In-Memory Database 12.1.0.2
Exadata and Big Data (In-Database MapReduce in 12c)
Consolidated Database Replays & Better Reporting (12c)
Other 12c New Features
October 21, 2015
Were #1 in Everything!
Top 250
Partners
10
11
12
Source Database
10.2.0.5 (or higher)
Target Database
12.1.x
12.1.x
12.1.x
In-Direct Upgrade Path
Source Database
Target Database
11.2.x
11.2.x
11.2.x
11.2.x
13
14
12.1.0.2
15
16
17
Databas
e Smart
Flash
Cache
Database Smart Flash Cache (Solaris/Oracle Linux) L2 cache set 2-10x SGA:
DB_FLASH_CACHE_FILE = /dev/sda, /dev/sdb, /dev/sdc
DB_FLASH_CACHE_SIZE = 32G, 32G, 64G
18
Initialization Parameter
None
SHARED_POOL_SIZE
LARGE_POOL_SIZE
JAVA_POOL_SIZE
DB_CACHE_SIZE
STREAMS_POOL_SIZE
19
Initialization Parameter
LOG_BUFFER (pfile only since 10g)
DB_KEEP_CACHE_SIZE
DB_RECYCLE_CACHE_SIZE
DB_nK_CACHE_SIZE
20
21
IM - Initialization Parameters
The Database In-Memory (IM) is not enabled if:
INMEMORY_SIZE is set to zero!
Add space to the SGA_TARGET to accommodate the IM: ALTER
SYSTEM SET SGA_TARGET=200G scope=both (SGA_TARGET
must be large enough for new IM)
ALTER SYSTEM SET INMEMORY_SIZE=100G scope=both
The IM Column Store (IM) creates an area in the SGA called InMemory Area. This is an added memory area in addition to the
buffer cache and other SGA areas.
October 21, 2015
22
In 11g, a procedure for SQL Plan Baselines (well cover these later).
DBMS_XPLAN.DISPLAY_SQL_PLAN_BASELINE (
sql_handle IN VARCHAR2 := NULL,
plan_name IN VARCHAR2 := NULL,
format
IN VARCHAR2 := 'TYPICAL') <BASIC/ALL>
RETURN dbms_xplan_type_table;
October 21, 2015
23
| Operation
Name
| Rows
| Bytes | Cost
| Pstart| Pstop |
--------------------------------------------------------------------------------------
0 | UPDATE STATEMENT
328 |
2296 |
2 |
1 |
| JOURNAL_LINE
2 |
1 |
4 |
3 |
328 |
2296 |
2 |
1 |
4 |
UPDATE
24
| Operation
| Name
| Rows
-----------------------------------------------------------------------------|
0 | SELECT STATEMENT
1 |
14 |
728 |
(0)| 00:00:01 |
14 |
728 |
(0)| 00:00:01 |
-----------------------------------------------------------------------------Note
----PLAN_TABLE_OUTPUT
-------------------------------------------------------------------------------October
2015
- 21,
dynamic
25
26
Great to turn off indexes for a while when you think theyre not
being used, but BEFORE you drop them.
Can NOT use INDEX hint (to override invisibility) anymore, but
CAN use NO_INDEX (to turn off visible indexes).
The index IS MAINTAINED during DML
Great for testing!
More in the 12c Tuning Session my next session!
October 21, 2015
27
select count(*) from dept_rich where deptno = 30; (doesnt see the index)
COUNT(*)
-------------512
Execution Plan
---------------------------------------------------------Plan hash value: 3024595593
-------------------------------------------------------------------------------| Id
| Operation
| Name
| Rows
--------------------------------------------------------------------------------
0 | SELECT STATEMENT
1 |
2 |
1 |
1 |
2 |
|*
2 |
SORT AGGREGATE
512 |
(0)| 00:00:01 |
|
1024 |
|
(0)| 0:00:01 |
--------------------------------------------------------------------------------
28
512
Execution Plan
---------------------------------------------------------Plan hash value: 3699452051
---------------------------------------------------------------------------------------
| Id | Operation
| Name
1|
2|
| 1 | SORT AGGREGATE |
1|
2|
|* 2 |
1 (0)| 00:00:01 |
|
---------------------------------------------------------------------------------------
29
from dept_rich
where deptno = 30; (forces not using the index with hint)
COUNT(*)
---------512
Execution Plan
----------------------------------------------------------
-------------------------------------------------------------------------------| Id
| Operation
| Name
| Rows
-------------------------------------------------------------------------------|
0 | SELECT STATEMENT
1 |
2 |
1 |
1 |
2 |
|*
2 |
SORT AGGREGATE
512 |
(0)| 00:00:01 |
|
1024 |
|
(0)| 0:00:01 |
October
21, 2015
--------------------------------------------------------------------------------
30
31
32
33
DNAME
---------ACCOUNTING
RESEARCH
SALES
OPERATIONS
LOC
---------NEW YORK
DALLAS
CHICAGO
BOSTON
34
35
ERROR at line 1:
ORA-00001: unique constraint (SYS.DEPT_UNIQUE1) violated
36
COLUMN_NAME
UNIQUENESS
VISIBILITY
DEPT
October 21, 2015
DEPT_UNIQUE1
DEPTNO
UNIQUE
INVISIBLE
37
user_indexes a, user_ind_columns b
where
a.index_name = b.index_name
and
a.table_name = DEPT;
TABLE_NAME INDEX_NAME
COLUMN_NAME
UNIQUENESS
VISIBILITY
DEPT_UNIQUE1
DEPTNO
UNIQUE
VISIBLE
38
Make FIRST Index Invisible & can now create SECOND index:
alter index dept_unique1 invisible;
Index altered.
Index created.
39
COLUMN_NAME
UNIQUENESS
VISIBILITY
DEPT
DEPT_UNIQUE1
DEPTNO
UNIQUE
INVISIBLE
DEPT
DEPT_NORMAL
DEPTNO
NONUNIQUE
VISIBLE
40
41
dept
where
deptno=10;
DEPTNO
------
10
-------------------------------------------------------------------------------| Id
| Operation
| Name
| Rows
-------------------------------------------------------------------------------|
0 | SELECT STATEMENT |
1 |
13 |
(0)| 00:00:01 |
|*
1 |
1 |
13 |
(0)| 00:00:01 |
--------------------------------------------------------------------------------
Index altered.
42
user_indexes a, user_ind_columns b
where
a.index_name = b.index_name
and
a.table_name = DEPT;
TABLE_NAME INDEX_NAME
COLUMN_NAME
UNIQUENESS
VISIBILITY
DEPT
DEPT_UNIQUE1
DEPTNO
UNIQUE
INVISIBLE
DEPT
DEPT_REVERSE
DEPTNO
NONUNIQUE
VISIBLE
DEPT
DEPT_NORMAL
DEPTNO
NONUNIQUE
INVISIBLE
43
44
user_indexes a, user_ind_columns b
where
a.index_name = b.index_name
and
a.table_name = DEPT;
TABLE_NAME INDEX_NAME
COLUMN_NAME
UNIQUENESS
VISIBILITY
DEPT
DEPT_UNIQUE1
DEPTNO
UNIQUE
INVISIBLE
DEPT
DEPT_REVERSE
DEPTNO
NONUNIQUE
INVISIBLE
DEPT
DEPT_NORMAL
DEPTNO
NONUNIQUE
INVISIBLE
DEPT
DEPT_BITMAP
DEPTNO
NONUNIQUE
VISIBLE
DEPT
DEPT_FB
SYS_NC00004$
NONUNIQUE
VISIBLE
45
from
dept
where
substr(deptno,1,1)=1;
DEPTNO
---------10
-------------------------------------------------------------------------| Id
| Operation
| Name | Rows
-------------------------------------------------------------------------|
0 | SELECT STATEMENT
|*
1 |
1 |
5 |
(0)| 00:00:01 |
1 |
5 |
(0)| 00:00:01 |
--------------------------------------------------------------------------
1 - filter(TO_NUMBER(SUBSTR(TO_CHAR("DEPTNO"),1,1))=1)
46
dept
where
substr(deptno,1,1)='1';
DEPTNO
---------10
-------------------------------------------------------------------------------| Id
| Operation
| Name
| Rows
| Bytes | Cost
--------------------------------------------------------------------------------
0 | SELECT STATEMENT
1 |
|*
2 |
1 |
5 |
1 |
5 |
| DEPT_FB |
1 |
--------------------------------------------------------------------------------
47
48
More Data
Install New DB
Non-CDB
Separate PDB
October 21, 2015
Pristine DB
49
50
Pluggable Databases
CDB = Container Database (has Root DB & also has a seed PDB)
PDB = Pluggable Database (plugged into a CDB)
Non-CDB = Original type of Database (neither a CDB or PDB)
Why?: Cant consolidate 100s of database on one machine too many
resources required when you add the SGAs up! Enter PDBs.
51
Pluggable Databases
52
53
54
55
OPEN_MODE
OPEN_TIME
READ ONLY
PDB1
PDB_SS
23-FEB-13 05.29.19.861 AM
56
57
Cloning a PDB
CREATE PLUGGABLE DATABASE pdb2 FROM pdb1
PATH_PREFIX = '/disk2/oracle/pdb2'
FILE_NAME_CONVERT = ('/disk1/oracle/pdb1/',
'/disk2/oracle/pdb2/');
CREATE PLUGGABLE DATABASE pdb2 FROM pdb1
FILE_NAME_CONVERT = ('/disk1/oracle/pdb1/',
'/disk2/oracle/pdb2/') STORAGE (MAXSIZE 2G
MAX_SHARED_TEMP_SIZE 100M);
CREATE PLUGGABLE DATABASE pdb2 FROM
pdb1@pdb1_link;
October 21, 2015
58
59
Session altered.
SQL> alter session set container=CDB1;
ERROR:
60
Open/Close PDBs
SQL> ALTER PLUGGABLE DATABASE CLOSE IMMEDIATE;
Pluggable database altered.
SQL> ALTER PLUGGABLE DATABASE OPEN READ WRITE;
Pluggable database altered.
SQL> ALTER PLUGGABLE DATABASE CLOSE; (shutdown)
Pluggable database altered.
Alter pluggable database open upgrade; (to migrate)
Pluggable database altered.
October 21, 2015
61
Open/Close PDBs
ALTER PLUGGABLE DATABASE PDB_SS, PDB1 CLOSE; (not in
CDB)
ALTER PLUGGABLE DATABASE PDB_SS, PDB1 CLOSE
*
ERROR at line 1:
ORA-65040: operation not allowed from within a pluggable database
Session altered.
alter pluggable database ALL open read only; (from CDB)
Pluggable database altered.
ALTER PLUGGABLE DATABASE PDB_SS, PDB1 CLOSE;
October 21, 2015
Startup PDB
Startup pluggable database pdb1 open;(read/write)
Pluggable Database opened.
(or while in pdb1 just run STARTUP)
Startup pluggable database pdb1 open
read only;
Pluggable Database opened.
Startup pluggable database pdb1 force;
(closes/opens)
Pluggable Database opened.
63
NAME
SQL> startup
Fixed Size
Variable Size
Database Buffers
Redo Buffers
626327552 bytes
2276008 bytes
524289368 bytes
92274688 bytes
7487488 bytes
OPEN_MODE
OPEN_TIME
Database mounted.
PDB1
MOUNTED
Database opened.
PDB_SS
MOUNTED
open_time
27-MAR-13
64
CDB_PDBS p, CDB_TABLES t
where
p.PDB_ID = t.CON_ID
AND
T.OWNER ='ORDDATA
ORDER
BY t.TABLE_NAME;
PDB_ID PDB_NAME
OWNER
TABLE_NAME
ORDDATA
ORDDCM_ANON_ACTION_TYPES
3 PDB1
ORDDATA
ORDDCM_ANON_ACTION_TYPES
2 PDB$SEED
ORDDATA
ORDDCM_ANON_ATTRS
3 PDB1
ORDDATA
ORDDCM_ANON_ATTRS
3 PDB1
ORDDATA
ORDDCM_ANON_ATTRS_TMP
2 PDB$SEED
ORDDATA
ORDDCM_ANON_ATTRS_TMP
3 PDB1
ORDDATA
ORDDCM_ANON_ATTRS_WRK
2 PDB$SEED
ORDDATA
ORDDCM_ANON_ATTRS_WRK
65
FROM
CDB_PDB_HISTORY
WHERE
CON_ID > 2
ORDER
BY CON_ID;
Sample output:
DB_NAME
CON_ID PDB_NAME
OPERATION
OP_TIMEST CLONED_FROM_PDB
3 PDB1
CREATE
01-APR-13 PDB$SEED
NEWCDB
4 PDB_SS
CREATE
01-APR-13 PDB$SEED
NEWCDB
5 PDB2
CLONE
02-APR-13 PDB1
66
67
ISPDB_MODIFIABLE
AND
= 'TRUE'
(without condition can set 147 parameters out of 357)
(There were 341 parameters in 11gR2)
NAME
---------------------------------------optimizer_adaptive_reporting_only
optimizer_capture_sql_plan_baselines
optimizer_dynamic_sampling
optimizer_features_enable
optimizer_index_caching
optimizer_index_cost_adj
optimizer_mode
optimizer_use_invisible_indexes
optimizer_use_pending_statistics
optimizer_use_sql_plan_baselines
10 rows selected.
68
69
70
STATUS
-------------------ACTIVE
ACTIVE
COMMENTS
-------------------Default CDB plan
Internal CDB plan
Pluggable
Utilization Parallel
Plan
Database
Shares
Limit
Limit
-------------------------- ------------------------- ------ ----------- -------DEFAULT_CDB_PLAN
ORA$DEFAULT_PDB_DIRECTIVE
1
100
100
DEFAULT_CDB_PLAN
ORA$AUTOTASK
90
100
71
72
This guy and his team working hard to make your life easier!
73
74
75
Will the additional column condition reduce the result set or not?
Should it be used.
Oracle calculates correlated statistics so the optimizer will make great decisions.
Single column statistics and histograms are not enough!
October 21, 2015
76
Example
CORVETTE
40,000
RED
CORVETTE
60,000
BLACK
CORVETTE
50,000
SILVER
Make
Price
Color
CORVETTE
40,000
RED
CORVETTE
60,000
BLACK
CORVETTE
50,000
SILVER
CADILLAC
90,000
RED
JEEP
35,000
BLACK
JEEP
45,000
SLIVER
77
Example, cont.
CORVETTE
40,000
RED
SELECT
FROM
WHERE
AND
Make
Price
Color
CORVETTE
40,000
RED
CORVETTE
60,000
BLACK
CORVETTE
50,000
SILVER
CADILLAC
90,000
RED
JEEP
35,000
BLACK
JEEP
45,000
SLIVER
78
Example, cont.
CORVETTE
50,000
RED
CORVETTE
50,000
BLACK
CORVETTE
50,000
SLIVER
Correlated columns
Additional predicate has no effect
Single column statistics are NOT sufficient
Must use = and not < or >
Make
Price
Color
CORVETTE
50,000
RED
CORVETTE
50,000
BLACK
CORVETTE
50,000
SILVER
CADILLAC
90,000
RED
JEEP
35,000
BLACK
JEEP
45,000
SLIVER
79
80
NUM_DISTINCT HISTOGRAM
2 NONE
19 FREQUENCY
CUST_STATE_PROVINCE
145 NONE
CUST_CITY_ID
CUST_CITY
620 NONE
CUST_LAST_NAME
908 NONE
CUST_FIRST_NAME
1300 NONE
CUST_ID
55500 NONE
...
October 21, 2015
23 rows selected.
81
select dbms_stats.create_extended_stats('SH','CUSTOMERS',
'(country_id, cust_state_province)') from dual;
DBMS_STATS.CREATE_EXTENDED_STATS('SH','CUSTOMERS','(CO
-------------------------------------------------------------------------------SYS_STUJGVLRVH5USVDU$XNV4_IR#4
exec dbms_stats.gather_table_stats('SH','CUSTOMERS',
method_opt => 'for all columns size skewonly');
PL/SQL procedure successfully completed.
October 21, 2015
82
NUM_DISTINCT HISTOGRAM
145 FREQUENCY
CUST_VALID
2 FREQUENCY
COUNTRY_ID
19 FREQUENCY
CUST_STATE_PROVINCE
145 FREQUENCY
CUST_CITY_ID
CUST_CITY
CUST_LAST_NAME
CUST_FIRST_NAME
CUST_ID
...
24 rows selected.
83
NUM_DISTINCT HISTOGRAM
19 FREQUENCY
CUST_STATE_PROVINCE
145 NONE
CUST_CITY_ID
CUST_CITY
620 NONE
CUST_LAST_NAME
908 NONE
CUST_FIRST_NAME
CUST_ID
October 21, 2015
2 NONE
...
23 rows selected.
1300 NONE
55500 NONE
84
If Oracle peeks and sees the President, it will use the index. Future queries
also use the index without peeking after that (bad for the OPERATOR query).
October 21, 2015
85
Ename
Empno
Job
SMITH
6973
OPERATOR
ALLEN
7499
OPERATOR
WARD
7521
OPERATOR
KING
8739
PRESIDENT
SCOTT
7788
OPERATOR
CLARK
7782
OPERATOR
Ename
Empno
Job
SMITH
6973
OPERATOR
ALLEN
7499
OPERATOR
WARD
7521
OPERATOR
SCOTT
7788
OPERATOR
CLARK
7782
OPERATOR
86
87
88
Bind Peeking
Cursor Sharing (cs) Statistics
select sql_id, peeked, executions, rows_processed, cpu_time
from v$sql_cs_statistics; (using the peeked value on the 2nd+ execution)
SQL_ID
P EXECUTIONS ROWS_PROCESSED
CPU_TIME
5wfj3qs71nd7m Y
2rad83pp613m1 Y
dr78c03uv97bp N
dr78c03uv97bp N
dr78c03uv97bp Y
9qv6tq9ag5b80 Y
a2k4qkh681fzx Y
413zr99jf9h72 N
413zr99jf9h72 N
413zr99jf9h72 Y
fd69nfzww1mhm Y
89
EXECUTIONS I I
------------- ---------- - -
9ugwm6xmvw06u
11 Y N
bdfrydpbzw07g
11 Y N
57pfs5p8xc07w
20 N N
...
90
91
Adaptive Plans does not pick the final plan until execution time based on statistics collection.
Information learned at execution time is used in future executions. Youll see the plan table
output in the note section:
Note
-------------------------- this is an adaptive plan
The 12c Adaptive Optimizer adapts plans based on not just the original tables stats, but also
additional adaptive statistics
There are three types of Adaptive Statistics:
October 21, 2015
92
Set it to TRUE for reporting only. You can then check to get notes about runtime optimizations, such as dynamic
plans switching from NL to HASH joins.
(Use DBMS_XPLAN.DISPLAY_CURSOR use ADAPTIVE for format)
SQL> sho parameter OPTIMIZER_ADAPTIVE_REPORTING_ONLY
NAME
TYPE
VALUE
optimizer_adaptive_reporting_only boolean
FALSE
93
94
Even if you DONT set the parameter above, reoptimization based on statistics may influence degree
of parallelism that the optimizer uses.
Reoptimization creates SQL Plan Directives (information/instructions for optimizer to use to generate
a more optimal plan next time).
SQL Plan Directives stored in SYSAUX tablespace & initially created in Shared Pool
SQL Plan Directives may be managed using the DBMS_SPD package
DBA_SQL_PLAN_DIRECTIVES will show directives/reasons (e.g. MISESTIMATE)
Note
---------------------------------------------------- dynamic sampling used for this statement (level=2)
95
96
97
98
99
CPU is exceeded
Physical I/O is exceeded (disk)
Logical I/O is exceeded (memory)
Elapsed Time is exceeded
100
BEGIN
DBMS_RESOURCE_MANAGER.CREATE_PLAN_DIRECTIVE (
END;
/
BEGIN
DBMS_RESOURCE_MANAGER.CREATE_PLAN_DIRECTIVE (
PLAN => 'DAYTIME',
GROUP_OR_SUBPLAN => 'OLTP',
COMMENT => 'OLTP group',
MGMT_P1 => 75,
SWITCH_GROUP => 'LOW_GROUP',
SWITCH_IO_REQS => 10000,
SWITCH_IO_MEGABYTES => 2500,
SWITCH_FOR_CALL => TRUE);
END;
/
101
WHERE
se.current_consumer_group_id = co.id;
SESS_ID CONSUMER_GROUP
STATE
113
OLTP_ORDER_ENTRY
WAITING
137947
28846
135
OTHER_GROUPS
IDLE
785669
11126
124
OTHER_GROUPS
WAITING
50401
14326
114
SYS_GROUP
RUNNING
495
102
SYS_GROUP
IDLE
88054
80
147
DSS_QUERIES
WAITING
460910
512154
0
102
NUMBER(2),
DEPT_NAME
VARCHAR2(30))
PARTITION BY RANGE(DEPTNO)
(PARTITION D1 VALUES LESS THAN (10) TABLESPACE DEPT1,
PARTITION D2 VALUES
PARTITION D3 VALUES
104
partition cust_sales_q3 values less than (1998, 10, 01) tablespace users3,
partition cust_sales_q4 values less than (1999, 01, 01) tablespace users4,
partition cust_sales_qx values less than (maxvalue, maxvalue, maxvalue) tablespace users4);
October 21, 2015
105
106
PARTITION BY
PARTITION q1_2000
VALUES
107
List Partitioning
(Allowed since 9i)
create table dept_part
(deptno number(2),
dname
loc
varchar2(14),
varchar2(13))
Table created.
October 21, 2015
108
109
NUMBER(2),
DEPT_NAME VARCHAR2(30))
PARTITION BY RANGE(DEPTNO)
(PARTITION D1 VALUES LESS THAN (10),
PARTITION D2 VALUES
PARTITION D3 VALUES
Table created.
SQL> insert into dept_new values(40, 'test2');
insert into dept_new values(40, 'test2')
*
ERROR at line 1:
ORA-14400: inserted partition key does not map to any partition
October 21, 2015
110
SEGMENT_NAME
-----------------------------DEPT_NEW
DEPT_NEW
DEPT_NEW
October 21, 2015
PARTITION_NAME
---------------------------D1
D2
D3
111
112
PARTITION_NAME
------------------------------ ------------------------------
DEPT_NEW2
D1
DEPT_NEW2
D2
DEPT_NEW2
D3
DEPT_NEW2
SYS_P41
DEPT_NEW2
SYS_P42
DEPT_NEW2
SYS_P43
113
Partition Compression
CREATE TABLE DEPT_new3
(DEPTNO
NUMBER(2),
DEPT_NAME
VARCHAR2(30))
PARTITION D2 VALUES
PARTITION D3 VALUES
Table created.
NOCOMPRESS - The table or partition is not compressed. This is the default action
COMPRESS - Suitable for data warehouse. Compression enabled during direct-path inserts only.
COMPRESS FOR DIRECT_LOAD OPERATIONS - Same affect as the simple COMPRESS.
COMPRESS FOR ALL OPERATIONS - Suitable for OLTP systems. Compression for all operations, including regular DML
statements. Requires COMPATIBLE to be set to 11.1.0 or higher.
October 21, 2015
COMPRESS FOR OLTP - Suitable for OLTP systems. Enables compression for OLTP operations, including regular DML
statements. Requires COMPATIBLE to be set to 11.1.0 or higher and in 11.2 replaces the COMPRESS FOR ALL
OPERATIONS Syntax, but COMPRESS FOR ALL OPERATIONS syntax still exists and is still valid.
114
Partition Compression
select table_name, partition_name, compression
from dba_tab_partitions
where table_name = 'DEPT_NEW3;
TABLE_NAME
PARTITION_NAME COMPRESS
DEPT_NEW3
D1
ENABLED
DEPT_NEW3
D2
DISABLED
DEPT_NEW3
D3
ENABLED
DEPT_NEW3
SYS_P64
ENABLED
DEPT_NEW3
SYS_P65
ENABLED
DEPT_NEW3
SYS_P66
ENABLED
6 rows selected.
115
PARTITION D2 VALUES
PARTITION D3 VALUES
Table created.
SQL> create index dept3_partial on dept3 (dept_name)
local indexing partial;
Index created.
October 21, 2015
(Local Index Partitions D1 & D2 will be usable can create global index instead)
116
* Oracle Survey
October 21, 2015
117
118
This is especially helpful for Exadata migrations where more compression options (HCC) are available.
October 21, 2015
119
TRANSFORM=TABLE_COMPRESSION_CLAUSE:compress:table
5.937 KB
4 rows
122
123
124
125
126
127
128
Row
Column
Memory
Transactions
In the
Buffer Cache
SALES
Row
Format
Memory
SALES
Column
Format
Analytics
In the
In-Memory
Column Store
129
130
131
132
133
IM - Basics
You may remove some indexes on tables (make invisible initially);
Leave indexes that support referential integrity and fast OLTP
access to small amounts of data.
Buffer cache usually only has 10% or less of a table (unless its
very small), where IM has 100% of the table.
Some products force you to cache the entire database Oracle
allows object level INMEMORY.
IM does not have an LRU (like buffer cache), When full - another
object in the IM must be dropped or declared NO INMEMORY
a warning in the alert log that an attempt was made to populate
data and the IM column store is full!
October 21, 2015
134
135
* Available NOW!
136
137
IM Why so fast?
SIMD (Simple Instruction, Multiple Data)
Concept of SIMD
Performs the same operation on multiple data points simultaneously - Wikipedia (i.e.
Scans multiple data values in the same CPU instruction (instead of one at a time)).
138
IM - SIMD
SIMD (Simple Instruction, Multiple Data) vector processing (one
dimensional array processing) scans multiple values in one CPU
instruction instead of evaluating each entry one at a time
SIMD + IM = billions/second rows scanned
Parallel computations One process-instruction on multiple data points
simultaneously parallelism/not concurrency).
SIMD applicable to adjusting contrast of an image (same instruction to
all data points).
The column format in IM has been maximized to use SIMD.
Vector (array) processing popularized by Cray in 1970
Used in 3-D graphics (graphics cards have embedded SIMD).
October 21, 2015
139
140
141
IM - Initialization Parameters
The Database In-Memory is not enabled if: INMEMORY_SIZE is
set to zero!
Add space to the SGA_TARGET to accommodate the IM: ALTER
SYSTEM SET SGA_TARGET=200G scope=both (SGA_TARGET
must be large enough for new IM)
ALTER SYSTEM SET INMEMORY_SIZE=100G scope=both
The IM Column Store (IM) creates an area in the SGA called InMemory Area (IM Column Store). This is an added memory area
in addition to the buffer cache and other SGA areas.
142
143
144
IM Setting INMEMORY
Create EMP and put it into the IM:
SQL> CREATE TABLE emp8
145
Check IM in USER_TABLES
SQL> alter table emp inmemory;
Table altered.
ENABLED
NONE
ORDER BY EMPNO;
EMPNO
---------7839
---------------------------------------------------------------------------| Id | Operation
|Name |
-----------------------------------------------------------------------------
| 0 | SELECT STATEMENT
| 1 | SORT AGGREGATE
| EMP |
--------------------------------------------------------------------------
147
A partitioned table automatically inherits whether or not the table is IM. You
can remove the D1 partition on the DEPT table from the IM immediately: 148
149
IM Priority Levels
Change the Priority Level: Objects are populated based on priority
or immediately if they are accessed. The priorities that you can set
are:
CRITICAL Populated upon database opening
HIGH Populated after CRITICAL if space exists in IM
MEDIUM After CRITICAL/HIGH if space exists in IM
LOW - After CRITICAL/HIGH/MEDIUM if space exists
NONE (default) Populated only when accessed for the first time
if space exists in IM
October 21, 2015
150
IM Priority Levels
Populate the EMP table upon database startup (when open):
ALTER TABLE emp INMEMORY PRIORITY CRITICAL;
Table altered.
151
152
Column1
Column1
Column 1
Column1
(Warehouse)
(Archive)
153
IM - Compression
Compression Level when populating the IM :
NO MEMCOMPRESS Populate IM without compressing
MEMCOMPRESS FOR DML Minimal compression for DML
MEMCOMPRESS FOR QUERY LOW Optimized for query (DEFAULT)
MEMCOMPRESS FOR QUERY HIGH Optimized for query but save more
space
MEMCOMPRESS FOR CAPACITY LOW Balanced with bias toward
saving space (+OZIP)
MEMCOMPRESS FOR CAPACITY HIGH Optimized for best space
savings (slowest)
Usually get 2-20x; Ive seen 50x+
October 21, 2015
154
ERROR at line 4:
ORA-64350: only one INMEMORY clause may be specified
October 21, 2015
155
Table created.
October 21, 2015
156
157
158
IM - Storage Indexes
IM Storage Indexes:
IM storage indexes are created and maintained on each
column in the IMCUs regardless of the compression.
Automatically created by Oracle (like Exadata).
They are used to prune the data by checking the
min/max values in each IMCU (In Memory Compression
Units)
To evaluate WHERE clause: equality/in-list/some range)
In Exadata, ORDERED data in the table matters a lot
will it also matter in IM not sure yet
October 21, 2015
159
160
Bloom Filters in IM
A Bloom Filter created based on join & applied to the second table as the
first table is loaded as a hash table into memory (PGA) - (note the
BF=Bloom Filter - below). In a multi-table join many Bloom Filters can be
created.
---------------------------------------------------------------------------------| Id | Operation
| Name |
----------------------------------------------------------------------------------
| 0 | SELECT STATEMENT
| 1 | SORT AGGREGATE
|* 2 | HASH JOIN
| 3|
| :BF0000 |
|* 4 |
| 5|
|* 6 |
October 21, 2015
| EMP
| :BF0000 |
| DEPT |
-----------------------------------------------------------------------------------
161
Type=Outlet
Amount
StoreID in
15, 38, 64
Store ID
Store ID
Type
Stores
Sum
October 21, 2015
162
IM with CDB/PDB
IMMEMORY_SIZE
(Shared by all PDBs)
Local
IM alloc
Local
IM alloc
Local
IM alloc
163
IM with CDB/PDB
All PDBs within a CDB share a single IM column store
INMEMORY_SIZE initialization parameter on the CDB
Each PDB also sets an INMEMORY_SIZE and anything put in IM
comes from total CDBs IM setting
All PDBs added together can be higher than CDBs IM size (oversubscribed); Memory is used on a first come basis by design to
ensure this CDB IM is not wasted
One PDB can take up entire CDB IM & starves others
Each PDB has its own PRIORITY list (which PDB starts first
will matter A LOT!). When out of space - you are out! until
PDB shut down or something removed.
October 21, 2015
164
IM Effects of DML
Consistency when DML occurs in Buffer Cache:
IM Transaction Manager will ensure IM is updated with
transactions as they occur
No logging needed in IM - Buffer Cache takes care of that.
Records are marked stale (when changed in the buffer cache) in
the IMCU (1M) of the IM and new record is inserted in the IM
Transaction Journal.
The original and new values are both present for transactional
consistency and are coordinated using SCNs (System Change
Numbers) as in the buffer cache (it may also get the value from
the buffer cache).
October 21, 2015
165
IM Effects of DML
Consistency when DML occurs in Buffer Cache:
The IM will be repopulated if a staleness threshold is reached by a
low priority background process (based on IMCU & amount of stale
rows).
INMEMORY_TRICKLE_REPOPULATE_SERVERS_PERCENT is max % of
time worker can participate in trickle repopulation (wakes up every
2 minutes). It can also be set to 0 to disable trickle repopulation.
Consistency costs depend on things like compression level, rate of
change, location of records, and type of operation.
Changes within the same IMCU are the least costly.
October 21, 2015
166
IM and RAC
RAC has multiple SGAs (on each node) and has multiple IMs
Can have different IM sizes (recommend they are the same)
Can have different IM data in different nodes
Large tables can span nodes
By default it DISTRIBUTES between the nodes.
Can have same data on every node in IM DUPLICATE but
ONLY on Engineered Systems (later example)
You can DISTRIBUTE (by rowid, partition, or subpartition):
ALTER TABLE emp INMEMORY DISTRIBUTE BY PARTITION;
October 21, 2015
167
IM and RAC
Distributing is especially good for partition-wise joins with
partitions/subpartitions
Single objects in a 1M IMCUs will be on only 1 node
If row is updated on different node cache fusion will be used to
update IM
Oracles RAC work from the past is beneficial
Space should be left in each IM in RAC to ensure if one of the
nodes goes down, the others will be able to populate INMEMORY
objects from the down node as they are accessed.
October 21, 2015
168
169
IM & RAC
Duplicate & Fault Tolerance
Duplicate in-memory
columns on one other
node (DUPLICATE ALL
will duplicate on all nodes)
Enabled per
table/partition
Application
transparent
Downtime eliminated by
using duplicate after failure
RAC
Thanks Oracle: Graphics
170
IM Hints
/*+ INMEMORY(table) */
/*+ NO_INMEMORY(table) */ (or NO INMEMORY??)
/*+ INMEMORY_PRUNING(table) */ (Control the use of the IM Storage Index)
/*+ NO_INMEMORY_PRUNING(table) */ (Control the use of the IM Storage Index)
/*+ PX_JOIN_FILTER(table) */ (force the use of a Bloom Filter for a join if optimizer
doesnt)
/*+ NO_PX_JOIN_FILTER(table) */ (force the NON-use of a Bloom Filter for a join if
optimizer doesnt)
/*+ VECTOR_TRANSFORM */ (force the use of the VECTOR GROUP BY - see
earlier section not in docs!)
October 21, 2015
171
172
IM Partition Exchange
174
INMEMORY_TRICKLE_REPOPULATE_SERVERS_PERCENT DEFAULT
175
176
DBMS_STATS.GATHER_TABLE_STATS run on a partitioned table when CONCURRENT is set to TRUE will gather
stats using multiple jobs concurrently
Online statistics gathered during a bulk load (similar to rebuild index command)
Flashback Data Archive (FDA) can be fully used on HCC tables on Exadata
Enterprise Manager Database Express 12c ships with every database (NICE!)
Spot ADDM triggered by high CPU or I/O into AWR Reports
October 21, 2015
Mask Data At Source for testing & Oracle Masking templates for E-Business
Oracle Data Redaction (prevents things like SSN from being displayed)
177
178
179
V$ Views
X$ Tables
23
? (35)
72
126
8.0
132
200
8.1
185
271
9.0
227
352
9.2
259
394
10gR1
340 (+31%)
543 (+38%)
10gR2
396
613
11gR1
484 (+42%)
798 (+46%)
11gR2
525 (+33%)
945 (+54%)
12cR1
606 (+25%)
1062 (+33%)
180
181
10 TB of user data
Requires 10 TB of IO
20 GB
with Storage Indexes
(Also IN IM)
1 TB
with compression
(Also in IM)
5 GB
with Smart Scans
(Also in Big Data Appliance)
100 GB
with partition pruning
Sub second
On Database
Machine
182
Exadata (X4-2)
(Oracles picture)
8 Compute Servers
14 Storage Servers
- 14x12=168 Disks
- 200T HP (1.2T) or
- 672T HC (4T)
InfiniBand Network
183
NEW X4-2
How they got these NUMBERS?
8 compute servers
184
185
(Oracles picture)
*** If on 11.2.3.3+ Does not require Database/ASM186
/
Cluster upgrade
187
Half
Quarter Eighth
Memory/DRAM
4T
2T
1T
1T
Servers/cores
Servers/disks**
8/288
14/168
4/144
7/84
2/72
3/36
2/36
3/18
Flash Memory
44.8T
22.4T
9.6T
4.8T
90T
336T
2,072,000
2
10T/hr*
38.4T 19.2T
144T 72T
1,036,000 518K
2
2
5T/hr* 2.5T/hr
179T
SAS (High Capacity) 672T
Flash IOPs*
4,144,000
InfiniBand Switches 2
Data Load Rates 20T/hr*
EF (Extreme Flash)
* Estimate (Reads of 8K blocks Writes are the same for Flash and around for disk
** 4T High Capacity SAS or 1.6T NVMe PCI Flash Drives; X5-2, X4-2, X3-2 has 1/8 Rack, the X2-2 does not!
October 21, 2015
188
189
190
191
Exadata Simulation
192
193
194
195
Big Data
Rich Niemiec
196
No Search
Few using the Internet
No Amazon, Facebook, Twitter
197
198
199
200
Whats Next
201
64-Bit advancement of
Address Direct
16
256
65,536
4,294,967,296
18,446,744,073,709,551,616
Indirect/Extended
(640)
(65,536)
(1,048,576)
202
Memory
8 bit
16-bit
32-bit
64-bit
203
16 Bit
(65,536 bytes)
What if directly
addressable
memory was
pennies?
In comparison, Mt.
Everest at 29,000 feet
is only 1,700 feet
taller
4 Bit
(16 bytes)
1 exa-penny
(1,000,067,088,384,000
,000 pennies) would
form a 27,300 square
foot cube
8 Bit
(256 bytes)
204
32 Bit
(4,294,967,296 bytes)
205
1 Exabyte:
Not quite 64-bit
1 exa-penny
(1,000,067,088,384,0
00,000 pennies)
would form a 27,300
square foot cube
In comparison, Mt.
Everest at 29,000
feet is only 1,700 feet
taller
October 21, 2015
206
64 Bit
(18,446,744,073,709,551,616 bytes)
Mount Everest
16 exa-pennies would
easily dwarf even Mt.
Everest!
207
208
Increase (Result)
1 mph (Windows)
65K mph (Internet)
300T mph (Robotics/3Detc.)
5T*T*B mph
209
How Big?
210
Indirect/Extended
4 Bit:
16
(640)
8 Bit:
256
(65,536)
16 Bit:
65,536
(1,048,576)
32 Bit:
4,294,967,296
64 Bit:
18,446,744,073,709,551,616
126 Bit:
Qubits allow multiple states so that you can look at all of the possibilities/probabilities at one time.
The Quantum Zone next (Quantum Physics is incomplete Einstein)
Just 512 qubits would store 512-bits332of addressable memory or 2512 (which is well over a googol or 1 with 100
zeros after it a googol is about 2 ).
Brush up on your Eigenvectors, Eigenvalues, Pauli Matrices & Grovers Algorithm
Create Singularity all atoms of a person by 2045 (I think earlier); 12-Monkeys
Private universes Is there one for each person? (Schroeders cat I think not)
Rearranging atoms to create new objects; Nanotech + Quantum Physics coming!
211
212
Email
Telephone / Cell Phone
Cars / Planes
Plastics
Digital Pictures
Smartphone/Tablet
USB
Wikipedia
213
Instagram
Implant
Virtual Conferences
3D printed in the home
Google Glass Life Record
IOT
Cloud
Implants / Robotics
214
Implant Communication
Implant
Implant
Virtual Reality / Bio printed
Implant Recorder
IOT/Implant connection
Better
Faster Cloud
215
216
217
218
219
220
221
222
223
224
225
Current DBA
Current Developers
Junior Developer
226
Future DBA?
227
ORFuture DBA!
(My bets on this one)
228
229
230
231
232
Monday:
The Best 12c Database Features 10:30 - 11:00 AM Rolta Booth #1701
Enter to Win an iPad Air
Rolta Booth #1701
Tuesday:
Innovation, Big Data & IOT Brief 3:15 3:35 PM Rolta Booth #1701
Enter to Win an iPad Air
Rolta Booth #1701
Wednesday:
All Booth Presentations at Rolta Booth # 1701 in Moscone South Vendor Hall
234
Great Sales/Marketing
Great Database
Applications Leader
BI Leader /
Already in the lead
Game Over!
Hardware/Software Engineering!
235
236
237
238
Database References
Oracle 12c Beta Documentation & Beta Database
Oracle11g Performance Tuning Tips & Techniques; Richard J. Niemiec; Oracle Press
www.tusc.com. www.rolta.com
Database Secure Configuration Initiative: Enhancements with Oracle Database 11g,
www.oracle.com
All Oracle11g Documentation from Oracle Beta Site
Introduction to Oracle Database 11g, Ken Jacobs
Oracle Database 11g New Features, Linda Smith
New Optimizer Features in 11g, Maria Colgan
www.ioug.org, www.oracle.com, en.wikipedia.org & technet.oracle.com
Thanks Dan M., Bob T., Brad, Joe, Heidi, Mike K., Debbie, Maria, Linda
All companies and product names are trademarks or registered trademarks of the respective
owners
October 21, 2015
239
Exadata References
Exadata V2 Sun Oracle DB Machine, Oracle
Oracle Exadata Implementation Workshop, Oracle Corporation, McLean, Virginia - Multiple
Exadata sessions
Oracle Learning Library multiple sessions/topics
Oracle 11g R1/R2 Best Features, Rich Niemiec
Oracle Enterprise Manager Deployment and High Availability Best Practices, Jim Viscusi
(Oracle Corporation), Jim Bulloch (Oracle Corporation), Steve Colebrook-Taylor (Barclays
Global Investors)
Oracle11g Performance Tuning Tips & Techniques, Rich Niemiec, Oracle Press McGraw-Hill
Advanced Compression with Oracle Database 11g Release 2, Oracle Corporation, Steven Lu
Tech Crunch
Twilight Zone Series
Rod Serling; Submitted for Your Approval, American Masters
YouTube/oracle Oracle OpenWorld On Demand
October 21, 2015
240
241
Oracle9i Tuning (May 2003)
Oracle10g Tuning (June 2007)
Oracle11g Tuning (Jan 2014)
242
V$ View Poster
243
244