195
<Insert Picture Here> Upgrade to Oracle Database 11g Daniel T. Liu Principal Solution Architect UTOUG Training Day Date: Wednesday, March 30, 2011 Time: 02:15 PM – 04:30 PM Venue: 9750 South 300 West Sandy, Utah 84070

Liu 11gR2 Upgrade

Embed Size (px)

Citation preview

Page 1: Liu 11gR2 Upgrade

<Insert Picture Here>

Upgrade to Oracle Database 11g

Daniel T. LiuPrincipal Solution Architect

UTOUG Training DayDate: Wednesday, March 30, 2011 Time: 02:15 PM – 04:30 PM Venue: 9750 South 300 West

Sandy, Utah 84070

Page 2: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 2

Preparation

Agenda

Upgrade

Diagnostics & Tuning

Best Practices

News and Task List

Performance Testing

Installation

Page 3: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 3

Preparation

Agenda

Upgrade

Diagnostics & Tuning

Best Practices

News and Task List

Performance Testing

InstallationSupport Policy

CertificationDocumentation

ReferencesUpgrade paths

Sanity operationsPreparation

Page 4: Liu 11gR2 Upgrade

Oracle10gR1 on Extended Support9i was unsupported in August 2010

Cost & Risk of Older Releases

• Oracle Database 10g Release 1• Extended Support Starts 1/31/2009

• Oracle9i Database• Extended Support Started 7/31/07• Extended Support Ends 7/31/10

• No support for Oracle8i or earlier

Additional Costs:

+ 10% 1st Year+ 20% Year 2 + 3

Presently at riskPresently at risk

Presently at risk

Page 5: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 5

t2008

2003

2004

2005

2006

2007

2002

2009

2010

today

Lifetime Support Policy

2011

2012

2013

2014

Sustaining SupportPremier Support

R2July 2007

Extended SupportJuly 2010

January 2009 January 2012

R2 July 2010 July 2013

2015

2016

August 2012 August 2015

July 2008

July 2011

R2

2017

2018

January 2015 January 2018

Page 6: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 7

Releases – Support-SRs

23%

67%

9%

Page 7: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 8

Upgrade to Oracle Database 11g

R2

R2≥ 10.2.0.2

10.1.0.5

R2

≥ 7.3.4

≥ 8.0.6

≥ 8.1.7.4

≥ 9.0.1.4

9.2.0.8

≥ 9.2.0.4

"Empty" arrows mean: no specific patch release required

Page 8: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 9

Oracle Certification• Please see Note:964664.1 for explanations on

products and product group assignments• See: Note:431578.1 on Middleware, Application Server

Page 9: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 10

Oracle Certification

Page 10: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 13

Upgrade is easier!• The upgrade to Oracle Database 11g is much easier

than any upgrades to earlier Oracle releases

• Size of Upgrade guides:• 8.1.7 - 512 pages• 9.0.1 - 484 pages – 111 steps for an RDBMS with 9 components

• 9.2.0 - 344 pages• 10.1.0 - 170 pages • 10.2.0 - 140 pages • 11.1.0 - 186 pages• 11.2.0 -178 pages

Page 11: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 14

Upgrade Length• How long will the upgrade take

to complete?• Independent of:

• Size of the database• Used datatypes

• Dependent mainly on:• The number of installed components and options• Valid and non-stale data dictionary statistics• Number of synonyms – they'll get recompiled (upgrade from 9i)• Number of objects in XDB• At a very low rate, if COMPATIBLE is increased:

• Number of datafiles• Size of redo logs

Page 12: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 15

Upgrade Length• Speed up your upgrade performance by:

• Truncating the auditing table SYS.AUD$

• Possibly switch off archiving• Make sure this is not against your business rules

• Creating dictionary statistics right before the upgrade• Oracle 9i:

• Oracle 10g/11g:

SQL> truncate SYS.AUD$;

SQL> exec DBMS_STATS.GATHER_SCHEMA_STATS('SYS', options => 'GATHER',estimate_percent =>DBMS_STATS.AUTO_SAMPLE_SIZE, method_opt => 'FORALL COLUMNS SIZE AUTO', cascade => TRUE);

SQL> exec DBMS_STATS.GATHER_DICTIONARY_STATS;

Page 13: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 16

Documentation• Note:601807.1 Upgrade Companion 11g

• Note:785351.1 Upgrade Companion 11g Release 2

Page 14: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 17

Documentation• Note:785351.1 Upgrade Companion 11g

Page 15: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 18

Documentation• Note:785351.1 Upgrade Companion 11g

Page 16: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 19

Documentation• Upgrade Guide

http://download.oracle.com/docs/cd/E11882_01/server.112/e10819/toc.htm

• Important Notes• Note:837570.1

Complete Checklist for Manual Upgrades to 11g Release 2

• Note: 421191.1Complete checklist for manual upgrades from X to Y

Page 17: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 20

OTN Upgrade Page• http://www.oracle.com/technology/products/database/oracle11g/upgrade/index.html

Page 18: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 21

OTN Upgrade Page

• Or simply ... ☺

Page 19: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 22

Upgrade Paths

Stay on same OS?N Y

UPGRADEExport/Import

CTAS, COPY

Transportable Tablespaces

Transportable Database

Oracle StreamsDBUA

Downtime >30min?

Y

N

SQL Apply

CLI SQL> @catupgrd

Oracle Golden Gate

Page 20: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 23

Sanity Operations• Always check for INVALID objects:

• Fix all INVALID objects BEFORE the upgrade!!!!!!

• There should be no invalid objects in SYS and SYSTEM user schema

• Recompile invalid objects with utlrp.sql before the upgrade• Compare invalid objects from before and after the upgrade

• Beginning with 11.1.0.7 the comparison has been automated• Find invalid objects in registry$sys_inv_objs and registry$nonsys_inv_objs

• Compare before-after: utluiobj.sql• The view DBA_INVALID_OBJS contains a list of invalid objects after the

upgrade

SQL> SELECT UNIQUE object_name, object_type, ownerFROM dba_objects WHERE status='INVALID';

Page 21: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 24

Sanity Operations• If upgrading from 10g or 11g, purge the recyclebin

SQL> purge DBA_RECYCLEBIN;

Page 22: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 25

Sanity Operations

init.ora:<...>

_always_semi_join=off_unnest_subquery=false<...>optimizer_features_enable=9.0.1<...>

event = "10061 trace name context forever, level 10" <...>

• Remove "old" parameters, underscores and events from your init.ora/spfile

• Examples:

Page 23: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 26

Preparation• Preserve performance statistics

• Get accurate performance statistics• Comparison: before ↔ after• Time specific queries and batches

• Test upgrade of the database• Functional tests• Performance tests with real life loads!!!

• Real Application Testing• SQL Performance Analyzer • Database Replay

Page 24: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 27

Preparation• Collecting sufficient performance data prior

to the upgrade is of vital importance• Sufficient means: Starting at least 4 weeks before the upgrade• Gather accurate performance statistics• In Oracle 8i/9i:

• Use STATSPACK• Export the PERFSTAT user right before the upgrade• Note:466350.1 STATSPACK before/after upgrade

• In Oracle 10g/11g:• Use AWR

• Take snapshots every 30-60 minutes – retention: >30 days• Export the AWR with DBMS_SWRF_INTERNAL.AWR_EXTRACT• Use AWR DIFF reports to compare before & after upgrade performance:DBMS_WORKLOAD_REPOSITORY.AWR_DIFF_REPORT_HTML

Page 25: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 28

Preparation

Agenda

Upgrade

Diagnostics & Tuning

Best Practices

News and Task List

Performance Testing

InstallationInstallation Overview

Oracle Clusterware & ASMInstallation

PatchesTime Zone

Listener

Page 26: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 29

Installation• How to access the software?

• http://edelivery.oracle.com/

• Download from OTN:http://otn.oracle.com/software/index.html

Page 27: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 30

Installation overview

Oracle Clusterware

Oracle ASM

Oracle Database

Oracle Clusterware

Oracle ASM

Oracle Database

Grid Infrastructure

≥ 11.2.0.1≤ 11.1.0.7

1.

2.

3.

$ORACLE_BASE$ORACLE_BASE

ORA_CRS_HOME

$ORACLE_HOME – for ASM

$ORACLE_HOME – for Database $ORACLE_HOME – for Database

same owner

Inventory, ADR etc.

GRID_HOME

Inventory, ADR etc.

Page 28: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 31

Preparation

Agenda

Upgrade

Diagnostics & Tuning

Best Practices

News and Task List

Performance Testing

InstallationInstallation Overview

Oracle Clusterware & ASMInstallation

PatchesTime Zone

Listener

Page 29: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 32

Oracle Clusterware Upgrade 11g and 11.2• Always upgrade Oracle Clusterware first!!!• Upgrading to Oracle Clusterware 11g Release 1:

• Install new software into the existing Clusterware home• In-place software upgrade

• Upgrading to Oracle Clusterware 11g Release 2:• Install new software into new Grid Infrastructure home• Out-of-place software upgrade• Grid Infrastructure home is owned by 'root'

• On 32-bit Windows there'll be no 32-bit Grid Infrastructure and ASM available!

Page 30: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 33

Oracle Clusterware Upgrade 11g Release 2

R2No ASM, no Oracle Clusterware

ClusterwareR2

Clusterware

Clusterware

ClusterwareR2

Clusterware:Rolling upgradeASM:No rolling upgrade

Clusterware & ASM: rolling upgrade

Clusterware & ASM: ≥ 10.2.0.3

Clusterware & ASM:10.1.0.5

==> Unset ORACLE_HOME, ORACLE_BASE and ORA_CRS_HOME

Page 31: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 34

If upgrade is not highlighted we did not detect a previous clusterware installation

Oracle Clusterware Upgrade 11g Release 2

Page 32: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 35

Oracle Clusterware Upgrade 11g Release 2Setup ASM Roles

Page 33: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 36

Clusterware - ASM - DB Compatibility

Note:337737.1

a) The Matrix is valid after the (rolling) upgrade has been completed.During the upgrade you may use an older ASM version.

b) Linux specific: see Note 781628.1 c) The ASM version needs to be at least 10.1.0.3

Page 34: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 37

Preparation

Agenda

Upgrade

Diagnostics & Tuning

Best Practices

News and Task List

Performance Testing

InstallationInstallation Overview

Oracle Clusterware & ASMInstallation

PatchesTime Zone

Listener

Page 35: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 38

Installation Database Home(1) Install software into a new Oracle Home(2) Apply the newest available patch set(3) Apply the newest available patch set update (PSU)(4) Apply recommended patch bundles and one-off patches

Page 36: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 39

Installation• Space / resource requirements

• RAM: ≥ 1GB

• Software installation:• 1GB in /tmp or \TEMP necessary• Between 3 GB (Windows), 3.9 GB (Linux32) and 7 GB (HP-UX)

• Seed database: ≥ 1.7 GB• Seed databases (ORCL) are always prebuilt EE databases with all

options!!!

• Swapspace• Between 1 GB and 2 GB: 1.5 times the size of RAM• Between 2 GB and 16 GB: Equal to the size of RAM• More than 16 GB: 16 GB

Page 37: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 40

Installation 11g Release 2

Page 38: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 41

Installation 11g Release 2

Page 39: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 42

Installation 11g Release 2

Page 40: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 43

Installation 11g Release 2

Page 41: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 44

Installation 11g Release 2

Page 42: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 45

Installation 11g Release 2

Page 43: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 46

Installation 11g Release 2

Oracle Base and Software Locationshould be in different paths!!!

Page 44: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 47

Installation 11g Release 2

Page 45: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 48

Installation 11g Release 2

Page 46: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 49

Installation 11g Release 2

Page 47: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 50

Installation 11g Release 2

Page 48: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 51

Installation 11g Release 2

Page 49: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 52

Installation 11g Release 2

Page 50: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 53

Installation 11g Release 2

Page 51: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 54

Preparation

Agenda

Upgrade

Diagnostics & Tuning

Best Practices

News and Task List

Performance Testing

InstallationInstallation Overview

Oracle Clusterware & ASMInstallation

PatchesTime Zone

Listener

Page 52: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 55

Patch Set Installation• Install patch sets and patches before you start the upgrade

Page 53: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 56

Recommended Patches

Page 54: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 57

Recommended Patches

Page 55: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 58

Patch Set Update (PSU) Installation• Install PSUs as well

• Note:854428.1: Introduction to Database Patch Set Updates

• Database PSUs include:• Fixes for critical issues that may affect a large number of customers

and that are already proven in the field• Critical Patch Update (CPU) fixes

• Database PSUs do not include:• Changes that require re-certification• Fixes that require configuration changes

• Typically 50-100 new bug fixes - cumulative• Guaranteed to be RAC rolling installable• (Change the fifth digit of the release number from ≥11.2.0.1.1)• Will be released 4x per year such as CPUs on the same schedule

Page 56: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 59

• Note 161818.1

Important Alerts?

Page 57: Liu 11gR2 Upgrade

• Note:880782.1Support Status and Alerts for Oracle 11g Release 2 (11.1.0.X)

Upgrade Information / Alerts

Page 58: Liu 11gR2 Upgrade

• Note 880707.1 Known Issues specific to the 11.2.0.1 Base Release

Upgrade Information / Alerts

Page 59: Liu 11gR2 Upgrade

• Note 880707.1.1 Known Issues specific to the 11.2.0.1 Base Release

Upgrade Information / Alerts

Page 60: Liu 11gR2 Upgrade

Recommended OS patches• Note:169706.1: OS Installation and Configuration

Page 61: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 64

Preparation

Agenda

Upgrade

Diagnostics & Tuning

Best Practices

News and Task List

Performance Testing

InstallationInstallation Overview

Oracle Clusterware & ASMInstallation

PatchesTime Zone

Listener

Page 62: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 65

• Taken from an Oracle internal information email:

time zone Patches

Page 63: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 66

• Why DST time zone patches? (DST: Daylight Savings Time)

• Since 2007 DST definitions and time zone names have been changed several times

• time zone versions by release:• Oracle 9i: TZ V1• Oracle 10.1: TZ V2• Oracle 10.2.0.1/2: TZ V2• Oracle 10.2.0.3: TZ V3• Oracle 10.2.0.4: TZ V4• Oracle 11.1: TZ V4

• Source release requires TZ V4 – otherwise no upgrade will be possible

• Oracle 11.2: TZ V11• Source release does not have to be patched. time

zone conversion will be done in 11.2

time zone Patches

Page 64: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 67

Preparation

Agenda

Upgrade

Diagnostics & Tuning

Best Practices

News and Task List

Performance Testing

InstallationInstallation Overview

Oracle Clusterware & ASMInstallation

PatchesTime Zone

Listener

Page 65: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 68

Listener Configuration• Best Practices - strongly recommended:

Create a new listener environment with NETCA:

Page 66: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 69

Agenda

Database Upgrade AssistantCommand Line Upgrade

Post UpgradeAlternatives

Preparation

Upgrade

Diagnostics & Tuning

Best Practices

News and Task List

Performance Testing

Installation

Page 67: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 70

Database Upgrade Assistant (GUI)• Features:

• Graphically led upgrade• Lots of important checks• RAC aware - inclusion of all nodes

• for RAC (almost) a must !!!• Offline Backup and Restore possible• ASM upgrade (until 11.1)• Oracle XE upgrade• Patch upgrades

• Logs:• $ORACLE_HOME/cfgtoollogs/dbua

• Documentation:• Oracle® Database Upgrade Guide

11.1: http://download.oracle.com/docs/cd/B28359_01/server.111/b28300/toc.htm11.2: http://download.oracle.com/docs/cd/E11882_01/server.112/e10819/toc.htm

Page 68: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 71

Database Upgrade Assistant (GUI)• Silent mode:

• $ dbua –help shows all valid options• See doc:

11.1: http://download.oracle.com/docs/cd/B28359_01/server.111/b28300/upgrade.htm11.2: http://download.oracle.com/docs/cd/E11882_01/server.112/e10819/upgrade.htm#UPGRD12405

Page 69: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 72

Database Upgrade Assistant (GUI)

• dbua [ -silent ] [ -sid SID ] [-oracleHome home_name][-oracleBase base_name] [-diagnosticDest diagnostic_destination][-sysDBAUserName SYSDBA_user] [-sysDBAPassword SYSDBA_pwd] [-upgradeASM] [-autoextendFiles] [-newGlobalDbName db_name][-newSid new_SID] [-generateMapFile] [-useASM][-commonFileLocation common_files] [-omfLocation omf_area] [-databaseMapFile map_file_name] [-newRecoveryArea recover_area][-newRecoveryAreaSize recover_size] [-apexAdminPassword apex_pwd][-disableUpgradeScriptLogging ] [-backupLocation directory][-sysauxTablespace -datafileName name -datafileSize size

-datafileSizeNext size -datafileSizeMax size][-postUpgradeScripts script [, script ] ... ] [-initParam parameter=value [, parameter=value ] ... ] [-disableArchiveLogMode] [-recompile_invalid_objects true | false][-degree_of_parallelism cpu_number] [-emConfiguration {CENTRAL|LOCAL|ALL|NOBACKUP|NOEMAIL|NONE}

-dbsnmpPassword password -sysmanPassword password -asmPassword password -hostUserName hostname-hostUserPassword password -backupSchedule hh:mm [-smtpServer server_name -emailAddress address][-centralAgent location] [-localRacSid SID]]

[-recoveryAreaDestination directory][-h|-help]

Page 70: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 73

Database Upgrade Assistant (GUI)

• Example:

dbua -silent -sid dwh-oracleHome /opt/oracle/product/RDBMS10g-diagnosticDest /opt/oracle/diag

-sysDBAUserName sys-sysDBAPassword manager

-recompile_invalid_objects true-degree_of_parallelism 4

-emConfiguration LOCAL-dbsnmpPassword manager-sysmanPassword manager

Page 71: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 74

Database Upgrade Assistant (GUI)

Page 72: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 75

Database Upgrade Assistant (GUI)

Page 73: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 76

Database Upgrade Assistant (GUI)

Page 74: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 77

Database Upgrade Assistant (GUI)

Page 75: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 78

Database Upgrade Assistant (GUI)

Page 76: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 79

Database Upgrade Assistant (GUI)

Page 77: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 80

Database Upgrade Assistant (GUI)

Page 78: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 81

Database Upgrade Assistant (GUI)

Page 79: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 82

Database Upgrade Assistant (GUI)

Page 80: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 83

Database Upgrade Assistant (GUI)

Page 81: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 85

Database Upgrade Assistant (GUI)

Page 82: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 86

Database Upgrade Assistant (GUI)

Page 83: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 87

Database Upgrade Assistant (GUI)

Page 84: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 88

Agenda

Database Upgrade AssistantCommand Line Upgrade

Post UpgradeAlternatives

Preparation

Upgrade

Diagnostics & Tuning

Best Practices

News and Task List

Performance Testing

Installation

Page 85: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 89

Command Line Upgrade• Typical scenario: e.g. changing to a new server

Server(OLD) Server(NEW)

3) Run utlu112i.sql4) Shutdown database5) Copy all relevant files

(dbf, ctl, log, spfile, orapw)

1) Install Oracle11g software2) Copy utlu112i.sql

6) Apply suggested changes7) Start the upgrade process

Page 86: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 90

Command Line Upgrade• Step-by-step:

1. Complete online backup of the database2. Install 11g Oracle software and apply patch set, PSU etc.3. Analyze the DB using utlu112i.sql and follow all

requirements given by the script 4. Create a new 11g listener with NETCA5. Switch to the new environment, startup the DB (startup

upgrade) and create the SYSAUX tablespace (only if source db is an Oracle 9i db)

6. Run upgrade script catupgrd.sql7. Recompile with utlrp.sql - compare with utluiobj.sql8. Run catuppst.sql if you are upgrading from ≥10g9. Check the post upgrade status: utlu112s.sql

Page 87: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 91

Command Line Upgrade• Upgrade information script: utlu112i.sql

• Run in the environment of the source database• Checks all init parameters and displays warnings for obsolete and

deprecated parameters• Checks

• Components• Tablespace SYSAUX• National Characterset• time zone file version check• Cluster check

Info

Page 88: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 92

Command Line Upgrade• Get the current version of utlunmi.sql

• Download it now!

•Note:884522.1

Page 89: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 93

Command Line Upgrade• utlu112i.sql: DB info

• Time zone conversion should be done after the upgrade has completed• Recommended• Necessary if datatype TIMESTAMP WITH TIME ZONE is used

Page 90: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 94

Command Line Upgrade•utlu112i.sql: Tablespaces adequate size?

Page 91: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 95

Command Line Upgrade•utlu112i.sql: Init parameter changes?

Page 92: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 96

Command Line Upgrade• utlu112i.sql: Components and options?

• Annotation:You'll have to install all options installed for the release you are upgrading from – otherwise some components can’t be upgraded

• To remove (or reinstall) components manually:Note:472937.1 Information On Installed Database Componentsand Schemas Note.300056.1 Debug and Validate Invalid ObjectsNote:753041.1 How to diagnose Components with NON VALID statusNote.733667.1 How to Determine if XDB is Being Used in the Database?

Page 93: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 97

Command Line Upgrade

• Create Dictionary statistics• Shutdown the database (IMMEDIATE/NORMAL) • Adjust init parameters:

• COMPATIBLE ≥ 10.1.0• SGA_TARGET ≥ 524MB (32-bit) ... ≥ 748MB (64-bit)• PGA_AGGREGATE_TARGET ≥ 25MB• LOG_ARCHIVE_FORMAT must contain %s, %t and %r

• Move init.ora/SPFILE and PWDsid.ora to their new location• Create a new 11g-Listener (use the NETCA)

• Change environment to point to the new $ORACLE_HOME

Page 94: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 98

Command Line Upgrade• Windows only:

• Delete the old Service:> oradim -DELETE -SID ORCL

• Create a new Service:> oradim -NEW-SID ORCL-SYSPWD passwrd-STARTMODE a-PFILE initfile

ORADIM creates a logfile in %ORACLE_HOME%\database

Page 95: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 99

SQL> STARTUP UPGRADE;

• Supresses unnecessary error messages likeORA-00942: table or view does not exist -thus logfiles will be easier to read and check

Command Line Upgrade

Please note:This is an excerpt from the alert.log – these parameters will be set implicitely during a STARTUP UPGRADE

ALTER SYSTEM SET _system_trig_enabled=FALSE SCOPE=MEMORY;Autotune of undo retention is turned off. ALTER SYSTEM SET _undo_autotune=FALSE SCOPE=MEMORY;ALTER SYSTEM SET undo_retention=900 SCOPE=MEMORY;ALTER SYSTEM SET aq_tm_processes=0 SCOPE=MEMORY;ALTER SYSTEM SET enable_ddl_logging=FALSE SCOPE=MEMORY;Resource Manager disabled during database migration: plan '' not setALTER SYSTEM SET resource_manager_plan='' SCOPE=MEMORY;ALTER SYSTEM SET recyclebin=‘OFF’ DEFERRED SCOPE=MEMORY;Resource Manager disabled during database migration

Page 96: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 100

Command Line Upgrade• Create tablespace SYSAUX (only if source is a 9i db) :

SQL> CREATE TABLESPACE sysauxDATAFILE 'file' SIZE 500MEXTENT MANAGEMENT LOCALSEGMENT SPACE MANAGEMENT AUTOONLINE;

Page 97: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 101

Command Line Upgrade• One upgrade scripts for all releases and all components:

• Useful:

• Database will be shutdown when script has been completed

• Generate fixed object stats (best practice!):

SQL> @catupgrd.sql

SQL> SPOOL c:\temp\upgrade.log

SQL> executedbms_stats.gather_fixed_objects_stats;

Page 98: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 102

• Recompilation:• utlrp.sql

• Calls utlprp.sql and dertermines the parallel degree for recompilation based on CPU cores

• Recompiles all INVALID objects • Utilizes package utl_recomp• Re-enables functional indexes automatically• utlprp.sql can be called directly like:

• SQL> @utlprp 7

• This can be useful to minimize CPU usage

Command Line Upgrade

Page 99: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 103

• Progress during recompilation :

Command Line Upgrade

1. Query returning the number of invalid objects remaining.This number should decrease with time.SELECT COUNT(*) FROM obj$ WHERE status IN (4, 5, 6);

2. Query returning the number of objects compiled so far.This number should increase with time.SELECT COUNT(*) FROM UTL_RECOMP_COMPILED;

3. Query showing jobs created by UTL_RECOMP.SELECT job_name FROM dba_scheduler_jobsWHERE job_name like 'UTL_RECOMP_SLAVE_%';

4. Query showing UTL_RECOMP jobs that are running.SELECT job_name FROM dba_scheduler_running_jobsWHERE job_name like 'UTL_RECOMP_SLAVE_%';

Page 100: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 104

• Post upgrade script: catuppst.sql• Only necessary when upgrading from ≥10.1• Located in ?/rdbms/admin• Database is not in upgrade mode anymore• Can be run concurrently with utlrp.sql

• Upgrade Automatic Workload repository (AWR) baseline information • Upgrade ADDM task metadata• Update Oracle Label security (OLS) policies

Command Line Upgrade

Page 101: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 105

• Post upgrade script: utlu112s.sql• Run against new database in 11g environment• Checks the upgrade results according to DBA_REGISTRY• Displays duration of the upgrade per component and in total

Command Line UpgradeStatus/Success

Page 102: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 106

Command Line Upgrade• Post upgrade script: utlu112s.sql

SQL> @?/rdbms/admin/utlu112s.sql

Oracle Database 11.2 Post-Upgrade Status Tool 10-07-2009 11:48:30

Component Status Version HH:MM:SS

Oracle Server VALID 11.2.0.1.0 00:24:32 JServer JAVA Virtual Machine VALID 11.2.0.1.0 00:06:10 Oracle Workspace Manager VALID 11.2.0.1.0 00:01:11 OLAP Analytic Workspace VALID 11.2.0.1.0 00:00:44 OLAP Catalog VALID 11.2.0.1.0 00:01:33 Oracle OLAP API VALID 11.2.0.1.0 00:00:58 Oracle Enterprise Manager VALID 11.2.0.1.0 00:15:19 Oracle XDK VALID 11.2.0.1.0 00:06:11 Oracle Text VALID 11.2.0.1.0 00:01:18 Oracle XML Database VALID 11.2.0.1.0 00:07:43 Oracle Database Java Packages VALID 11.2.0.1.0 00:00:42 Oracle Multimedia VALID 11.2.0.1.0 00:09:57 Spatial VALID 11.2.0.1.0 00:10:34 Oracle Expression Filter VALID 11.2.0.1.0 00:00:23 Oracle Rules Manager VALID 11.2.0.1.0 00:00:20 Gathering Statistics 00:11:31

Total Upgrade Time: 01:39:16

Page 103: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 107

Agenda

Database Upgrade AssistantCommand Line Upgrade

Post UpgradeAlternatives

Preparation

Upgrade

Diagnostics & Tuning

Best Practices

News and Task List

Performance Testing

Installation

Page 104: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 108

Post Upgrade Best Practice - SPFILE• Always create an editable init.ora from the current SPFILE

after the upgrade has been finished• Prevents rewrite in case of setting wrong parameters or

forced edit• Keep in mind:

• The SPFILE is binary file!!! Don't edit it!! Default since Oracle 9.0• It simply will exist after using DBUA or DBCA

• Parameter can be changed by:

SQL> create pfile from spfile; <<Now edit init.ora with any editor>>SQL> startup force pfile=initDB.oraSQL> create spfile from pfile;

SQL> alter system set PARAMETER=VALUE scope=both;

Page 105: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 109

Post Upgrade Task – time zoneOnly in 11g Release 2

• Adjust time zone data in the database to DST V11 or higher:

• For more information see the Globalization Doc:http://download.oracle.com/docs/cd/E11882_01/server.112/e10729/ch4datetime.htm#NLSPG261

startup upgrade exec dbms_dst.begin_upgrade(new_version => 11); shutdown immediate;

startup; set serveroutput on; declare num_of_failures number; begin dbms_dst.upgrade_database(num_of_failures); dbms_output.put_line(num_of_failures); dbms_dst.end_upgrade(num_of_failures); dbms_output.put_line(num_of_failures); end; /

Page 106: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 110

Gather Workload Statistics• Gather system statistics during a regular workload period -

otherwise non-appropriate values for the CBO will be used:

SQL> select pname NAME, pval1 VALUE, pval2 INFOfrom aux_stats$;

NAME VALUE INFO-------------------- ---------- ------------------------------STATUS COMPLETEDDSTART 04-03-2010 12:30DSTOP 05-03-2010 12:30FLAGS 1CPUSPEEDNW 2498,65IOSEEKTIM 11,405IOTFRSPEED 25595,605...

SQL> EXECUTE dbms_stats.gather_system_stats('start');<< Run it for several hours on a workload – does not generate overhead!!! >>

SQL> EXECUTE dbms_stats.gather_system_stats('stop');

Page 107: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 111

Post Upgrade Best Practice• Create fixed table statistics directly after catupgrd.sql has

been completed:

• Otherwise it can happen that MMON will cause too much CPU load

• Create fixed table statistics again after a week with regular production workload

• This task should be done only a few times per year

SQL> executedbms_stats.gather_fixed_objects_stats;

Page 108: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 112

Agenda

Database Upgrade AssistantCommand Line Upgrade

Post UpgradeAlternatives

Preparation

Upgrade

Diagnostics & Tuning

Best Practices

News and Task List

Performance Testing

Installation

Page 109: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 113

Upgrade Alternatives• Migration methods • Minimal downtime methods

• What does "minimal downtime" really mean?• 12 hours?• 60 minutes?• 5 minutes?• Less?• No downtime at all?

Page 110: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 114

Upgrade Alternatives

Same OS?N Y

UPGRADEExport/Import

CTAS, COPY

Transportable Tablespaces

Transportable Database

Oracle StreamsDBUA

Downtime >30min?

Y

N

SQL Apply

CLI SQL> @catupgrd

Oracle Golden Gate

Page 111: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 115

Upgrade Alternatives

Same OS?N Y

UPGRADEExport/Import

CTAS, COPY

Transportable Tablespaces

Transportable Database

Oracle StreamsDBUA

Downtime >30min?

Y

N

SQL Apply

CLI SQL> @catupgrd

Oracle Golden Gate

Page 112: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 116

"Regular" Database Upgrade• Database Upgrade Assistant (DBUA)• Command line upgrade with catupgrd.sql• Usually between 30 and 90 minutes

• Dependent mainly on installed options and componentsComponent HH:MM:SS

Oracle Server 00:16:17

JServer JAVA Virtual Machine 00:05:19

Oracle Workspace Manager 00:01:01

Oracle Enterprise Manager 00:10:13

Oracle XDK 00:00:48

Oracle Text 00:00:58

Oracle XML Database 00:04:09

Oracle Database Java Packages 00:00:33

Oracle Multimedia 00:07:43

Oracle Expression Filter 00:00:18

Oracle Rule Manager 00:00:12

Gathering Statistics 00:04:53

Total Upgrade Time: 00:52:31

Component HH:MM:SS

Oracle Server 00:16:17

JServer JAVA Virtual Machine 00:05:19

Oracle XDK 00:00:48

Oracle Text 00:00:58

Oracle XML Database 00:04:09

Oracle Database Java Packages 00:00:33

Gathering Statistics 00:02:43

Total Upgrade Time: 00:30:47

Page 113: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 117

Upgrade Alternatives

Same OS?N Y

UPGRADEExport/Import

CTAS, COPY

Transportable Tablespaces

Transportable Database

Oracle StreamsDBUA

Downtime >30min?

Y

N

SQL Apply

CLI SQL> @catupgrd

Oracle Golden Gate

Page 114: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 118

Export - Import

6.0.36 11.2.0.1

Create newSource DB Dest. DB

$ exp FULL=Y $ imp FULL=Y

Dum

p Fi

le T

rans

fer

Page 115: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 119

Export - Import• All purpose• Import of all versions ≥ Oracle V5 possible • "exp" is not supported in 11g anymore

• But the utility is still there and can be used• "imp" is still supported for importing older dumpfiles

• Not really fast but well known and reliable• Relation between amount of data and runtime

• Necessary and helpful :• Changing the database charactersets• Changing the OS platform• Schema consolidation• Non-direct-upgrade supported releases such as 8.0.3

• No need to care for source patch release or time zone patches

Page 116: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 120

Export - Import• Export/Import

• Changing the character set• Changing the Database Character Set

Note: 225912.1• Use Scanner Utility CSscan before altering the DB Character set

Note: 123670.1• Unicode

• Problem can be special characters, e.g.:Umlaut Ä in WE8ISO... = 1 ByteUmlaut Ä in UTF8 = 2 Byte• Workaround: nls_length_semantics=char

• Important Unicode Notes on support.oracle.com:Note: 260893.1 and Note: 788156.1

• WE8ISO8859P1 ==> P15: Note 257722.1• Character Set Migration - White Paper:

• http://www.oracle.com/technology/tech/globalization/pdf/mwp.pdf

Page 117: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 121

Export - Import• Hints and tricks

• Transfer dump files always in BINARY mode• Do full database export always as user SYSTEM

• GRANTs on SYS's objects have to be exported seperately• Import takes approximately 3x times as long as Export• Export always with the lowest involved database version• Import always with imp of target database

• See also: Note:286775.1

• Export performance• DIRECT=Y ... bypasses SQL-Layer, but no conversions!• Parallelize export by dividing into logical independent chunks of data

• Import performance• Increase BUFFER• INDEXES=N ... build indexes later in parallel ... INDEXFILE=...• Parameter COMMIT_WRITE=NOWAIT (10g) or COMMIT_WAIT=NOWAIT

(11g) during import

Page 118: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 122

Data Pump• The "new" exp/imp - since Oracle Database 10g

• Faster than exp/imp• Powerful concept and more capabilities than exp/imp

• EXCLUDE• COMPRESS=ALL (Advanced Compression Option ☺)• SQL with WHERE clause• Hint: Use EXCLUDE=STATISTICS while importing

• Compatibility and version changes: Note:553337.1

Page 119: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 123

Data Pump with NETWORK_LINK

10.2.0.4 11.2.0.1

Create newSource DB Dest. DB

$ impdp FULL=Y

<< TRANSFER >>Database Link

$ impdp USER=abc$ impdp ...

Page 120: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 124

Data Pump• Data Pump cross database link

• Parameter: NETWORK_LINK• Run impdp on the target system• No expdp necessary

• Does not work with LONG/LONG RAW and object types• No disk-IO and no dump file transfer will be performed

• Limitation: network bandwidth• Example:

$ impdp system/pw NETWORK_LINK=mydblink FULL=Y

Page 121: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 125

Upgrade Alternatives

Same OS?N Y

UPGRADEExport/Import

CTAS, COPY

Transportable Tablespaces

Transportable Database

Oracle StreamsDBUA

Downtime >30min?

Y

N

SQL Apply

CLI SQL> @catupgrd

Oracle Golden Gate

Page 122: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 126

Transportable Tablespaces• Concept:

• Create an "empty" database in the new environment• Plug in all data tablespaces from source to target database

- SYSTEM+SYSAUX tablespaces can't be transported- Additional steps necessary to move views, synonyms etc.

• "Possibly" very fast upgrade• Complexity could be constraining• Works cross-platform and cross-Endianness since Oracle

Database 10g

Page 123: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 127

Transportable Tablespaces• General facts regarding TTS

• Feature available since Oracle 8i

imp meta data

Copy the datafiles

exp meta data

Read Only

Read Write

Dest. DBSource DB

Page 124: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 128

Transportable Tablespaces• TTS x-platform (v$transportable_platform):

FILE

COPY

FILE

COPY

Big EndianLittle Endian RMANconvert

HP Open VMSHP Tru64 UNIX

Linux IA (32-bit)Linux IA (64-bit)Linux 64-bit for AMD

Microsoft Windows IA (64-bit)Microsoft Windows 64-bit for AMDMicrosoft Windows IA (32-bit)

Solaris Operating System (x86)

Apple Mac OS

HP-UX (64-bit)HP-UX IA (64-bit)

AIX-Based Systems (64-bit)IBM zSeries Based LinuxIBM Power Based Linux

Solaris[tm] OE (32-bit)Solaris[tm] OE (64-bit)

Page 125: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 129

Transportable Tablespaces

Source DB

Move non-segmenteduser objects

10.2.0.4 11.2.0.1

Dest. DB

Create new

Transport

Page 126: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 130

Upgrade Alternatives

Same OS?N Y

UPGRADEExport/Import

CTAS, COPY

Transportable Tablespaces

Transportable Database

Oracle StreamsDBUA

Downtime >30min?

Y

N

SQL Apply

CLI SQL> @catupgrd

Oracle Golden Gate

Page 127: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 131

Transportable Database• Feature since Oracle Database 10g Release 2

• Cross-platform• Unfortunately not cross-Endianness!!!• With RMAN in an automated way

• Database must be switched to READ ONLY mode• Datafiles must be converted with RMAN into target format

• RMAN CONVERT DATABASE command• Either on the source or the target system – in most cases

completes faster on the target system• Not a real minimal downtime concept

• But very comfortable for migrations in between one Endianness group

Page 128: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 132

RMANconvert

Transportable Database• TDB x-platform (For OS naming conventions see: v$transportable_platform):

Big EndianLittle EndianRMANconvert

HP Open VMSHP Tru64 UNIX

Linux IA (32-bit)Linux IA (64-bit)Linux 64-bit for AMD

Microsoft Windows IA (64-bit)Microsoft Windows 64-bit for AMDMicrosoft Windows IA (32-bit)

Solaris Operating System (x86)

HP-UX (64-bit)HP-UX IA (64-bit)

AIX-Based Systems (64-bit)IBM zSeries Based LinuxIBM Power Based Linux

Solaris[tm] OE (32-bit)Solaris[tm] OE (64-bit)

Page 129: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 133

Transportable Database

• Transportable Database - Information• Database Upgrades using Transportable Database (RMAN):

http://www.oracle.com/technology/deploy/availability/pdf/MAA_WP_10gR2_PlatformMigrationTDB.pdf

• Note: 413586.1How To Use RMAN CONVERT DATABASE for Cross Platform Migration

Page 130: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 134

Upgrade Alternatives

Same OS?N Y

UPGRADEExport/Import

CTAS, COPY

Transportable Tablespaces

Transportable Database

Oracle StreamsDBUA

Downtime >30min?

Y

N

SQL Apply

CLI SQL> @catupgrd

Oracle Golden Gate

Page 131: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 135

Oracle Streams• Concept

• Build up a copy of your database and upgrade it• Synchronize it with the source database• Downtime:

• Just reconnecting the clients• Cross platform• Cross version since Oracle 9iR2• Some effort necessary to set it up• Fallback possible• Logminer

• Datatype restrictions• Performance

• How to:Oracle® Streams Concepts and Administration: Appendix Dhttp://download.oracle.com/docs/cd/E11882_01/server.112/e10704/ap_strmnt.htm#CIHJBIAA

Page 132: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 136

Upgrade Alternatives

Same OS?N Y

UPGRADEExport/Import

CTAS, COPY

Transportable Tablespaces

Transportable Database

Oracle StreamsDBUA

Downtime >30min?

Y

N

SQL Apply

CLI SQL> @catupgrd

Oracle Golden Gate

Page 133: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 137

Oracle GoldenGate• Concept

• Create a copy of your database with Transportable Tablespaces• GoldenGate CDG mechanism for synchronization• http://www.goldengate.com/

Page 134: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 138

Agenda

ParametersProcesses

MiscellaneousTools

LOB & SecureFilesFlashback

ADRCompression

Preparation

Upgrade

Diagnostics & Tuning

Best Practices

News and Task List

Performance Testing

Installation

Page 135: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 139

Parameter COMPATIBLE• COMPATIBLE has to be at least 10.1.0 for an 11g database• No way back once ≥11.1.0 has been enabled

• Supported release downgrade to 10.1.0.5, ≥10.2.0.2, ≥11.1.0.6• No ALTER DATABASE RESET COMPATIBILITY command anymore

COMPATIBLE = 10.0/1/2.0

COMPATIBLE = 11.0.0

Page 136: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 140

Parameter COMPATIBLE• DBUA raises COMPATIBLE only for 9i databases• To enable new features after the upgrade:

• 11.1:

• 11.2 :

• Afterwards: restart the database• New features will be enabled• Datafile headers will be adjusted• Redologfiles will be adjusted during first access

SQL> alter systemset compatible='11.1.0' scope=spfile;

SQL> alter systemset compatible='11.2.0' scope=spfile;

Page 137: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 141

New 11g Parameters• See the list in the Oracle Reference "New Features"

http://download.oracle.com/docs/cd/E11882_01/server.112/e10820/whatsnew.htm#sthref6

• New in 11.1.0.6:• ASM_PREFERRED_READ_FAILURE_GROUPS

CLIENT_RESULT_CACHE_LAGCLIENT_RESULT_CACHE_SIZECOMMIT_LOGGINGCOMMIT_WAITCONTROL_MANAGEMENT_PACK_ACCESSDB_LOST_WRITE_PROTECTDB_SECUREFILEDB_ULTRA_SAFEDDL_LOCK_TIMEOUTDIAGNOSTIC_DESTGLOBAL_TXN_PROCESSESJAVA_JIT_ENABLEDLDAP_DIRECTORY_SYSAUTHMEMORY_MAX_TARGETMEMORY_TARGETOPTIMIZER_CAPTURE_SQL_PLAN_BASELINESOPTIMIZER_USE_INVISIBLE_INDEXESOPTIMIZER_USE_PENDING_STATISTICSOPTIMIZER_USE_SQL_PLAN_BASELINES

• New in 11.1.0.7 (for Exadata/SAGE):• CELL_OFFLOAD_PROCESSING

CELL_OFFLOAD_DECRYPTIONCELL_OFFLOAD_PARAMETERS

PARALLEL_IO_CAP_ENABLEDPLSCOPE_SETTINGSREDO_TRANSPORT_USERRESOURCE_MANAGER_CPU_ALLOCATIONRESULT_CACHE_MAX_RESULTRESULT_CACHE_MAX_SIZERESULT_CACHE_MODERESULT_CACHE_REMOTE_EXPIRATIONSEC_CASE_SENSITIVE_LOGONSEC_MAX_FAILED_LOGIN_ATTEMPTSSEC_PROTOCOL_ERROR_FURTHER_ACTIONSEC_PROTOCOL_ERROR_TRACE_ACTIONSEC_RETURN_SERVER_RELEASE_BANNERXML_DB_EVENTS

CELL_OFFLOAD_COMPACTIONCELL_OFFLOAD_PLAN_DISPLAY

Page 138: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 142

New 11g Release 2 Parameters• See the list in the Oracle Reference "New Features"

http://download.oracle.com/docs/cd/E11882_01/server.112/e10820/whatsnew.htm#sthref6

• New in 11.2.0:• DEFERRED_SEGMENT_CREATIONDST_UPGRADE_INSERT_CONVLISTENER_NETWORKSPARALLEL_DEGREE_LIMITPARALLEL_DEGREE_POLICYPARALLEL_FORCE_LOCALPARALLEL_MIN_TIME_THRESHOLDPARALLEL_SERVERS_TARGET

Page 139: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 143

New Parameters 11g - Selection• CONTROL_MANAGEMENT_PACK_ACCESS

• Default: DIAGNOSTIC+TUNING• Values: DIAGNOSTIC+TUNING

DIAGNOSTICNONE

• Purpose:Controls access to several functionalties of Diagnostic and Tuning Pack

• Example: CONTROL_MANAGEMENT_PACK_ACCESS=NONE

select count(*) from v$active_session_history;==> 0 rows

Page 140: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 144

New Parameters 11g - Selection• DIAGNOSTIC_DEST

• Default: $ORACLE_BASE• Value: OS path/directory• Layout: <diagnostic_dest>/diag/rdbms/<dbname>/<instname>

• Purpose:Substitutes background_dump_dest,user_dump_dest, listener trace etc. and specifies theADR home (Automatic Diagnostic Repository)

Page 141: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 145

New Parameters 11g - Selection

• MEMORY_TARGET and MEMORY_MAX_TARGET• Default: 0• Value: integer [K | M | G] • Purpose:Specifies the complete plus the maximum memory

available to the Oracle server

SGA_TARGET

SGA_MAX_SIZE

MEMORY_MAX_TARGET

MEMORY_TARGET

PGA_AGGREGATE_TARGET

Page 142: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 146

New Parameter Defaults 11g• AUDIT_TRAIL

• Default: NONE or DB• Values: NONE

OSXMLDBDB_EXTENDED

• Purpose:Will help auditing security relevant statements.Upon an upgrde AUDIT_TRAIL keeps its defaultfrom 9.2/10.1/10.2 (NONE). If a 11g database iscreated from scratch then it'll set to DB andstatements get logged in SYS.AUD$

Page 143: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 147

Agenda

ParametersProcesses

MiscellaneousTools

AutomationLOB & SecureFiles

FlashbackADR

Compression

Preparation

Upgrade

Diagnostics & Tuning

Best Practices

News and Task List

Performance Testing

Installation

Page 144: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 148

• Example:

Background Processes

select name, description from v$bgprocess, v$processwhere paddr=addr;

NAME DESCRIPTION----- -----------------------ARC0 Archival Process 0ARC1 Archival Process 1ARC2 Archival Process 2ARC3 Archival Process 3CJQ0 Job Queue CoordinatorCKPT checkpointDBRM Resource Manager processDBW0 db writer process 0DIA0 diagnosibility process 0DIAG diagnosibility processDSKM slave DiSKMon processFBDA Flashback Data Archiver Pr.GEN0 General Task Execution Pr.LGWR Redo etc.

NAME DESCRIPTION----- --------------------------MMAN Memory ManagerMMNL Manageability Monitor Pr 2MMON Manageability Monitor PrPMON process cleanupPSP0 process spawner 0QMNC AQ CoordinatorRECO distributed recoverySMCO Space Manager ProcessSMON System Monitor ProcessVKRM Virtual sKeduler for RMgrVKTM Virtual Keeper of TiMe pr

BLUE: New in 11gR2RED: New in 11gR1

Page 145: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 149

Agenda

ParametersProcesses

MiscellaneousTools

AutomationLOB & SecureFiles

FlashbackADR

Compression

Preparation

Upgrade

Diagnostics & Tuning

Best Practices

News and Task List

Performance Testing

Installation

Page 146: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 150

• The CONNECT Role has been changed since 10gR2:

CONNECT Role

GRANTEE PRIVILEGE----------------------- -------------------CONNECT CREATE VIEWCONNECT CREATE TABLECONNECT ALTER SESSIONCONNECT CREATE CLUSTERCONNECT CREATE SESSIONCONNECT CREATE SYNONYMCONNECT CREATE SEQUENCECONNECT CREATE DATABASE LINK

GRANTEE PRIVILEGE----------------------- -------------------CONNECT CREATE SESSION

R2

Page 147: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 151

• Hash Group by aggregation which allows a hash algorithm to process group by statements

• For sorts ORDER BY has to be used

• Description see Note:345048.1• _gby_hash_aggregation_enabled=false

• See also:Note:295819.1 Potential Query Tuning Related Issues

GROUP BY results: unsorted

select sum(sal), deptno from scott.emp group by deptno;

SUM(SAL) DEPTNO---------- ----------

8750 1010875 209400 30

SUM(SAL) DEPTNO---------- ---------

9400 3010875 208750 10

Page 148: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 152

RMAN - Recovery Manager• RMAN Compatibility Matrix

• Note:73431.1

• Rules:• The RMAN executable version should be the same as the target database• The RMAN catalog schema version must be greater than or equal to the

RMAN executable• The RMAN catalog is backwards compatible with target databases from

earlier releases• Upgrade the catalog:

RMAN> upgrade catalog

Page 149: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 153

Agenda

ParametersProcesses

MiscellaneousTools

AutomationLOB & SecureFiles

FlashbackADR

Compression

Preparation

Upgrade

Diagnostics & Tuning

Best Practices

News and Task List

Performance Testing

Installation

Page 150: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 154

Enterprise Manager 11g• Database Control for all database administration tasks

• Grid Control as an IT system administration tool• Supports Oracle and non-Oracle IT infrastructures • GC patch set 10.2.0.5 + 10.2.0.5.2 PSU contains 11g functionality

• Patch the agents as well to 10.2.0.5• GridControl 11g is available since 22-APR-2010

Page 151: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 155

SQL Developer 1.5.5• Developer tool at no extra cost

http://www.oracle.com/technology/products/database/sql_developer/index.html

• Key-Features:• Excellent PL/SQL development and debugging• Extremely fast object browser• Schema copy and diff• Supports Oracle 9iR2 and above• Migration workbench for:

• MS SQL-Server• MS Access• MySQL

• No extra license costs!

Page 152: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 156

APEX 3.2• APEX = Application Express = ex-HTMLDB

• GUI development environment• Easy to use - wizard driven• Forms conversion assistant

• APEX is available by default• No additional installation or license necessary• Current release: 3.2.1

• HTTP via "Embedded Gateway"

• Two configuration steps:• $ORACLE_HOME/apex/apxconf.sql• ALTER USER anonymous ACCOUNT UNLOCK;

Page 153: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 157

Agenda

ParametersProcesses

MiscellaneousTools

LOB & SecureFilesFlashback

ADRCompression

Preparation

Upgrade

Diagnostics & Tuning

Best Practices

News and Task List

Performance Testing

Installation

Page 154: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 158

SecureFiles• Securefiles = new LOB storage technology

• Better performance• Additional features: deduplication, encryption

• Examples:

• Tablespace must be ASSM managed

• Additional init.ora parameter

CREATE TABLE t1 (a CLOB) LOB(a) STORE AS SECUREFILE;

CREATE TABLE t2 (a CLOB) LOB(a) STORE AS SECUREFILE(DEDUPLICATE);

CREATE TABLE t3 (a CLOB ENCRYPT USING 'AES128')LOB(a) STORE AS SECUREFILE (CACHE);

DB_SECUREFILE = [NEVER | PERMITTED | ALWAYS | IGNORE]

Page 155: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 159

LONG LOB Conversion• LONG data type is still supported, but Oracle

recommends conversion to LOB types

• Disadvantages of LONG:• Maximum number of LONG columns per table : 1• No replication possible with LONG und LONG RAW • Attention:

• LONG LOB conversion is irreversible

LONG

CLOB NCLOB

LONG RAW

BLOB

Page 156: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 160

LONG LOB Conversion• Conversion:

• Online Table Redefinition• Available for LONG/LOB since 10g• Package: DBMS_REDEFINITION • Regulation:

• LONG CLOB• LONG RAW BLOB

• Conversion is done implicitly• More information: Note:251417.1 and 1012454.7 (including examples)

• Advantage:Source table is available during the whole process

ALTER TABLE long_tab MODIFY ( long_col CLOB );

Page 157: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 161

SecureFiles• Securefiles are fully transparent

• Data type still a BLOB/CLOB• Definition per storage clause or controlled by init Parameter• No functional differences

• Even "deduplication" is fully transparent for developers

• API access: PL/SQL (DBMS_LOB), JDBC, .NET, PHP, ...

Page 158: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 162

Agenda

ParametersProcesses

MiscellaneousTools

LOB & SecureFilesFlashback

ADRCompression

Preparation

Upgrade

Diagnostics & Tuning

Best Practices

News and Task List

Performance Testing

Installation

Page 159: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 163

Undo

Flashback• Different types of flashback and its sources

• Flashback Query• Versions Query• Transaction Query• Flashback Table

• Flashback Drop

• Flashback Database

• Total Recall Flashback Data Archive

Undo

Flashback Logs

Enabled by default

Enabled by default

Has to be enabled

Has to be enabled

Page 160: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 164

Agenda

ParametersProcesses

MiscellaneousTools

LOB & SecureFilesFlashback

ADRCompression

Preparation

Upgrade

Diagnostics & Tuning

Best Practices

News and Task List

Performance Testing

Installation

Page 161: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 165

• ADR: systemwide logging and tracing directory• Set via diagnostic_dest parameter• Default: ORACLE_BASE

Automatic Diagnostic Repository

Page 162: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 166

Agenda

ParametersProcesses

MiscellaneousTools

LOB & SecureFilesFlashback

ADRCompression

Preparation

Upgrade

Diagnostics & Tuning

Best Practices

News and Task List

Performance Testing

Installation

Page 163: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 167

Agenda

Object StatisticsMonitoring

SQL Tuning

Preparation

Upgrade

Diagnostics & Tuning

Best Practices

News and Task List

Performance Testing

Installation

Page 164: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 168

Tuning with the right tools ...

Page 165: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 169

Agenda

Object StatisticsMonitoring

SQL Tuning

Preparation

Upgrade

Diagnostics & Tuning

Best Practices

News and Task List

Performance Testing

Installation

Page 166: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 170

Optimizer Statistics Gathering

• Default maintenance job

Page 167: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 171

Optimizer Statistics Gathering• Configure maintenance schedule

Page 168: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 172

Optimizer Statistics Gathering• Configure settings and parameters

Page 169: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 173

GATHER_STATS_JOB

No# of DMLs in: DBA/USER_TAB_MODIFICATIONS:

Tables without statistics:EMPTY

Table changed >10%:STALE

Table-Monitoring ON SMON manually:

SQL> exec DBMS_STATS.FLUSH_DATABASE_MONITORING_INFO();

every 15min

manually:SQL> exec DBMS_STATS.GATHER_SCHEMA_STATS('SCOTT');

Automatic Job – once a day:

Page 170: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 174

GATHER_STATS_JOB

Statistics: EMPTY

Statistics: STALE

Statistics: OK

54%

Objects: Analysis order:high

low

Priority

27%

54%27%

Page 171: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 175

Optimizer without statistics• What happens if there are no object statistics?

The optimizer (CBO) will estimate (at parsing time) the statistics for tables and indexesPrerequisite:OPTIMIZER_DYNAMIC_SAMPLING=2 [Default since 10g]

• Level 0 - Dynamic Sampling off (~OLTP)• Level 2 – Optimizer checks first 64 blocks of object

• For descriptions of all levels:Performance Tuning Guide

• Example:http://www.oracle.com/technology/oramag/oracle/09-jan/o19asktom.html

Page 172: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 176

Agenda

Object StatisticsMonitoring

SQL Tuning

Preparation

Upgrade

Diagnostics & Tuning

Best Practices

News and Task List

Performance Testing

Installation

Page 173: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 177

• STATISTICS_LEVEL=TYPICAL [default]• Alternative Settings:

• BASIC• ALL

• TYPICAL (recommended setting) will enable:• Automatic SGA Tuning• Automatic Statistics Collection• Active Session History • DML Monitoring

Requirements for Diagnostics & Tuning

Page 174: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 178

Diagnostics & Tuning Concept since 10g

Snapshots

ADDMADDMresults

MMON

Alerts

In-memorystatistics AWR

SGA

Reactive

ProactiveDBA

Page 175: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 179

Tuning Basics since 10g• AWR (Automatic Workload Repository)

• Statistics repository in SYSAUX tablespace for AWR snapshots• Self managing• Data stored in the AWR is collected by MMON

• Every 60 minutes and kept for 7 days [default]• Query AWR contents: DBA_HIST-Views

• The automatic removal of certain snapshots can be supressed for later analysis by defining them as a baseline

• Snapshots can be created on demand at every time:• EXEC dbms_workload_repository.create_snapshot();

• AWR size and analysis:• @?/rdbms/admin/awrinfo.sql

• Report:• SI: SQL> @?/rdbms/admin/awrrpt.sql

• RAC: SQL> @?/rdbms/admin/awrrpti.sql

• Single statements: SQL> @?/rdbms/admin/awrsqrpt.sql

Page 176: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 180

Tuning Basics since 10g• AWR

• Recommendation: Change retention:

Page 177: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 181

Tuning Basics since 10g• AWR

• Typical production database values• Interval: 30-60 minutes ... retention: 20-31 days

Page 178: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 184

DB Management Pack Enhancements 11g• Diagnostic Pack

• ADDM for RAC• AWR Baselines and Adaptive Thresholds• Transportable AWR

• Tuning Pack• Automatic SQL Tuning Advisor• Partition Advisor• Real-time SQL Monitoring• SQL Plan Management's Plan Evolution

Page 179: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 185

Agenda

Object StatisticsMonitoring

SQL Tuning

Preparation

Upgrade

Diagnostics & Tuning

Best Practices

News and Task List

Performance Testing

Installation

Page 180: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 187

Manual SQL Tuning Challenges

• Complex - requires expertise in several domains• SQL optimization: adjust the execution plan• Access design: provide fast data access• SQL design: use appropriate SQL constructs

• Time consuming• Each SQL statement is unique• Potentially large number of statements to tune

• Never ending task• SQL workload always evolving• Plan regressions can happen

Page 181: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 188

SQL Tuning Automation in 11g• Fully automatic SQL Tuning task

• Runs automatically in the Maintenance Window• Identifies, ranks and tunes candidate SQL• Leverages SQL Tuning Advisor

• Candidate SQL automatically chosen• Excluded: parallel queries, DML/DDL, recursive, ad-hoc (infrequent)

• Tests and (optionally) implements SQL profiles• Only implements significantly improved plans (3x) • Time budgeted to avoid run-away plans

• DBA can still invoke the advisor manually for reactive tuning, like in 10g

Page 182: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 189

SQL Tuning Automation in 11g• Configure Automatic SQL Tuning

Page 183: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 190

SQL Tuning Automation in 11g• Configure Automatic SQL Tuning

Page 184: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 191

It’s Automatic!

Choose Candidate

SQLone

week

Automatic SQL Tuning in 11g

Workload

SQL Tuning Candidates

Test SQL ProfilesImplementSQL Profiles

GenerateRecommendations

AWRDBA

View Reports / Control Process

Page 185: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 193

SQL Tuning Advisor

• Can be used in EM or on CLI (via DBMS_SQLTUNE)• 2 Different tuning modes are available:

• “Limited mode” will not generate a SQL Profile• “Comprehensive mode” runs through all possible analysis options

• SQL Profiles contain information that lead to improved execution plans without changing the application code

• Use different optimizer settings• Correct wrong/missing statistics and wrong estimates• SQL Profiles are persistent • SQL Profiles don’t change the original SQL statement• SQL Profiles can be transported within SQL Tuning Sets (STS)

• See Note:751068.1 for an example• SQL Profiles can be tested and verified without any risk

Page 186: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 194

SQL Tuning• Example: Results „Tuning Advisor“ SQL Profile

Page 187: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 195

SQL Tuning• Example: Compare original to new explain plan

Page 188: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 196

Agenda

ChallengesReal Application Testing

Database ReplaySQL Performance Analyzer

Preparation

Upgrade

Diagnostics & Tuning

Best Practices

News and Task List

Performance Testing

Installation

Page 189: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 197

Agenda

Fallback StrategiesGuidelines

Preparation

Upgrade

Diagnostics & Tuning

Best Practices

News and Task List

Performance Testing

Installation

Page 190: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 198

Fallback Strategy• In any case: Take a backup!!!• Then make clear:

• If anything unforeseen happens and you'll have to step back, will you be allowed to lose data(i.e. changes done to the data in the system after the upgrade):YES or NO?• If YES: restore a backup, flashback (since 10g) • If NO: export/import, downgrade, Oracle Streams, Oracle

Golden Gate

Page 191: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 199

Agenda

Fallback StrategiesGuidelines

Preparation

Upgrade

Diagnostics & Tuning

Best Practices

News and Task List

Performance Testing

Installation

Page 192: Liu 11gR2 Upgrade

© 2010 Oracle Corporation 200

Guidelines• Never ever change too many system components at once!• Document all changes detailed and clearly into a change log!• Always (!!!) use real world data for testing!• Don't underestimate the test efforts. Reserve enough time and

resources for testing.• ALWAYS collect as much performance data BEFORE the

upgrade will be started!!• Create a fallback strategy!• PLEASE test your fallback strategy - does it really work??

• Please remember:Upgrade has never been easier - but you still have to test!!!

Page 193: Liu 11gR2 Upgrade

<Insert Picture Here>

&

Page 194: Liu 11gR2 Upgrade

Thanks For Coming !!

Daniel Liu Contact InformationEmail: [email protected]

Email: [email protected]

Company Web Site:http://www.oracle.com

Page 195: Liu 11gR2 Upgrade