You are on page 1of 53

www.en-sof.com.

br

GERENCIANDO MUDANAS - ORACLE 11G 1

11g

CHANGE MANAGEMENT

Luciano Incio de Melo Oracle Database Administrator Certified Oracle Instructor Bacharel em Cincias da Computao - UNESP Mestre em Engenharia da Computao IPT/USP
www.en-sof.com.br 2 11g

SCHEDULE

1. 2. 3. 4.

Introduction SQL Performance Analyzer SQL Plan Management Database Replay

www.en-sof.com.br

11g

ENTERPRISE GRID COMPUTING

SMP dominance

RAC clusters for availability

Grids of low-cost hardware and storage

Managing change across the enterprise

www.en-sof.com.br

11g

CHALLENGES FACED BY DBAS WHEN PERFORMING CHANGES

Maintaining service-level agreements through changes to hardware or software configurations


Change is the most common cause of instability.

Offering production-level workload environment for testing purposes


Actual workloads are difficult to simulate. Realistic testing before production is impossible.

Effectively forecasting and analyzing impact on SQL performance


Reluctance to make changes Inability to adopt new competitive technologies

www.en-sof.com.br

11g

LIFECYCLE OF CHANGE MANAGEMENT


Test
(Database Replay or SQL Performance Analyzer)

Make change Set up test environments


(snapshot standbys)

Diagnose and resolve problems


(advisors)

Provision for production Diagnose problems

Patches and workarounds

Realistic testing
www.en-sof.com.br 6 11g

LIFECYCLE OF CHANGE MANAGEMENT


Test Make change Set up test environments Diagnose and resolve problems

Provision for production


(rolling upgrades)

Patches and workarounds


(Enterprise Manager)

Diagnose problems
(ADR/Support Workbench)

Provisioning automation
www.en-sof.com.br 7 11g

SETTNG UP A TEST ENVIRONMENT BY USING THE SNAPSHOT STANDBY DATABASE

Redo stream

Physical standby database

Open database as snapshot standby.

Back out testing changes.

Redo stream

Snapshot standby database


8

Perform testing

www.en-sof.com.br

11g

CHANGE MANAGEMENT UNITS

Database Replay

GB HJ HJ

SQL Performance Analyzer


www.en-sof.com.br 9

SQL Plan Management


11g

CHANGE MANAGEMENT UNITS

Database Replay

GB HJ HJ

SQL Performance Analyzer


www.en-sof.com.br 10

SQL Plan Management


11g

SQL PERFORMANCE ANALYZER: USER CASES


SQL Performance Analyzer is beneficial in the following use cases: Database upgrades Implementation of tuning recommendations Schema changes Statistics gathering Database parameter changes OS and hardware changes

www.en-sof.com.br

11

11g

USAGE MODEL

1. 2. 3. 4. 5.

Capture SQL Workload Transport to a Test System Build Before Change Performance Build After Change Performance Compare and Analyze Performance

www.en-sof.com.br

12

11g

1. CAPTURE SQL WORKLOAD


SQL Tuning Set (STS) is used to store SQL workload. Includes:
SQL Text Bind variables Execution plans Execution statistics

Cursor cache
Incremental capture

Database Instance

Production database

Incremental capture is used to populate STS from cursor cache over a period of time. STSs filtering and ranking capabilities filter out undesirable SQL.
13 11g

www.en-sof.com.br

2. TRANSPORT TO A TEST SYSTEM

Cursor cache Database instance Database instance

Production database

Test database

Copy SQL Tuning Set to staging table (pack). Transport staging table to test system (data pump, DB link, etc). Copy SQL Tuning Set from staging table (unpack).
14 11g

www.en-sof.com.br

3. BUILD BEFORE CHANGE PERFORMANCE


Before change, SQL performance version is the SQL workload performance baseline. SQL performance = execution plans + execution statistics Test/execute SQL in STS:
Produce execution plans and statistics. Execute SQL serially (no concurrency). Every SQL is executed only once. Skip DDL/DML effects.

Test/execute

Before changes

Database instance

Explain plan SQL in STS to generate SQL plans only.


15

Test database

www.en-sof.com.br

11g

4. BUILD AFTER CHANGE PERFORMANCE


Manually implement the planned change: Database upgrade Implementation of tuning recommendations Schema changes Statistics gathering Database parameter changes OS and hardware changes Reexecute SQL after change: Test/execute SQL in STS to generate SQL execution plans and statistics. Explain plan SQL in STS to generate SQL plans. 16 www.en-sof.com.br

After changes

Database instance
After changes implemented

Test database

11g

5. COMPARE AND ANALYZE PERFORMANCE


Rely on user-specified metric to compare SQL performance: elapsed_time, buffer_gets, disk_reads, ... Calculate impact of change on individual SQLs and SQL workload: Overall impact on workload Net SQL impact on workload Use SQL execution frequency to define a weight of importance. Detect improvements, regressions, and unchanged performance. Detect changes in execution plans. Recommend running SQL Tuning Advisor to tune regressed SQLs. Analysis results can be used to seed SQL Plan Management baselines.
SQL Tuning Advisor

Improvement Compare analysis

Regression

Database instance

Test database

www.en-sof.com.br

17

11g

COMPARISON REPORT EXAMPLE

www.en-sof.com.br

18

11g

CHANCE MANAGEMENT UNITS

Database Replay

GB HJ HJ

SQL Performance Analyzer


www.en-sof.com.br 19

SQL Plan Management


11g

SQL PLAN MANAGEMENT: OVERVIEW


SQL Plan Management is automatically controlled SQL plan evolution. Optimizer automatically manages SQL plan baselines. baselines
Only known and verified plans are used.

Plan changes are automatically verified. verified


Only comparable or better plans are used going forward.

Can preseed critical SQL with SQL Tuning Set (STS) from SQL Performance Analyzer

www.en-sof.com.br

20

11g

SQL PLAN BASELINE: ARCHITECTURE


SYSAUX SQL Management Base Statement log Plan history
GB HJ HJ GB HJ HJ

Plan history
HJ HJ GB HJ HJ GB HJ HJ

Plan baseline GB

Repeatable SQL statement

Plan baseline GB

HJ HJ

SQL profile

Plan History
GB HJ HJ GB HJ HJ

Plan baseline GB

HJ HJ

Plan verification before integration to baseline

Automatic SQL Tuning task

www.en-sof.com.br

21

11g

LOADING SQL PLAN BASELINES


load_plans_from_cursor_cache
OPTIMIZER_CAPTURE_SQL_PLAN_BASELINES=TRUE

dbms_spm

Plan history
ba se an lin Pl GB e
HJ HJ

Plan history 1
an Pl

ba

se lin e

GB HJ HJ

2
GB HJ HJ

GB HJ HJ

alter_sql_plan_baseline *_stgtab_baseline

3 Plan history
HJ

Cursor cache

Staging table

ba an GB seli l P ne
HJ

DBA

www.en-sof.com.br

22

load_plans_from_sqlset

11g

POSSIBLE SQL PLAN MANAGEABILITY SCENARIOS


Database Upgrade
Oracle Database 11g
GB HJ HJ

New Application Deployment


Production database
GB HJ HJ

Plan History ba se an lin Pl GB e


HJ HJ

Plan History ba se an lin Pl GB e


HJ HJ

No plan regressions

No plan regressions

DBA

DBA
Welltuned plan
GB HJ HJ GB HJ HJ

Plan history ba se an l lin P GB e


HJ HJ

Well-tuned plan

Oracle Database 10g

Development database

Baseline plans staging table

www.en-sof.com.br

23

11g

LOADING A SQL PLAN BASELINE AUTOMATICALLY


Oracle Database 11g
Plan history Plan baseline GB
HJ HJ

No plan regressions

Oracle Database 11g


New plan waiting verification
GB HJ HJ

GB HJ

GB HJ

Plan history Plan baseline GB


HJ HJ

No plan regressions

HJ

HJ

optimizer_features_enable=10.2.0.2 optimizer_capture_sql_plan_baselines=true

optimizer_features_enable=11.1.0.1 optimizer_capture_sql_plan_baselines=true

Oracle Database 11g


Plan history Plan baseline
GB HJ HJ GB HJ HJ GB HJ HJ GB HJ HJ GB HJ HJ

Better plans

Welltuned plans

Oracle Database 10g

optimizer_features_enable=11.1.0.1 optimizer_capture_sql_plan_baselines=true

www.en-sof.com.br

24

11g

LOADING A SQL PLAN BASELINE MANUALLY


variable report clob exec :report:=DBMS_SPM.EVOLVE_SQL_PLAN_BASELINE(sql_handle=>'SYS_SQL_593bc74fca8e6738'); Print report

Plan history Automatic SQL Tuning


ba se an lin Pl GB e
HJ HJ GB HJ HJ

DBA

>?

SQL Tuning Advisor

www.en-sof.com.br

25

11g

ENTERPRISE MANAGER AND SQL PLAN BASELINES

www.en-sof.com.br

26

11g

CHANGE MANAGEMENT UNITS

Database Replay

GB HJ HJ

SQL Performance Analyzer


www.en-sof.com.br 27

SQL Plan Management


11g

WHY USE DATABASE REPLAY?


System changes (such as hardware and software upgrades) are a fact of life. Customers want to identify the full impact of changes before going live. Extensive testing and validation can be expensive in terms of time and money. Despite expensive testing, success rates are low: Many issues go undetected. Changes can negatively affect system availability and performance. Cause of low success rate: Inability to properly test with real-world production workloads, with many issues going undetected. The Database Replay feature makes it possible to do real-world testing.

www.en-sof.com.br

28

11g

DATABASE REPLAY
Re-create actual production database workload in test environment. Identify and analyze potential instabilities before making changes to production. Capture workload in production: Capture full production workload with real load & concurrency Move the captured workload to test system Replay workload in test: Make the desired changes in test system Replay workload with production load & concurrency Honor commit ordering Analyze and report: Errors Data divergence Performance divergence 29 11g

www.en-sof.com.br

THE BIG PICTURE

www.en-sof.com.br

30

11g

DATABASE REPLAY WORKFLOW IN ENTERPRISE MANAGER

1. 2. 3. 4. 5. 6. 7. 8.

Capture the workload on a database. (Task 1) Optionally export the AWR data. (Task 1) Restore the replay database on a test system. Make changes to the test system as required. Copy the workload to the test system. Preprocess the captured workload. (Task 2) Configure the test system for the replay. Replay the workload on the restored database. (Task 3)
31 11g

www.en-sof.com.br

1. CAPTURING WORKLOAD WITH ENTERPRISE MANAGER

www.en-sof.com.br

32

11g

USING THE CAPTURE WIZARD

www.en-sof.com.br

33

11g

USING THE CAPTURE WIZARD

www.en-sof.com.br

34

11g

USING THE CAPTURE WIZARD

www.en-sof.com.br

35

11g

USING THE CAPTURE WIZARD

www.en-sof.com.br

36

11g

USING THE CAPTURE WIZARD

www.en-sof.com.br

37

11g

2. OPTIONALLY EXPORT THE AWR DATA (CAPTURE WIZARD)

www.en-sof.com.br

38

11g

STEPS THAT ARE NOT PART OF THE EM WORKFLOW


3. Restore the replay database on a test system. Backup / restore Snapshot Standby database 4. Make changes to the test system as required. Database upgrades, patchs Schema, parameters CPU, Memory, Storage 5. Copy the workload to the test system. File transfer: ftp, scp, ...
www.en-sof.com.br 39 11g

6. PROCESSING CAPTURED WORKLOAD

www.en-sof.com.br

40

11g

USING THE PREPROCESS CAPTURED WORKLOAD WIZARD

www.en-sof.com.br

41

11g

7. CONFIGURE THE TEST SYSTEM FOR THE REPLAY

www.en-sof.com.br

42

11g

8. REPLAY THE WORKLOAD (USING WIZARD)

www.en-sof.com.br

43

11g

REPLAY WORKLOAD WIZARD

www.en-sof.com.br

44

11g

REPLAY WORKLOAD WIZARD

www.en-sof.com.br

45

11g

REPLAY WORKLOAD WIZARD

www.en-sof.com.br

46

11g

REPLAY WORKLOAD WIZARD


$ wrc REPLAYDIR=/home/oracle/solutions/dbreplay USERID=system PASSWORD=oracle Workload Replay Client: Release 11.1.0.6.0 - Production on Tue Copyright (c) 1982, 2007, Oracle. All rights reserved. Wait for the replay to start (21:47:01) $ wrc REPLAYDIR=/home/oracle/solutions/dbreplay USERID=system PASSWORD=oracle Workload Replay Client: Release 11.1.0.6.0 - Production on Tue Copyright (c) 1982, 2007, Oracle. All rights reserved. Wait for the replay to start (21:47:01)

www.en-sof.com.br

47

11g

REPLAY WORKLOAD WIZARD

$ wrc REPLAYDIR=/home/oracle/solutions/dbreplay USERID=system PASSWORD=oracle Workload Replay Client: Release 11.1.0.6.0 - Production on Tue Copyright (c) 1982, 2007, Oracle. All rights reserved. Wait for the replay to start (21:47:01) Replay started (21:48:14)

www.en-sof.com.br

48

11g

VIEWING WORKLOAD REPLAY STATISTICS

www.en-sof.com.br

49

11g

VIEWING WORKLOAD REPLAY STATISTICS

$ wrc REPLAYDIR=/home/oracle/solutions/dbreplay USERID=system PASSWORD=oracle Workload Replay Client: Release 11.1.0.6.0 - Production on Tue Copyright (c) 1982, 2007, Oracle. All rights reserved. Wait for the replay to start (21:47:01) Replay started (21:48:14) Replay finished (21:51:21) $

www.en-sof.com.br

50

11g

VIEWING WORKLOAD REPLAY STATISTICS

www.en-sof.com.br

51

11g

CHANGE MANAGEMENT
Maintaining service-level agreements through changes to hardware or software configurations
Change is the most common cause of instability.

Offering production-level workload environment for testing purposes !

o p Effectively forecasting and analyzing impact on SQL


performance
Reluctance to make changes Inability to adopt new competitive technologies
www.en-sof.com.br 52 11g

e Actual workloads are difficult to simulate. l b i s Realistic testing before production is impossible. s

COMPROMETIMENTO COM O FUTURO


Organizao e Planejamento + Reinvestimentos em . Recursos Humanos . Novas Tecnologias + Parceiros Estratgicos = Garantia de Continuidade
. Para Nossos Clientes . e Colaboradores....
www.en-sof.com.br 53 11g

You might also like