Download - Oracle Database 12c R1/R2 New Features for 11g DBA (and ... · Oracle Database 12c R1/R2 New Features for 11g DBA (and Developer)! @biju_thomas Biju Thomas ... READ Privilege (12.1.0.2)

Transcript
Page 1: Oracle Database 12c R1/R2 New Features for 11g DBA (and ... · Oracle Database 12c R1/R2 New Features for 11g DBA (and Developer)! @biju_thomas Biju Thomas ... READ Privilege (12.1.0.2)

Oracle Database 12c R1/R2 New Features for 11g DBA(and Developer)!

@biju_thomas

Biju Thomas

Principal Solutions ArchitectOneNeck IT Solutionswww.OneNeck.com

Page 2: Oracle Database 12c R1/R2 New Features for 11g DBA (and ... · Oracle Database 12c R1/R2 New Features for 11g DBA (and Developer)! @biju_thomas Biju Thomas ... READ Privilege (12.1.0.2)

OneNeck IT Solutions at a Glance• Backed by Fortune 500 strength of Telephone and Data Systems

• Hybrid IT

• Nearly 550 employees

• 8 data centers in 6 states, Coast-to-coast presence

2

Page 3: Oracle Database 12c R1/R2 New Features for 11g DBA (and ... · Oracle Database 12c R1/R2 New Features for 11g DBA (and Developer)! @biju_thomas Biju Thomas ... READ Privilege (12.1.0.2)

About me!

Biju Thomas

3

Principal Solutions Architect with OneNeck IT Solutions Over 20 years of Oracle Database development and administration expertise Over 10 years of Oracle E-Business Suite Architecture & Tuning expertise First book published in September 2000, seventh in 2015 DBA Website since 1997 – www.bijoos.com Oracle ACE Director

Page 4: Oracle Database 12c R1/R2 New Features for 11g DBA (and ... · Oracle Database 12c R1/R2 New Features for 11g DBA (and Developer)! @biju_thomas Biju Thomas ... READ Privilege (12.1.0.2)

©2014 OneNeck IT Solutions LLC. All rights reserved. All other trademarks are the property of their respective owners.4 ©2014 TDS Hosted & Managed Services, LLC. All rights reserved. All other trademarks are the property of their respective owners.

Learn features of Oracle Database 12c that are not top, but

would help you!

As a 11g DBA/Developer, what you should know when working

with 12c R1 or R2 database (changed behavior or additional

functionality).

Many features at a high level – once you know what to look for,

“googling” always works! (have <90 seconds for each feature)

Session Objectives

Page 5: Oracle Database 12c R1/R2 New Features for 11g DBA (and ... · Oracle Database 12c R1/R2 New Features for 11g DBA (and Developer)! @biju_thomas Biju Thomas ... READ Privilege (12.1.0.2)

Database 12.2 Features(Cloud Only)

Page 6: Oracle Database 12c R1/R2 New Features for 11g DBA (and ... · Oracle Database 12c R1/R2 New Features for 11g DBA (and Developer)! @biju_thomas Biju Thomas ... READ Privilege (12.1.0.2)

©2014 OneNeck IT Solutions LLC. All rights reserved. All other trademarks are the property of their respective owners.6 ©2014 TDS Hosted & Managed Services, LLC. All rights reserved. All other trademarks are the property of their respective owners.

Automatic Password Propagation to Standby: Changing SYS password

Versions 12.1 and earlier Change password in primary

Copy password file from primary to standby sites

Version 12.2 Change password in primary

Automatically synched to all standby sites

One less thing to worry about!

Data Guard Password Sync 12.2

Page 7: Oracle Database 12c R1/R2 New Features for 11g DBA (and ... · Oracle Database 12c R1/R2 New Features for 11g DBA (and Developer)! @biju_thomas Biju Thomas ... READ Privilege (12.1.0.2)

©2014 OneNeck IT Solutions LLC. All rights reserved. All other trademarks are the property of their respective owners.7 ©2014 TDS Hosted & Managed Services, LLC. All rights reserved. All other trademarks are the property of their respective owners.

A partition or sub-partition can be marked as READ ONLY at the time of creation (CREATE TABLE) or later (ALTER TABLE).

Specify key word READ ONLY.

READ WRITE is the default.

Example 1: (xxt is partitioned table)

ALTER TABLE xxt READ ONLY;

All current and future created partitions will be read only.

Example 2:

ALTER TABLE xxt MODIFY PARTITION xxt_p4 READ WRITE;

All partitions except xxt_p4 are read only.

Read Only Partitions 12.2

Page 8: Oracle Database 12c R1/R2 New Features for 11g DBA (and ... · Oracle Database 12c R1/R2 New Features for 11g DBA (and Developer)! @biju_thomas Biju Thomas ... READ Privilege (12.1.0.2)

©2014 OneNeck IT Solutions LLC. All rights reserved. All other trademarks are the property of their respective owners.8 ©2014 TDS Hosted & Managed Services, LLC. All rights reserved. All other trademarks are the property of their respective owners.

In 12.1 and earlier, create the partitions and specify the values that fall in each partition. DEFAULT partition is used to catch all (similar to MAXVALUE in range).

New AUTOMATIC keyword in list partition. Oracle automatically creates a new partition for each distinct value in the partition column.

CREATE TABLE ab1 (s1 varchar2(2), d1 varchar2 (20))

PARTITION BY LIST (s1)

AUTOMATIC (PARTITION p_az VALUES ('AZ'));

ALTER TABLE xyz SET AUTOMATIC;

Notes An automatic list-partitioned table must have at least one partition when created.

Cannot have a DEFAULT partition.

Not supported at the sub-partition level.

Automatic List Partitions 12.2

Page 9: Oracle Database 12c R1/R2 New Features for 11g DBA (and ... · Oracle Database 12c R1/R2 New Features for 11g DBA (and Developer)! @biju_thomas Biju Thomas ... READ Privilege (12.1.0.2)

©2014 OneNeck IT Solutions LLC. All rights reserved. All other trademarks are the property of their respective owners.9 ©2014 TDS Hosted & Managed Services, LLC. All rights reserved. All other trademarks are the property of their respective owners.

Modify a non-partitioned table to partitioned table, online!

alter table allsyn modify

partition by list (owner)

AUTOMATIC (partition p_sys values ('SYS')) ONLINE;

alter table allsyn modify

partition by list (owner)

AUTOMATIC (partition p_sys values ('SYS'))

update indexes (allsyn_I1 LOCAL) ONLINE;

In versions prior to 12.2, this activity required DBMS_REDEFINITION.

Convert to Partitioned Table Online! 12.2

Page 10: Oracle Database 12c R1/R2 New Features for 11g DBA (and ... · Oracle Database 12c R1/R2 New Features for 11g DBA (and Developer)! @biju_thomas Biju Thomas ... READ Privilege (12.1.0.2)

©2014 OneNeck IT Solutions LLC. All rights reserved. All other trademarks are the property of their respective owners.10 ©2014 TDS Hosted & Managed Services, LLC. All rights reserved. All other trademarks are the property of their respective owners.

SQL*Plus command history available.

SET HIST[ORY] ON

SQL*Plus Notables 12.2

SET FEEDBACK ONLY

Returns just the number of rows returned by the query without displaying the query result.

SET MARKUP CSV

SET MARKUP command supports the display of data in CSV format. Produce output in HTML or CSV format.

Page 11: Oracle Database 12c R1/R2 New Features for 11g DBA (and ... · Oracle Database 12c R1/R2 New Features for 11g DBA (and Developer)! @biju_thomas Biju Thomas ... READ Privilege (12.1.0.2)

©2014 OneNeck IT Solutions LLC. All rights reserved. All other trademarks are the property of their respective owners.11 ©2014 TDS Hosted & Managed Services, LLC. All rights reserved. All other trademarks are the property of their respective owners.

Undo local to each pluggable database – default for newly created databases.

When local undo is enabled, each PDB has own undo tablespace.

SELECT property_name, property_value

FROM database_properties

WHERE property_name = 'LOCAL_UNDO_ENABLED';

To change Undo mode, outage required, and need the database in UPGRADE mode.

STARTUP UPGRADE;

ALTER DATABASE LOCAL UNDO ON/OFF;

Local Undo for Pluggable Databases

http://docs.oracle.com/database/122/ADMIN/administering-a-cdb-with-sql-plus.htm#ADMIN-GUID-8F8B2FF8-7FA7-40CD-8AA5-ACABCD3964D8

12.2

Page 12: Oracle Database 12c R1/R2 New Features for 11g DBA (and ... · Oracle Database 12c R1/R2 New Features for 11g DBA (and Developer)! @biju_thomas Biju Thomas ... READ Privilege (12.1.0.2)

©2014 OneNeck IT Solutions LLC. All rights reserved. All other trademarks are the property of their respective owners.12 ©2014 TDS Hosted & Managed Services, LLC. All rights reserved. All other trademarks are the property of their respective owners.

A PDB lockdown profile is a named set of features that control operations available to users connected to a PDB.

New parameter PDB_LOCKDOWN

CREATE LOCKDOWN PROFILE medium;

ALTER LOCKDOWN PROFILE medium DISABLE STATEMENT=('ALTER

SYSTEM');

ALTER LOCKDOWN PROFILE medium ENABLE STATEMENT=('ALTER

SYSTEM') CLAUSE=('FLUSH SHARED POOL');

Creates a profile called medium that disables all ALTER SYSTEM statements except for ALTER SYSTEM FLUSH SHARED POOL.

Alter lockdown profile XP1 disable

statement=('ALTER SESSION') clause=('SET') OPTION

ALL EXCEPT=('sql_trace','optimizer_mode')

PDB Lockdown Profile

Reference: http://docs.oracle.com/database/122/CNCPT/overview-of-the-multitenant-architecture.htm#CNCPT-GUID-B964031E-8ACE-4603-8F1E-DD173BE5BA01

12.2

Page 13: Oracle Database 12c R1/R2 New Features for 11g DBA (and ... · Oracle Database 12c R1/R2 New Features for 11g DBA (and Developer)! @biju_thomas Biju Thomas ... READ Privilege (12.1.0.2)

©2014 OneNeck IT Solutions LLC. All rights reserved. All other trademarks are the property of their respective owners.13 ©2014 TDS Hosted & Managed Services, LLC. All rights reserved. All other trademarks are the property of their respective owners.

New user profile resource: INACTIVE_ACCOUNT_TIME

Automatically locks the database user account who has not logged into the database instance in a specified number of days.

Inactive Account Lock 12.2

Page 14: Oracle Database 12c R1/R2 New Features for 11g DBA (and ... · Oracle Database 12c R1/R2 New Features for 11g DBA (and Developer)! @biju_thomas Biju Thomas ... READ Privilege (12.1.0.2)

©2014 OneNeck IT Solutions LLC. All rights reserved. All other trademarks are the property of their respective owners.14 ©2014 TDS Hosted & Managed Services, LLC. All rights reserved. All other trademarks are the property of their respective owners.

In 12.1, maximum number of PDBs is 252

In 12.2 maximum number of PDBs is 4096

New parameter MAX_PDBS

In a single-tenant environment (if not licensed for multitenant), set this parameter to 1.

Maximum Number of PDBs 12.2

Page 15: Oracle Database 12c R1/R2 New Features for 11g DBA (and ... · Oracle Database 12c R1/R2 New Features for 11g DBA (and Developer)! @biju_thomas Biju Thomas ... READ Privilege (12.1.0.2)

©2014 OneNeck IT Solutions LLC. All rights reserved. All other trademarks are the property of their respective owners.15 ©2014 TDS Hosted & Managed Services, LLC. All rights reserved. All other trademarks are the property of their respective owners.

The SYSRAC administrative privilege Uused by the Clusterware agent in its connection to the database on behalf of Oracle RAC

utilities, such as SRVCTL.

The SYSRAC privilege provides only the minimal privileges necessary for performing day-to-day Oracle RAC operations.

Initialization parameter ALLOW_GROUP_ACCESS_TO_SGA Determines if the Oracle Database installation owner account is the only user that can

read and write to the database System Global Area (SGA), or if members of the OSDBA group can read the SGA.

The default value for this parameter is FALSE.

The maximum length for most database object names has increased from 30 bytes to 128 bytes.

Local temporary tablespace Created using LOCAL TEMPORARY TABLESPACE clause of CREATE TABLESPACE.

In RAC environment, local temporary tablespaces store a separate, nonshared temp files for each database instance, which can improve I/O performance.

A local temporary tablespace must be a BIGFILE tablespace.

Few more 12.2 12.2

Page 16: Oracle Database 12c R1/R2 New Features for 11g DBA (and ... · Oracle Database 12c R1/R2 New Features for 11g DBA (and Developer)! @biju_thomas Biju Thomas ... READ Privilege (12.1.0.2)

©2014 OneNeck IT Solutions LLC. All rights reserved. All other trademarks are the property of their respective owners.16 ©2014 TDS Hosted & Managed Services, LLC. All rights reserved. All other trademarks are the property of their respective owners.

Live SQL is Running 12.2

Page 17: Oracle Database 12c R1/R2 New Features for 11g DBA (and ... · Oracle Database 12c R1/R2 New Features for 11g DBA (and Developer)! @biju_thomas Biju Thomas ... READ Privilege (12.1.0.2)

©2014 OneNeck IT Solutions LLC. All rights reserved. All other trademarks are the property of their respective owners.17 ©2014 TDS Hosted & Managed Services, LLC. All rights reserved. All other trademarks are the property of their respective owners.

http://www.lakako.com/googleplus/search/db12cr2

http://www.lakako.com/twitter/search/db12cr2

More 12.2 Features… 12.2

Page 18: Oracle Database 12c R1/R2 New Features for 11g DBA (and ... · Oracle Database 12c R1/R2 New Features for 11g DBA (and Developer)! @biju_thomas Biju Thomas ... READ Privilege (12.1.0.2)

Database 12.1 Features

Page 19: Oracle Database 12c R1/R2 New Features for 11g DBA (and ... · Oracle Database 12c R1/R2 New Features for 11g DBA (and Developer)! @biju_thomas Biju Thomas ... READ Privilege (12.1.0.2)

©2014 TDS Hosted & Managed Services, LLC. All rights reserved. All other trademarks are the property of their respective owners.

• Allows the creation of global and local indexes on a subset of the partitions of a partitioned table.

ALTER TABLE tt1 MODIFY PARTITION p_vold1 INDEXING OFF;

ALTER TABLE tt1 MODIFY PARTITION p_vold2 INDEXING OFF;

CREATE INDEX tt1_part_idx ON tt1(x1) LOCAL INDEXING

PARTIAL;

ALTER INDEX tt1_existing1 INDEXING PARTIAL;

• Rebuild existing global indexes to regain space. Local indexes drop partitions immediately.

Partial Indexes

Page 20: Oracle Database 12c R1/R2 New Features for 11g DBA (and ... · Oracle Database 12c R1/R2 New Features for 11g DBA (and Developer)! @biju_thomas Biju Thomas ... READ Privilege (12.1.0.2)

©2014 OneNeck IT Solutions LLC. All rights reserved. All other trademarks are the property of their respective owners.20 ©2014 TDS Hosted & Managed Services, LLC. All rights reserved. All other trademarks are the property of their respective owners.

READ Object Privilege, READ ANY TABLE system privilege

SELECT privilege also includes privilege to lock LOCK TABLE <table_name> IN EXCLUSIVE MODE;

SELECT ... FROM <table_name> FOR UPDATE;

READ privilege is more secure, a true READ ONLY privilege!

Grants and Revokes work similar to SELECT grants.

No, there is no READ statement to go with the privilege, you still use the SELECT statement

SQL> GRANT READ ON XX.XXLE_CUSTOMERS_T TO smith;

SQL> GRANT READ ANY TABLE TO peter;

SQL> REVOKE READ ON XX.XXLE_SUPPLIERS_VW FROM smith;

SQL> REVOKE READ ANY TABLE FROM peter;

READ Privilege (12.1.0.2)

Page 21: Oracle Database 12c R1/R2 New Features for 11g DBA (and ... · Oracle Database 12c R1/R2 New Features for 11g DBA (and Developer)! @biju_thomas Biju Thomas ... READ Privilege (12.1.0.2)

©2014 OneNeck IT Solutions LLC. All rights reserved. All other trademarks are the property of their respective owners.23 ©2014 TDS Hosted & Managed Services, LLC. All rights reserved. All other trademarks are the property of their respective owners.

File move (rename) in 11g Take tablespace offline

Use OS command to copy or move file – DBA does copy outside database

Use SQL to update the controlfile

ALTER DATABASE RENAME FILE or

ALTER TABLESPACE … RENAME DATAFILE

Bring tablespace online

To move files belonging the SYSTEM, do in MOUNT mode.

File move in 12c Just one step – no unavailability!

ALTER DATABASE MOVE DATAFILE 'x' TO 'y'

The “TO” clause is optional – if omitted, file is moved to DB_CREATE_FILE_DEST as OMF.

Online Data File Move

Page 22: Oracle Database 12c R1/R2 New Features for 11g DBA (and ... · Oracle Database 12c R1/R2 New Features for 11g DBA (and Developer)! @biju_thomas Biju Thomas ... READ Privilege (12.1.0.2)

©2014 OneNeck IT Solutions LLC. All rights reserved. All other trademarks are the property of their respective owners.24 ©2014 TDS Hosted & Managed Services, LLC. All rights reserved. All other trademarks are the property of their respective owners.

Files belonging to SYSTEM tablespace can be moved using

ALTER DATABASE MOVE DATAFILE, online!

MOVE DATAFILE syntax allows only 1 file move at a time. You

can still move multiple files with ALTER DATABASE

RENAME FILE or ALTER TABLESPACE RENAME

DATAFILE options – but offline mode.

File can be moved from file system to ASM disk group, and

vice versa.

File can be moved from one diskgroup to another in ASM.

Optional KEEP clause to keep the data file at the source.

More to File Move in 12c…

Page 23: Oracle Database 12c R1/R2 New Features for 11g DBA (and ... · Oracle Database 12c R1/R2 New Features for 11g DBA (and Developer)! @biju_thomas Biju Thomas ... READ Privilege (12.1.0.2)

©2014 OneNeck IT Solutions LLC. All rights reserved. All other trademarks are the property of their respective owners.25 ©2014 TDS Hosted & Managed Services, LLC. All rights reserved. All other trademarks are the property of their respective owners.

Security related values in the USER$ table are [as existed in 11gR2]:

CTIME: Date & Time when user was created

PTIME: Date & Time when user password was last changed

LTIME: Date & Time when the user account was locked

LCOUNT: Number of failed login attempts

SPARE4: Encrypted case sensitive password 11g version

PASSWORD: Encrypted case insensitive password 10g version

Added in Oracle Database 12c:

SPARE6: Last login time of the user.

Displayed when you invoke SQL*Plus

Last Login Time

$ sqlplus hr/hr

SQL*Plus: Release 12.1.0.1.0 Production on Tue Jul 9 23:34:32 2013

Copyright (c) 1982, 2013, Oracle. All rights reserved.

Last Successful login time: Tue Dec 09 2013 23:34:22 -05:00Connected to:

Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production

With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

SQL>

Page 24: Oracle Database 12c R1/R2 New Features for 11g DBA (and ... · Oracle Database 12c R1/R2 New Features for 11g DBA (and Developer)! @biju_thomas Biju Thomas ... READ Privilege (12.1.0.2)

©2014 OneNeck IT Solutions LLC. All rights reserved. All other trademarks are the property of their respective owners.26 ©2014 TDS Hosted & Managed Services, LLC. All rights reserved. All other trademarks are the property of their respective owners.

New CASCADE clause for TRUNCATE

Truncates all child tables that reference truncated table.

Foreign key must be defined with ON DELETE CASCADE option

Foreign key must be in ENABLED status.

Children, grand children are truncated

Cascaded TRUNCATE

In Oracle Database 11gR2 and earlier versions, the TRUNCATE statement

had the following two restrictions along with few others.

You cannot truncate the parent table of an enabled foreign key

constraint. You must disable the constraint before truncating the table.

An exception is that you can truncate the table if the integrity

constraint is self-referential.

You cannot truncate the parent table of a reference-partitioned table.

You must first drop the reference-partitioned child table.

Page 25: Oracle Database 12c R1/R2 New Features for 11g DBA (and ... · Oracle Database 12c R1/R2 New Features for 11g DBA (and Developer)! @biju_thomas Biju Thomas ... READ Privilege (12.1.0.2)

©2014 OneNeck IT Solutions LLC. All rights reserved. All other trademarks are the property of their respective owners.27 ©2014 TDS Hosted & Managed Services, LLC. All rights reserved. All other trademarks are the property of their respective owners.

More DDL statements support ONLINE Dropping an index (DROP INDEX ... ONLINE)

Marking an index as UNUSABLE (using ALTER INDEX ... UNUSABLE ONLINE)

Marking a column as UNUSED (ALTER TABLE ... SET UNUSED ... ONLINE)

Dropping a constraint (ALTER TABLE ... DROP ... ONLINE)

Moving a table partition (ALTER TABLE ... MOVE PARTITION ... ONLINE)

Moving a table subpartition (ALTER TABLE ... MOVE SUBPARTITION ... ONLINE)

Do More w/o Waiting

Page 26: Oracle Database 12c R1/R2 New Features for 11g DBA (and ... · Oracle Database 12c R1/R2 New Features for 11g DBA (and Developer)! @biju_thomas Biju Thomas ... READ Privilege (12.1.0.2)

©2014 OneNeck IT Solutions LLC. All rights reserved. All other trademarks are the property of their respective owners.28 ©2014 TDS Hosted & Managed Services, LLC. All rights reserved. All other trademarks are the property of their respective owners.

Merge Multiple Partitions

Split Multiple Partitions

Multiple Partition Management

Page 27: Oracle Database 12c R1/R2 New Features for 11g DBA (and ... · Oracle Database 12c R1/R2 New Features for 11g DBA (and Developer)! @biju_thomas Biju Thomas ... READ Privilege (12.1.0.2)

©2014 OneNeck IT Solutions LLC. All rights reserved. All other trademarks are the property of their respective owners.29 ©2014 TDS Hosted & Managed Services, LLC. All rights reserved. All other trademarks are the property of their respective owners.

Add Multiple partitions

Drop Multiple Partitions

Truncate Multiple Partitions

More Partition Management

Page 28: Oracle Database 12c R1/R2 New Features for 11g DBA (and ... · Oracle Database 12c R1/R2 New Features for 11g DBA (and Developer)! @biju_thomas Biju Thomas ... READ Privilege (12.1.0.2)

©2014 OneNeck IT Solutions LLC. All rights reserved. All other trademarks are the property of their respective owners.30 ©2014 TDS Hosted & Managed Services, LLC. All rights reserved. All other trademarks are the property of their respective owners.

New parameter PGA_AGGREGATE_LIMIT

Specifies a limit on the aggregate PGA memory consumed by the instance

Default Value: Greater of

2 GB

200% of PGA_AGGREGATE_TARGET

3 MB times the PROCESSES parameter.

It will not exceed 120% of the physical memory size minus the total SGA size.

PGA_AGGREGATE_TARGET maintains the same behavior as 11g - specifies the target aggregate PGA memory available to all server processes attached to the instance.

Limit PGA

Page 29: Oracle Database 12c R1/R2 New Features for 11g DBA (and ... · Oracle Database 12c R1/R2 New Features for 11g DBA (and Developer)! @biju_thomas Biju Thomas ... READ Privilege (12.1.0.2)

©2014 OneNeck IT Solutions LLC. All rights reserved. All other trademarks are the property of their respective owners.31 ©2014 TDS Hosted & Managed Services, LLC. All rights reserved. All other trademarks are the property of their respective owners.

New mandatory background process LREG

Registers information about the database instance and dispatcher processes with the Oracle Net Listener

When an instance starts, LREG polls the listener to determine whether it is running. If the listener is running, then LREG passes it relevant parameters. If it is not running, then LREG periodically attempts to contact it.

Manual listener registration using ALTER SYSTEM REGISTER – same as in 11g.

In 11g, PMON process had this responsibility.

Listener Registration

Page 30: Oracle Database 12c R1/R2 New Features for 11g DBA (and ... · Oracle Database 12c R1/R2 New Features for 11g DBA (and Developer)! @biju_thomas Biju Thomas ... READ Privilege (12.1.0.2)

©2014 OneNeck IT Solutions LLC. All rights reserved. All other trademarks are the property of their respective owners.33 ©2014 TDS Hosted & Managed Services, LLC. All rights reserved. All other trademarks are the property of their respective owners.

Can create B-Tree and Bitmap indexes on same set of columns

Partitioned and Non-partitioned indexes

Locally partitioned and Globally partitioned indexes

Indexes that differ in partitioning type (range vs hash)

Unique and Non-unique indexes

Only one index on the same set of columns can be visible at any point in time.

If you are creating a visible index, then any existing indexes on the set of columns must be invisible. Alternatively, you can create an invisible index on the same set of columns.

Multiple Indexes on Same Column

Page 31: Oracle Database 12c R1/R2 New Features for 11g DBA (and ... · Oracle Database 12c R1/R2 New Features for 11g DBA (and Developer)! @biju_thomas Biju Thomas ... READ Privilege (12.1.0.2)

©2014 OneNeck IT Solutions LLC. All rights reserved. All other trademarks are the property of their respective owners.34 ©2014 TDS Hosted & Managed Services, LLC. All rights reserved. All other trademarks are the property of their respective owners.

In #DB12c statistics are automatically created as part of a bulk load operation such as

CREATE TABLE AS SELECT operation or

INSERT INTO ... SELECT operation

Operation must be on an empty table.

Basic statistics on the table gathered, but non-default statistics such as histograms are not calculated.

Automatic Stats During Bulk Load

Page 32: Oracle Database 12c R1/R2 New Features for 11g DBA (and ... · Oracle Database 12c R1/R2 New Features for 11g DBA (and Developer)! @biju_thomas Biju Thomas ... READ Privilege (12.1.0.2)

©2014 OneNeck IT Solutions LLC. All rights reserved. All other trademarks are the property of their respective owners.35 ©2014 TDS Hosted & Managed Services, LLC. All rights reserved. All other trademarks are the property of their respective owners.

New function APPROX_COUNT_DISTINCT (<expr>)

Returns the approximate number of rows that contain distinct values of <expr>.

Alternative to the COUNT (DISTINCT <expr>) function, which returns the exact number of rows that contain distinct values of <expr>.

APPROX_COUNT_DISTINCT processes large amounts of data significantly faster than COUNT, with negligible deviation from the exact result.

SQL> SELECT APPROX_COUNT_DISTINCT (item_id) AS

"Items Ordered" FROM order_lines;

Faster (Approximate) Count – 12.1.0.2

Page 33: Oracle Database 12c R1/R2 New Features for 11g DBA (and ... · Oracle Database 12c R1/R2 New Features for 11g DBA (and Developer)! @biju_thomas Biju Thomas ... READ Privilege (12.1.0.2)

©2014 OneNeck IT Solutions LLC. All rights reserved. All other trademarks are the property of their respective owners.36 ©2014 TDS Hosted & Managed Services, LLC. All rights reserved. All other trademarks are the property of their respective owners.

APPROX_COUNT_DISTINCT APPROX_COUNT_DISTINCT_DETAIL APPROX_COUNT_DISTINCT_AGG TO_APPROX_COUNT_DISTINCT APPROX_MEDIAN APPROX_PERCENTILE APPROX_PERCENTILE_DETAIL APPROX_PERCENTILE_AGG TO_APPROX_PERCENTILE

Set the approx_for_aggregation initialization parameter to TRUE for the current session or for the entire database. This parameter acts as an umbrella parameter for enabling the use of functions that return approximate results

https://docs.oracle.com/cloud/latest/exadataexpress-cloud/CSDBF/approximate-query-processing.htm#CSDBF-GUID-F8DF817F-11E0-4D39-830C-6B4D9FC6ABAB

Enhanced in 12.2 with more Functions

Page 34: Oracle Database 12c R1/R2 New Features for 11g DBA (and ... · Oracle Database 12c R1/R2 New Features for 11g DBA (and Developer)! @biju_thomas Biju Thomas ... READ Privilege (12.1.0.2)

©2014 OneNeck IT Solutions LLC. All rights reserved. All other trademarks are the property of their respective owners.37 ©2014 TDS Hosted & Managed Services, LLC. All rights reserved. All other trademarks are the property of their respective owners.

VARCHAR2 [and NVARCHAR2, RAW] column width up to 32767 bytes

Parameter MAX_STRING_SIZE = EXTENDED – must change only when the database is started in UPGRADE mode

Once enabled, no going back

Invalidates views and materialized views, compile after change.

Individual PDBs in a CDB can have different setting

Bigger VARCHAR2

Page 35: Oracle Database 12c R1/R2 New Features for 11g DBA (and ... · Oracle Database 12c R1/R2 New Features for 11g DBA (and Developer)! @biju_thomas Biju Thomas ... READ Privilege (12.1.0.2)

©2014 OneNeck IT Solutions LLC. All rights reserved. All other trademarks are the property of their respective owners.38 ©2014 TDS Hosted & Managed Services, LLC. All rights reserved. All other trademarks are the property of their respective owners.

ALTER PLUGGABLE DATABASE CLOSE [IMMEDIATE]

ALTER PLUGGABLE DATABASE OPEN UPGRADE

Change the setting of MAX_STRING_SIZE to EXTENDED

Run the ?/rdbms/admin/utl32k.sql script as SYSDBA.

ALTER PLUGGABLE DATABASE CLOSE ALTER PLUGGABLE DATABASE OPEN

Changing MAX_STRING_SIZE

Shutdown database Start the database in UPGRADE

mode Change the setting of

MAX_STRING_SIZE to EXTENDED

Run the ?/rdbms/admin/utl32k.sql script as SYSDBA.

Restart the database in normal mode.

Page 36: Oracle Database 12c R1/R2 New Features for 11g DBA (and ... · Oracle Database 12c R1/R2 New Features for 11g DBA (and Developer)! @biju_thomas Biju Thomas ... READ Privilege (12.1.0.2)

©2014 OneNeck IT Solutions LLC. All rights reserved. All other trademarks are the property of their respective owners.42 ©2014 TDS Hosted & Managed Services, LLC. All rights reserved. All other trademarks are the property of their respective owners.

Columns can be invisible (ALTER TABLE, CREATE TABLE syntax – INVISIBLE)

Not supported on temporary and external tables

Specify explicitly in INSERT, SELECT clauses

SQL*Plus: SET COLINVISIBLE ON

When you make an INVISIBLE column in Oracle 12c database to VISIBLE, the COL# is assigned the highest available. Thus the column becomes the last column in the table (not storage, only display). So, if you accidentally make a column INVISIBLE and correct it by changing to VISIBLE, the column order changes. So, if the application uses "SELECT *" or "INSERT" without column names, they might break!

Invisible Columns

Page 37: Oracle Database 12c R1/R2 New Features for 11g DBA (and ... · Oracle Database 12c R1/R2 New Features for 11g DBA (and Developer)! @biju_thomas Biju Thomas ... READ Privilege (12.1.0.2)

©2014 OneNeck IT Solutions LLC. All rights reserved. All other trademarks are the property of their respective owners.43 ©2014 TDS Hosted & Managed Services, LLC. All rights reserved. All other trademarks are the property of their respective owners.

New clause in SELECT statement

Follows the ORDER BY clause

[ OFFSET offset { ROW | ROWS } ]

[ FETCH {FIRST | NEXT} [ {rowcount | percent

PERCENT} ]

{ ROW | ROWS } { ONLY | WITH TIES } ]

OFFSET clause is used to skip the specified number of rows before the limiting begins.

FETCH clause can specify the number of rows to return or a percentage of rows to return.

ONLY specifies to return exact number or percent of rows to return.

WITH TIES specifies to return all rows that have the same sort keys as the last row of the row-limited result set.

Row Limiting Clause

http://bijoos.com/oraclenotes/2013/95

Page 38: Oracle Database 12c R1/R2 New Features for 11g DBA (and ... · Oracle Database 12c R1/R2 New Features for 11g DBA (and Developer)! @biju_thomas Biju Thomas ... READ Privilege (12.1.0.2)

©2014 OneNeck IT Solutions LLC. All rights reserved. All other trademarks are the property of their respective owners.44 ©2014 TDS Hosted & Managed Services, LLC. All rights reserved. All other trademarks are the property of their respective owners.

Row Limiting Examples

Page 39: Oracle Database 12c R1/R2 New Features for 11g DBA (and ... · Oracle Database 12c R1/R2 New Features for 11g DBA (and Developer)! @biju_thomas Biju Thomas ... READ Privilege (12.1.0.2)

©2014 OneNeck IT Solutions LLC. All rights reserved. All other trademarks are the property of their respective owners.45 ©2014 TDS Hosted & Managed Services, LLC. All rights reserved. All other trademarks are the property of their respective owners.

“datapatch” to run post patch scripts

Will automatically determine post scripts and actions

MOS Note “Datapatch: Database 12c Post Patch SQL Automation (Doc ID 1585822.1)”

Queryable patch inventory using DBMS_QOPATCH Package

Shows all the patch information available as part of the OPATCH LSINVENTORY -XML command.

Queryable Patch Inventory requires Oracle database instance to be open in read/write mode.

MOS Note “Oracle Database 12.1 : FAQ on Queryable Patch Inventory (Doc ID 1530108.1)”

Enhanced Patching

GET_OPATCH_LIST

PATCH_CONFLICT_DETECTION

GET_SQLPATCH_STATUS

GET_OPATCH_PREQS

GET_OPATCH_LSINVENTORY

Page 40: Oracle Database 12c R1/R2 New Features for 11g DBA (and ... · Oracle Database 12c R1/R2 New Features for 11g DBA (and Developer)! @biju_thomas Biju Thomas ... READ Privilege (12.1.0.2)

©2014 OneNeck IT Solutions LLC. All rights reserved. All other trademarks are the property of their respective owners.46

Security Defaults

AUDIT_SYS_OPERATIONS defaults to TRUE in #Oracle 12c

AUDIT_ADMIN and AUDIT_VIEWER Security Roles

utlpwdmg.sql script creates ora12c_verify_function and ora12c_strong_verify_function

RESOURCE Role No Longer Grants the UNLIMITED TABLESPACE Privilege

Default Unified Audit Policy Enabled. Failed logins are written to UNIFIED_AUDIT_TRAIL. The ORA_LOGON_FAILURES unified audit policy for new databases, tracks failed

logons only.

AUDSYS schema will be used solely for storage of the unified audit trail data table.

Page 41: Oracle Database 12c R1/R2 New Features for 11g DBA (and ... · Oracle Database 12c R1/R2 New Features for 11g DBA (and Developer)! @biju_thomas Biju Thomas ... READ Privilege (12.1.0.2)

©2014 OneNeck IT Solutions LLC. All rights reserved. All other trademarks are the property of their respective owners.47 ©2014 TDS Hosted & Managed Services, LLC. All rights reserved. All other trademarks are the property of their respective owners.

Single location, single table for audit records

Unified interface

Unified audit trail records can be read using the UNIFIED_AUDIT_TRAIL view standard auditing

SYS auditing

fine grained auditing

data pump

SQL loader,

database vault

label security

recovery manager RMAN

real application security

Unified Audit Trail

Page 42: Oracle Database 12c R1/R2 New Features for 11g DBA (and ... · Oracle Database 12c R1/R2 New Features for 11g DBA (and Developer)! @biju_thomas Biju Thomas ... READ Privilege (12.1.0.2)

©2014 OneNeck IT Solutions LLC. All rights reserved. All other trademarks are the property of their respective owners.48 ©2014 TDS Hosted & Managed Services, LLC. All rights reserved. All other trademarks are the property of their respective owners.

DBLINK_INFO

Returns the source of a database link session. Specifically, it returns a string of the form:

SOURCE_GLOBAL_NAME=dblink_src_global_name,

DBLINK_NAME=dblink_name,

SOURCE_AUDIT_SESSIONID=dblink_src_audit_sessionid

dblink_src_global_name is the unique global name of the source database

dblink_name is the name of the database link on the source database

dblink_src_audit_sessionid is the audit session ID of the session on the source database that initiated the connection to the remote database using dblink_name

Same information in UNIFIED_AUDIT_TRAIL view – DBLINK_INFO column.

New SYS_CONTEXT Namespace

Page 43: Oracle Database 12c R1/R2 New Features for 11g DBA (and ... · Oracle Database 12c R1/R2 New Features for 11g DBA (and Developer)! @biju_thomas Biju Thomas ... READ Privilege (12.1.0.2)

©2014 OneNeck IT Solutions LLC. All rights reserved. All other trademarks are the property of their respective owners.49

Connecting Lower Version Clients

SQLNET.ALLOWED_LOGON_VERSION_CLIENT

SQLNET.ALLOWED_LOGON_VERSION_SERVER

Replaced SQLNET.ALLOWED_LOGON_VERSION

Page 44: Oracle Database 12c R1/R2 New Features for 11g DBA (and ... · Oracle Database 12c R1/R2 New Features for 11g DBA (and Developer)! @biju_thomas Biju Thomas ... READ Privilege (12.1.0.2)

©2014 OneNeck IT Solutions LLC. All rights reserved. All other trademarks are the property of their respective owners.53 ©2014 TDS Hosted & Managed Services, LLC. All rights reserved. All other trademarks are the property of their respective owners.

Import without generating archived logs TRANSFORM=DISABLE_ARCHIVE_LOGGING:Y[:TABLE|INDEX]

Sets object to NOLOGGIG before import and reverts to original setting after import.

Choose to disable logging for tables (Y:TABLE), indexes (Y:INDEX), or both (Y).

$ impdp DIRECTORY=dump_dir DUMPFILE=ex2.dmp

LOGFILE=ex2.log SCHEMAS=ball

TRANSFORM=DISABLE_ARCHIVE_LOGGING:Y:TABLE

$ impdp DIRECTORY=dump_dir DUMPFILE=ex1.dmp

LOGFILE=ex1.log SCHEMAS=basket

TRANSFORM=DISABLE_ARCHIVE_LOGGING:Y

TRANSFORM=DISABLE_ARCHIVE_LOGGING:N:INDEX

Data Pump NOLOGGING Import

Page 45: Oracle Database 12c R1/R2 New Features for 11g DBA (and ... · Oracle Database 12c R1/R2 New Features for 11g DBA (and Developer)! @biju_thomas Biju Thomas ... READ Privilege (12.1.0.2)

©2014 OneNeck IT Solutions LLC. All rights reserved. All other trademarks are the property of their respective owners.54 ©2014 TDS Hosted & Managed Services, LLC. All rights reserved. All other trademarks are the property of their respective owners.

Export one or more views as tables VIEWS_AS_TABLES=[schema_name.]view_name[:table_na

me], ...

table_name specifies the name of a table to serve as the source of the metadata for the exported view (mainly for RO db).

Data Pump performs a table-mode export.

Useful to get a subset of data exported.

Also available in “impdp” to use in the network mode of import.

Data Pump Export Views As Tables

Page 46: Oracle Database 12c R1/R2 New Features for 11g DBA (and ... · Oracle Database 12c R1/R2 New Features for 11g DBA (and Developer)! @biju_thomas Biju Thomas ... READ Privilege (12.1.0.2)

©2014 OneNeck IT Solutions LLC. All rights reserved. All other trademarks are the property of their respective owners.55 ©2014 TDS Hosted & Managed Services, LLC. All rights reserved. All other trademarks are the property of their respective owners.

SQL*Loader in #DB12c has a new option that does not require the user to create a SQL*Loader control file.

Instead, command-line parameters are used to specify how the data file is loaded, and SQL*Loader automatically chooses the best method with which to load the data.

Data files formatted as comma-separated values (CSV) to both SQL*Loader and external tables are supported.

The new parameter, TABLE, turns on express mode. The value of the TABLE parameter is the name of the table that SQL*Loader will load.

If no data file is specified, then looks for file named tablename.dat in the current directory

sqlldr username TABLE=EMPLOYEES

SQL*Loader Express Mode

Page 47: Oracle Database 12c R1/R2 New Features for 11g DBA (and ... · Oracle Database 12c R1/R2 New Features for 11g DBA (and Developer)! @biju_thomas Biju Thomas ... READ Privilege (12.1.0.2)

©2014 OneNeck IT Solutions LLC. All rights reserved. All other trademarks are the property of their respective owners.56 ©2014 TDS Hosted & Managed Services, LLC. All rights reserved. All other trademarks are the property of their respective owners.

“Describe” in RMAN, similar to SQL*Plus.

Most SQL statements can be run in RMAN without the “SQL” prefix (and messing with quotes around the SQL!!).

SYSBACKUP Administration Role – Start replacing scripts where SYSDBA is used

RMAN Notables

Page 48: Oracle Database 12c R1/R2 New Features for 11g DBA (and ... · Oracle Database 12c R1/R2 New Features for 11g DBA (and Developer)! @biju_thomas Biju Thomas ... READ Privilege (12.1.0.2)

©2014 OneNeck IT Solutions LLC. All rights reserved. All other trademarks are the property of their respective owners.57 ©2014 TDS Hosted & Managed Services, LLC. All rights reserved. All other trademarks are the property of their respective owners.

The biggest RMAN feature is restore table from backup.

RECOVER TABLE SCOTT.EMP, SCOTT.DEPT

UNTIL TIME 'SYSDATE-1'

AUXILIARY DESTINATION '/t1/tdb'

DATAPUMP DESTINATION '/t1/dump'

DUMP FILE 'emp_dept_dump.dat'

REMAP TABLE 'HR'.'EMP':'EMP_RECVR';

--NOTABLEIMPORT;

When NOTABLEIMPORT option is used, RMAN performs the restore/recover and creates the export dump file, but does not perform the import.

RMAN Restore Table

Page 49: Oracle Database 12c R1/R2 New Features for 11g DBA (and ... · Oracle Database 12c R1/R2 New Features for 11g DBA (and Developer)! @biju_thomas Biju Thomas ... READ Privilege (12.1.0.2)

©2014 OneNeck IT Solutions LLC. All rights reserved. All other trademarks are the property of their respective owners.61 ©2014 TDS Hosted & Managed Services, LLC. All rights reserved. All other trademarks are the property of their respective owners.

http://www.oracle.com/webfolder/technetwork/tutorials/obe/db/12c/r1/poster/OUTPUT_poster/poster.html#

TechNet Interactive Reference

Page 50: Oracle Database 12c R1/R2 New Features for 11g DBA (and ... · Oracle Database 12c R1/R2 New Features for 11g DBA (and Developer)! @biju_thomas Biju Thomas ... READ Privilege (12.1.0.2)

©2014 OneNeck IT Solutions LLC. All rights reserved. All other trademarks are the property of their respective owners.62 ©2014 TDS Hosted & Managed Services, LLC. All rights reserved. All other trademarks are the property of their respective owners.

https://apex.oracle.com/pls/apex/f?p=44785:141:0:::141:P141_PAGE_ID,P141_SECTION_ID:6,18

Database 12c Learning Library

Page 51: Oracle Database 12c R1/R2 New Features for 11g DBA (and ... · Oracle Database 12c R1/R2 New Features for 11g DBA (and Developer)! @biju_thomas Biju Thomas ... READ Privilege (12.1.0.2)

Thank you!

Daily #oratidbit on Facebook and Twitter. Follow me!

Tweets: @biju_thomasFacebook: facebook.com/oraclenotes

Blog: bijoos.com/oraclenotes