2. email: alfredokrieg@gmail.com
Senior Oracle Cloud Administrator at The
Sherwin-Williams Company based in
Cleveland, Oh
Oracle ACE
OEM Cloud Control 13c and Database
Performance Tuning
Oracle Technologies since 2004 & 11g
Certified
Blog bitkode.blogspot.com
3. New Features for Developers
◦ Conversion Functions
CAST, TO_* & VALIDATE_CONVERSION
Identifiers
SQL*Plus New Features
◦ History
◦ SET PREFETCH
◦ SET LOBPREFETCH
◦ SET STATEMENTCACHE
◦ SET FEEDBACK ONLY
◦ FAST option
◦ SET MARKUP CVS
◦ Identifier Length
◦ VARIABLE
◦ SYSRAC Administrative Privilege
4. New Features for Administrators
◦ Database Upgrade
◦ Multi-tenant & PDBs
◦ Performance
◦ DBMS_STATS
◦ Cursor Management
◦ RMAN
◦ Data Guard
◦ Partitioning
◦ Materialized Views
◦ Datapump
◦ Compression
◦ Scheduler
◦ Grid Infrastructure
5. Conversion Functions (CAST)
CREATE TABLE test_tbl ( id1 VARCHAR2(10) );
INSERT INTO test_tbl VALUES('1');
INSERT INTO test_tbl VALUES('2');
INSERT INTO test_tbl VALUES('A');
COMMIT; SELECT * FROM test_tbl;
ID1
----------
1
2
A
SELECT CAST(id1 AS NUMBER) num FROM test_tbl;
SQL Error: ORA-01722: invalid number
SELECT id1, CAST(id1 AS NUMBER DEFAULT -900 ON CONVERSION ERROR) num FROM test_tbl;
ID1 NUM
---------- ----------
1 1
2 2
A -900
6. Conversion Functions (TO_)
SELECT TO_NUMBER(id1) num FROM test_tbl;
SQL Error: ORA-01722: invalid number
SELECT id1, TO_NUMBER(id1 DEFAULT -900 ON CONVERSION ERROR) num FROM test_tbl;
ID1 NUM
---------- ----------
1 1
2 2
A -900
Conversion Functions
(VALIDATE_CONVERSION)
SELECT id1 FROM test_tbl
WHERE VALIDATE_CONVERSION(id1 AS NUMBER) = 1;
7. Identifier Length
The maximum length of identifier names
increased to 128 bytes/char instead of 30
bytes/char.
8. SQL*Plus History
◦ HIST[ORY]
◦ RUN, EDIT, DEL[ETE], CLEAR & LIST
SQL> set history on
SQL> show history History is ON and set to "100"
SQL> set history off
SQL> show history History is OFF
SQL> set history 1000
SQL> show history
SQL> History is ON and set to "1000"
9. SQL> show history
History is ON and set to "100"
SQL> show user
USER is "SYSTEM"
SQL> desc dual
Name Null? Type
----------------------------------------- -------- ----------------------------
PROD VARCHAR2(1)
SQL> select * from dual;
D
-
X
SQL> history 4 run
D
-
X
SQL> history
1 show history
2 show user
3 desc dual
* 4 select * from dual;
10. SQL*Plus SET ROWPREFETCH
Minimize server roundtrips in a query.
Reduces OCI fetch calls by prefetching data on
the OCI execute call.
(Was available in JDBC)
SQL> set rowprefetch 20
SQL> Select * from emp;
11. SQL*Plus SET LOBPREFETCH
Minimize server roundtrips in a query by
caching LOB data when is within the defined
size.
SQL> set lobprefetch 2000
SQL> select * from lob_tab;
12. SQL*Plus SET STATEMENTCACHE
Will cache executed statements in the current
session. Reduces parsing time for the same
query.
SQL> set statementcache 20
SQL> select * from emp;
SQL> select * from emp;
13. SQL*Plus SET FEEDBACK ONLY
This option will display the number of rows
selected without displaying the data. Useful to
measure fetch time.
SQL> set feedback only
SQL> select * from emp;
14 rows selected.
14. SQL*Plus command line –FAST option
Improves performance when using command
line option. It SETs the following values:
◦ ARRAYSZE 100
◦ LOBPREFETCH 16384
◦ PAGESIZE 50000
◦ ROWPREFETCH 2
◦ STATEMENTCACHE 20
$ sqlplus –f @emp.sql
15. SQL*Plus SET MARKUP CVS
Will format the output in CSV format:
◦ SET MARKUP CSV ON [DELIMI[TER] character] [QUOTE {ON|OFF}]
SQL> set markup csv on
SQL> select * from emp;
"EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COM
M","DEPTNO"
7369,"SMITH","CLERK",7902,"17-DEC-80",800,,20
7499,"ALLEN","SALESMAN",7698,"20-FEB-
81",1600,300,30
7521,"WARD","SALESMAN",7698,"22-FEB-
81",1250,500,30 7566,"JONES","MANAGER",7839,"02-
APR-81",2975,,20
3 rows selected.
16. VARIABLE
VARIABLE can now assign values directly.
12.1
SQL> variable text char
SQL> exec :text:='X'
PL/SQL procedure successfully completed
12.2
SQL> variable text char=‘X’
17. SYSRAC Administrative Privilege
The SYSRAC administrative privilege is used by the Oracle
Real Application Clusters (Oracle RAC) Clusterware agent.
The SYSRAC administrative privilege provides only the
minimal privileges necessary for performing day-to-day
Oracle RAC operations. For example, this privilege is used
for Oracle RAC utilities such as SRVCTL.
https://docs.oracle.com/en/database/oracle/oracle-database/12.2/dbseg/configuring-privilege-and-role-authorization.html#GUID-
69D0614C-D24E-4EC1-958A-79D7CCA3FA3A
18. Database Upgrade
◦ Automatically Setting of User Tablespaces to Read
Only During the Upgrade
$dbupgrade –T -l $ORACLE_HOME/diagnostics
Oracle Database 12c Release 2 (12.2) DBUA : Understanding New Changes / Features (Doc ID 2171985.1)
19. Database Upgrade
◦ Automatic catuppst.sql Script Run During Upgrade
◦ Automatic Resume After Failed Upgrades
Both DBUA and manual upgrade
DBUA screen needs to be up and running
◦ Pre-Upgrade Tool Script
Preupgrd.sql & utluppkg.sql replaced by
preupgrade.jar
◦ Prioritize PDB Upgrades
20. Multi-tenant & PDBs
◦ Support for 4096 PDBs per container (252 in 12.1)
◦ PDBs with different Char Sets, TZ File Versions and
DB TZ in a CDB
◦ Cloning a PDB without setting the source to read-
only
◦ Resource Manager (RM) can now manage memory
usage between PDBs in a CDB including Per-Process
PGA limits
◦ I/O Rate limits. MAX_IOPS and MAX_MBPS params
◦ Flashback PDBs
◦ Local UNDO: alter database local undo on
21. Multi-tenant & PDBs
◦ Initialization Parameters
AWR_PDB_AUTOFLUSH_ENABLED
Enables or disables AWR snapshots for all or individual PDBs
ENABLE_AUTOMATIC_MAINTENANCE_PDB
Enables or disables the automated maintenance tasks for all
or individual PDBs
AUTOTASK_MAX_ACTIVE_PDBS
Specifies the number of PDBs that can schedule automated
maintenance tasks at the same time (during a maintenance
window)
22. Multi-tenant & PDBs
◦ Heat Map and Automatic Optimization (ADO) now
available at CDB level
◦ PDB Refresh – Is a read only PDB (on
demand|automatic)
◦ Proxy PDB – aggregate data from multiple backends
◦ Hint in CONTAINERS query.
SELECT /*+ CONTAINERS
(DEFAULT_PDB_HINT=<hint_string>) */ ...
FROM CONTAINERS (<object>)
23. Performance
◦ Optimizer Statistics Advisor
Stale, out-of-date, missing vs Poor quality
Automated
Manual
Generates findings, but does not implement actions
automatically
Results stored in SYSAUX TBS
◦ Active Data Guard Support for SQL Tuning Advisor
◦ SPM
Create baseline from AWR
Automatic capture can filter plans
25. DBMS_STATS
◦ DBMS_STATS preference for automatic column
group statistics (AUTO_STAT_EXTENSION|off)
◦ DBMS_STATS statistics
preference PREFERENCE_OVERRIDES_PARAMETER
◦ Access to current statistics does not
require FLUSH_DATABASE_MONITORING_INFO.
You no longer need to ensure that view metadata is up-to-date by
using DBMS_STATS.FLUSH_DATABASE_MONITORING_INFO to save monitoring
information to disk.
26. Cursor
◦ Cursor-duration temporary tables
In memory during query compilation
Complex operations such a WITH clause or start
transformations
Optimizes I/O
◦ Fine-grained cursor invalidation
Specify deferred invalidation on DDL statements
ALTER TABLE ... DEFERRED INVALIDATION
This option depends on the DDL statement. Not
available to all.
27. RMAN
◦ RECOVER DATABASE UNTIL AVAILABLE REDO
◦ Recovery – REMAP_SCHEMA for tables
◦ Disk space check during RECOVER TABLE
◦ SET NEWNAME works on entire tablespace or
database instead of on per file basis.
Data Guard
◦ Broker supports multi-instance redo apply
◦ Password file automatically synchronize
◦ Active DG preserves connections during role
changes
28. Partitioning
◦ Alter table to convert standard table to partitioned tables
online
◦ Read-only partitions
◦ Online partition maintenance with SPLIT operations
◦ Partitioned external tables
Materialized Views
◦ Real-Time materialized views
A real-time materialized view is a type of materialized view that
provides fresh data to user queries even when the materialized
view is not in sync with its base tables because of data changes
(STALE)
◦ Statement-Level refresh (ON STATEMENT)
◦ Refresh Statistics History
29. Datapump
◦ Parfile content written to logfile
◦ Parallel operation for metadata_only
◦ Import LONG type using NETWORK_LINK
◦ REMAP_DIRECTORY
Compression
◦ Advanced Index compression. High compression
available
30. Scheduler
◦ Job Incompatibilities
◦ Resource Queues - jobs cannot execute until the
required resources are available
◦ In-Memory Jobs (repeating | one time)
Grid Infrastructure
◦ OCR and Voting Files must be stored in ASM
◦ Cluster Resource Activity Log
◦ CVU – Second Generation
Provides status of progress of each check
Output format as XML or HTML
32. EM Express: Single Port Access for Multitenant - 12.2 New Feature (Doc ID 2170770.1)
Restricting the PGA Usage Per Session Level Using Resource Manager - 12.2 New Feature (Doc ID 2170748.1)
Grid Infrastructure 12.2 New Feature: Clusterware Files Must Be Stored in ASM (Doc ID 2201844.1)
12.2 New Feature: Database In-Memory (IM) Column Store Join Groups (Doc ID 2242995.1)
12.2 New Feature: Database In-Memory (IM) Column Store Expressions (Doc ID 2242973.1)
12.2 New Feature: Database In-Memory (IM) FastStart (Doc ID 2242985.1)
Oracle Database 12c Release 2 (12.2) DBUA In Silent Mode (Doc ID 2172040.1)
Complete Checklist for upgrading Oracle 12.1 Container Database (CDB) to Oracle Database 12c Release 2 (12.2) using DBUA (Doc ID 2240413.1)
Complete Checklist for Upgrading to Oracle Database 12c Release 2 (12.2) using DBUA (Doc ID 2189854.1)
Real Application Testing: Database Replay New Features for 12.2 (Doc ID 2208707.1)
12.2 NEW FEATURE : -RECOVER DATABASE UNTIL AVAILABLE REDO (Doc ID 2300465.1)
How to Control and Monitor the Memory Usage (Both SGA and PGA) Among the PDBs in Mutitenant Database- 12.2 New Feature (Doc ID 2170772.1)
Oracle Database 12c Release 2 (12.2) DBUA : Understanding New Changes / Features (Doc ID 2171985.1)
Data Pump: Oracle Database 12c Release 2 (12.2) New Features (Doc ID 2249901.1)
Oracle Database Upgrade Known issues - 12.2 (Doc ID 2243613.1)
Oracle Database 12c Release 1 (12.2) Upgrade New Features (Doc ID 2316310.1)
Database 12.2 Installation,Upgrade related FAQ’s (Doc ID 2308753.1)
ORA-01450: Maximum Key Length Exceeded error while creating function based index in 12.2 database (Doc ID 2324543.1)
Requirements for Installing Oracle Database 12.2 64-bit (AMD64/EM64T) on SLES 12 (Doc ID 2194473.1)
Column Collation and Case Insensitive Database - 12.2 Feature (Doc ID 2198234.1)
I/O Rate Limits for PDBs 12.2 New feature . (Doc ID 2164827.1)
12.2 NEW FEATURE JOB_QUEUE_PROCESSES=4000 CAN ONLY HANDLE A MAXIMUM OF 1024 JOBS (Doc ID 2315892.1)
Optimizer Statistics Advisor In 12.2 (Doc ID 2259398.1)
SYSAUX Tablespace Grows Rapidly After Upgrading Database to 12.2.0.1 Due To Statistics Advisor (Doc ID 2305512.1)
Rolling Back Online Table Redefinition (Doc ID 2164079.1)
SPM From the AWR repository (new to Oracle Database 12c Release 2)