+ All Categories
Home > Documents > - zseriesoraclesig.org · 3 Agenda • Oracle for Linux on System z – Overview • Oracle 11g –...

- zseriesoraclesig.org · 3 Agenda • Oracle for Linux on System z – Overview • Oracle 11g –...

Date post: 09-Apr-2018
Category:
Upload: vuongkien
View: 261 times
Download: 6 times
Share this document with a friend
73
1
Transcript

1

<Insert Picture Here>

Migrating to Oracle 11.2 for LoZ – Performance upgrade

Thomas NiewelPrincipal Sales ConsultantOracle Deutschland BV & CO KG

3

Agenda

• Oracle for Linux on System z – Overview

• Oracle 11g – Some interesting features

• Testing applications accessing Oracle 11.2

4

• Previous version of the Oracle database on that

platform was 10.2.0.5

• Current version is 11.2.02

Oracle for 11.2 Linux on System z

5

System z configuration examples

Hardware

LPAR1

VM1

VMGuest 1

VM60

LPAR60

Virtual machines– VM-Guests– Linux for z– 1 .. n

z/VM Operating System

Logical partitions– 1 - 60 LPAR’s

Basic Mode

VMGuest 2

VMGuest n

VM00

VMGuest 3

6

Oracle

LPAR 1 –Oracle for Linux on z

LPAR 2 –z/OS

Hipersockets

Application running under z/OS

Hipersockets – Example in a z/OS client environment

7

Agenda

• Oracle for Linux on System z – Overview

• Oracle 11g – Some interesting features

• Testing applications accessing Oracle 11.2

8

Some interesting Oracle 11g features

• Result CacheFaster results with help of Result Cache

• SQL Plan ManagementMinimize the risks of execution plan changes

• SQL Performance AnalyzerHelps to compare the effects of changes

• CompressionSaves disk space and improves performance

• Automatic SQL TuningAutomated tuning of SQL statements

9

Result Cache

• Concept: – Dedicated cache in shared pool– No installation necessary– Automatic refresh if data changes– Easy setup and monitoring

• Useful for – SQL-queries– PL/SQL-functions

• Use cases:– Known queries and applications like DWH applications,

reporting,etc.

10

Easy to use

• Enabled by init parameter RESULT_CACHE_MODE• If RESULT_CACHE_MODE=MANUAL =>

Hint has to be used

• If set to RESULT_CACHE_MODE=FORCE => Hint is automatically added to root select

SELECT /*+ result_cache */ count(*) FROM sales

SELECT count(*) FROM sales ...

11

Result Cache Settings

RESULT_CACHE_MAX_RESULT 5 (%)

RESULT_CACHE_MAX_SIZE depending on OS

RESULT_CACHE_MODE MANUAL/FORCE

RESULT_CACHE_REMOTE_EXPIRATION 0 (min)

• RESULT_CACHE_MAX_SIZE:• specifies the maximum amount of SGA memory (in bytes) that can be used by the

Result Cache

• RESULT_CACHE_MAX_RESULT:• specifies the percentage of RESULT_CACHE_MAX_SIZE that any single result

can use• RESULT_CACHE_REMOTE_EXPIRATION:

• specifies the number of minutes that a result using a remote object is allowed to remain valid

12

Monitoring

SQL> SELECT /*+ result_cache */ COUNT(*), SUM(salary) FROM hr.bigemp group by department_id ORDER BY department_id;

...

-------------------------------------------------------------------------------------------------| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time -------------------------------------------------------------------------------------------------| 0 | SELECT STATEMENT | | 11 | 55 | 2229 (2)| 00:00:34 | 1 | RESULT CACHE | 91myw5c1bud0mcn64g3d0ykdhm | | | | | 2 | SORT GROUP BY | | 11 | 55 | 2229 (2)| 00:00:34 | 3 | TABLE ACCESS FULL| BIGEMP | 876K| 4280K| 2201 (1)| 00:00:34

Statistics-----------------------------------------------------------------------------

0 recursive calls0 db block gets0 consistent gets0 physical reads0 redo size

696 bytes sent via SQL*Net to client419 bytes received via SQL*Net from client

2 SQL*Net roundtrips to/from client0 sorts (memory)0 sorts (disk)

12 rows processed

13

Monitoring

SQL> SELECT name, type, row_count, status, invalidations, scan_count2 FROM v$result_cache_objects;

NAME TYPE ROW_COUNT INVALIDATIONS SCAN_COUNT-------------------- ---------- ---------- ------------- ----------HR.GET_DATUM Dependency 0 0 0SCOTT.EMP Dependency 0 0 0HR.BIGEMP Dependency 0 1 0SELECT /*+ result_ca Result 12 0 5che */ COUNT(*), SUM(salary)FROM hr.bigemp groupby department_id OR

DER BY department

14

Some interesting Oracle 11g features

• Result CacheFaster results with help of Result Cache

• SQL Plan ManagementMinimize the risks of execution plan changes

• SQL Performance AnalyzerHelps to compare the effects of changes

• CompressionSaves disk space and improves performance

• Automatic SQL TuningAutomated tuning of SQL statements

15

SQL Plan Management

Is useful in case of

• Software upgrades

• Application changes

• If SQL execution plans should be controlled / frozen

16

SQL plan management

• Solution before 11g:– Use of Hints ? Manipulation of statistics ? Use of stored

outlines?

• 11g– Structured SQL plan development

• Concept– Statement Logging– SQL Plan – SQL Plan Baselines

17

• Prerequisite: Plan management ist activated• After the 1st Parse => Entry in statement log• After the 2nd Parse => Entry in plan history and mark

as SQL plan baseline• If changes occur:

– Re-parsing of the statement– Execution plan has changed=> Plan baseline is used and the „new“ execution

plan is marked for verifcation

SQL Plan Management

18

Administration

• Capture of SQL Plan baselines:–

OPTIMIZER_CAPTURE_SQL_PLAN_BASELINES=TRUE/FALSE

– Export or import– Use of SQL tuning set or cursor cache

• Use of existing SQL Plan baselines:– OPTIMIZER_USE_SQL_PLAN_BASELINES=TRUE/FALSE

• Evolve of existing baselines– Enterprise Manager– Package

19

Monitoring: SQL Plan Managementexecution plan

Execution Plan-------------------------------------------------------------------------Plan hash value: 3911979438-------------------------------------------------------------------------| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time -------------------------------------------------------------------------| 0 | SELECT STATEMENT | | 1 | 7 | 6066 (1)| 00:01:13 | 1 | SORT AGGREGATE | | 1 | 7 | ||* 2 | TABLE ACCESS FULL| DOC1 | 1835 | 12845 | 6066 (1)| 00:01:13 --------------------------------------------------------------------------Predicate Information (identified by operation id):---------------------------------------------------

2 - filter("ORT" LIKE 'Frankfurt%')Note-----

- SQL plan baseline "SYS_SQL_PLAN_bb53c5913fe9c83b" used for this statement

20

Monitoring: SQL Plan ManagementEM: Server => SQL Plan Control

21

Upgrade-Scenario

Plan Baseline

Plan History

HJ

GB

HJ

Oracle Database 11g

optimizer_features_enable=10.2.0.5

optimizer_features_enable=11.2.0.2

HJ

GB

HJ

Only verified execution plans

Start of SQL Workload and capture of SQL Plan baselines

HJ

GB

NL

11g execution plans waiting for verification

Target: 11g execution plans should only be used after verificationIdea: Use of OPTIMIZER_FEATURES_ENABLE

22

Some interesting Oracle 11g features

• Result CacheFaster results with help of Result Cache

• SQL Plan ManagementMinimize the risks of execution plan changes

• SQL Performance AnalyzerHelps to compare the effects of changes

• CompressionSaves disk space and improves performance

• Automatic SQL TuningAutomated tuning of SQL statements

23

SQL Performance Analyzer

Is useful when

• A dedicated SQL-workload has to be analyzed after changes

• Risks have to be evaluated after changes• A detailed performance analysis of a single SQL

statement is necessary

• Performance evaluations of SQL workloads before Oracle 11g

24

SQL Performance Analyzer

• Benefits:

– No additional installation necessary

– No Scripting necessary

– Enterprise Manager

• Useful for

– Performance analysis of a dedicated workload

• Prerequisites: SQL Tuning Sets

25

SQL Performance Analyzer Workflow

SQL Tuning Set

Execution Plan &statistics

Execution

After Change

Test

PerformanceComparison

Test Datenbank

Before Change Test

Productiondatabase

Cursor Cache

SQL Tuning Set

Inkrementelles Capture

ftpExport/Import

26

Generate SQL Tuning Set

27

Enterprise Manager Report

28

Enterprise Manager reports - details

29

SQL Performance Analyzer (SPA) and Replay

SPA DB Replay

Focus Evaluation a set of SQL Statements Replay of the whole workload including concurrency

Repeatable Yes Yes (with Backup)

Installation 11g: -<11g: Patch

11g: - (wrc available)<11g: Patch

Use before Version 11g (*)

(*) (*)

Prerequisites STS -

Results Analysis of execution plans / execution statistics

Capture and Replay Report, AWR und ASH diff report

(*) See Note 560977.1

30

Some interesting Oracle 11g features

• Result CacheFaster results with help of Result Cache

• SQL Plan ManagementMinimize the risks of execution plan changes

• SQL Performance AnalyzerHelps to compare the effects of changes

• CompressionSaves disk space and improves performance

• Automatic SQL TuningAutomated tuning of SQL statements

31

Selected Oracle 11g features - Compression

Can be used

• To reduce cost and resources• To save disk space of structured and unstructured

data• To utilize the Buffer cache more efficient• To reduce duplicates in relational and unstructured

data

32

Selected Oracle 11g features - Compression

Compression is available for• Indexes• Structured table data

(and partitions) with DIRECT Load

And with Advanced Compression also for• Unstructured data types (SecureFiles)• Conventional DML(OLTP-compression) • Datapump and RMAN data• Redo Traffic with Data Guard

33

Selected Oracle 11g features - Compression

SmithJohn3

DoeJane4

DoeJane2

DoeJohn1

LAST_NAMEFIRST_NAMEID

Employee Table Nicht komprimierter Block

1•John•Doe 2•Jane• Doe 3•John•Smith 4• Jane • DoeFree Space

Header

INSERT INTO employee VALUES (5,'Jack','Smith');COMMIT;

34

Selected Oracle 11g features - Compression

1•John•Doe 2•Jane• Doe 3•John•Smith 4• Jane • Doe 5•Jack •Smith Free Space

Header

Uncompressed block

John= |Doe= |Jane= |Smith=

Header

1•John•Doe 2•Jane• Doe 3•John•Smith 4• Jane • DoeFree Space

1• • 2• • 3• • 4 • •5•Jack•

Free Space

Compressed block

Local block informationLocal block informationMore data per blockMore data per block

35

Selected Oracle 11g features - Compression

• Activation – CREATE TABLE– ALTER TABLE MOVE COMPRESS for existing tables– ALTER TABLE MOVE PARTITION COMPRESS for partitions

• Example - syntax:

• Enterprise Manager:CREATE TABLE sales_history(…) COMPRESS FOR ALL OPERATIONS | DIRECT_LOAD OPERATIONS

36

Oracle SecureFiles – New LOB‘s

• Advantages– Enhanced performance– Simplified LOB management– Additional functionality

• Compression• Deduplication • Encryption (AES128, AES192 etc)

• Note:– The programming API‘s remain unchanged– Prerequisite: ASSM Tablespace– ONLINE Migration via DBMS_REDEFINITION

CREATE TABLE media_secure (id NUMBER,... lob1 BLOB) LOB (lob1) STORE AS SECUREFILE (TABLESPACE COMPDEDUPLICATE COMPRESS HIGH DISABLE STORAGE IN ROW)

37

Enterprise Manager

38

Table compression

• Compression Advisor (DBMS_COMPRESSION)declare

block_comp PLS_INTEGER;block_uncomp PLS_INTEGER;row_comp PLS_INTEGER;row_uncomp PLS_INTEGER;comp_ratio NUMBER;comp_str VARCHAR2(200);

beginDBMS_COMPRESSION.GET_COMPRESSION_RATIO (SCRATCHTBSNAME =>'USERS',OWNNAME =>'TNIEWEL',TABNAME =>'EMPLOYEE',PARTNAME =>'',COMPTYPE =>DBMS_COMPRESSION.COMP_FOR_OLTP,BLKCNT_CMP =>block_comp,BLKCNT_UNCMP =>block_uncomp,ROW_CMP =>row_comp,ROW_UNCMP =>row_uncomp,CMP_RATIO =>comp_ratio,COMPTYPE_STR =>comp_str);

39

Table compression

dbms_output.put_line('# Blocks compressed => '|| block_comp);dbms_output.put_line('# Blocks uncompressed => '|| block_uncomp);dbms_output.put_line('Ratio => '|| comp_ratio);dbms_output.put_line('Compression-Typ => '|| comp_str);end;

SQL> @compadvisor# Blocks compressed => 15# Blocks uncompressed => 83Ratio => 5.5Compression-Typ => "Compress For OLTP“

• Compression Advisor (DBMS_COMPRESSION) continued

40

Compression overview

Index Bitmap and compressed index

Table For all operations

Lob Segment compression with SecureFile

Data pump With parameter COMPRESSION=ALL

RMAN CONFIGURE COMPRESSION ALGORITHM='...'

Data Guard LOG_ARCHIVE_DEST_3=' ....COMPRESSION=ENABLE'

Algorithm Depending on object type

41

Some interesting Oracle 11g features

• Result CacheFaster results with help of Result Cache

• SQL Plan ManagementMinimize the risks of execution plan changes

• SQL Performance AnalyzerHelps to compare the effects of changes

• CompressionSaves disk space and improves performance

• Automatic SQL TuningAutomated tuning of SQL statements

42

Automatic SQL Tuning

• Allows the automatic tuning of SQL statements

• Test and implementation of profiles can be automated

• The tuning process can be fully automated

43

Manage Performance SQL Tuning

AWR

ADDM

SQL tuning camdidates

DBASQL Tuning Advisor

Recommendations

DBA

DBA

Workload

Evaluation of recommendations

implementation

startadvisor

44

Manage PerformanceSQL Tuning

Indexes

Stalestatistics

Rewrite SQL

Manual

• Automatic during maintenance window• Automatic selection of candidates• Automatic Test and implementation(optional) of SQLprofiles

DBA

observation

AWR

ADDM

SQL Tuning Kandidaten

Workload

Select candidates

SQL tuning candidates

Test profiles

Implement profiles

SQL Tuning AdvisorRecommendations

Automatic

45

Automated SQL Tuning

46

Agenda

• Oracle for Linux on System z – Overview

• Oracle 11g – Some interesting features

• Testing applications accessing Oracle 11.2

47

Oracle Real Application Testing

48

Enterprise Manager

49

Oracle Real Application Testing – Capture Flow

• Create directory

• Set filter for capture (optional)

• Start the capture

• Stop capture

• Check and monitor capture (optional)

• Export AWR (optional)

50

Oracle Real Application TestingPL/SQL

•Create directory

create or replace directory RAT as '/home/oracle/rat';

•Set filter for captureSQL> @CAPTUREFILTER

SQL> execute dbms_workload_capture.add_filter (fname=>'FILTERSH',

fattribute=>'USER',fvalue=>'&Schema');

Enter value for schema: TNIEWEL_RAT

PL/SQL procedure successfully completed.

51

Oracle Real Application TestingPL/SQL

• Start captureSQL> @CAPTURESTART.sql

SQL> execute dbms_workload_capture.start_capture

(name=>'&name', dir=>'&dir',default_action=>'EXCLUDE');

Enter value for name: CAP1

Enter value for dir: RAT1

PL/SQL procedure successfully completed.

• Execute workload

52

Oracle Real Application TestingPL/SQL

• Stop captureSQL> @CAPTUREFINISH.sql

SQL> execute dbms_workload_capture.FINISH_CAPTURE();

PL/SQL procedure successfully completed.

53

Oracle Real Application TestingPL/SQL

• Monitor CaptureSQL> @CAPTUREMONITOR

SQL> col name format a25

SQL> col status format a15

SQL> select id, name, status, errors, awr_exported,

duration_secs from dba_workload_captures;

ID NAME STATUS ERRORS AWR_EXPORTED DURATION_SECS

---------- ------------------------- --------------- ---------- ------------ -------------

1 tn1 COMPLETED 2 YES 1768

2 CAP1 COMPLETED 0 NO 555

54

Oracle Real Application TestingPL/SQL

• Export AWRSQL> @EXPORTAWR

SQL> execute dbms_workload_capture.export_awr('&id');

Enter value for id: 2

PL/SQL procedure successfully completed.

55

Oracle Real Application Testing - Replay flow

• Migrate data to 11.2 database on LoZ

• Activate flashback

• Create directory which contains the captured data

• Preprocess captured data

• Save current SCN

56

• Add filter (optional)

• Initialize replay

• Use filter (optional)

• Calibrate wrc client

• Start wrc clients

• Start replay

• Monitor replay run

• Import AWR data of capture

Oracle Real Application Testing - Replay flow

57

Oracle Real Application Testing - Replay flow

• Run reports

• Replay compare report

• AWR diff report

• Successive runs

• Flashback database to saved SCNstartup mount

FLASHBACK DATABASE to scn;

alter database open resetlogs;

58

Oracle Real Application Testing - Replay flow

• Migrate database to 11.2

• Activate flashback

• Create directory which contains the captured data

• Preprocess Captured dataSQL> begin

dbms_workload_replay.process_capture(capture_dir => '&dir');

end;

• Save current SCN for a rerun of the test

59

Oracle Real Application TestingPL/SQL

• Add filter (optional)SQL> begin2 DBMS_WORKLOAD_REPLAY.ADD_FILTER(3 fname => ‘FILT1',4 fattribute => 'USER',5 fvalue => ‘TNIEWEL_RAT');6 end;7 /

SQL> BEGIN2 DBMS_WORKLOAD_REPLAY.CREATE_FILTER_SET(3 replay_dir=> ‘RAT',4 filter_set => ‘FSET1',5 default_action => 'EXCLUDE');6 END;7 /

60

Oracle Real Application TestingPL/SQL

• Initialize replay SQL> execute

dbms_workload_replay.initialize_replay(‘REPLAY_10',‘RAT');

• Use filterset (optional)SQL> BEGIN

2

3 DBMS_WORKLOAD_REPLAY.USE_FILTER_SET (4 filter_set => '&FILTERSET_NAME');5

6 END;

61

Oracle Real Application TestingPL/SQL

• Prepare replaySQL> begindbms_workload_replay.prepare_replay(synchronization => FALSE ,connect_time_scale => '&CONNECT_TIME',think_time_scale => '&THINK_TIME');

• Calibrate wrc client

wrc userid=tniewel_rat password=tniewel_rat MODE=CALIBRATEreplaydir=./

62

Oracle Real Application Testingwrc clientsReport for Workload in: ./-----------------------Recommendation:Consider using at least 1 clients divided among 1 CPU(s)You will need at least 7 MB of memory per client process.If your machine(s) cannot match that number, consider using more clients.Workload Characteristics:- max concurrency: 2 sessions- total number of sessions: 2- Assumptions:- 1 client process per 50 concurrent sessions- 4 client process per CPU- 256 KB of memory cache per concurrent session- think time scale = 100- connect time scale = 100- synchronization = TRUE

63

Oracle Real Application Testingwrc clients

• Start wrc clientsoracle@strkf32:~/rat> wrc userid=tniewel_rat password=tniewel_rat MODE=REPLAY replaydir=./workload Replay Client: Release 11.2.0.2.0 - Production on Fri Jan 28 09:08:36 2011Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.Wait for the replay to start (09:08:36)

• Start replaySQL> EXEC dbms_workload_replay.start_replay();

Display on wrc screen

Replay started (09:10:56)Replay finished (09:33:19)

64

Oracle Real Application Testing

• Monitoring replaySQL> select name, id, status, awr_exported,start_time, end_time from

dba_workload_replays order by start_time;

NAME ID STATUS AWR_EXPORTED START_TIM END_TIME------------------------- ---------- ----------- ------------ --------- ---------play1 1 COMPLETED YES 26-JAN-11 26-JAN-11REP8 2 COMPLETED NO 27-JAN-11 27-JAN-11replay_10 5 IN PROGRESS NOT POSSIBLE 28-JAN-11

65

Oracle Real Application Testing

• Import AWR data of captureSQL> select name, id, status, awr_exported,start_time, end_time2 from dba_workload_captures order by start_time3 ;

tn1 1 COMPLETED YES 2011-01-2 2011-01-2CAP1 5 COMPLETED YES 2011-01-2 2011-01-2CAP2 6 COMPLETED YES 2011-01-2 2011-01-2CAP3 7 COMPLETED YES 2011-01-2 2011-01-2CAP5 8 COMPLETED YES 2011-01-2 2011-01-2CAP7 10 COMPLETED YES 2011-01-2 2011-01-2CAP8 12 COMPLETED YES 2011-01-2 2011-01-2CAPTURE_10 15 COMPLETED YES 2011-01-2 2011-01-2

8 rows selected.

SQL>SQL> declare2 t number;3 begin4 t:= DBMS_WORKLOAD_capture.IMPORT_AWR(&nr,'&schema', TRUE);5 end;6 /

66

Oracle Real Application Testing - reports

• Replay reportset long 100000set heading offset linesize 255

select dbms_workload_replay.report(replay_id=>'&repid', format=>'&FORMAT') from dual;

• Replay Compare period reportset long 30000set pagesize 0set heading offvariable results clobexec dbms_workload_replay.compare_period_report(replay_id1 =>'&id_1',replay_id2=>'&id2',format => '&Format',result=>:ergebnis);

print results

67

Oracle Real Application Testing- Replay reports

68

Oracle Real Application Testing - Replay reports

69

Oracle Real Application Testing - Replay reports

70

More information

http://www.oracle.com/technetwork/database/features/manageability/owp-manageability-and-rat-11gr2-12856http://www.oracle.com/technetwork/database/features/storage/advanced-compression-whitepaper-130502.pd

71

The preceding is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions.

The development, release, and timing of any features or functionality described for Oracle’s products remains at the sole discretion of Oracle.

72

73

We encourage you to use the newly minted corporate tagline “Hardware and Software, Engineered to Work Together.”at the end of all your presentations. This message should replace any reference to our previous corporate tagline “Software. Hardware. Complete.”


Recommended