More Related Content
Similar to Oracle Database 12.1.0.2: New Features
Similar to Oracle Database 12.1.0.2: New Features (20)
More from Deiby Gómez (9)
Oracle Database 12.1.0.2: New Features
- 1. Oracle Database 12.1.0.2: New Features
Prepared by:
Deiby Gómez
Oracle Certified Master 11g
Pythian Oracle Database Consultant
- 3. © 2014 Pythian Confidential3
ADVANCED INDEX COMPRESSION
CREATE INDEX (…) ON (…) COMPRESS ADVANCED LOW;
NO COMPRESSION
dgomez, Guatemala, 1
Jose, Canada, 1
Lucky, Mexico, 2
dgomez, Guatemala, 2
dgomez, guatemala, 3
WITH COMPRESSION
$$, 1
Jose, Canada, 1
Lucky, Mexico, 2
$$, 2
$$, 3
Prefix: $$
Compression
Performance
It’s good with so many repeated values
- 4. © 2014 Pythian Confidential4
ADVANCED INDEX COMPRESSION
kdxlepnro 3 <--How many prefixes exist
kdxlepnco 1 (Adaptive) <--How many columns are being compressed
prefix row#0[8023] flag: -P-----, lock: 0, len=9
col 0; len 6; (6): 43 61 6e 61 64 61 <--'Canada'
prc 1
prefix row#1[8003] flag: -P-----, lock: 0, len=11
col 0; len 8; (8): 43 6f 6c 6f 6d 62 69 61 <--'Colombia'
prc 1
prefix row#2[7982] flag: -P-----, lock: 0, len=12
col 0; len 9; (9): 47 75 61 74 65 6d 61 6c 61 <-- 'Guatemala'
prc 1
row#0[8014] flag: -------, lock: 0, len=9
col 0; len 6; (6): 01 80 00 dd 00 01 <-- Sufix
psno 0 <--Prefix #0
row#1[7994] flag: -------, lock: 0, len=9
col 0; len 6; (6): 01 80 00 dd 00 02 <-- Sufix
psno 1 <--Prefix#1
row#2[7973] flag: -------, lock: 0, len=9
col 0; len 6; (6): 01 80 00 dd 00 00 <-- Sufix
psno 2 <--Prefix #2
----- end of leaf block Logical dump -----
----- end of leaf block dump -----
- 5. © 2014 Pythian Confidential5
ADVANCED INDEX COMPRESSION
CREATE INDEX my_test_idx ON test(a, b)
COMPRESS ADVANCED HIGH LOCAL
(PARTITION p1 COMPRESS ADVANCED LOW,
PARTITION p2 COMPRESS,
PARTITION p3,
PARTITION p4 NOCOMPRESS);
- 6. © 2014 Pythian Confidential6
ADVANCED INDEX COMPRESSION
How does it work? At the block level in the following situations:
• During index creation when a leaf block becomes full
• When reorganizing an index block as a result of DML (block split may
not occur)
Restrictions:
• It’s not supported for bitmap indexes or index-organized tables.
• It cannot be specified on a single column unique index. WHY?
- 7. © 2014 Pythian Confidential7
APPROXIMATE COUNT DISTINCT
COUNT(DISTINCT expression)
Cost
- 8. © 2014 Pythian Confidential8
APPROXIMATE COUNT DISTINCT
SQL> select APPROX_COUNT_DISTINCT(col1) aprox_col1 from dgomez.t1
APROX_COL1
----------
92611
------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost(%CPU)| Time |
------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | 13 | 137 (1) |00:00:01|
| 1 | SORT AGGREGATE APPROX| | 1 | 13 | | |
| 2 | TABLE ACCESS FULL | T1 | 249K | 3166K | 137 (1) |00:00:01|
------------------------------------------------------------------------
- 9. © 2014 Pythian Confidential9
ATTRIBUTE CLUSTERING
“An attribute-clustered table stores data in close
proximity on disk in an ordered way based on the
values of a certain set of columns in the table or a set of
columns in the other tables.”
- 10. © 2014 Pythian Confidential10
ATTRIBUTE CLUSTERING
Types of Attribute Clustering
• Attribute Clustering with Linear Ordering
• Attribute Clustering with Interleaved Ordering
When occurs?
• Direct-path insert operations - Set the ON LOAD option to YES
• Data movement operations - Set the ON DATA MOVEMENT
option to YES
o online table redefinition
o partition operations:
MOVE
MERGE
SPLIT
COALESCE
- 12. © 2014 Pythian Confidential12
ATTRIBUTE CLUSTERING - ADVANTAGES
• Eliminates storage costs associated with using indexes
• Enables the accessing of clustered regions rather than performing random
I/O or full table scans when used in conjunction with zone maps
• Provides I/O reduction when used in conjunction with any of the following:
• Oracle Exadata Storage Indexes
• Oracle In-memory min/max pruning
• Zone maps
• Enables clustering of fact tables based on dimension columns in star
schemas
• Improves data compression ratios and in this way indirectly improves table
scan costs
• Minimizes table lookup and single block I/O operations for index range scan
operations when the attribute clustering is on the index selection criteria.
- 13. © 2014 Pythian Confidential13
AUTOMATIC BIG TABLE CACHING
• Big table cache is used for caching data for table scans.
• Automatic big table caching uses temperature and object based
algorithms to track medium and big tables.
How to enable it?
• DB_BIG_TABLE_CACHE_PERCENT_TARGET
o percentage [0%,90%]
o 10% of cache for No table scans
• PARALLEL_DEGREE_POLICY =AUTO | ADAPTIVE (RAC)
- 14. © 2014 Pythian Confidential14
AUTOMATIC BIG TABLE CACHING
If a large table is approximately the size of the combined size of the big table
cache of all instances, then the table is partitioned and cached, or mostly
cached, on all instances.
Where to check information about big table caching?
• V$BT_SCAN_CACHE
• V$BT_SCAN_OBJ_TEMPS
- 15. © 2014 Pythian Confidential15
FDA SUPPORT FOR CDBS
In Release 12.1.0.1, Flashback Database Archive
was not supported for multitenant container
databases (CDBs).
In Release 12.1.0.1, Flashback Database Archive
(FDA) is supported for CDBs
- 16. © 2014 Pythian Confidential16
FULL DATABASE CACHING
DB size > Buffer Cache
Little tables:
• Allocated in memory If the table size < 2% of the Buffer Cache size
Medium tables:
• Allocated in memory if table size [2%,10%] of Buffer Cache size (No
official information)
• Oracle analyze the date when the table was used last time
• Free space in Buffer Cache
• Etc
Big Tables
• Big tables are not allocated in Buffer Cache
• Use "KEEP” to advice Oracle to allocate a big table in Buffer Cache
- 17. © 2014 Pythian Confidential17
FULL DATABASE CACHING
Buffer Cache > DB size
Little tables:
• Allocated in memory If the table size < 2% of the Buffer Cache size
Medium tables:
• Allocated in memory if table size [2%,10%] of Buffer Cache size (No
official information)
• Oracle analyze the date when the table was used last time
• Free space in Buffer Cache
• Etc
Big Tables
• Big tables are not allocated in Buffer Cache
• Use "KEEP” to advice Oracle to allocate a big table in Buffer Cache
- 18. © 2014 Pythian Confidential18
FULL DATABASE CACHING
Buffer Cache > DB size
• Tables are not allocated in Buffer Cache immediately
• Buffer Cache must be bigger than DB (Oracle doesn’t verify this)
Is Full Database Caching enabled?
SQL> SELECT FORCE_FULL_DB_CACHING FROM V$DATABASE;
FORCE_FULL_DB_CACHING
---------------------
YES
- 19. © 2014 Pythian Confidential19
FULL DATABASE CACHING
Buffer Cache > DB size
What about if I enable it but Buffer Cache !> DB Size?
• Algorithms to allocate small, medium and large tables are not used.
• More Objects Deallocation
• New object scanned, blocks deallocated.
- 20. © 2014 Pythian Confidential20
FULL DATABASE CACHING
How to enabled it?
SQL> shutdown immediate;
SQL> startup mount;
SQL> ALTER DATABASE FORCE FULL DATABASE CACHING;
SQL> alter database open;
How to disable it?
SQL> shutdown immediate;.
SQL> startup ;
SQL> ALTER DATABASE NO FORCE FULL DATABASE
CACHING;
SQL> alter database open;
- 21. © 2014 Pythian Confidential21
IN-MEMORY COLUMN STORE
“A DBA simply has to allocate memory to In-Memory
Column Store. The optimizer is aware of In-Memory
Column Store, so whenever a query accesses objects that
reside in the column store, Optimizer takes advantage of
that.”
- 22. © 2014 Pythian Confidential22
IN-MEMORY COLUMN STORE
How to enable it?
The INMEMORY_SIZE initialization parameter must be set to a non-zero value.
-Minimum 100M.-
IM column store can be enabled at any of the following levels:
• Column
• Table
• Materialized view
• Tablespace
• Partition
- 23. © 2014 Pythian Confidential23
IN-MEMORY COLUMN STORE
Advantages:
• A query that uses operators such as the following: =, <, >, and IN
• A query that selects a small number of columns from a table or materialized
view with a large number of columns
• A query that joins a small table to a large table
INMEMORY PRIORITY Subclause
• PRIORITY NONE
• PRIORITY LOW
• PRIORITY MEDIUM
• PRIORITY HIGH
• PRIORITY CRITICAL
- 25. © 2014 Pythian Confidential25
JSON SUPPORT
“You can access JSON data stored in the database the same
way you access other database data”
“Unlike XML data, which is stored using SQL data type
XMLType, JSON data is stored in Oracle Database using SQL
data types VARCHAR2, CLOB, and BLOB”
- 26. © 2014 Pythian Confidential26
NEW FIPS 140 PARAMETER FOR
ENCRYPTION
How to enable it?
ALTER SYSTEM SET DBFIPS_140 = TRUE;
shutdown immediate;
startup;
“FIPS 140-2 Security Requirements for Cryptographic Modules is a U.S.
government standard for implementation of cryptographic modules that
encrypt and decrypt data or perform other cryptographic operations (such
as creating or verifying digital signatures)”
**sqlnet.ora
- 27. © 2014 Pythian Confidential27
PDB CONTAINERS CLAUSE
SELECT ename
FROM CONTAINERS(scott.emp)
WHERE CON_ID IN (11, 13);
- 28. © 2014 Pythian Confidential28
PDB CONTAINERS CLAUSE
The tables and views, or synonyms of them, specified in the
CONTAINERS clause must exist in the root and in all PDBs.
Each table and view specified in the CONTAINERS clause must
be owned by the common user.
When a synonym is specified in the CONTAINERS clause, the
synonym must resolve to a table or a view owned by the
common user issuing the statement.
- 29. © 2014 Pythian Confidential29
PDB FILE PLACEMENT IN OMF
• FILE_NAME_CONVERT clause of CREATE PLUGGABLE DATABASE
• CREATE_FILE_DEST clause of CREATE PLUGGABLE DATABASE
• DB_CREATE_FILE_DEST (root level)
• PDB_FILE_NAME_CONVERT initialization parameter
- 30. © 2014 Pythian Confidential30
PDB LOGGING CLAUSE
• Table Level – Logging
• Index Level – Logging
• Tablespace Level – Logging
• Tablespace Level - Force Logging
• PDB Level – Logging
• PDB Level - Force No logging
• CDB - Force Logging
- 31. © 2014 Pythian Confidential31
PDB LOGGING CLAUSE
SQL> alter session set container=pdb1;
SQL> startup restrict;
SQL> alter pluggable database pdb1 nologging;
SQL> alter pluggable database pdb1 logging;
SQL> select pdb_name, logging, force_logging,
force_nologging from cdb_pdbs;
PDB_NAME LOGGING FORCE_LOGGING
FORCE_NOLOGGING
---------- --------- --------------- --------------
-
PDB1 LOGGING NO NO
- 32. © 2014 Pythian Confidential32
PDB METADATA CLONE
NO DATA clause of the CREATE PLUGGABLE DATABASE
“This clause is useful for quickly creating clones of a PDB
with only the object definitions and no data.”
- 33. © 2014 Pythian Confidential33
PDB REMOTE CLONE
IN SOURCE DB:
**alter pluggable database pdbsource open read only;
create user C##dgomez identified by manager1;
grant create session to C##dgomez;
- 34. © 2014 Pythian Confidential34
PDB REMOTE CLONE
IN TARGET DB:
create user C##dgomez identified by manager1;
grant create session, create database link, create pluggable
database to C##dgomez;
PDBSOURCE =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = db12102.oraworld.com)(PORT =
1521))
(CONNECT_DATA =
(SERVER = DEDICATED)(SERVICE_NAME = pdbsource)
))
create database link dblinktosource connect to C##dgomez identified
by manager1 using 'PDBSOURCE';
create pluggable database pdbtarget3 from pdbsource@dblinktosource;
- 35. © 2014 Pythian Confidential35
PDB REMOTE CLONE
Target: 12.1.0.2
Source: 12.1.0.1
SQL> create pluggable database pdbtarget from
pdbsource@dblinktosource;
*
ERROR at line 1:
ORA-17627: ORA-00600: internal error code, arguments:
[ksrpcsexec_1], [158],
[20], [], [], [], [], [], [], [], [], []
ORA-17627: ORA-00600: internal error code, arguments:
[ksrpcsexec_1], [158],
[20], [], [], [], [], [], [], [], [], []
- 36. © 2014 Pythian Confidential36
PDB REMOTE CLONE
Target: 12.1.0.1
Source: 12.1.0.1
SQL> create pluggable database pdbtarget from
sourcepdb@dblinktosource
*
ERROR at line 1:
ORA-17628: Oracle error 19505 returned by remote Oracle server
ORA-19505: failed to identify file ""
- 37. © 2014 Pythian Confidential37
PDB REMOTE CLONE
Target: 12.1.0.2
Source: 12.1.0.2
SQL> create pluggable database pdbtarget from
pdbsource@dblinktosource;
Pluggable database created.
- 38. © 2014 Pythian Confidential38
PDB STANDBYS CLAUSE
PDB1
PDB2
PDB3
PDB1
PDB2
PDB3
Primary Standby
• Datafiles Offline
• Unnamed
- 39. © 2014 Pythian Confidential39
PDB STANDBYS CLAUSE
“The STANDBYS clause of the CREATE PLUGGABLE DATABASE
statement specifies whether the new PDB is included in standby CDBs”
STANDBYS=ALL includes the new PDB in all of the standby CDBs
.
STANDBYS=NONE excludes the new PDB from all of the standby
CDBs.
- 40. © 2014 Pythian Confidential40
PDB STANDBYS CLAUSE
“It is possible to enable a PDB on a standby CDB after it was
excluded on that standby CDB.”
PDB data files need to be copied to the standby database from the
primary database
The control file needs to be updated to reflect their paths
Execute ALTER PLUGGABLE DATABASE ENABLE RECOVERY
It automatically onlines all of the data files belonging to the PDB.
- 41. © 2014 Pythian Confidential41
PDB STATE MANAGEMENT ACROSS CDB
RESTART
Source: "Oracle Database 12c: New Features for Administrators” by Oracle University
12.1.0.1
- 42. © 2014 Pythian Confidential42
PDB STATE MANAGEMENT ACROSS CDB
RESTART
1. Set the PDB at the State you want to save.
1. SQL> alter pluggable database pdb1 save state;
Pluggable database altered.
or
SQL> alter pluggable database pdb1 discard state;
Pluggable database altered.
12.1.0.2
- 43. © 2014 Pythian Confidential43
PDB STATE MANAGEMENT ACROSS CDB
RESTART
SQL> ALTER PLUGGABLE DATABASE ALL EXCEPT PDB1 SAVE STATE;
Pluggable database altered.
SQL> ALTER PLUGGABLE DATABASE ALL SAVE STATE;
Pluggable database altered.
12.1.0.2
- 44. © 2014 Pythian Confidential44
PDB SUBSET CLONING
“The USER_TABLESPACES clause of the CREATE PLUGGABLE
DATABASE statement specifies which tablespaces are available in the new
PDB”
o List one or more tablespaces to include.
o Specify ALL, the default, to include all of the tablespaces.
o Specify ALL EXCEPT to include all of the tablespaces, except for
the tablespaces listed.
o Specify NONE to exclude all of the tablespaces.
- 45. Database Source
© 2014 Pythian Confidential45
PDB SUBSET CLONING
Tablespace 1
Tablespace 2
Tablespace 3
PDB 1
Tablespace 1
PDB 2
Tablespace 2
PDB 3
Tablespace 3
- 46. © 2014 Pythian Confidential46
REFERENCES
Una Introducción a "Oracle Advanced Index Compression"
http://www.toadworld.com/platforms/oracle/b/weblog/archive/2015/04/28/una-introducci-
243-n-a-advanced-index-compression
Oracle 12.1.0.2 y la función APPROX_COUNT_DISTINCT
http://www.toadworld.com/platforms/oracle/b/weblog/archive/2015/07/29/oracle-12-1-0-2-
y-la-funci-n-approx-count-distinct
Logging Levels in Oracle 12c
http://www.toadworld.com/platforms/oracle/b/weblog/archive/2015/08/01/logging-levels-
in-oracle-12c
Cómo clonar una PDB desde un CDB remoto
http://www.toadworld.com/platforms/oracle/b/weblog/archive/2015/05/13/c-243-mo-
clonar-una-pdb-desde-un-cdb-remoto
Cómo hacer persistente el estado de una PDB
http://www.toadworld.com/platforms/oracle/b/weblog/archive/2015/04/30/c-243-mo-
hacer-persistente-el-estado-de-una-pdb
Oracle Documentation 12.1.0.2
http://docs.oracle.com/database/121/NEWFT/chapter12102.htm#NEWFT003
- 47. © 2014 Pythian Confidential47
Questions?
Twitter: @hdeiby
Facebook: /HDeiby
Email: gomez@pythian.com
Blog: www.oraclefromguatemala.com.gt
Thanks for coming!