oracle database 12c features for developers! · learn oracle database 12c features relevant to...

35
Oracle Database 12c Features for Developers! @biju_thomas Biju Thomas Principal Solutions Architect OneNeck IT Solutions www.OneNeck.com

Upload: others

Post on 04-Jun-2020

60 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Oracle Database 12c Features for Developers! · Learn Oracle Database 12c features relevant to developers (and DBA). SQL (DML, DDL) & SQL*Plus features Many features at a high level

Oracle Database 12c Features for Developers!

@biju_thomas

Biju ThomasPrincipal Solutions ArchitectOneNeck IT Solutionswww.OneNeck.com

Page 2: Oracle Database 12c Features for Developers! · Learn Oracle Database 12c features relevant to developers (and DBA). SQL (DML, DDL) & SQL*Plus features Many features at a high level

About me!

Biju Thomas

2

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 blog since 1997 – www.bijoos.com Oracle ACE Director

Page 3: Oracle Database 12c Features for Developers! · Learn Oracle Database 12c features relevant to developers (and DBA). SQL (DML, DDL) & SQL*Plus features Many features at a high level

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

• Hybrid IT

• 550+ employees

• Coast to Coast Data Centers

3

Page 4: Oracle Database 12c Features for Developers! · Learn Oracle Database 12c features relevant to developers (and DBA). SQL (DML, DDL) & SQL*Plus features Many features at a high level

©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 Oracle Database 12c features relevant to developers (and DBA).

SQL (DML, DDL) & SQL*Plus features

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

“googling” always works!

Links on most slides to read and learn more.

Session Objectives

Page 5: Oracle Database 12c Features for Developers! · Learn Oracle Database 12c features relevant to developers (and DBA). SQL (DML, DDL) & SQL*Plus features Many features at a high level

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

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

If COMPATIBLE is set to a value of 12.2 or higher, then names must be from 1 to 128 bytes long with these exceptions: Names of databases are limited to 8 bytes.

Names of disk groups, pluggable databases (PDBs), rollback segments, tablespaces, and tablespace sets are limited to 30 bytes.

"schema"."table"."column“ can be up to 392 bytes (384 + each of the quotation marks and periods is a single-byte character).

New function ORA_MAX_NAME_LEN_SUPPORTED can be used to check the maximum length of identifiers allowed in the database.

If COMPATIBLE parameter is set to 12.1.0 or lower, the limit is 30 bytes.

No more weird abbreviations! 12.2

Page 6: Oracle Database 12c Features for Developers! · Learn Oracle Database 12c features relevant to developers (and DBA). SQL (DML, DDL) & SQL*Plus features Many features at a high level

©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.

New ENABLE ON QUERY COMPUTATION Clause Merges the data from the MV with the data still within the MV Log to generate the final, fully up to

date result. No additional overhead of ON COMMIT REFRESH Oracle reads the MV log and apply the changes to MV result

Parameters:query_rewrite_enabled = TRUE

query_rewrite_integrity = enforced (or trusted)

SQL> CREATE MATERIALIZED VIEW LOG ON salestab WITH

SEQUENCE, ROWID (col1, col2) INCLUDING NEW VALUES;

SQL> CREATE MATERIALIZED VIEW salesmv

REFRESH FAST ON DEMAND

ENABLE QUERY REWRITE ENABLE QUERY ON COMPUTATION

AS SELECT … FROM salestab WHERE …

Real Time Materialized Views 12.2

Page 7: Oracle Database 12c Features for Developers! · Learn Oracle Database 12c features relevant to developers (and DBA). SQL (DML, DDL) & SQL*Plus features Many features at a high level

©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.

Converting existing MVs to RTMV

ALTER MATERIALIZED VIEW salesmv ENABLE ON QUERY COMPUTATION;

Oracle Database does not automatically perform on-query computation for a real-time materialized view that is accessed directly in a user query. Use the FRESH_MV hint in the query to indicate that on-query computation must be performed for direct access of MV.

SELECT /*+ FRESH_MV */ FROM salesmv WHERE …

ON_QUERY_COMPUTATION column set to Y in DBA_MVIEWS (or USER_MVIEWS)

Real-Time Materialized Views -2 12.2

Page 8: Oracle Database 12c Features for Developers! · Learn Oracle Database 12c features relevant to developers (and DBA). SQL (DML, DDL) & SQL*Plus features Many features at a high level

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

• New in 12.2: VALIDATE_CONVERSION function

• Determines whether expr can be converted to the specified data type.

• If expr can be successfully converted, then this function returns 1; otherwise, this function returns 0. If expr evaluates to null, then this function returns 1.

• Returns 1

SELECT VALIDATE_CONVERSION('$100,00' AS NUMBER, '$999D99') FROM DUAL;

SELECT VALIDATE_CONVERSION('29-Jan-02 17:24:00' AS TIMESTAMP, 'DD-MON-YY HH24:MI:SS') FROM DUAL;

SELECT VALIDATE_CONVERSION('$29.99' AS BINARY_FLOAT, '$99D99') FROM DUAL;

• Returns 0

SELECT VALIDATE_CONVERSION('$29.99' AS BINARY_FLOAT) FROM DUAL;

Validate Datatype Conversion

8

12.2

Page 9: Oracle Database 12c Features for Developers! · Learn Oracle Database 12c features relevant to developers (and DBA). SQL (DML, DDL) & SQL*Plus features Many features at a high level

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

• The DEFAULT clause lets you specify a value to be assigned to the column if a subsequent INSERT statement omits a value for the column.

• Can use CURRVAL and NEXTVAL sequence pseudo columns as the default values for a column.

• Must have the INSERT privilege on the table and the SELECT privilege on the sequence.

• SEQUENCE must exist when creating TABLE.

https://oracle-base.com/articles/12c/default-values-for-table-columns-enhancements-12cr1

Default Column Value from Sequence

9

Page 10: Oracle Database 12c Features for Developers! · Learn Oracle Database 12c features relevant to developers (and DBA). SQL (DML, DDL) & SQL*Plus features Many features at a high level

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

• Specify the DEFAULT ON NULL clause, Oracle Database assigns the DEFAULT column value when a subsequent INSERT statement attempts to assign a NULL value.

DEFAULT ON NULL

10

Page 11: Oracle Database 12c Features for Developers! · Learn Oracle Database 12c features relevant to developers (and DBA). SQL (DML, DDL) & SQL*Plus features Many features at a high level

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

• Sequence pseudo column as default values for a column

• Only one per table

• CREATE TABLE AS SELECT will not inherit the identity property on a column.

CREATE TABLE t1 (id NUMBER GENERATED AS IDENTITY);

CREATE TABLE t2 (id NUMBER GENERATED BY DEFAULT AS

IDENTITY (START WITH 100 INCREMENT BY 10));

Identity Column

11

GENERATED

[ ALWAYS | BY DEFAULT [ ON NULL ] ]

AS IDENTITY [ ( identity_options ) ]

{ START WITH ( integer | LIMIT VALUE )

| INCREMENT BY integer

| ( MAXVALUE integer | NOMAXVALUE )

| ( MINVALUE integer | NOMINVALUE )

| ( CYCLE | NOCYCLE )

| ( CACHE integer | NOCACHE )

| ( ORDER | NOORDER ) }...

Page 12: Oracle Database 12c Features for Developers! · Learn Oracle Database 12c features relevant to developers (and DBA). SQL (DML, DDL) & SQL*Plus features Many features at a high level

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

• Values visible only in the session.

• Specifically designed to be used with global temporary tables that have session visibility.

• A session sequence returns a unique range of sequence numbers only within a session, but not across sessions.

• Can be accessed on any read-write or read-only databases (either a regular database temporarily open read-only or a standby database).

• The CACHE, NOCACHE, ORDER, or NOORDER clauses are ignored.

Session Sequences

12

CREATE SEQUENCE [ schema. ] sequence[ { INCREMENT BY | START

WITH } integer| { MAXVALUE integer |

NOMAXVALUE }| { MINVALUE integer |

NOMINVALUE }| { CYCLE | NOCYCLE }| { CACHE integer |

NOCACHE }| { ORDER | NOORDER }| { KEEP | NOKEEP }| { SESSION | GLOBAL }]...

;

Page 13: Oracle Database 12c Features for Developers! · Learn Oracle Database 12c features relevant to developers (and DBA). SQL (DML, DDL) & SQL*Plus features Many features at a high level

©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.

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 14: Oracle Database 12c Features for Developers! · Learn Oracle Database 12c features relevant to developers (and DBA). SQL (DML, DDL) & SQL*Plus features Many features at a high level

©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.

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

alter table SALES modify

partition by list (STATE)

AUTOMATIC (partition p_AZ values (‘AZ')) ONLINE;

alter table SALES modify

partition by list (owner)

AUTOMATIC (partition p_AZ values (‘AZ'))

update indexes (SALES_I1 LOCAL) ONLINE;

In versions prior to 12.2, this activity required DBMS_REDEFINITION or using EXCHANGE PARTITION.

Convert to Partitioned Table Online! 12.2

Page 15: Oracle Database 12c Features for Developers! · Learn Oracle Database 12c features relevant to developers (and DBA). SQL (DML, DDL) & SQL*Plus features Many features at a high level

©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.

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: (continued on same table)

ALTER TABLE xxt MODIFY PARTITION xxt_p4 READ WRITE;

All partitions except xxt_p4 are read only.

Read Only Partitions 12.2

Page 16: Oracle Database 12c Features for Developers! · Learn Oracle Database 12c features relevant to developers (and DBA). SQL (DML, DDL) & SQL*Plus features Many features at a high level

©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.

Merge Multiple Partitions

Split Multiple Partitions

Multiple Partition Management

Page 17: Oracle Database 12c Features for Developers! · Learn Oracle Database 12c features relevant to developers (and DBA). SQL (DML, DDL) & SQL*Plus features Many features at a high level

©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.

Add Multiple partitions

Drop Multiple Partitions

Truncate Multiple Partitions

More Partition Management

Page 18: Oracle Database 12c Features for Developers! · Learn Oracle Database 12c features relevant to developers (and DBA). SQL (DML, DDL) & SQL*Plus features Many features at a high level

©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 19: Oracle Database 12c Features for Developers! · Learn Oracle Database 12c features relevant to developers (and DBA). SQL (DML, DDL) & SQL*Plus features Many features at a high level

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

• Within a lateral inline view, you can specify tables that appear to the left of the lateral inline view in the FROM clause of a query.

• Specify this left correlation anywhere within subquery (such as the SELECT, FROM, and WHERE clauses) and at any nesting level.

• By adding the LATERAL syntax, you can reference an item in the outer query and have it pushed into the inner query.

SELECT * FROM employees e, (SELECT * FROM departments d

WHERE e.department_id = d.department_id);

ORA-00904: "E"."DEPARTMENT_ID": invalid identifier

SELECT * FROM employees e, LATERAL (SELECT * FROM departments d

WHERE e.department_id = d.department_id);

Lateral Inline Views

19

Page 20: Oracle Database 12c Features for Developers! · Learn Oracle Database 12c features relevant to developers (and DBA). SQL (DML, DDL) & SQL*Plus features Many features at a high level

©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.

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 21: Oracle Database 12c Features for Developers! · Learn Oracle Database 12c features relevant to developers (and DBA). SQL (DML, DDL) & SQL*Plus features Many features at a high level

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

Row Limiting Examples

Page 22: Oracle Database 12c Features for Developers! · Learn Oracle Database 12c features relevant to developers (and DBA). SQL (DML, DDL) & SQL*Plus features Many features at a high level

©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.

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 23: Oracle Database 12c Features for Developers! · Learn Oracle Database 12c features relevant to developers (and DBA). SQL (DML, DDL) & SQL*Plus features Many features at a high level

©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.

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 24: Oracle Database 12c Features for Developers! · Learn Oracle Database 12c features relevant to developers (and DBA). SQL (DML, DDL) & SQL*Plus features Many features at a high level

©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.

SQL*Plus 12.2.0.1.0 Change in Behavior for Search Path of Login.sql (SQL*Plus User Profile Script) (Doc ID 2241021.1)

Old Behavior:

Prior to SQL*Plus version 12.2.0.1.0, SQL*Plus searches for the User Profile in your current directory first, and then the directories you specify with the ORACLE_PATH environment variable.

New Behavior:

From 12.2.0.1.0, SQL*Plus will only search for the User Profile in the directories you specify with the ORACLE_PATH environment variable on Linux and SQLPATH on Windows.

SQL*Plus: login.sql behavior 12.2

Page 25: Oracle Database 12c Features for Developers! · Learn Oracle Database 12c features relevant to developers (and DBA). SQL (DML, DDL) & SQL*Plus features Many features at a high level

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

• Performance options:

• SET LOBPREFETCH {0 | n}

• SET ROWPREFETCH {1 | n}

• SET STATEMENTCACHE {0 | n}

• sqlplus –fast

• arraysize 100

• lobprefetch 16384

• pagesize 50000

• rowprefetch 2

• statementcache20

SQL*Plus Performance – Run Fast!

27

Page 26: Oracle Database 12c Features for Developers! · Learn Oracle Database 12c features relevant to developers (and DBA). SQL (DML, DDL) & SQL*Plus features Many features at a high level

©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.

New package – DBMS_TNS One function (for now) – RESOLVE_TNSNAME One parameter EZ Connect string or TNS Alias

SQL> select dbms_tns.resolve_tnsname('XXX') from dual;

DBMS_TNS.RESOLVE_TNSNAME('XXX')

---------------------------------------------------------(DESCRIPTION=(CONNECT_DATA=(SERVICE_NAME=SYS$USER)(CID=(PROGRAM=oracle)(HOST=myclient)(USER=oracle)))(ADDRESS=(PROTOCOL=TCP)(HOST=mydbhost)(PORT=1521)))

Verify database links quickly

SQL> SELECT DB_LINK, USERNAME, DBMS_TNS.RESOLVE_NAME (host) from DBA_DB_LINKS;

TNSPING from Database 12.2

Page 27: Oracle Database 12c Features for Developers! · Learn Oracle Database 12c features relevant to developers (and DBA). SQL (DML, DDL) & SQL*Plus features Many features at a high level

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

• Prepare your code to accommodate longer object names

• In 12.2, you can declare variable length using a constant

• The PL/SQL compiler has to know the value for the variable size at compile time.

• Cannot be results of a query.

• Recompile your code after changing constant value.

• ORA_MAX_NAME_LEN Constant

PL/SQL Programming

30

Code source: Chris Saxon, Oracle AskTom

create or replace package constants as

tab_length constant pls_integer := 128;

end constants;

/

declare

tab varchar2( constants.tab_length );

declare

tab varchar2( ora_max_name_len );

declare

if DBMS_DB_VERSION.VER_LE_12_1 $then

tab varchar2( 30 );

else

tab varchar2( ora_max_name_len );

end

Page 28: Oracle Database 12c Features for Developers! · Learn Oracle Database 12c features relevant to developers (and DBA). SQL (DML, DDL) & SQL*Plus features Many features at a high level

©2014 OneNeck IT Solutions LLC. All rights reserved. All other trademarks are the property of their respective owners.32 ©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 29: Oracle Database 12c Features for Developers! · Learn Oracle Database 12c features relevant to developers (and DBA). SQL (DML, DDL) & SQL*Plus features Many features at a high level

©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.

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 (segment).

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

_OPTIMIZER_GATHER_STATS_ON_LOAD=FALSE

12c adds this new parameter that can slow down data pump import operations when left at it's default setting of TRUE.

With 12c, if you intend on using EXCLUDE=STATISTICS for an import operation, then also set _OPTIMIZER_GATHER_STATS_ON_LOAD=FALSE at the database level.

Automatic Stats During Bulk Load

Page 30: Oracle Database 12c Features for Developers! · Learn Oracle Database 12c features relevant to developers (and DBA). SQL (DML, DDL) & SQL*Plus features Many features at a high level

©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.

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 31: Oracle Database 12c Features for Developers! · Learn Oracle Database 12c features relevant to developers (and DBA). SQL (DML, DDL) & SQL*Plus features Many features at a high level

©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.

There are two basic types of collation.

Binary : Ordering and comparisons of string data are based on the numeric value of the characters in the strings.

Linguistic : Ordering and comparisons of string data are based on the alphabetic sequence of the characters, regardless of their numeric values. The list of linguistic collations is available here.

When using collations there are three suffixes that alter the behaviour of sorts and comparisons.

"_CI" : Case insensitive, but accent sensitive.

"_AI" : Both case and accent insensitive.

"_CS" : Both case and accent sensitive.

If no collation is specified, directly or via a default setting, the default USING_NLS_COMP pseudo-collation is used, which means the NLS_SORT and NLS_COMP parameters are used to determine the actual collation used.

Case-Insensitive Database

https://oracle-base.com/articles/12c/column-level-collation-and-case-insensitive-database-12cr2

12.2

Page 32: Oracle Database 12c Features for Developers! · Learn Oracle Database 12c features relevant to developers (and DBA). SQL (DML, DDL) & SQL*Plus features Many features at a high level

©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.

Screen shots from https://oracle-base.com/articles/12c/column-level-collation-and-case-insensitive-database-12cr2

Case Insensitive Column - Example 12.2

Page 33: Oracle Database 12c Features for Developers! · Learn Oracle Database 12c features relevant to developers (and DBA). SQL (DML, DDL) & SQL*Plus features Many features at a high level

©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.

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 34: Oracle Database 12c Features for Developers! · Learn Oracle Database 12c features relevant to developers (and DBA). SQL (DML, DDL) & SQL*Plus features Many features at a high level

©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.

Live SQL is Running 12.2

Page 35: Oracle Database 12c Features for Developers! · Learn Oracle Database 12c features relevant to developers (and DBA). SQL (DML, DDL) & SQL*Plus features Many features at a high level

Thank you!

Daily #oratidbit on Facebook and Twitter. Follow me!

Tweets: @biju_thomasFacebook: facebook.com/oraclenotes

Google+: +bijoosoraclenotesBlog: bijoos.com/oraclenotes