Presentación Oracle Database Migración consideraciones 10g/11g/12c

Post on 02-Dec-2014

1,631 views 3 download

Tags:

description

Antes de migrar de 10g a 11g o 12c, tome en cuenta las siguientes consideraciones. No es tan sencillo como simplemente cambiar de motor de base de datos, se necesita hacer consideraciones a nivel del aplicativo.

transcript

Ronald Vargas Quesada, Oracle ACE

Expertise Database Management & Performance

Oracledbacr.blogspot.com

Technical Sales Consultant

Agenda Optimizador de consultas en Oracle Database, ( Optimización basada en

REGLA ó COSTO ) El parseo de instrucciones SQL en el motor de base de datos Compartiendo eficazmente de planes de ejecución en la base de datos Interpretación adecuada de los “Explain Plan” generados por la base de

datos Consideraciones para el uso adecuado de Índices basado en optimización

por "Costo“ Diseño y manejo de concurrencia a nivel de la base de datos. Concepto de AU ( Allocation Unit ) Buenas prácticas generales de afinamiento. Weblogic Server 12c, Nuevo Servidor de Aplicaciones

Arquitectura Ambientes Ejecución

Cliente / ServidorStandAlone

3 capasCliente delgado / AS DB

Host / Host

Nube

Dispositivos de acceso

Defining the Problem

Users DBA

Monitor

Reports and files

Database

instance

Feedback

Limit the Scope• Where is the problem?

– Application (SQL)– Instance– Operating system

Setting the Priority• Choose the problem that has the greatest impact:

– Analyze system performance in terms of work done (CPU or service time) versus time spent waiting for work (wait time).

– Determine which component consumes the greatest amount of time.

– Drill down to tune that component, if appropriate.

Concepto Convencional:

Arquitectura Oracle Instance y Database

Perspectiva física y lógica

Oracle Architecture & Features

Oracle Database 12c Architecture & New Features

Oracle Database 12c Architecture & New Features

SQL Statement Processing Phases

CloseOpen

FetchBindParse Execute

Considerations for SQL statements

Sensitive writingDriving Table ( Pivote )Clause: Where

Considerations for SQL statements

Table a = 20.000 rows

Table b = 25.000.000 rows

Order in clause FROM ?1. FROM a, b

2. FROM b, a

Considerations for SQL statements

Table a = 20.000 rows

Table b = 25.000.000 rows

Table c = 10.000.000 rows

Order in clause FROM ?1. FROM a, b, c

2. FROM b, c, a

3. FROM c, a, b

A ----- CB ----- C

You Probably Do Not Need to Use Bind Variables

Tom Kyte, Worst PracticesFor Developers and DBAs Alike

El rendimiento no es una preocupación !!!

SQL> set timing onSQL> begin 2 for i in 1 .. 100000 3 loop 4 execute immediate 5 'insert into t (x,y) 6 values ( ' || i || 7 ', ''x'' )'; 8 end loop; 9 end; 10 /

SQL> set timing onSQL> begin 2 for i in 1 .. 100000 3 loop 4 execute immediate 5 'insert into t (x,y) 6 values ( :i, ''x'' )' 7 using i; 8 end loop; 9 end; 10 /

+3x

Processing a DML StatementDatabase

Data files

Control files

Redo log files

UPDATE employees ...

Userprocess

SGA

Database buffer cache

Shared pool

Redo logbuffer

Serverprocess

31

4

2

EXPLAIN PLAN Command: Output

Plan hash value: 1343509718

-------------------------------------------------------------------------------| Id | Operation | Name | Rows | Bytes | Cost (%CPU|--------------------------------------------------------------------------------| 0 | SELECT STATEMENT | | 106 | 2862 | 6 (17|| 1 | MERGE JOIN | | 106 | 2862 | 6 (17|| 2 | TABLE ACCESS BY INDEX ROWID| DEPARTMENTS | 27 | 432 | 2 (0|| 3 | INDEX FULL SCAN | DEPT_ID_PK | 27 | | 1 (0||* 4 | SORT JOIN | | 107 | 1177 | 4 (25|| 5 | TABLE ACCESS FULL | EMPLOYEES | 107 | 1177 | 3 (0|--------------------------------------------------------------------------------

Predicate Information (identified by operation id):---------------------------------------------------

4 - access("E"."DEPARTMENT_ID"="D"."DEPARTMENT_ID") filter("E"."DEPARTMENT_ID"="D"."DEPARTMENT_ID")

18 rows selected.

SELECT PLAN_TABLE_OUTPUT FROM TABLE(DBMS_XPLAN.DISPLAY());

Reading an Execution Plan0 SELECT STATEMENT

SORT JOIN

1

3 5

MERGE JOIN

FULL TABLE SCANof EMPLOYEES

TABLE ACCESS BY INDEX ROWID

of DEPARTMENTS

INDEX FULL SCANDEPT_ID_PK

2 4

Selectivity– Selectivity represents a fraction of rows from a row source.

• Selectivity affects the estimates of I/O cost.• Selectivity affects the sort cost.

– Selectivity lies in a value range from 0.0 to 1.0.– When statistics are available, the estimator uses them to

estimate selectivity.– When statistics are not available the estimator uses default

values or dynamic sampling.– With histograms on columns that contain skewed data, the

results are good selectivity estimates.

Cardinality and Cost– Cardinality represents the number of rows in

a row source.– Cost represents the units of work or

resource that are used.

Changing Optimizer Behavior• The optimizer is influenced by:

– SQL statement construction– Hints– Statistics– Data structure– System parameters– Session parameters– SQL Plan Management options

Using Hints• Hints

– Are directives (suggestions) to the optimizer– Require changing the code– Are useful to test specific access paths– Must be maintained through upgrades– _optimizer_ignore_hints enables all

embedded SQL hints to be ignored

SELECT /*+ INDEX (tablename indexname) */ …

Optimizer Statistics• The optimizer depends on various statistics to

determine an optimal execution plan for an SQL statement.– Some statistics are gathered at various times and are

controlled by statistic preferences.• Object statistics • Dictionary statistics

– Other statistics are only gathered manually.• Statistics on fixed objects• Operating system statistics

Extended Statistics• Optimizer needs additional statistics in some cases.

– Multicolumn statistics for related columns (column groups)• Collect statistics over a group of columns• For complex predicates• For equality predicates only

– Expression statistics for function-based indexes

• Collect statistics over an expression• For expressions used in predicates • Creates a virtual column

Controlling the Behavior of the Optimizer with Parameters

• Optimizer behavior can be controlled using the following initialization parameters:– CURSOR_SHARING = EXACT– DB_FILE_MULTIBLOCK_READ_COUNT = 8,16– OPTIMIZER_INDEX_CACHING = 0– OPTIMIZER_INDEX_COST_ADJ = 100– PGA_AGGREGATE_TARGET = nn MB/GB– Optimizer underscore parameters:

• OPTIMIZER_FEATURES_ENABLE = Actual Version• OPTIMIZER_MODE = ALL_ROWS

Optimizer with Parameters: Cursor_Sharing

Les facilito esta nota de Tom Kyte ( ASKTOM) 

https://blogs.oracle.com/optimizer/entry/explain_adaptive_cursor_sharing_behavior_with_cursor_sharing_similar_and_force

Aquí clarifica bastante el tema del uso de cursor_sharing para sus valores. La nota esta en MOS es correcto, pero no esta obsoleto en 11g

También les paso esta otra nota de Morgan, ( otro viejo amigo ), que explica lo mismo y que el valor esta aún disponible en 11.2.0.4

http://www.morganslibrary.org/reference/cursor_sharing.html

Enabling Query Optimizer Features – The optimizer behavior can be set to prior

releases of the database.– The OPTIMIZER_FEATURES_ENABLE

initialization parameter can be set to values of different database releases (such as 8.1.7 or 12.1.0).

– Example:

OPTIMIZER_FEATURES_ENABLE=‘9.2.0';

Influencing the Optimizer Approach• The optimizer approach is to evaluate based on one of the following:

– Best throughput (default)– Fastest response

• The OPTIMIZER_MODE parameter can be set to change the approach:– ALL_ROWS (default)– FIRST_ROWS[_n]

• The OPTIMIZER_MODE can be set at various levels– System – ALTER SYSTEM SET…– Session – ALTER SESSION SET…– Statement – hint - /*+ FIRST_ROWS_10 */

Hash Joins• A hash join is executed as follows:

– Both tables are split into as many partitions as required, using a full table scan.

– For each partition pair, a hash table is built in memory on the smallest partition.

– The other partition is used to probe the hash table.

Sort-Merge Joins• A sort-merge join is executed as follows:1. The rows from each row source are sorted on

the join predicate columns.

2. The two sorted row sources are then merged and returned as the resulting row source.

Join Performance• Each join method works best in certain situations.

– Nested join• Small tables • Indexes on join columns

– Hash joins• Large tables• A large and small table• A large portion of the table is selected for the join

– Merge-sort• Non-equijoin • Row sources are already sorted

How the Query Optimizer Chooses Execution Plans for Joins

• The query optimizer determines: – Row sources– Type of join– Join method– Cost of execution plans– Other costs such as:

• I/O• CPU time• DB_FILE_MULTIBLOCK_READ_COUNT

– Hints specified

Optimezer Cost / Rule ?• Rule / Cost

– Oracle Database 10gR1/R2 or <• Cost

– Oracle Database 11gR1 or >

Optimizer Effects on indexes• Rule

– Syntactic Evaluation• Cost

– Mathematical

Optimizer Effects on indexes

a a a a a b b b b b b a

c c c d d

e

abcde

Rule Cost

• Query returned more than 5%– FTS for rule

• Invalid entries aprox 20%– FTS for rule

• Query without index– FTS for rule

• Table or Index without statistics– FTS for rule

Optimizer effects on indexes

• 5 Pilares de la nube• Infraestructura-as-a-Service (IaaS), que da a los usuarios acceso a los componentes de la infraestructura en una plataforma de Cloud, tales como los sistemas operativos y software de otro sistema

• Base de datos-as-a-Service (DBaaS), que ofrece a los usuarios el acceso a bases de datos que se ejecutan en una plataforma de computación en nube

• Platform-as-a-Service (PaaS), que ofrece a los usuarios el acceso a entornos de desarrollo y despliegue que se ejecutan en una plataforma de Cloud

• Software-as-a-Service (SaaS), que ofrece a los usuarios acceso a las soluciones que se ejecutan en una plataforma de computación en nube

• Middleware-as-a-Service (MWaaS) Ofrece un entorno completo que consta de todos los servicios necesarios para implementar y ejecutar una aplicación de clase empresarial.

DBaaS

PaaS

IaaS

SaaS

MWaaS

Nueva Plataforma de Tecnología

Oracle Weblogic Server 12c: Hacia un solo AS

Evolución a WLS 11g

Oracle Weblogic Server 12cLa más moderna versión de su servidor de aplicaciones Oracle WebLogic Server 12c, es la pieza central de Cloud Application Foundation y de Fusion Middleware, y esta especialmente diseñada para desplegar sistemas de información convencionales, así como de ingeniería y entornos en la nube.

Oracle Weblogic Server 12cEstá creada sobre tecnologías basadas en estándares para cuestiones de portabilidad, eficiencia y facilidad de integración.

Administración WebLogic ServerCloud Management – Nuevo en Enterprise Manager Cloud Control 12c

WebLogic Server 12c• Monitoreo de Rendimiento y

Diagnóstico• Administración de Configuraciones • Aprovisionamiento de Dominios y

Java EE App• Integración con MOS & Support

Workbench

Administración en la Nube• Self Service• Medición y devoluciones de cargo• Consolidation Planner

Oracle Weblogic Server 12c: Con OEM 12c

Oracle Forms 11gR2 ahora puede ser monitorizado desde RUEI ofreciéndonos información de las páginas visitadas por los usuarios, cuánto tiempo permanecen en ellas, etc.

• Oracle Forms & Reports 12c, como parte de Fusion Middleware. Integración con SOA, Coherence, Social. Posiblemente liberado para finales del Y13, principios de Y14

• A partir de la versión 13c de FMW, Reports ya no formará parte del kit de desarrollo aplicativo. Oracle Forms 13c y Oracle BI Publisher, es la combinación para las futuras versiones.

Oracle Weblogic Server 12c: F&R Servicies

Cuál es el Presente y Futuro de Forms & Reports ?

– Oracle Forms 6i and Oracle Reports 6i will be de-supported effective 01/31/05. – Oracle Forms 9iAS R2, April 2002– Oracle Forms 10g 9.0.4, December 2003– Oracle Forms 10gR2, January 2005– Oracle Forms 11g , January 2011– Oracle announced that Oracle Forms & Reports does not go from 2017– March 2012, Oracle has no plan to discontinue support of Oracle Forms. Furthermore, a

new version of Forms, Oracle Forms 12c, is planned for delivery as a component of Oracle Fusion Middleware 12c.

– The last major changes to Oracle Reports were in the 10g release. Since then, there have been limited new features added to the product in Oracle Reports 11gR1 and 11gR2. Development efforts for Oracle Reports since 10g have been focused on stability and bug fixes. We are planning to release Oracle Reports 12c as part of Oracle Fusion Middleware 12c.However, Oracle’s strategic reporting solution is now BI Publisher.

Recommendations for Oracle Customers Looking to Migrate from Forms and Reports

– In some cases, there may exist a business driver to move existing applications from Oracle Forms to a different technology choice. For example, Oracle Forms may no longer be the ideal fit for the application requirements, or you may be adopting a strategy to consolidate disparate or heterogeneous development environments

– Oracle JDeveloper 11g with Oracle ADF is the tool of choice for building applications on Fusion Middleware. However, given the architectural difference between Java EE and Oracle Forms, Oracle has no plans to offer a complete migration solution that attempts to automatically migrate applications built with these tools to Java EE.

Qué ganamos Weblogic Server 12c ?

Oracle Weblogic Server 12c: Principales novedades de WLS 11g

Oracle Weblogic Server 12c: Innovación

– Java EE 6 y Java SE 7– Mejor productividad del desarrollador ( Jrockit, FastSwap, Coherence

) – Implementación y administración simplificados con la virtualización– Integración de la Gestión de Tráfico – Alta Disponibilidad y Recuperación de Desastres– Rendimiento mejorado– Actualización sin problemas

Oracle Weblogic Server 12c: Principales novedades

WebLogic Server en ExalogicMás rápido en nuestros sistemas – Nuevo en WebLogic Server 12c

WebRequests/Sec.

Conventional HardwareExalogic

10X

78,840

836,520

Enterprise Java Operations/Sec.

Conventional HardwareExalogic

5X

9,560

49,460

JMSMessages/sec.

Conventional HardwareExalogic

5X

401,070

1,979,940

Oracle Weblogic Server 12c: Menos trabajo para migrar

* Ejemplo basado en una aplicación construída para JavaOne

• Less XML, Less Code• Java Server Faces 2.0• Java Servlets 3.0• Java Persistence 2.0• Enterprise Java Beans 3.1

& Interceptors 1.1

Lines of Code* Lines of XML*Java Classes*

25%Less

50%Less

80%Less

• Simplification, Productivity• Managed Beans 1.0• Bean Validation 1.0• JAX-WS 2.2

• Modernization• Context & Dependency

Injection 1.0• Bean Validation 1.0• Java API for RESTful

Web Services

Oracle Weblogic Server 12c: Mejoras con Java EE 6

Weblogic Server 12c: Java SE 7: Más limpio, código más fácil de mantener

7• Oracle WebLogic Server 12c

soporta Java SE 7 ( y Java SE 6)

• Optimización de lenguaje Java• Cliente/Servidor• Internacionalización• Capa de conexión segura SSL/TLS

(Transport Security Layer es el sucesor para SSL )1.2 en JSSE (Java Secure Socket Extension)

• Java VM concurrentes

rvargas@netsoftca.com

Twitter: @rovaque

Blog: oracledbacr.blogspot.com

Muchas Gracias