Oracle Database 12c
(12.1.0.1)
New Features
Who AM I?
Navneet Upneja (Oracle DBA)
7 Years of Experience in Oracle Databases and
Middleware Applications Oracle Certified Professional
Hand on experience on OLTP, Datawarehouse,
Oracle BI, APEX…
Member of North India Chapter.
Overview
• Optimizer Statistics
• DDL Logging
• Invisible Columns
• Multiple Indexes
• Nologging – Data Pump
• Limit on PGA
• Moving Datafile Online
• Global Temporary Undo
• Duplicate Database Enhancement
• Table Level Recovery using RMAN
• Q&A
Optimizer Statistics
Online Statistics Gathering Prior to 12c, only Index creation use to gather statistics during creation.
With 12c, Statistics are being gathered for objects created using Direct
Path operations like CTAS and Insert as select operations.
This will save extra Full Data scan required to gather statistics
immediately after creating a new object.
Will be useful in ETL Jobs.
Histograms are not generated by the online statistics gathering Job
since it require additional data scans and can impact the overall time
require to create the object or perform batch Insert operation.
Contd.
Statistics for GTT’s
GTT shares its definition with system wide users
Content in GTT is private to particular session.
Pre 12c, statistics gathered on GTT’s were published system wide. In 12c, statistics on GTT’s can be kept private to the session collecting
the stats.
Useful in cases, where volume of data varies greatly across sessions.
Controlled with GLOBAL_TEMP_TABLE_STATS preference of DBMS_STATS
By default, preference is set to Session {SHARED}
DBMS_STATS.SET_TABLE_PREFS('NUPNEJA','TEMP_GT','GLOBAL_TEMP_TABLE_STATS','SHARED');
SELECT dbms_stats.get_prefs('GLOBAL_TEMP_TABLE_STATS','NUPNEJA','TEMP_GT')
FROM DUAL;
Invisible Column
• Starting from 12c, one can add column to a table and make It as invisible.
• Can be used as low level security for a column.
• Different from system generated hidden columns
• Would not be shown up in result of select if not explicitly defined in Select
list of columns.
• Describe command will not show invisible column as part of table definition.
• Cannot create invisible column in
– External Tables
– Cluster Tables
– Temporary Tables
Contd.
Multiple Indexes on same column
• Now, you can multiple Indexes on same column or same set of columns as long as some characteristics of Index/Indexes are
different. • Unique and non Unique
• B*Tree and Bitmap
• Partitioning Strategies like Local and Global.
• One of the Index needs to be Invisible.
Can be used if
optimizer_use_invisible_indexes
set to True. Need to change the Index Type in
production on a big table.
Doing Troubleshooting for performance.
Need to change the Primary
key/Unique Key Index..
Do we need
this?
Contd.
DDL Logging
• In 12c, we can log the DDL statements running in a session or at system
level.
• Controlled by parameter “ENABLE_DDL_LOGGING” • Can be set at Session level as well.
• DDL log is stored in the log/ddl subdirectory of the ADR home.
• DDL log contains one log record for each DDL statement issued by the database/session.
• Two types of log files: XML and Text File.
• Can be useful to diagnose all the DDL’s running in a big package/program. • Can be useful in troubleshooting any application program.
Contd.
Contd.
Temporary Undo
• By default, undo records for temporary tables are stored in the undo
tablespace and are logged in the redo.
• 12c introduces new concept of Temporary Undo: Undo generated by
transactions on temporary tables managed inside temporary undo
segments.
• Reduces amount of undo stored in undo tablespace.
• Inturn, reduces amount of redo generated.
• Managed using TEMP_UNDO_ENABLED parameter.
• Can be set at session level or system level.
• Default value is “FALSE”. • Temp Undo statistics can be monitored through “V$TEMPUNDOSTAT”.
Limit on PGA
• The Program Global Area (PGA) is a private memory region that contains
the data and control information for a server process.
• PGA_AGGREGATE_TARGET: Target aggregate PGA memory available to
all server processes attached to the instance.
Is it a hard limit?
Shocked????
PGA_AGGREGATE_LIMIT
• PGA_AGGREGATE_TARGET setting acts as a target, and not a
limit.
• PGA_AGGREGATE_LIMIT initialization parameter enables you to specify a hard limit on PGA memory.
• Oracle Database aborts or terminates the sessions or processes that are consuming the most untunable PGA memory
– Calls for sessions that are consuming the most untunable PGA memory are
aborted.
– If PGA memory usage is still over the PGA_AGGREGATE_LIMIT, then the
sessions and processes that are consuming the most untunable PGA memory
are terminated.
Contd.
Recover Table using RMAN
TSPITR DBPITR
Pre Oracle 12 Way
Recylebin Flashback
Oracle 12c way
• RMAN enables you to recover one or more tables or table partitions to a
specified point in time without affecting the remaining database objects.
• Is a mix bag of already available techniques for recovery but with
automation added to it.
• Need to have backup available which contains the missing table/tables.
• Make use of Duplicate database concept and created an auxiliary instance
to recover the table.
• Make use of Data pump to export the table from auxiliary instance and
import into target database.
• Auxiliary Instance is removed after the table is recovered.
Contd.
Contd.
Additional Clauses
• DUMP FILE and DATAPUMP DESTINATION
• NOTABLEIMPORT
• REMAP TABLE
• REMAP TABLESPACE
Duplicate Enhancements
• With Introduction of Multitenant database architecture in Oracle 12c, there
has been more options added to duplicate database command as well.
• Duplicate CDB’s
• Duplicate PDB’s
• Duplicate with Noopen.
Moving Datafile Online
• Starting with Oracle 12c, we can move the datafile while it is online.
• ALTER DATABASE MOVE DATAFILE SQL statement to rename or relocate online data files.
• Enables you to rename or relocate a data file while the database is open
and users are accessing the data file.
• If a file with the same name already exists in the destination location, the
existing file is not overwritten, and the statement returns an error.
• Keep option to retain the original file as well.
• Datafile must be online to perform this.
• You cannot move datafile of a pluggable database from container database.
Contd.