• No results found

Tuning Tips and Techniques

N/A
N/A
Protected

Academic year: 2021

Share "Tuning Tips and Techniques"

Copied!
19
0
0

Loading.... (view fulltext now)

Full text

(1)

ORACLG

Oracle

Press14

Oracle

Database

12c

Release

2

Performance

Tuning Tips

and

Techniques

Richard

J.

Niemiec

Mc Graw Hill Education

New York

Chicago

San Francisco Athens London Madrid Mexico

City

(2)

Acknowledgments

xxix

Introduction xxxvii

IntroductiontoOracle Database 12c R1 &R2New Features

(DBA

and

Developer)

1

Oracle Database12cR1 (12.1.0.1) 5 IncreasedSize Limitto32K forVARCHAR2 and NVARCHAR2 5

Partial Indexes 5 InvisibleColumns 6

Multiple

Indexesonthe Same Column List 7

Fetch Firstx Rows 8

Pluggable

Databases(PDBs) 9

Oracle Database Cloud Service(Databaseas a Service) 11 PDBLevel: MEMORYJJMITand MEMORY_MINIMUM (12cR2) 17

Change Compression

at ImportTime 18

Adaptive Query Optimization

18

PGA_AGGREGATE_LIMIT 19 ConcurrentExecution for UNION/UNION ALL 20 Invoker

Rights

FunctionCan Be Results Cached 20 New DBMS_UTILITY.EXPAND_SQL_TEXT 20 Default for Columns Based on

Sequence

20

Multiple

SSD Devicesfor Smart Flash Cache 20

ConcurrentCost-Based

Optimizer

Statistics

Gathering

21

Enhanced

System

Statistics 21

Resource

Manager

for

Runaway Queries

22

Automatic Data

Optimization

(ADO) 22 Global Index Maintenance:

Drop

andTruncate Partition

Operations

23

ASM Disk

Scrubbing

23

(3)

Xli

Oracle Database 12c Release2 Performance

Tuning Tips

and

Techniques

Online

Capability

Improvements 23

Data Guard Improvements 24

RMAN

Improvements

24

Oracle Database 12cR1 (12.1.0.2) 25

In-Memory

Database 25

Advanced Index

Compression

28 Automatic

Big

Table

Caching

28

FDA

Support

for Container Databases 28

Full Database

Caching

28

JSON

Support

28

FlPS 140 Parameterfor

Encryption

28

PDB Subset

Cloning

29

Rapid

Home

Provisioning—Creating

"GoldImages" 29

Oracle Database 12cR2 (12.2) 29

Application Development

29

Enhanced Featuresto ReduceCostsand Issuesfor

Migration

toOracle 30

Availability

30

BigData 33

Compression and

Archiving

33

Oracle RAC and Grid Infrastructure 34

Security

34

New

Background

Processes in 12c 34 Exadata—New with Exadata X6! 35 Version

Comparison

Chart 36 New Features Review 41 References 42 2 Basic Index

Principles (Beginner Developer

and

Beginner

DBA) 43

Basic Index

Concepts

45

Invisible Indexes 47

Multiple Types

of Indexeson the SameColumn(s) 50

Concatenated Indexes 53

Suppressing

Indexes 54

UsingtheNOTEQUAL

Operators:

<>, != 55

Using

IS NULLor IS NOT NULL 55

Using

LIKE 57

Using

Functions 58

Comparing

Mismatched Data

Types

58

Selectivity

59

The

Clustering

Factor 59

The

Binary Height

60

Additional Details

Concerning

BLEVEL and Index

Height

62

Using Histograms

64

Fast Full Scans 65

(4)

Contents

xiii

Types

of Indexes 67 B-Tree Indexes 68

Bitmap

Indexes 69 Hash Indexes 71

Index-Organized

Tables 72

Reverse

Key

Indexes 73

Function-Based Indexes 73 Partitioned Indexes 74

New 12cR2 Featuresfor Partitioned Indexes 78

BitmapJoin Indexes 78

FastIndex

Rebuilding

79

Rebuilding

Indexes Online 79

Tips

Review 80

References 82

3

Pluggable

Databases,

Disk

Implementation

Methodology,

andASM(DBA) ... 83

Pluggable

Databases (New in Oracle 12c) 85

CDB or PDB Created

Objects

86

Creating

aPDB: Many Waysto Do It 87

Great

Pluggable

Database Commands 88

ALTERSYSTEM While in aPDB and Other NiceCommands 92

Using In-Memory(IM) with

Pluggable

Databases 93 Other12cR2 Featureswith

Pluggable

Databases 93 Subset

Standby

(New in Oracle 12cR2) 94

Disk

Arrays

94

UseDisk

Arrays

to

Improve

Performanceand

Availability

94 How

Many

DisksDo You Need? 95

What Are Some of the RAID Levels Available? 95

The Newer RAID 5 96

Solid-State Disks 97

ASM

Storage Management (Striping/Mirroring)

97

Setup

and Maintenance of the Traditional

Filesystem

98

WhatIsthe Cost? 98

Storing

Data and Index Files in

Separate

Locations 99

Avoiding

I/O Disk Contention 99

The12c HeatMapandAutomatic DataOptimization(ADO) 101

12c I/O Performance

Tracking

Views(Outliers) 102 Oracle

BigfileTablespaces

103

ASM Introduction 104

Communication Across IT Roles 105

ASM Instances 106

ASM Initialization Parameters 107 ASM Installation in 12c 107

Srvctl Enhancements 115

(5)

xiv

Oracle Database 12c Release 2 Performance

Tuning

Tips

and

Techniques

ASM Rebalance Enhancements 121 ASM FastMirrorResync 123 ASM Filter Driver 124 ASMand

Privileges

132 ASMand

Multipathing

136

BigfileandASM

137

Avoiding

Disk Contention

by Using

Partitions 137

Getting

More Information AboutPartitions 139

Other

Types

of

Partitioning

140 Partitioned Indexes (Local) 143 Partial Indexes 143

Global Index Maintenance:

Drop

and Truncate Partition

Operations

146

Other

Partitioning Options

146

Index

Partitioning

149

Exporting

Partitions 150

Eliminating

Fragmentation

(Only

IfNeeded—Careful!) 150

Using

the CorrectExtent Size 151

Avoiding

Chaining

by Setting

PCTFREE

Correctly

151

Using

Automatic

Segment Space Management

(ASSM) 152

Increasing

the

Log

FileSizeand LOG_CHECKPOINTJNTERVAL for

Speed

153

Determining

IfRedo

Log

File Size IsaProblem 154

Determining

the Size of Your

Log

Files and

Checkpoint

Interval 155

Other

Helpful

Redo

Log

Commands 155

Storing Multiple

Control Files onDifferent Disks and Controllers 157 Other Disk I/OPrecautionsandTips 157

Issuesto Considerinthe

Planning

Stages

158

Tips

Review 159

References 161

4

Tuning

the Database with Initialization Parameters (DBA) 163

When

Upgrading

toOracle Database12c 165

Using

SEC_CASE_SENSITIVE_LOGON 166

Crucial Memory InitializationParametersfor Performance 166

PDB Level: MEMORY_LIMIT and MEMORY_MINlMUM 170

In-Memory

Database (INMEMORY_SIZE) 170

Changing

the Initialization Parameters Withouta Restart 176

Modifying

an Initialization Parameteratthe PDB Level 180

Insight

into the Initialization Parameters from Oracle Utilities 181

Viewing

the Initialization Parameters with

Enterprise Manager

181

IncreasingPerformance

by

Tuningthe DB_CACHE_SIZE 182

Using V$DB_CACHE_ADVICEin

Tuning

DB_CACHE_SIZE 185

Monitoring

the

V$SQLAREA

ViewtoFind Bad Queries 186

Setting

DB_BLOCK_SIZEtoReflectthe SizeofYour Data Reads 189

(6)

Contents XV

Tuning

theSHARED_POOL_SIZEfor

Optimal

Performance 191

Using

Stored Procedures for

Optimal

Use of the Shared

SQL

Area 191

Setting

the SHARED_POOL_SIZE

High Enough

to

Fully

Use

theDB_CACHE_SIZE 193

Keeping

the Data

Dictionary

Cache

Objects

Cached 193

Keeping

the

Library

Cache Reload Ratio at 0and theHit Ratio

Above95Percent 195

Using

AvailableMemorytoDetermineIf the SHARED_POOL_SIZE

IsSet

Correctly

197

Using

theX$KSMSPTableto GetaDetailed Lookatthe Shared Pool 198 PointstoRemember About Cache Size 199 Waits Relatedto Initialization Parameters 200

Using

Oracle

Multiple

BufferPools 201

Pools Relatedto DB_CACHE_SIZE and

Allocating Memory

for Data 201

Modifying

the LRU

Algorithm

202

Pools RelatedtoSHARED_POOL_SIZEand

Allocating Memory

for Statements 202

Tuning

PGA_AGGREGATE_TARGETand PGA_AGGREGATE_LIMIT 203

Modifying

the Size of Your SGAtoAvoid

Paging

and

Swapping

204

Understanding

the OracleOptimizer 204

How

Optimization

Looksatthe Data 204

Creating

Enough

Dispatchers

205

Have

Enough

Open

Cursors(OPEN_CURSORS) 206

Don't Let Your DDL Statements Fail (DDL_LOCK_TIMEOUT) 206

Two

Important

Exadata Initialization Parameters(Exadata

Only)

207

Top

25Initialization Parameters 207

Initialization Parametersoverthe Years 210

Finding

Undocumented Initialization Parameters 210

Understanding

the

Typical

Server 211

Modeling

a

Typical

Server 212

Sizing

the Oracle

Applications

Database 213

Tips

Review 218

References 220 5

Tuning

with

Enterprise

Manager

Cloud Control (DBA and

Developer)

221 OracleEnterprise

Manager

Basics and

Accessing

OEM via Oracle Cloud 223

Starting

with All

Targets

and Other

Groupings

227

Monitoring

andTuning

Using

theOEMPerformanceMenu 229

Performance Tab:Top

Activity

229

Performance Tab:SQL

|

SQL Performance

Analyzer

230

Performance Tab: Real-TimeADDM 233

Performance Tab:SQL

|

AccessAdvisor 237

Performance Tab:

Manage Optimizer

Statistics 237

Performance Tab:AWR

|

AWR Administration 238 Performance Tab: ASH

Analytics

241

(7)

XVI Oracle Database 12c Release2 Performance

Tuning

Tips

and

Techniques

Monitoring

and

Tuning Using

theOEMAdministration Menu 241 Database AdministrationTab:

Storage|Tablespaces

242

DatabaseAdministrationTab:

In-Memory

Central and

Initialization Parameters 244

Database Administration Tab: All Initialization Parameters 244

Database Administration Tab: Resource

Manager

(Consumer

Groups)

246

Monitoring

andTuning

Using

theOEM DatabaseorCluster DatabaseMenu 247

Database Tab:Job

Activity

247 Cluster Database Tab:

Configuration!

Database

Topology

248

Monitoring

theHosts 248

Monitoring

the

Application

Servers and Web

Applications

250

Real

Application Testing

(Database

Replay)

252

Summary

253

Tips

Review 253

References 254

6

Using

EXPLAIN, TRACE,

and

SQL

Plan

Management (Developer

and

DBA)

255 TheOracleSQLTRACE

Utility

256

Simple Steps

for SQLTRACE with a

Simple Query

257

The Sections ofaTRACE

Output

262

Digging

into theTKPROF

Output

263

Using

DBMS_MONITOR 266

Setting

Trace Basedon Session IDand Serial Number 267

Setting

Trace Basedon Client Identifier 267

Setting

Traceforthe ServiceName/Module Name/Action Name 268 Enabled

Tracing

Views 269 TRCSESS

Multiple

Trace Files into One File 269

Using

EXPLAIN PLAN Alone 271

AnAdditional EXPLAIN

Example

fora

Simple Query

273

EXPLAIN PLAN—Read It

Top

to BottomorBottom to

Top?

274

Tracing/Explaining

Problem Queriesin

Developer

Products 279

Important

Columns inthe PLAN_TABLETable 280

Using

DBMS_XPLAN 282

Initialization Parameters for Undocumented TRACE 283

Using

Stored Outlines 284

Dropping

Stored Outlines 285

Using

SQL PlanManagement(SPM) and SPM

Example

285

SPM Terms 286

Using

SPM 287

Using

Fixed SQL Plan Baselines 291

Dropping

a Plan 292

Converting

from Stored OutlinestoSQLPlan

Management

292

Adaptive

Plans(12cNewFeature)and SPM 294

TipsReview 301

(8)

Contents

xvii

7 Basic Hint

Syntax (Developer

and DBA) 305

Top Hints Used 307

Use Hints

Sparingly

308

Fixthe

Design

First 308

AvailableHintsand

Groupings

309

ExecutionPath 309

AccessMethods 310

Query

Transformation Hints 310

Join

Operations

311

Parallel Execution 311

Other Hints 311

Specifying

a Hint 312

Specifying Multiple

Hints 313

When

Using

an Alias, Hint the

Alias,

Notthe Table 314

TheHints 314

The Oracle Demo

Sample

HRSchema 314 The FIRST_ROWSHint 315 The ALL_ROWS Hint 316

The FULL Hint 316

The INDEX Hint 317

The NOJNDEX Hint 319

The INDEXJOIN Hint 320

TheINDEX_COMBINEHint 320

TheINDEX_ASC Hint 321

TheINDEX_DESCHint 322

TheINDEX_FFS Hint 322 The ORDERED Hint 323 The LEADING Hint 324 The NO_EXPAND Hint 325 TheDRIVING_SITE Hint 325 TheUSE_MERGEHint 326

The USE_NL Hint 327

The USE_HASH Hint 328

TheQB_NAME Hint 329

ThePUSH_SUBQ Hint 330

The PARALLEL Hint 331

TheNO_PARALLEL Hint 332

ThePARALLELJNDEX Hint 333

TheAPPEND Hint 333 TheNOAPPEND Hint 334 The CACHE Hint 334 The NOCACHE Hint 335 TheRESULT_CACHEHint 335 The CURSOR_SHARING_EXACTHint 336

(9)

wiii

Oracle Database 12c Release2 Performance

Tuning Tips

and

Techniques

The INMEMORY and NOJNMEMORYandOther IM Hints 337

The USEJNVISIBLEJNDEXESHint 338

The CONTAINERS Hint 339

The

WITH_PLSQL

Hint 339

Some Miscellaneous Hints and Notes 339

Undocumented Hints 341

Using

HintswithViews 342

Noteson HintsandStored Outlines (or SQL Plan Baselines) 343

Why

Isn't

My

Hint

Working?

343 HintsataGlance 343

Tips

Review 345

References 347

8

Query

Tuning (Developer

and

Beginner

DBA) 349 Which Queries Do I Tune?

Querying V$SQLAREA

and

V$SQL

Views 351

Selecting

fromtheV$SQLAREAView toFind the WorstQueries 351

Selecting

from theV$SQLViewto Find the WorstQueries 353 Oracle 12c Viewsfor

Locating

Resource-Intensive Sessions and

Queries

354

Selecting

fromV$SESSMETRICto Find Current Resource-Intensive Sessions .. . 354

Viewing

AvailableAWR

Snapshots

355

Selecting

from theDBA_HIST_SQLSTATViewto Find the WorstQueries 355 When Should I UseanIndex? 356

Selecting

Query

TextfromtheDBA_HIST_SQLTEXTView 357

Selecting Query

EXPLAIN PLAN from the DBA_HIST_SQL_PLANView 358 What If I

Forget

the Index? 359

Creating

an Index 360

Invisible Index 360

Checking

the Indexon aTable 360 Isthe Column

Properly

Indexed? 361

WhatIfI Createa Bad Index? 362

Exercising

CautionWhen

Dropping

anIndex 364

Indexing

the Columns Used in the SELECT and WHERE 365

Using

the Fast Full Scan 367

Making

theQuery

"Magically"

Faster 368

Caching

aTablein Memory 369

Using

the Result Cache 371

Choosing

Among

Multiple

Indexes(Use theMostSelective) 372

TheIndex

Merge

373

Indexes That Can Get

Suppressed

375 Function-Based Indexes 377 Virtual Columns 378 The "Curious" OR 379

Using

the EXISTS Function and the Nested

Subquery

380

ThatTable Is

Actually

aView! 381

(10)

Contents XIX

Tuning Changes

inOracle Database 12c 382

Oracle12c

Adaptive

Query Optimization 383

Adaptive

Statistics 389

Oracle 12c

Changes

in Statistics

Gathering

andTwo New

Histograms

394

Oracle12c

Changes

in SQLPlan

Management

395

Oracle AutomaticSQL

Tuning

397

Ensuring

the

Tuning

User Has Accesstothe APIs 398

Creating

the

Tuning

Task 398

Making

Sure the Task Can Be Seen in the Advisor

Log

399

Executing

the

SQL Tuning

Task 399

Checking

Status of the

Tuning

Task 399

Displaying

the

SQL Tuning

Advisor Report 399

Reviewing

theReport Output 400

Tuning SQL

Statements

Automatically Using

SQL TuningAdvisor 402

Enabling

Automatic SQL

Tuning

Advisor 402

Configuring

Automatic SQL

Tuning

Advisor 402

Viewing

AutomaticSQL

Tuning

Results 403

Using

SQLPerformance

Analyzer

(SPA) 407

Tips

Review 412 References 414 9 Table

Joins

and Other Advanced

Tuning

(Advanced

DBAand

Developer)

... 415

Database

Replay (capture/replay)

417

Set

Up

Source Database for Database

Replay Capture

418

Prepare

to

Capture

Workload 418

Capturethe Workload 418

Preparethe Workload for

Replay

419

Processthe Workload for

Replay

420

Prepare

to

Replay

the Workload 420

ExecutetheWorkload

Replay

421

SQLPerformance

Analyzer

423

Createa SQL

Tuning

Set 423

Createan

Analysis

Task 424

Execute

Analysis

Task 424

Query

SQL Performance

Analyzer

Advisor Tasks 425

Cancel an

Executing

SQLPerformance

Analyzer Analysis

Task 425

RemoveSQL Performance

Analyzer

Analysis

Task 426

Determine ActiveSQL

Tuning

Sets 426

RemoveSQL

Tuning

Set 426

Drop

SQL

Tuning

Set 427

JoinMethods 427

NESTED LOOPSJoins 428

SORT-MERGEJoins 428 CLUSTER Joins 429 HASH Joins 430

(11)

XX Oracle Database 12c Release 2 Performance

Tuning Tips

and

Techniques

TableJoinInitialization Parameters 434

SORT-MERGE andHASHJoin Parameters 434 ATwo-Table Join:

Equal-Sized

Tables(Cost-Based) 435 ATwo-Table INDEXEDJoin:

Equal-Sized

Tables(Cost-Based) 439

Forcing

a

Specific

Join Method 443

Eliminating

Join Records (Candidate Rows) in MultitableJoins 445 A Two-TableJoin Betweena

Large

and Small Table 447

Three-TableJoins: Notas Much Fun 450

BitmapJoin Indexes 452

Bitmap

Indexes 452

Bitmap

Join Index 454

BestUsesforthe

Bitmap

Join Index 455

Third-Party

Product

Tuning

458

Example

1 458

Example

2 459

Example

3 460

TuningDistributed

Queries

462

WhenYou Have

Everything

Tuned 464

Miscellaneous

Tuning Snippets

464

ExternalTables 465

Snapshot

Too Old:

Developer Coding

Issue 469

Set Eventto

Dump Every

Wait 469

14 Hours to 30Seconds with the EXISTS

Operator

471

Tuningatthe Block Level (Advanced) 473

Key

Sections ofa Block

Dump

476

ABrief Look atan Index Block

Dump

483

Tuning Using

Simple

Mathematical

Techniques

485

Traditional Mathematical

Analysis

486

Seven-Step Methodology

486

DerivingPerformance

Equations

487

Pattern

Interpretation

493

Mathematical

Techniques

Conclusions 498

Tips

Review 499 References 500

10

Using

PL/SQL

to Enhance Performance

(Developer

and

DBA)

503

Leveragethe

PL/SQL

Function Result Cacheto

Improve

Performance

(Improved

in 12c) 505

DefinePL/SQL

Subprograms

in a

SQL

Statement(Newin 12c) 515

Reference Sequences

Directly

in PL/SQL

Expressions

517

Identity

Columns (New in 12c) 519

Max Size Increaseto 32K forVARCHAR2,NVARCHAR2, and RAW Data

Types

(Newin 12c) 521 Allow

Binding PL/SQL-Only

Data

Types

toSQLStatements (New in 12c) 522

(12)

Contents

xxi

Simplify

Loopswith the CONTINUE Statement 525

Leverage

Compile-Time

Warnings

toCatch

Programming

Mistakes

(Improved

in12c) ... 528

IncreasePerformancewith Native

Compilation

530

Maximize Performancewiththe

Optimizing Compiler

533

UseDBMS_APPLICATION_INFOfor Real-Time

Monitoring

539

Log Timing

Information in aDatabase Table 541

Reduce PL/SQL

Program

Unit Iterations and IterationTime 544

Use ROWID for Iterative

Processing

546

StandardizeonDataTypes, IF Statement

Order,

and PLSJNTEGER 548 Ensure theSame DataTypes in

Comparison Operations

548 OrderIFConditions Based onthe

Frequency

of the Condition 550

Usethe PLSJNTEGERPL/SQLData

Type

for

Integer Operations

551

Reduce the Calls toSYSDATE 552

Reduce theUseof the MOD Function 553

Improve

Shared Pool Use

by Pinning

PL/SQL

Objects

555

Pinning

(Caching)

PL/SQL

Object

Statements into

Memory

555

Pinning

All

Packages

556

Identify

PL/SQL

Objects

That Needto Be Pinned 557

Useand

Modify

DBMS_SHARED_POOLSIZES 557

Find

Large Objects

558

Get Detailed

Object

Information from DBA_OBJECT_SIZE 558 Get

Contiguous Space Currently

in the Shared Pool 559 Find Invalid

Objects

559 Find Disabled

Triggers

561

Use

PL/SQL

AssociativeArraysfor FastReference Table

Lookups

562

Find andTunetheSQLWhen

Objects

AreUsed 565

ConsiderTime ComponentWhen

Working

with DATE Data

Types

568

Use

PL/SQL

to Tune

PL/SQL

570

Understand the

Implications

ofPL/SQL

Object

Location 571 UseRollback

Segments

to

Open Large

Cursors 572

Active Transaction

Management:

Process

Large Quantities

ofData 573

Use

Temporary

DatabaseTables for Increased Performance 574

LimittheUseof

Dynamic

SQL 574

Use

Pipelined

Table FunctionstoBuild

Complex

ResultSets 575 Leave Those

Debugging

Commands Alone! 580

The"Look and Feel":Justfor the

Beginners

586

PL/SQL

Example

587

CreateaProcedure

Example

587

Execute the Procedure from

PL/SQL Example

588

CreateaFunction

Example

588

Execute the GET_CUST_NAME FunctionfromSQL

Example

588

Createa

Package Example

588

DatabaseTrigger

Example Using

PL/SQL 589

Tips

Review 589 References 592

(13)

XXH Oracle

Database

12c Release2 Performance

Tuning Tips

and

Techniques

11 Oracle

Cloud,

Exadata,

Tuning

RAC,

and

Using

Parallel Features 593 The March tothe Cloud (PastandPresent) 596 The Oracle Cloud 599 Exadata Database Machine 609

Exadata

Terminology

and the Basics 609

Exadata Statistics 610

Exadata

Storage Expansion

Rack

Briefly

612

Smart Scans 614

Flash Cache 614

Storage

Indexes 617

Hybrid

Columnar

Compression

618

I/O Resource

Management

621

Use All Oracle

Security Advantages

with Exadata 622

Best Practices 622

Summary:

Exadata =

Paradigm

Shift! 623

Oracle Database

Appliance

(ODA) 624

SuperCluster

Usingthe M7 SPARC

Chip

624

Other OracleHardwaretoConsider 625 Oracle

Big

Data

Appliance

X6-2 625

ZFS

Storage

Servers 625

StorageTek

Modular

Library System

625

Parallel Databases 626

Real

Application

Clusters (RAC) 626

Oracle RAC Architecture 627

Internal

Workings

of theOracle RAC

System

629

RAC Performance

Tuning

Overview 632

RAC Cluster Interconnect Performance 633

Finding

RAC Wait Events—Sessions

Waiting

633

RAC Wait Events and Interconnect Statistics 635

Cluster Interconnect

Tuning—Hardware

Tier 641

BasicConceptsof Parallel Operations 645

Basic

Concepts

ofParallel

Operations

645

Parallel DMLandDDLStatements and

Operations

647

Managing

Parallel Server Resources and Parallel Statement

Queuing

648 Parallelism and Partitions 649

Inter- and

Intra-operation

Parallelization 649

Examples

of

Using

Inter- and

Intra-operations

(PARALLEL and NO_PARALLEL Hints) 650

Creating

Table and Index

Examples

Using

Parallel

Operations

652

Monitoring

Parallel

Operations

viathe V$Views 653

Using

EXPLAIN PLAN andAUTOTRACEonParallel

Operations

655

Using

the SET AUTOTRACE ON/OFF Command 658

(14)

Contents

xxiii

Parallel

Loading

662

Optimizing

Parallel

Operations

in RAC 664

Objectives

of Parallel

Operations

664

RAC Parallel

Usage

Models 664

Parallel InitializationParameters 665

V$Viewsfor

Viewing

ParallelStatistics 665

CreateTableAs 665

Parallel Index Builds 665

Performance Considerations and

Summary

666

Other Parallel Notes 666 Oracle Documentation Is Online 666

Tips

Review 667 References 668 12 The

V$

Views

(Developer

and

DBA)

671

Creating

and

Granting

AccesstoV$Views 673

Obtaining

aCountand

Listing

ofAllV$Views 676

Getting

a

Listing

for theX$

Scripts

ThatMake

Up

theV$Views 677

Examining

the

Underlying

Objects

That Make

Up

the DBA_Views 678

Using

Helpful

V$

Scripts

680

Basic Database Information 681 Basic Automatic Workload

Repository

(AWR) Information 682 Basic

Licensing

Information 683 Database

Options

Installed in Your Database 683

Summary

of

Memory

Allocated (V$SGA) 684

Querying

V$IM_SEGMENTSAfter

Setting

theINMEMORY_SIZE 685

Automatic

Memory Management

and MEMORY_TARGET 687

Detailed MemoryAllocated(V$SGASTAT) 688

Detailed MemoryAllocated(V$SGASTAT) foraPDBvs. Root CDB 689

Finding spfile.ora/init.ora

SettingsinV$PARAMETER 690

Modifying

anInitialization ParameteratPDBLevel 691

Determining

IfData Is in

Memory

(V$SYSSTAT &V$SYSMETRIC) 692

Determining Memory

fortheData

Dictionary

(V$ROWCACHE) 693

Determining Memory

forthe Shared SQLand

PL/SQL

(V$LIBRARYCACHE) 694

Querying

V$CONTAINERSandV$PDBSfor Container Information 696

Querying

V$CONTAINERSWhen

Using Pluggable

Databases 696

Querying

V$PDBSfor

Pluggable

Database Information 697

Using

the Result Cache 698

Identifying

PL/SQL

Objects

That Needto BeKept (Pinned) 700

Finding

ProblemQueries

by Monitoring

V$SESSION_LONGOPS 701

Finding

ProblemQueries

by Querying V$SQLAREA

703

Finding

Out What Users Are

Doing

and Which Resources

They

Are

Using

704

Finding

Out Which

Objects

aUser Is

Accessing

705

(15)

XXIV Oracle Database 12c Release2 Performance

Tuning Tips

and

Techniques

Using

Indexes 706

Identifying Locking

Issues 708

Killing

the Problem Session 710

Finding

Userswith

Multiple

Sessions 711

Querying

forCurrentProfiles 712

Finding

DiskI/O Issues 713

Checking

for

Privileges

and Roles 715

Wait Events V$ Views 718

Some of the

Major

V$ View

Categories

721

Tips

Review 728 References 730 13 The X$ Tables and Internals

Topics

(Advanced

DBA) 731

Introducing

theX$Tables 732

Misconceptions

About theX$Tables 734

Granting

AccesstoViewthe X$ Tables 734

Creating

V$Views and X$ Tables in 12c 735

TheX$Tables

Comprising

theV$Views 737

Obtaining

aListof All the X$Tables in 12c 738

Obtaining

aListof All theX$ Indexes in12c 740

Using

Hints with X$Tables and Indexes 741

Monitoring Space

Allocationsinthe Shared Pool 742

Creating

Queriesto Monitorthe Shared Pool 743

ORA-04031 Errors 744

Large

Allocations

Causing

Contention 745

Shared Pool

Fragmentation

745

Low Free Memory in Shared and Java Pools 747

Library

CacheMemory Use 747

High

Numberof Hard Parses 750

Mutex/LatchWaitsand/or

Sleeps

751

MiscellaneousX$ TableNotes 752

Obtaining

Information About Redo

Log

Files 753

Setting

Initialization Parameters 753

Case 1 754

Case 2 755

Case3 755

Case4 755

Case 5 755

Exploring

Buffer Cache/Data Block Details 757

Buffer Statuses 758

Segments

Occupying

Block Buffers 760

Hot Data Blocks and the Causes of Latch Contention and Wait Events 761

Obtaining

Database- and

Instance-Specific

Information 766

(16)

Contents XXV Oracle Internals

Topics

768

Traces 768 DBMS_TRACE

Package

772 Events 773

Dumps

774 ORADEBUG 775 trcsess

Utility

777

Reading

theTraceFile 778

Wait Information and

Response

Time 781 RecursiveCalls 782 Module Info 782 Commit 783

Unmap

783 Bind Variables 783 Errors 784

Some Common X$Table

Groups

784 SomeCommonX$Table andNon-V$ Fixed View Associations 801

CommonX$Table Joins 803

X$Table

Naming

Conventions(MyFavorite Section of This Book!) 805 X$Table

Naming

Conventionswith CONJD,and INMEMORY 812 FutureVersion Impactin 12cR2 813

Tips

Review 813

References 814

Using Statspack

and

the AWR

Report

toTune

Waits, Latches,

andMutexes ... 815

What's New in 12cR2(12.2)

Statspack

and theAWR

Report

817

Installing

Statspack

818

Security

of the PERFSTAT Account 818

Post-Installation 819

Gathering

Statistics 820

Running

the Statistics

Report

822

The Automatic Workload

Repository

(AWR) and the AWR

Report

824

Manually Managing

the AWR 825

AWRAutomated

Snapshots

826

AWR

Snapshot Reports

826

Run theAWRReportin Oracle

Enterprise Manager

Cloud Control 828

Interpretingthe

Statspack

andAWR Report

Output

831

The Header Information and Cache Sizes 832

The Load Profile 833

Instance

Efficiency

835

Shared Pool Statistics 838

Top

Wait Events 838

Oracle

Bugs

851 The Life ofanOracle ShadowProcess 852

(17)

XXvi

Oracle Database 12c Release2 Performance

Tuning Tips

and

Techniques

RAC Wait Events and Interconnect Statistics 852

Top

SQLStatements 853 Instance

Activity

Statistics 856

Tablespace

and File I/O Statistics 861

SegmentStatistics 864

Additional

Memory

Statistics 865 UNDO Statistics 871 Latch andMutex Statistics 872

Tuning

and

Viewing

atthe Block Level (Advanced) 883

Dictionary

and

Library

Cache Statistics 886

SGA

Memory

Statistics 888

Nondefault Initialization Parameters 889

Top

15

Things

toLook forin AWR

Report

and

Statspack

Output

890

Managing

the

Statspack

Data 892

Upgrading Statspack

892

Deinstalling Statspack

893

Quick

Notesonthe New ADDM

Report

893

Scripts

in 12cR2 898

Tips

Review 900

References 902

15

Performing

a

Quick

System

Review

(DBA)

905

Total Performance Index (TPI) 906

Education Performance Index (EPI) 907

System

Performance Index(SPI) 909

Memory Performance Index (MPI) 912 Top25 "MemoryAbuser"StatementsTuned 912

Top

10

"Memory

Abusers"asa Percentof AllStatements 914

Buffer Cache HitRatio 914

Dictionary

CacheHit Ratio 916

Library

Cache Hit Ratio 91 7

PGA

Memory

Sort Ratio 918

Percentage

of Data Buffers Still Free 919

Using

the Result Cache

Effectively

920

Pinning/Caching

Objects

921 Disk PerformanceIndex(DPI) 922

Top

25 "Disk-Read Abuser" Statements Tuned 922

Top

10 Disk-Read Abusersas

Percentage

of AllStatements 923

Tables/Indexes

Separated

or

Using

ASM 925

Mission-Critical Table

Management

925

Key

Oracle Files

Separated

926

Automatic Undo

Management

926

(18)

Contents XXVII Total Performance Index(TPI) 930

Overall

System

Review

Example

930

Rating System

931

Example System

Review

Rating Categories

931

Items

Requiring

Immediate Action 933

Other Items

Requiring

Action 934

System

Information List 934

Memory-Related

Values 934

Disk-Related Values 935 CPU-Related Values 935

Backup-

and

Recovery-Related

Information 936

Naming

Conventionsand/or Standards and Security Information

Questions

.. . 937

DBA

Knowledge

Rating

937

Other ItemstoConsiderin Your TPI and

System

Review 938

Tips

Review 939

References 940

16 Monitor the

System Using

Unix Utilities

(DBA)

941 Unix/Linux Utilities 942

Using

thesarCommandtoMonitor CPU

Usage

943

sar -u(Checkfor CPU

Bogged

Down) 943

Thesar-d Command(Find I/O Problems) 944

Thesar-b Command(Checkthe BufferCache) 947

Thesar-q Command(Checkthe RunQueue and

Swap Queue Lengths)

948

Usingthesarand vmstatCommandstoMonitor

Paging/Swapping

948

Using

sar-pto Report PagingActivities 949

Using

sar -wto Report Swappingand

Switching

Activities 949

Using

sar -rto ReportFreeMemory and FreeSwap 950

Using

sar-gto

Report Paging

Activities 950

Using

sar-wpgrto

Report

on

Memory

Resources 951

Finding

theWorst Useron the

System Using

thetopCommand 954

Monitoring

Tools 955

Using

the

uptime

CommandtoMonitor CPU Load 955

Using

thempstatCommandto

Identify

CPU Bottlenecks 956

Combining

ps with Selected V$ Views 957

CPU/Memory Monitoring

Tool (Task

Manager)

onWindows 959

Using

the iostat Commandto

Identify

Disk I/O Bottlenecks 959

Using

iostat-d for Disk Drives sd15, sd16, sd17, and sd18 960

Using

iostat-D 960

Using

iostat-x 960

Combining

iostat-xwith

Logic

ina Shell

Script

961

Using

the

ipcs

CommandtoDetermine Shared

Memory

962

(19)

XXVlii

Oracle Database 12c Release2 Performance

Tuning Tips

and

Techniques

Monitoring

Disk Free

Space

964

The dt Command 965 TheduCommand 966

Monitoring

Network Performance with netstat 966

Modifying

the

Configuration

Information File 967

Other Factors That Affect Performance 967 Other Sources toImprove Performance 969

Tips

Review 969

References 970 A

Key

Initialization Parameters (DBA) 971

Obsoleted/Desupported

Initialization Parameters 972

Deprecated

Initialization Parameters 973

Top

25 Initialization Parameters 974

Top

20 Initialization Parameters Notto

Forget

977

Top 13 Undocumented Initialization Parameters (As I See It) 978

Bonus 11 Undocumented Initialization Parameters 981

Listing

of Documented Initialization Parameters

(V$PARAMETER)

982

Listing

of Undocumented Initialization Parameters

(X$KSPPI/X$KSPPCV)

1009

Additional Oracle

Applications

Notes 1009

Concurrent

Managers

1009

Applications—Finding Module-Specific

Patches 1011

Diagnostics

DataCollection: EBS

Analyzers

1011

WebServer

Tuning

1013

Timeouts 1014

Database Initialization ParameterSizing 1016

Top

10 Reasons NottoWriteaBook 1017

Tips

Review 1017

References 1018

B The

V$

Views (DBAand

Developer)

1019

CreationofV$ and GV$ Views and X$Tables 1020

A Listof Oracle 12c(12.2.0.0.1) GV$Views 1021

A ListofOracle 12c(12.2.0.0.1) V$Views 1021

Oracle 12c

Scripts

for theX$Tables Used to CreatetheV$Views 1029 C The

X$

Tables (DBA) 1039 Oracle 12cR2 X$Tables Ordered

by

Name 1040

Oracle 12cR2 X$ Indexes 1048

Oracle 12cR2V$Views Cross-ReferencedtotheX$Tables 1048

References

Related documents

The role composition language that is used to obtain an integrated data model for all tools involved in an integration scenario, is an essential part of our approach.. For example,

On top of the capacity benefits provided by smart caching, the Exadata Storage Server Software 11.2.3.3 and above, introduces the Exadata Smart Flash Cache Compression feature, which

Enterprise Manager Cloud Control 12c Architecture: Overview Cloud Control Monitoring Architecture for Exadata Database Machine Configuring Cloud Control to Monitor Exadata

Keys to Speed and Cost Advantage Exadata Hybrid Columnar Exadata Smart Flash Cache Exadata Intelligent Storage Compression Grid.. Exadata Intelligent

 Oracle Exadata Database Machine X4-2 (Oracle data sheet).  The Teradata Data

• Engineered systems such as Exadata and Exalogic provide extreme performance and efficiency for mixed workloads Cloud infrastructure Oracle Cloud Infrastructure provides a

The minimum requirements on the qualifications and experience of the key personnel of a registered specialist contractor in site formation works category (RSC(SF)) are given in

Storage integration is also driving innovation with Oracle engineered systems such as the Oracle Exadata Database Machine and Oracle Exalogic Elastic Cloud, which have achieved