oracle upgrade11gr1 workshop1

248
<Insert Picture Here> Move to Oracle Database 11g – The whole Story Mike Dietrich Database Upgrade & Utilities ORACLE Corporation

Upload: hector-martinez

Post on 13-May-2015

4.296 views

Category:

Technology


3 download

DESCRIPTION

Presentación de Oracle sobre la actualización a 11g

TRANSCRIPT

Page 1: Oracle Upgrade11gr1 Workshop1

<Insert Picture Here>

Move to Oracle Database 11g – The whole Story

Mike DietrichDatabase Upgrade & Utilities

ORACLE Corporation

Page 2: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 2

Welcome!!!

Page 3: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 3

Preparation

Agenda

Upgrade

Diagnostics & Tuning

Best Practices

News and Task List

Performance Testing

Page 4: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 4

Preparation

Agenda

Support PolicyPatches

CertificationDocumentationUpgrade paths

InstallationEditions

Upgrade

Diagnostics & Tuning

Best Practices

News and Task List

Performance Testing

Page 5: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 5

t2008

2003

2004

2005

2006

2007

2002

2009

2010

today

Lifetime Support Policy

2011

2012

2013

2014

Sustaining Support

Premier Support

R2July 2007

Extended SupportJuly 2010

January 2009 January 2012

R2 July 2010 July 2013

http://www.oracle.com/support/library/brochure/lifetime-support-technology.pdf

2015

2016

August 2012 August 2015

July 2008

July 2011

R2

2017

2018

Page 6: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 6

Lifetime Support Policy

NoNo����������������Certification with new Oracle ProductsCertification with new Oracle Products

NoNo����������������Certification with existing Third Party Certification with existing Third Party

Products/VersionsProducts/Versions

NoNoNoNo��������Certification with New Third Party Certification with New Third Party

Products/VersionsProducts/Versions

NoNo����������������Upgrade ScriptsUpgrade Scripts

NoNo����������������Tax, Legal and Regulatory UpdatesTax, Legal and Regulatory Updates

PrePre--existing Onlyexisting Only����������������Updates, Fixes, Security Alerts and Critical Patch Updates, Fixes, Security Alerts and Critical Patch

UpdatesUpdates

������������������������Access to Knowledge BaseAccess to Knowledge Base

(MetaLink/Customer Connection/SupportWeb)(MetaLink/Customer Connection/SupportWeb)

������������������������Technical SupportTechnical Support

������������������������Major Product and Technology ReleasesMajor Product and Technology Releases

Sustaining

Support

Extended

Support

Premier

Support

Feature

Page 7: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 7

Lifetime Support Policy

• See:http://www.oracle.com/support/library/brochure/lifetime-support-technology.pdf

Page 8: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 8

Releases – Support-SRs

12%

Page 9: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 9

Upgrade to Oracle Database 11g

R2R2

R2R2

≥≥≥≥ 10.2.0.210.2.0.210.2.0.210.2.0.2≥≥≥≥ 10.2.0.210.2.0.210.2.0.210.2.0.2

10.1.0.510.1.0.510.1.0.510.1.0.510.1.0.510.1.0.510.1.0.510.1.0.5

R2R2

≥≥≥≥ 7.3.47.3.47.3.47.3.4≥≥≥≥ 7.3.47.3.47.3.47.3.4

≥≥≥≥ 8.0.68.0.68.0.68.0.6≥≥≥≥ 8.0.68.0.68.0.68.0.6

≥≥≥≥ 8.1.7.48.1.7.48.1.7.48.1.7.4≥≥≥≥ 8.1.7.48.1.7.48.1.7.48.1.7.4

≥≥≥≥ 9.0.1.49.0.1.49.0.1.49.0.1.4≥≥≥≥ 9.0.1.49.0.1.49.0.1.49.0.1.4

9.2.0.89.2.0.89.2.0.89.2.0.89.2.0.89.2.0.89.2.0.89.2.0.8

≥≥≥≥ 9.2.0.49.2.0.49.2.0.49.2.0.4≥≥≥≥ 9.2.0.49.2.0.49.2.0.49.2.0.4

"Empty" arrows mean: no specific patch release required

Page 10: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 10

Recommended Patches

Page 11: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 11

Recommended Patches

Page 12: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 12

Recommended Patches

Page 13: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 13

• Note 161818.1

Important Alerts?

Page 14: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 14

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

Upgrade Information / Alerts

Page 15: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 15

• Note 738538.1 Known Issues specific to the 11.1.0.7 Patch Set

Upgrade Information / Alerts

Page 16: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 16

• Note 738538.1 Known Issues specific to the 11.1.0.7 Patch Set

Upgrade Information / Alerts

Page 17: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 17

• Why DST timezone patches? (DST: Daylight Savings Time)• The date for moving to DST has been changed for 7 different

timezones since 2007• HST - EST - MST - EST5EDT - MST7MDT - CST6CDT - PST8PDT

• Current DST definitions are included from within the following patch set

• 10.2.0.4• Oracle Database 11g requires timezone version V.4

• Oracle 9i: Timezone V1• Oracle 10g: Timezone V2

• Without timezone V4 no upgrade to Oracle Database 11g will be possible!!!

Timezone Patches

Page 18: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 18

• Summary – 4 important ML notes:• Note 414590.1: FAQ and Issues

• Note 413671.1: Timezone V4 - Checks and Links to the Patches

• Note 359145.1: Links to download utltzuv2.sql

• Note 396387.1: Explanations• Run script utltzuv2.sql to recognize TIMESTAMP WITH TIMEZONE• Files timezone.dat and timezlrg.dat will be applied

Timezone Patches

Page 19: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 19

• Timezone How To:• Download the right patch according to the table in Note 413671.1

• Download the script utltzuv2.sql according to Note 359145.1

• Run the script utltzuv2.sql in your current source database

• Apply files timezone.dat and timezlrg.dat to the source $ORACLE_HOME/oracore/zoneinfo directory with either Opatchor manually and restart the database

Timezone Patches

Page 20: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 20

Verify Database Creation Wordsize - 10.2.0.3

• Has the database been created originally in a 32-bit environment and is now on a 64-bit platform?•

• Happens in 10.2.0.3 - see Note:412271.1• Apply patch:5871314 and patch:5892355 if:

• KOPM$.METADATA contains 'B023'� created in 32-bit env

• Don't apply patch if:• KOPM$.METADATA contains 'B047'� created in 64-bit env

• Database version is 10.2.0.4

select decode(instr(metadata,'B023'),0,

'64bit Database','32bit Database') "DB Creation"

from kopm$;

select decode(instr(metadata,'B023'),0,

'64bit Database','32bit Database') "DB Creation"

from kopm$;

Page 21: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 21

Related to Database Creation Wordsize - 11gR1

• Database upgrade to 11.1.0.6:• Delete orphan rows from KOTTD$

• Apply patch 6770913

• Database upgrade to 11.1.0.7:• Delete orphan rows from KOTTD$

• No patches necessary

• If result is not null:

• See Note:579523.1 - bug:6770913

select sys_nc_oid$ from kottd$ where sys_nc_oid$

not in (select oid$ from obj$ where type#=13);

select sys_nc_oid$ from kottd$ where sys_nc_oid$

not in (select oid$ from obj$ where type#=13);

delete from kottd$ where sys_nc_oid$ not in

(select oid$ from obj$ where type#=13);

commit;

delete from kottd$ where sys_nc_oid$ not in

(select oid$ from obj$ where type#=13);

commit;

Page 22: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 22

Oracle Certification

Page 23: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 23

Recommended OS patches and settings

• Note: 169706.1

• Note: 401705.1 Linux x86, x86-64, and s390x Requirements Reference List

Page 24: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 24

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 - only 6 stepsl!!!

• 10.2.0 - 140 pages

• 11.1.0 - 186 pages - now detailed explanations andinformation about new options included

Page 25: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 25

Upgrade Length

• How long will the upgrade taketo complete?• Independent of:

• Size of the database

• Used datatypes

• Dependent on:• The number of objects needing upgrading

• Thus: the number of installed options/components

• Valid and non-stale data dictionary statistics

• Number of synonyms – they‘ll get recompiled (upgrade from 9i)

• Number of objects in XDB

• Number of rows in SYS.AUD$

• At a very low rate if COMPATIBLE will be increased:

• Number of datafiles

• Size of redo logs

Page 26: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 26

Documentation

• Note: 466181.1 Upgrade Companion 10gR2

• Note: 601807.1 Upgrade Companion 11g

Page 27: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 27

Documentation

• Note: 601807.1 Upgrade Companion 11g

Page 28: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 28

Documentation

• Note: 601807.1 Upgrade Companion 11g

Page 29: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 29

Documentation

• Upgrade Guide

http://download.oracle.com/docs/cd/B28359_01/server.111/b28300/toc.htm

• Note:429825.1Complete Checklist for Manual Upgrades to 11gR1

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

Page 30: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 30

Database.us.oracle.com: Upgrade Page

• http://database.us.oracle.com

Page 31: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 31

OTN Upgrade Page

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

Page 32: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 32

OTN Upgrade Forum

• http://forums.oracle.com/forums/forum.jspa?forumID=583&start=0

Page 33: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 33

42 External 11g References 1/2

01-JUL-2009

Page 34: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 34

42 External 11g References 2/2

01-JUL-2009

Page 35: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 35

Upgrade Paths

Stay on same OS?Stay on same OS?NN YY

UPGRADEUPGRADEExport/ImportExport/Import

CTAS, COPYCTAS, COPY

Transportable TablespacesTransportable Tablespaces

Transportable DatabaseTransportable Database

Oracle StreamsOracle Streams

DBUA DBUA

Downtime >45min?Downtime >45min?

YY

NN

SQL ApplySQL Apply

ORACLE recommended

ORACLE recommended

CLI CLI SQL> @catupgrd

Page 36: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 36

Preparation

• Get INVALID Objects:

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

• Beginning with 11.1.0.7 the comparison has been automated• registry$sys_inv_objs, registry$nonsys_inv_objs => utluiobj.sql

• 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!!!

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

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

Page 37: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 37

Preparation

• Possibilities for performance analysis:• STATSPACK – export Perfstat user!!!

• Note:394937.1 STATSPACK guide

• Note:466350.1 STATSPACK before/after upgrade

• AWR - extract the AWR

• Do AWR diff reports comparing before/after upgrade

• Real Application Testing

• SQL Performance Analyzer

• Database Replay

Page 38: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 38

Preparation

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

SQL> purge DBA_RECYCLEBIN;SQL> purge DBA_RECYCLEBIN;

Page 39: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 39

Preparation

• Remove from your init.ora/spfile:• Underscore parameter

• e.g. _always_anti_join=off, _bloom_filter_enabled = FALSE etc.

• Events• e.g. event="10235 trace name context forever, level 512"

• To the previous release related parameter• e.g. optimizer_features_enabled=9.2.0

Page 40: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 40

Preparation

• Create dictionary statistics prior to the upgrade - otherwise it will take significantly longer

• Or in / :

BEGINdbms_stats.gather_schema_stats('SYS',options => 'GATHER',estimate_percent => DBMS_STATS.AUTO_SAMPLE_SIZE,method_opt => 'FOR ALL COLUMNS SIZE AUTO',cascade => TRUE);

END;

/

BEGINdbms_stats.gather_schema_stats('SYS',options => 'GATHER',estimate_percent => DBMS_STATS.AUTO_SAMPLE_SIZE,method_opt => 'FOR ALL COLUMNS SIZE AUTO',cascade => TRUE);

END;

/

SQL> EXECUTE dbms_stats.gather_dictionary_stats;SQL> EXECUTE dbms_stats.gather_dictionary_stats;

Page 41: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 41

Preparation

• Switch off DATABASE VAULT (if used/installed)• Oracle® Database Vault Administrator's Guide: Appendix B

• Unix: (simplified)

• Relinking without Database Vault[$ make -f ins_rdbms.mk dv_off ]

• Windows:

• Rename oradv10.dll in ORACLE_HOME\bin

• Upon restart:

• After upgrading relink with dv_on or rename the DLL and enable Database Vault again:

$ dvca -action disable ...$ dvca -action disable ...

$ dvca -action disable ...$ dvca -action disable ...

$ dvca -action enable ...$ dvca -action enable ...

Page 42: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 42

Preparation

• Drop table SYS.PLAN_TABLE$ and the public synonym PUBLIC.PLAN_TABLE

• See Alert-Note:782735.1 and Notes: 605317.1 and 736353.1

• Otherwise the component "Oracle Server" can be INVALID after the upgrade

• Applies to 10.2.0.4 and further releases

• Introduced with DBMS_SQLPA

• Steps to solve this issue if it has happened:• @catplan.sql -- recreate the plan table

@dbmsxpln.sql -- reload dbms_xplan spec

@prvtxpln.plb -- reload dbms_xplan implementation

@prvtspao.plb -- reload dbms_sqlpa

alter package SYS.DBMS_SUMADVISOR compile ;

alter package SYS.DBMS_SUMADVISOR compile body;

Page 43: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 43

Installation

• Space / resource requirements• Software installation:

• 150-200 MB in /tmp or \TEMP necessary• Between 2.7 GB (Windows), 3.5 GB (Linux) and 6.9 GB (HP-UX)

• Seed database: ≥ 1,6 GB• Seed databases (ORCL) are always prebuilt EE databases with all options!!!

• RAM: ≥ 1GB

• Swapspace

• RAM up to 2048Mb → 1.5x RAM• RAM between 2049Mb and 8192Mb → 1x RAM• RAM more than 8192Mb → 0.75x RAM

Page 44: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 44

Installation

• How to access the software?• Download from OTN:http://otn.oracle.com/software/index.html

• Metalink:

• http://edelivery.oracle.com/

Page 45: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 45

Installation

• Download from OTN:

Page 46: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 46

Installation

• DVD contents?• Database

• Enterprise Edition• Standard Edition• Personal Edition (Windows)

• Client• Clusterware

• Extra: Examples (formerly known as companion)• Required Products• Oracle Globalization Support Demos• Oracle Multimedia Demos• Oracle Precompiler Demos• Oracle Spatial Demos• Oracle SQLJ Demos• Oracle XML Demos• Oracle JDBC Development Drivers• Oracle Text Knowledge Base

Page 47: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 47

Installation

• Pre-installation checks:

• Warning: 500MB swap space needed – also on Windows!!!

• Ask support before installing with:./runInstaller -ignoreSysPrereqs

Page 48: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 48

Installation - Loopback Adapter for DBcontrol

• Microsoft Loopback Adapter is recommended if IP address is distributed via DHCP• Install the MS Loopback Adapter

• Launch the Add Hardware wizard and install a new network adapter - manufacturer is Microsoft

• Adjust this adapter to be the primary network adapter

• My Network Places => Properties => TCP/IP

• IP address: 10.10.10.10

• Subnet mask: 255.255.255.0

• Edit:

• \windows\system32\drivers\etc\hosts• 10.10.10.10 mycomputer.mydomain.com mycomputer

• http://download.oracle.com/docs/cd/B28359_01/install.111/b32006/reqs.htm#sthref291

Page 49: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 49

Installation - Loopback Adapter for DBcontrol

• Launch the Windows Add Hardware Wizard

• Choose Yes, I've already connected the hardware ...

• Scoll down to Add a new hardware device

• Choose Install the hardware that I manually select ...

• Select Network Adapters:

• Click on Manufacturer Microsoft

• Install the Loopback Adapter

• Make the Loopback Adapterthe FIRST network card in TCP/IP properties!!

Page 50: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 50

Installation

Page 51: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 51

Installation

Page 52: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 52

Installation

Important:„CUSTOM“ ALWAYS installs

Enterprise Edition

Important:„CUSTOM“ ALWAYS installs

Enterprise Edition

Page 53: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 53

Installation

• Custom installation:• 10gR2 doc installation guide

• 11gR1 doc installation guidehttp://download.oracle.com/docs/cd/B28359_01/install.111/b32002/install_overview.htm#BABEGJFD

Page 54: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 54

Patch Set Installation

• Install patch sets and patches before you start the upgrade

Page 55: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 55

Patch Set Update (PSU) Installation

• Install PSUs as well• See Note:854428.1: Introduction to Database Patch Set Updates

• PSU patches are intended to be low-risk.Included in the criteria for the bug fixes in the Database PSU are:• Critical technical issues with fixes that may affect a large number of customers and that are already proven in the field

• Critical Patch Update fixes

• PSU patches do not include:• Changes that require re-certification

• Fixes that require configuration changes

• Typically 50-100 new bug fixes - cummulative

• Guaranteed to be RAC rolling installable

• Change the fifth digit of the release number, e.g. 10.2.0.4.3

• Will be released 4x per year such as CPUs on the same schedule• Platforms: HP-UX Itanium and PA-RISC64, AIX, Linux x86 and x86-64, Solaris SPARC64

Page 56: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 56

Unattended Installation/Configuration

• Two options:

• Oracle Universal Installer OUI• ./runInstaller -record -destinationFile ...

• ./runInstaller -silent -noconsole -responseFile ...

• But this has to be done for a patch set, too

• Home Cloning (script or Provisioning Pack)• Prepare a fully patched Oracle Home

• Create an archive consisting of all files

• Exclude *log, *dbf, tnsnames/listener/sqlnet.ora

• ./runInstaller -silent -clone -...

• Listener Configuration• ./netca /silent /responseFile $OH/inventory/response/netca.rsp

Page 57: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 57

Installation

• Overview on differences of database editions and available options by edition• Feature differences:Note.465465.1Differences Between Enterprise, Standard and Personal Editions on Oracle 10.2

• Oracle® Database Licensing Information11g Release 1 (11.1)Part Number B28287-01

http://download.oracle.com/docs/cd/B28359_01/license.111/b28287/editions.htm

Page 58: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 58

Installation

• Windows OS - Home Selector :

Page 59: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 59

Listener Configuration

• Best Practices- strongly recommended:Create a new listener environment with NETCA:

Page 60: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 60

Preparation

Agenda

Upgrade

Diagnostics & Tuning

Best Practice

News and Task List

Performance Testing

Database Upgrade AssistantCommand Line Upgrade

Post UpgradeAlternatives

CRS UpgradeASM Upgrade

Migration

Page 61: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 61

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• Oracle XE upgrade• Patch upgrades

• Logs:• $ORACLE_HOME/cfgtoollogs/dbua

• Documentation:• Oracle® Database Upgrade Guide

http://download.oracle.com/docs/cd/B28359_01/server.111/b28300/toc.htm

Page 62: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 62

Database Upgrade Assistant (GUI)

• Silent mode:• $ dbua –help shows all valid options

• See doc: http://download.oracle.com/docs/cd/B28359_01/server.111/b28300/upgrade.htm

Page 63: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 63

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 64: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 64

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 65: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 65

Database Upgrade Assistant (GUI)

• Before you start DBUA:• Run $OH_11g/rdbms/admin/utlu111i.sql in your current environment

• Check especially the components status in DBA_REGISTRY

• To remove (or reinstall) components manually:Note:472937.1 Information On Installed Database ComponentsNote:753041.1 How to diagnose Components with NON VALID status

Page 66: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 66

Database Upgrade Assistant (GUI)

Page 67: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 67

Database Upgrade Assistant (GUI)

Page 68: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 68

Database Upgrade Assistant (GUI)

Page 69: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 69

Database Upgrade Assistant (GUI)

Page 70: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 70

Database Upgrade Assistant (GUI)

Page 71: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 71

Database Upgrade Assistant (GUI)

Page 72: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 72

Database Upgrade Assistant (GUI)

Page 73: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 73

Database Upgrade Assistant (GUI)

Page 74: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 74

Database Upgrade Assistant (GUI)

Page 75: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 75

Database Upgrade Assistant (GUI)

Page 76: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 76

Database Upgrade Assistant (GUI)

From 11g on alwaysSECURESECURESECURESECURE

From 11g on alwaysSECURESECURESECURESECURE

Page 77: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 77

Database Upgrade Assistant (GUI)

Page 78: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 78

Database Upgrade Assistant (GUI)

Page 79: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 79

Database Upgrade Assistant (GUI)

Page 80: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 80

Database Upgrade Assistant (GUI)

Page 81: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 81

Database Upgrade Assistant (GUI)

Page 82: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 82

Database Upgrade Assistant (GUI)

Page 83: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 83

Database Upgrade Assistant (GUI)

Page 84: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 84

Database Upgrade Assistant (GUI)

Page 85: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 85

Database Upgrade Assistant (GUI)

Page 86: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 86

Preparation

Agenda

Upgrade

Diagnostics & Tuning

Best Practice

News and Task List

Performance Testing

Database Upgrade AssistantCommand Line Upgrade

Post UpgradeAlternatives

CRS UpgradeASM Upgrade

Migration

Page 87: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 87

Command Line Upgrade

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

Server(OLD) Server(NEW)

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

(dbf, ctl, log, spfile, orapw)

1) Install Oracle11g software2) Copy utlu111i.sql

6) Apply suggested changes7) Start the upgrade process

Page 88: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 88

Command Line Upgrade

• Step-by-step:1. Complete online backup of the database

2. Install 11g Oracle software and apply patch set 11.1.0.7

3. Analyze the DB using utlu111i.sql and follow all requirements given by the script

4. Create a new 11g listener with NETCA

5. Switch to the new environment, startup the DB (startup upgrade) and create the SYSAUX tablespace (if source db is an Oracle 9i db)

6. Run upgrade script catupgrd.sql

7. Recompile with utlrp.sql - compare with utluiobj.sql

8. Run catuppst.sql if you are upgrading from ≥10g

9. Check the post upgrade status: utlu111s.sql

Page 89: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 89

Command Line Upgrade

• Upgrade information script: utlu111i.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

• Timezone file version check

• Cluster check

Info

Page 90: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 90

Command Line Upgrade

• utlu111i.sql: DB info and time zone check? (see also PREPARATION)

• DST (Daylight Savings Time) patches for Version V4 have to beapplied as a requirement for the upgrade to Oracle Database 11g

• REGISTRY$DATABASE ==> TZ_VERSION=4

Page 91: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 91

Command Line Upgrade

•utlu111i.sql: Tablespaces adequate size?

Page 92: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 92

Command Line Upgrade

•utlu111i.sql: Init parameter changes?

Page 93: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 93

Command Line Upgrade

• utlu111i.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 ComponentsNote:753041.1 How to diagnose Components with NON VALID status

Page 94: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 94

Command Line Upgrade - 10gR2

•utlu102i.sql: Typical pitfalls

• Ideally includethe Companion-CD's"Oracle Database Products"in all installations:

Page 95: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 95

Command Line Upgrade

• Create Dictionary statistics

• Shutdown the database (IMMEDIATE/NORMAL)

• Adjust init parameters:• COMPATIBLE ≥ 10.1.0

• SGA_TARGET ≥ 340MB (32-bit) ... ≥ 640MB (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 96: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 96

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 97: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 97

SQL> STARTUP UPGRADE;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

Taken from an example alert.log

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 set

ALTER SYSTEM SET resource_manager_plan='' SCOPE=MEMORY;Resource Manager disabled during database migration

Page 98: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 98

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;

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

Page 99: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 99

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:

SQL> @catupgrd.sqlSQL> @catupgrd.sql

SQL> SPOOL c:\temp\upgrade.logSQL> SPOOL c:\temp\upgrade.log

SQL> executedbms_stats.gather_fixed_objects_stats;

SQL> executedbms_stats.gather_fixed_objects_stats;

Page 100: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 100

• Recompilation:• utlrp.sql

• Calls utlprp.sql with CPU_COUNT-1

• Determines automatically if serial or parallel recompilation with multiple threads can be done

• 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 101: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 101

• 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_%';

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 102: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 102

• 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 103: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 103

• Post upgrade script: utlu111s.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

Page 104: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 104

Command Line Upgrade

• Post upgrade script: utlu111s.sqlSQL> @?/rdbms/admin/utlu111s.sql

Oracle Database 11.1 Post-Upgrade Status Tool 05-06-2009 11:23:33

Component Status Version HH:MM:SS

Oracle Server VALID 11.1.0.7.0 00:16:17

JServer JAVA Virtual Machine VALID 11.1.0.7.0 00:05:19

Oracle Workspace Manager VALID 11.1.0.7.0 00:01:01

Oracle Enterprise Manager VALID 11.1.0.7.0 00:10:13

Oracle XDK VALID 11.1.0.7.0 00:00:48

Oracle Text VALID 11.1.0.7.0 00:00:58

Oracle XML Database VALID 11.1.0.7.0 00:04:09

Oracle Database Java Packages VALID 11.1.0.7.0 00:00:33

Oracle Multimedia VALID 11.1.0.7.0 00:07:43

Oracle Expression Filter VALID 11.1.0.7.0 00:00:18

Oracle Rule Manager VALID 11.1.0.7.0 00:00:12

Gathering Statistics 00:04:53

Total Upgrade Time: 00:52:31

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

Oracle Database 11.1 Post-Upgrade Status Tool 05-06-2009 11:23:33

Component Status Version HH:MM:SS

Oracle Server VALID 11.1.0.7.0 00:16:17

JServer JAVA Virtual Machine VALID 11.1.0.7.0 00:05:19

Oracle Workspace Manager VALID 11.1.0.7.0 00:01:01

Oracle Enterprise Manager VALID 11.1.0.7.0 00:10:13

Oracle XDK VALID 11.1.0.7.0 00:00:48

Oracle Text VALID 11.1.0.7.0 00:00:58

Oracle XML Database VALID 11.1.0.7.0 00:04:09

Oracle Database Java Packages VALID 11.1.0.7.0 00:00:33

Oracle Multimedia VALID 11.1.0.7.0 00:07:43

Oracle Expression Filter VALID 11.1.0.7.0 00:00:18

Oracle Rule Manager VALID 11.1.0.7.0 00:00:12

Gathering Statistics 00:04:53

Total Upgrade Time: 00:52:31

Page 105: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 105

Preparation

Agenda

Upgrade

Diagnostics & Tuning

Best Practice

News and Task List

Performance Testing

Database Upgrade AssistantCommand Line Upgrade

Post UpgradeAlternatives

CRS UpgradeASM Upgrade

Migration

Page 106: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 106

Post Upgrade - SPFILE

• Always create an editable init.ora from the current SPFILE after the upgrade has been finished

• SPFILE is:• It’s a binary file!!!

• Default since Oracle 9.0

• It simply exists after using DBUA or DBCA

• Parameter can be changed by:

or:

SQL> create pfile from spfile;

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

SQL> create pfile from spfile;

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

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

Page 107: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 107

Post Upgrade

• Create 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-2008 12:30DSTOP 05-03-2008 12:30FLAGS 1CPUSPEEDNW 1392,39IOSEEKTIM 11,405IOTFRSPEED 25595,605...

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

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

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

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

Page 108: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 108

Post Upgrade

• Create fixed table statistics directly after catupgrd.sql has been completed:

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

SQL> executedbms_stats.gather_fixed_objects_stats;

SQL> executedbms_stats.gather_fixed_objects_stats;

Page 109: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 109

Preparation

Agenda

Upgrade

Diagnostics & Tuning

Best Practice

News and Task List

Performance Testing

Database Upgrade AssistantCommand Line Upgrade

Post UpgradeAlternatives

CRS UpgradeASM Upgrade

Migration

Page 110: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 110

Upgrade Alternatives

• Export/Import

• DataPump

• Transportable Tablespaces

• Streams

• Logical Standby

Page 111: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 111

Upgrade Alternatives

• Export/Import• All-purpose

• Import possible for ≥ Oracle V5

• Export is not supported anymore in Oracle 11g

• Time and resource consuming

• Necessary or useful for:• Changing the character set

• Changing the OS platform before Oracle 10gR2

• Consolidating schemas

• All non-supported upgrade releases (like 8.1.6)

Page 112: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 112

Upgrade Alternatives

• Export/Import• Changing the character set

• Changing the Database Character SetNote: 225912.1

• Use Scanner Utility CSscan before altering the DB Character setNote: 123670.1

• Unicode

• Problem can be:Umlaut Ä in WE8ISO... = 1 ByteUmlaut Ä in UTF8 = 2 Byte

• Important Unicode Notes on Metalink: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 113: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 113

Upgrade Alternatives

• 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 114: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 114

Upgrade Alternatives

• Data Pump• Goal:

• Much faster and more flexible than exp/imp

• Concept:• Use impdp through a database link to transport the data into a new database without dumping the data to disk

• Pros & Cons:+ All advantages of the datapump concept+ No dumpfile will be created (so no additional IO)+ Very simple to realize- Works only with 10.1.0.2 and above

• For documentation see:Oracle® Database Utilities

• Further information and examples: Note:553337.1

IMPDP usr1/password NETWORK_LINK=db_link1 FULL=Y IMPDP usr1/password NETWORK_LINK=db_link1 FULL=Y

Page 115: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 115

Upgrade Alternatives

• Transportable Tablespaces• Goal:

• Minimal downtime

• Concept:• Tablespaces and metadata will be just transported from one database to another and plugged in

• Pros&Cons:+ "Can be" extremely fast- SYSTEM+SYSAUX tablespaces won't get transported - so additional tasks are required to get views, synonyms etc. moved into the new database

- Full backup necessary afterwards

• Cases and White Papers on OTN:• Amadeus Customer Case

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

• For TTS White Papers see the MAA webpage: http://www.oracle.com/technology/deploy/availability/htdocs/maa.htm

Page 116: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 116

Upgrade Alternatives

• General Transportable Tablespaces feature• Available since Oracle 8i

Target DBSource DB

imp meta data

Copy datafiles

exp meta data

Read Only

Read Write

Page 117: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 117

Upgrade Alternatives

• 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 118: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 118

Upgrade Alternatives

Source DB

Import non-segment

user data (views etc.)

10.2.0.4 11.1.0.7

Target DB

Create new

Transport

Page 119: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 119

Upgrade Alternatives

• Transportable Tablespaces - 3 ways• The "brutal" way

• Full exp/imp with ROWS=N

• The "smart" way

• Generate scripts

• String concatenation with || ...

• DBMS_METADATA

• The "very smart" way

• RMAN clone with SKIP TABLESPACES option

Page 120: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 120

Upgrade Alternatives

• Transportable Tablespaces - Information• For TTS White Papers see the MAA webpage:

http://www.oracle.com/technology/deploy/availability/htdocs/maa.htm

• Database Upgrades using TTS: http://www.oracle.com/technology/deploy/availability/pdf/maa_wp_11g_upgradetts.pdf

• Database Upgrades using Transportable Database (RMAN): http://www.oracle.com/technology/deploy/availability/pdf/MAA_WP_10gR2_PlatformMigration

TDB.pdf

• Transportable Database - Information• Note: 413586.1

How To Use RMAN CONVERT DATABASE for Cross Platform Migration

Page 121: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 121

Upgrade Alternatives

• Oracle Streams• Goal:

• Least downtime

• Concept:• Build up a second database, run it synchronized with Streams andswitch over to the new db at any time

• Pros&Cons:+ Operation in parallel+ Possibility of changing the platform environment- Logminer has some datatype restrictions- Effort is relatively high and source db must be at least 9.2

• For a detailed documentation see:Oracle® Streams Concepts and Administration: Appendix Dhttp://download.oracle.com/docs/cd/B28359_01/server.111/b28321/ap_strup.htm#i642623

Page 122: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 122

Upgrade Alternatives

• Logical Standby (Data Guard)• Goal:

• Minimal downtime

• Concept:• Upgrade will be done on the standby first• Afterwards: Switchover - standby will be now prod system• Now upgrade on ex-prod - switchover back to start layout

• Pros&Cons:+ Downtime ~2min for both switchovers- No changes of the OS platform possible- Logminer has some datatype restrictions- Some effort to setup and prod must be at least 10.1.0.3

+ But beginning with 11g:Transient Logical Standby utilizes an existing Physical Standby database for the rolling upgrade process

Page 123: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 123

Logical Standby configuration

Clients Redo

10.1.0.3 10.1.0.3

1

LP

Switchover (role change),

then upgrade on L (ex-P)

Redo

4

Upgrade

11.1.0.711.1.0.7

PL

"Mixed setup" for testing

Redo

3

11.1.0.710.1.0.3

P L

Upgrade node L to 11.1

Upgrade

Log

ARCH

10.1.0.3

2

11.1.0.7

P L

Upgrade Alternatives

Page 124: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 124

Upgrade Alternatives

• How to:• Patches, Links and Restrictions: Note: 300479.1

• Please see the documentation!!!http://download.oracle.com/docs/cd/B28359_01/server.111/b28294/create_ls.htm#g105412

http://download.oracle.com/docs/cd/B28359_01/server.111/b28294/rollup.htm#BABJIDHI

• Note:748595.1 (how to create a logical standby from a physical)

• White Paper (see OTN.oracle.com => High Availability => MAA):Database Upgrades using SQL Applyhttp://www.oracle.com/technology/deploy/availability/pdf/maa_wp_10gr2_rollingupgradebestpractices.pdf

Database Upgrades using a Transient Logical Standbyhttp://www.oracle.com/technology/deploy/availability/pdf/maa_wp_11g_transientlogicalrollingupgrade.pdf

Page 125: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 125

PRODPRODPRODPROD PSTBYPSTBYPSTBYPSTBYGuaranteed

Restore Point Guaranteed

Restore Point

LogminerBuild

LogminerBuild LSTBYLSTBYLSTBYLSTBY

Upgrade with DBUA Upgrade with DBUA

KEEP IDENTITY

PRODPRODPRODPRODSWITCHOVER

GuaranteedRestore Point Guaranteed

Restore Point

FLASHBACKDATABASE TO:

PRODPRODPRODPROD

New $OHNew $OH

SWITCHOVER

t t

LSTBYLSTBYLSTBYLSTBY

PSTBYPSTBYPSTBYPSTBY

PSTBYPSTBYPSTBYPSTBY

synchronize

synchronize

synchronize

Upgrade Alternatives – Transient Standby

��������

��������

��������

��������

����������������

��������

����������������

Upgrade via

Logshipping:

Page 126: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 126

Preparation

Agenda

Upgrade

Diagnostics & Tuning

Best Practices

News and Task List

Performance Testing

Database Upgrade AssistantCommand Line Upgrade

Post UpgradeAlternatives

CRS UpgradeASM Upgrade

Migration

Page 127: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 127

CRS Upgrade

• Always install into the existing CRS Home

Page 128: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 128

CRS Upgrade

Page 129: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 129

CRS Upgrade

• Documentation:• Oracle Clusterware Administration and Deployment Guide 11g

http://download.oracle.com/docs/cd/B28359_01/rac.111/b28255/toc.htm

• CRS Rolling Upgrade:• Note: 338706.1: Oracle Clusterware Rolling Upgrades

Page 130: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 130

Preparation

Agenda

Upgrade

Diagnostics & Tuning

Best Practices

News and Task List

Performance Testing

Database Upgrade AssistantCommand Line Upgrade

Post UpgradeAlternatives

CRS UpgradeASM Upgrade

Migration

Page 131: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 131

ASM Upgrade

• Upgrade an ASM instance with DBUA:http://download.oracle.com/docs/cd/B28359_01/server.111/b28300/upgrade.htm#BABGEDJI

• Upgrade an ASM instance manually:• http://download.oracle.com/docs/cd/B28359_01/server.111/b28300/upgrade.htm#BABHJIFJ

• ASM Rolling Upgrade (only in clustered environments):http://download.oracle.com/docs/cd/B28359_01/server.111/b31107/asminst.htm#OSTMG02400

Page 132: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 132

ASM Upgrade using DBUA

Page 133: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 133

ASM Upgrade using DBUA

Page 134: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 134

CRS - ASM - DB Compatibility

Note:337737.1

!

Page 135: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 135

CRS - ASM - DB Upgrade

• Reconfigure Oracle Cluster Synchronization Services• Upgrading a single-instance ASM requires that Oracle Cluster

Synchronization Services (CSS) first be configured to run from the new Oracle Database 11g Release 1 (11.1) home. To do this you need to run the following command before upgrading ASM:

• localconfig reset [destination_Oracle_home]

• Prepare the new ASM Home• Copy config files ... $OH/dbs/...

• Copy password file

• Adjust init.ora

Page 136: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 136

Preparation

Agenda

Upgrade

Diagnostics & Tuning

Best Practices

News and Task List

Performance Testing

Database Upgrade AssistantCommand Line Upgrade

Post UpgradeAlternatives

CRS UpgradeASM Upgrade

Migration

Page 137: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 137

Platform Migration

• Data Guard Physical Standby• Goal:

• Platform migration between with a Physical Standby

• Concept:• Build a physical standby database and do a switchover

• Pros&Cons:+ Only 1 minute downtime for a complete platform migration+ Simple to setup+ For Oracle 9.2.0.7+8 and 10.2.0.2+3+4:HP-PA 11.23 HP-IA64

+ Since Oracle 11g: Win Linux• For supported combinations see: Note:413484.1

Page 138: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 138

OS change on HP: PA RISC ���� IA64

• Migration from HP PA-RISC (64bit) to HP Itanium ia64 Note:266220.11) Complete valid backup

2) Trace the controlfile• SQL> alter database backup controlfile to trace;

3) Shutdown immediate (or normal)

4) Copy all datafiles

5) Startup nomount

6) Create a new controlfile

7) Possibly rebuild the JVM • SQL> create or replace java system;

Page 139: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 139

ASM Migration

• Migration to ASM• Option 1: RMAN• Option 2: Physical standby

• Simple switchover will do the migration to ASM• Just 1 minute downtime

• See:

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

Page 140: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 140

RAC Migration

• Migration from Single Instance to RAC:• Option 1: rconfig utility

http://download.oracle.com/docs/cd/B28359_01/install.111/b28264/cvrt2rac.htm#BABGGEGJ

• Modify $ORACLE_HOME/assistants/rconfig/sampleXMLs/ConvertToRAC.xml

• Run $ORACLE_HOME/bin/rconfig myconvert.xml

• Option 2: Enterprise Manager Grid Controlhttp://download.oracle.com/docs/cd/B28359_01/install.111/b28264/cvrt2rac.htm#sthref466

• Option 3: Manual• Install Cluster Ready Services (CRS) software

• Install Oracle RAC software (or link with RAC option)

• Reconfigure database to accommodate RAC settings• @$ORACLE_HOME/rdbms/admin/catclust.sql

• init.ora

• Register instances with srvctl

• See an example:• http://www.oracle.com/technology/pub/articles/chan_sing2rac_install.html

Page 141: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 141

Preparation

Agenda

Upgrade

Diagnostics & Tuning

Best Practices

News and Task List

Performance Testing

ParametersProcesses

MiscellaneousTools

AutomationLOB & SecureFiles

FlashbackADR

Compression

Page 142: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 142

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 only down to 10.1.0

• Supported patch downgrade only down to 11.1.0

• No ALTER DATABASE RESET COMPATIBILITY command anymore

COMPATIBLE = 10.0/1/2.0COMPATIBLE = 10.0/1/2.0

COMPATIBLE = 11.0.0COMPATIBLE = 11.0.0

Page 143: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 143

Parameter COMPATIBLE

• Upgrade 9i �11g precautions:• Make 100% sure that you've applied DST patches before starting the 9i database in an 11g environment

• 9i �11g requires COMPATIBLE ≥ 10.1

• No possibility to have COMPATIBLE=9.2.0

• No way back as soon as the database has be opened with a raised COMPATIBLE setting

COMPATIBLE ≥≥≥≥ 10.1/2.0COMPATIBLE ≥≥≥≥ 10.1/2.0

Page 144: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 144

Parameter COMPATIBLE

• DBUA raises COMPATIBLE only for 9i databases to 10.1.0

• To enable Oracle 11g features:

• 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.1.0' scope=spfile;

Page 145: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 145

New 11g Parameters

New in 11gOracle® Database Reference

ASM_PREFERRED_READ_FAILURE_GROUPSCLIENT_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_BASELINES

OPTIMIZER_USE_INVISIBLE_INDEXESOPTIMIZER_USE_PENDING_STATISTICSOPTIMIZER_USE_SQL_PLAN_BASELINESPARALLEL_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

ES

Page 146: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 146

New Parameters - Selection

• CONTROL_MANAGEMENT_PACK_ACCESS

• Default: DIAGNOSTIC+TUNING

• Values: DIAGNOSTIC+TUNINGDIAGNOSTICNONE

• 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

CONTROL_MANAGEMENT_PACK_ACCESS=NONE

select count(*) from v$active_session_history;

==> 0 rows

Page 147: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 147

New Parameters - 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 148: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 148

New Parameters - 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_TARGETSGA_TARGET

SGA_MAX_SIZESGA_MAX_SIZE

MEMORY_MAX_TARGETMEMORY_MAX_TARGET

MEMORY_TARGETMEMORY_TARGET

PGA_AGGREGATE_TARGETPGA_AGGREGATE_TARGET

Page 149: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 149

New Parameters - Selection

• OPTIMIZER_USE_INVISIBLE_INDEXES

• Default: FALSE

• Values: TRUEFALSE

• Purpose:"Invisible" indexes will be ignored by the optimizer if set toFALSE. But DMLs will be still executed to the index.

• Motivation: Isolated testing of performance effects of anindex based on a session level

• Example: CREATE INDEX emp_ename ON emp(ename) INVISIBLE;

ALTER SESSION SETOPTIMIZER_USE_INVISIBLE_INDEXES=TRUE;

CREATE INDEX emp_ename ON emp(ename) INVISIBLE;

ALTER SESSION SETOPTIMIZER_USE_INVISIBLE_INDEXES=TRUE;

Page 150: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 150

New Parameters - Selection

• SEC_CASE_SENSITIVE_LOGON 1/2• Default: TRUE

• Values: TRUEFALSE

• Purpose:Switches on/off the case sensitivity of passwordsAttention: also valid for database links!!

• Info:SELECT username, password_versions FROM dba_users;

USERNAME PASSWORD_VERSIONS---------- -----------------JONES 10G 11GPRESTON 11GBLAKE 10G

SELECT username, password_versions FROM dba_users;

USERNAME PASSWORD_VERSIONS---------- -----------------JONES 10G 11GPRESTON 11GBLAKE 10G

Created in:Created in:

Changed in:Changed in:

Page 151: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 151

New Parameters - Selection

• SEC_CASE_SENSITIVE_LOGON 2/2• Switching on the case sensitivity password mode can have several impacts:

• Scripts with user/pw like SCOTT/TIGER won't run anymore if the user gets created or altered e.g. as SCOTT/tiger in 11g• Annotation: Upon upgrading the "old" mechanism is still valid

• Check password encrypted database links

• Can be enabled also for the password file checkings

• Very helpful:Check view for default passwords: DBA_USERS_WITH_DEFPWD

orapwd file=orapwSID password=GeHeIm ignorecase=norapwd file=orapwSID password=GeHeIm ignorecase=n

Page 152: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 152

New Parameter Defaults - Selection

• AUDIT_TRAIL

• Default: NONE or DB

• Values: NONEOSXMLDBDB_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 153: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 153

Preparation

Agenda

Upgrade

Diagnostics & Tuning

Best Practices

News and Task List

Performance Testing

ParametersProcesses

MiscellaneousTools

AutomationLOB & SecureFiles

FlashbackADR

Compression

Page 154: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 154

• 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.LGWR Redo etc.MMAN Memory Manager

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.LGWR Redo etc.MMAN Memory Manager

NAME DESCRIPTION----- --------------------------MMNL Manageability Monitor Pr 2MMON Manageability Monitor PrPMON process cleanupPSP0 process spawner 0QMNC AQ CoordinatorRECO distributed recoverySMCO Space Manager ProcessSMON System Monitor ProcessVKTM Virtual Keeper of TiMe pr

Page 155: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 155

New Background Processes

ASMMaintains disk membership in ASM disk groupsGMON

ALL.The process archives historical rows for tracked tables into flashback data archives and manages the

flashback archives. FBDA

ALL with any

registered event

activity

(optional non-fatal)

The Event Monitor Coordinator coordinates the event management and notification activity in the database which includes Streams Event Notifications, Continuous Query Notifications and Fast

Application Notifications.

EMNC /

e0xx

ALLPerforms diagnostic dumps and executes global oradebug commands.

DIAG

ALLResponsible for hang detection and deadlock resolution.

DIA0

ALLThe Resource Manager process is responsible for setting Resource Plans and other Resource Manager

related tasks. DBRM

RAC

In an RAC environment, this per-instance process (Atomic Controlfile to Memory Service) is an agent which contributes to ensuring a distributed SGA memory update is either globally committed on success

or globally aborted in the event of a failure. ACMS

RAC onlyProvides transparent support for XA global transactions in a RAC environment. The database autotunes the number of these processes based on the workload of XA global transactions. GTX0-j

Description FoundProcess

Name

Page 156: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 156

New Background Processes

RAC onlyThe RAC Management Processes perform manageability tasks for RAC, e.g. creation of RAC related

resources when new instances are added to the clusters RMSn

RAC only

In a RACenvironment, this process manages background slave process creation and communication on remote instances. These background slave processes perform tasks on behalf of a coordinating process

running in another instance. RMSN

ALLThe Virtual Keeper of TiMe

?is responsible for providing a Wall-Clock time (updated every second) and

Reference-Time Counter (updated every 20ms and available only when running at elevated priority). VKTM

ALL (optional non-

fatal)

The space management coordinator process coordinates the execution of various space management related tasks, such as proactive space allocation and space reclamation. It dynamically spawns slave

processes (Wnnn) to implement the task.

SMCO /

Wnnn

ASM, spawned on

demand.Marks ASM Allocation Units as stale following a missed write to an offline disk. MARK

ASM, spawned on

demand.Performs proxy I/O to an ASM metafile when a disk becomes offline.KATE

Spawns Oracle processes.

Description

ALLPSP0

FoundProcess

Name

Page 157: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 157

Preparation

Agenda

Upgrade

Diagnostics & Tuning

Best Practices

News and Task List

Performance Testing

ParametersProcesses

MiscellaneousTools

AutomationLOB & SecureFiles

FlashbackADR

Page 158: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 158

• 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 VIEWCONNECT CREATE TABLECONNECT ALTER SESSIONCONNECT CREATE CLUSTERCONNECT CREATE SESSIONCONNECT CREATE SYNONYMCONNECT CREATE SEQUENCECONNECT CREATE DATABASE LINK

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

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

R2

Page 159: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 159

• Find out affected database users:

CONNECT Role

SELECT granteeFROM dba_role_privsWHERE granted_role = 'CONNECT' and

grantee NOT IN ('SYS', 'OUTLN', 'SYSTEM','CTXSYS', 'DBSNMP','LOGSTDBY_ADMINISTRATOR','ORDSYS', 'ORDPLUGINS','OEM_MONITOR', 'WKSYS','WKPROXY', 'WK_TEST', 'WKUSER', 'MDSYS','LBACSYS', 'DMSYS', 'WMSYS','EXFSYS', 'SYSMAN','MDDATA', 'XDB', 'ODM','SI_INFORMTN_SCHEMA');

SELECT granteeFROM dba_role_privsWHERE granted_role = 'CONNECT' and

grantee NOT IN ('SYS', 'OUTLN', 'SYSTEM','CTXSYS', 'DBSNMP','LOGSTDBY_ADMINISTRATOR','ORDSYS', 'ORDPLUGINS','OEM_MONITOR', 'WKSYS','WKPROXY', 'WK_TEST', 'WKUSER', 'MDSYS','LBACSYS', 'DMSYS', 'WMSYS','EXFSYS', 'SYSMAN','MDDATA', 'XDB', 'ODM','SI_INFORMTN_SCHEMA');

Page 160: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 160

• Parameter shared_pool_size is calculated differently since 10g

• Real shared pool = shared_pool_size – startup overhead

Shared Pool calculation since 10g

SQL> select * from v$sgainfo;

NAME BYTES RES-------------------------------- ---------- ---Fixed SGA Size 1266372 NoRedo Buffers 2924544 NoBuffer Cache Size 16777216 YesShared Pool Size 83886080 YesLarge Pool Size 0 YesJava Pool Size 50331648 YesStreams Pool Size 0 YesGranule Size 4194304 NoMaximum SGA Size 155189248 NoStartup overhead in Shared Pool 29360128 NoFree SGA Memory Available 0

SQL> select * from v$sgainfo;

NAME BYTES RES-------------------------------- ---------- ---Fixed SGA Size 1266372 NoRedo Buffers 2924544 NoBuffer Cache Size 16777216 YesShared Pool Size 83886080 YesLarge Pool Size 0 YesJava Pool Size 50331648 YesStreams Pool Size 0 YesGranule Size 4194304 NoMaximum SGA Size 155189248 NoStartup overhead in Shared Pool 29360128 NoFree SGA Memory Available 0

Page 161: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 161

• 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;select sum(sal), deptno from scott.emp group by deptno;

SUM(SAL) DEPTNO

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

8750 10

10875 20

9400 30

SUM(SAL) DEPTNO

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

8750 10

10875 20

9400 30

SUM(SAL) DEPTNO

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

9400 3010875 208750 10

SUM(SAL) DEPTNO

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

9400 3010875 208750 10

Page 162: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 162

• To prevent optimizer issues in since 10gR2 complex view structures security:

• optimizer_secure_view_merging=false

• Otherwise it is possible for the optimizer to create different execution plans for identical statements on identical objects issued from different user schemas

• Alternative:Grant MERGE ANY VIEW privilege to subordinate users

• See Note:468380.1

Secure-View-Merging Privilege

Page 163: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 163

• Optimizer sometimes does wrong rewrites with cascading views

• Requirement:

• "_push_join_predicate" is set to TRUE

• Solution:

• Patch on top of 10.2.0.4: #7445276

• Or: _optimizer_join_elimination_enabled=false

• Otherwise sometimes:• This Query: select * from some_view where col1=10;

results in:

• OK: select * from (select * from base_table where col1=10);

• Not OK: select * from (select * from base_table) where col1=10;

Cascading View Issues - 10.2.0.x

Page 164: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 164

• Observation:Query timing problems after upgrade to 10/11g• Since 10g CBO has been added costed subquery unnesting and view merging functionality.

• Can be disabled by:• _optimizer_cost_based_transformation=off

Costed query transformations since 10g

Page 165: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 165

• The CBO since 10g verifies more join orders to find out the least expensive one - this can sometimes lead to higher parse times

• Remedy: _new_initial_join_orders=false

• Example: observation for an explain plan:

• Set OFE=920: Number of join permutations tried: 187

• Set OFE=10203: Number of join permutations tried: 986

CBO verifies more joins orders since 10g

Page 166: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 166

• Before 10.2.0.4 PL/SQL cursors will be cached automatically because of OPEN_CURSORS. Since 10.2.0.4 SESSION_CACHED_CURSORS has to be defined to ensure cursor caching for PL/SQL

• Remedy: session_cached_cursors=500

PL/SQL cursors not cached ≥≥≥≥10.2.0.4

Page 167: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 167

• Large tables most likely won't be cached for sequential FTS regardless of ALTER TABLE CACHE attribute

• Remedy: set _small_table_treshold

• Example:• CREATE TABLE big_has_95000_rows(...);

• Force a preload:ALTER SESSION SET "_small_table_threshold"=100000;

SELECT /*+FULL(a) */ ... FROM big_has_95000_rows;

• Now the table is in cache and will be kept there

Table caching has changed ≥≥≥≥11.1.0.6

Page 168: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 168

• ORA-7445 [kkqtutlGenRowid()+157]• Bug 7596023

• Apply patch on top of 11.1.0.7

or:

• Workaround:

• Set "_optimizer_join_elimination_enabled"=false

• Disable the fix for bug 6167716 eg:Set "_FIX_CONTROL"='6167716:OFF'

Bug 7596023

Page 169: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 169

• SYSAUX-Tablespace• SYSAUX is the new home for most repositories

• SYSAUX can't be deleted or renamed

• SYSAUX can't be changed to read-only

• SYSAUX has to be created

• Recommended size: 500 MB

• ASSM and Locally Managed

• Size estimation: ?/rdbms/admin/utlsyxsz.sql

• View V$SYSAUX_OCCUPANTS shows:

• Repositories and their owner

• Space usage

• Procedures for moving repositories

SYSAUX

Page 170: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 170

SYSAUX

• V$SYSAUX_OCCUPANTS - an excerpt:

REPO DESCR MOVE MB--------------- ----------------------------------- --------------- ------AO Analytical Workspace Object Table DBMS_AW.MOVE_AW 1.4AUTO_TASK Automated Maintenance Tasks .3EM_MONITORING_U Enterprise Manager Monitoring User 2.4EM Enterprise Manager Repository emd_maintenance 123.6LOGMNR LogMiner SYS.DBMS_LOGMNR 7.6SDO Oracle Spatial MDSYS.MOVE_SDO 0STREAMS Oracle Streams 1PL/SCOPE PL/SQL Identifier Collection .4SQL_MANAGEMENT_ SQL Management Base Schema 1.6SM/ADVISOR Server Manageability - Advisor Fram 7.8SM/AWR Server Manageability - Automatic Wo 27.6SM/OPTSTAT Server Manageability - Optimizer St 3.6SM/OTHER Server Manageability - Other Compon 5.6STATSPACK Statspack Repository 0JOB_SCHEDULER Unified Job Scheduler .4WM Workspace Manager DBMS_WM.move_pr 7.1

REPO DESCR MOVE MB--------------- ----------------------------------- --------------- ------AO Analytical Workspace Object Table DBMS_AW.MOVE_AW 1.4AUTO_TASK Automated Maintenance Tasks .3EM_MONITORING_U Enterprise Manager Monitoring User 2.4EM Enterprise Manager Repository emd_maintenance 123.6LOGMNR LogMiner SYS.DBMS_LOGMNR 7.6SDO Oracle Spatial MDSYS.MOVE_SDO 0STREAMS Oracle Streams 1PL/SCOPE PL/SQL Identifier Collection .4SQL_MANAGEMENT_ SQL Management Base Schema 1.6SM/ADVISOR Server Manageability - Advisor Fram 7.8SM/AWR Server Manageability - Automatic Wo 27.6SM/OPTSTAT Server Manageability - Optimizer St 3.6SM/OTHER Server Manageability - Other Compon 5.6STATSPACK Statspack Repository 0JOB_SCHEDULER Unified Job Scheduler .4WM Workspace Manager DBMS_WM.move_pr 7.1

Page 171: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 171

SYSAUX

•utlsyxsz.sql:

Page 172: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 172

Instant Client

• Universal. small footprint Oracle client• Works with OCI, OCCI, Pro*C, ODBC, JDBC, ODP.NET, ASP.NET, OLE DB and OO4O applications

• No OUI Oracle Client installation necessary anymore

• Easy and simple deployment• Download it from OTN

• Copy it to the target/client system(s)

• Add its directory to PATH/LD_LIBRARY_PATH and set TNS_ADMIN

• For ODBC run the provided batch script

• Patching? Just deploy the current version

• More Information on OTN:http://www.oracle.com/technology/tech/oci/instantclient/instantclient.html

Page 173: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 173

Instant Client

• Instant Client Download:http://www.oracle.com/technology/software/tech/oci/instantclient/index.html

Page 174: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 174

Instant Client

• Instant Client Packaging

• Basic: All files required to run OCI, OCCI, and JDBC-OCI applications (46 MB)• JDBC Supplement: Additional support for XA, Internationalization, and RowSet operations under JDBC (1.5 MB)• SQL*Plus: Additional libraries and executable for running SQL*Plus with Instant Client (0.8 MB) • SDK: Additional header files and an example makefile for developing Oracle applications with Instant Client (1 MB)• ODBC: Additional libraries for enabling ODBC applications (0.7 MB)• WRC: Workload Replay Client used to replay workload for RAT's DB Replay Feature (6 KB) • ´Precompiler: Additional files for "proc" binary and related files to precompile a Pro*C application and demo (0.5 MB)

Page 175: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 175

• Client certification - Note: 207303.1

Clients & Net

Certified

Not supported anymore Never supported

10.1.0

10.1.0

9.2.0

9.0.1

9.2.0 9.0.1 8.1.7

8.1.7

Database Release

C

l

i

e

n

t

10.2.0

10.2.0

11.1.0

11.1.0

Supported but ES

Page 176: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 176

Clients & Net

• Database links• Only supported if matrix shows ‚Supported‘ in both directions

• Not supported means: Use it on your own risk

• JDBC certification• Note:203849.1

• Forms/Reports certification• Metalink � Certify Tab � Development Tools

Page 177: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 177

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

Page 178: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 178

• PL/SQL issues while upgrading from 7/8 to 10g/11g?

• PLSQL_V2_COMPATIBILITY = TRUEPL/SQL checking methods work such as in release 8i

PL/SQL Compilation

Page 179: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 179

Upgrading your applications

• Compatibility Issues:• Check for reserved words

• Appendix A, Upgrade Guide

• Check for behaviour changes• Appendix A, Upgrade Guide

• Upgrade Companion

• Check for changes in the data dictionary• Appendix A, Upgrade Guide

Page 180: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 180

Upgrading your applications

• Precompiler and OCI applications:

• Upgrading the Oracle Database Server software• If you do not change the client environment than you won't have to precompile, compile or relink

• Database Server version should be identical or higher than client version

• Upgrading the Oracle Client software• It is recommended that Oracle client software has the same release than the server

• Dynamic Libraries: No relink required

• Static Libraries: Need to be relinked always

Page 181: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 181

Upgrading your applications

• Precompiler and OCI applications:

• Option 1: Leave the application unchanged• Don't upgrade the client installation

• Simple and easy

• Option 2: Precompile the application and change client• Recompile when you change the major release

• You don't have to recompile for a patch release

• Option 3: Change the application code to use 11g features • Most potential benefits

• Most difficult option

• Precompile, compile and relink

Page 182: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 182

Wordsize

• Word size change 32/64-bit happens implicitly during upgrade/downgrade process• This will apply to patch sets, too

Page 183: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 183

Conversion between XE, SE and EE

• SE � EE see Note:117048.1• Take a full backup

• Run catalog.sql and catproc.sql in the EE environment

• EE � SE see Note:139642.1• Only Export/Import with exp/imp or expdp/imdp will be supported

• XE � SE/SEone/EE• http://download.oracle.com/docs/cd/B28359_01/server.111/b28300/intro.htm#BABGDCDD

• Use the DBUA to upgrade your XE database to Seone/SE/EE

Page 184: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 184

Preparation

Agenda

Upgrade

Diagnostics & Tuning

Best Practices

News and Task List

Performance Testing

ParametersProcesses

MiscellaneousTools

AutomationLOB & SecureFiles

FlashbackADR

Compression

Page 185: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 185

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 contains 11g functionality

• GridControl 11g is not yet available

Page 186: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 186

Enterprise Manager 11g

• Components• Database Control:Agent and standalone OC4J - thus no additional webserver needed

• Grid Control:OMS, Management Agent and Repository Database

• Installation:• Database Control:Automatically done within the 11g database software installation

• Grid Control:Separate download/DVD

• License:• Both products are included in any database license

• Specific packs and plug-ins may be licensed additionally

Page 187: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 187

Enterprise Manager 11g

• Database Control

Page 188: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 188

Enterprise Manager 10g

• Grid Control 10.2

Page 189: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 189

SQL Developer 1.5.5

• Developer tool at no extra cost(Installation deploys V.1.1.3 - Update available via OTN)

• Key-Features:• PL/SQL development and debugging

• Extremely fast object browser

• Excellent reporting capabilities

• Supports Oracle 9iR2 and above

• Migration workbench for:

• MS SQL-Server

• MS Access

• MySQL

• No extra license costs!

Page 190: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 190

SQL Developer 1.5

• Connections and object browser

Page 191: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 191

APEX 3.0

• APEX = Application Express = ex-HTMLDB• GUI development enviroment

• Easy to use - wizard driven

• APEX is available by default• No additional installation or license necessary

• Current release: 3.2

• HTTP via "Embedded Gateway"

• Two configuration steps:• $ORACLE_HOME/apex/apxconf.sql

• ALTER USER anonymous ACCOUNT UNLOCK;

Page 192: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 192

APEX

• APEX web page: apex.oracle.com

Page 193: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 193

Data Pump

• Facts• The „new“ export/import• Available and usable only for 10g and 11g • No backward compatibility to exp/imp• But syntax very similar to exp/imp• And much faster than exp/imp - parallelism!!!• It‘s server based only

• Interface• Command line: expdp and impdp

• Package DBMS_DATAPUMP• Controllable through interactive Job Control

• API

• Documentation:• Database Utilities and Note:553337.1

Page 194: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 194

Data Pump in Enterprise Manager

Page 195: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 195

Data Pump

• Step-by-step1) Directory in which Oracle OS user has write permissions

2) Default DATA_PUMP_DIR already defined – may be changed in 11g: DBA_DIRECTORIES

3) Grant non-privileged users permissions:

4) Example of a full database export:

expdp system/managerDUMPFILE=DATA_PUMP_DIR:full%u.dmpFULL=y NOLOGFILE=y

expdp system/managerDUMPFILE=DATA_PUMP_DIR:full%u.dmpFULL=y NOLOGFILE=y

grant READ,WRITE on directory DPDIR to SCOTT;grant READ,WRITE on directory DPDIR to SCOTT;

Page 196: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 196

Data Pump

• Step-by-step5) Enter the interactive job control by pressing CTRL-C:

Page 197: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 197

Data Pump

• Step-by-step6) Commands available in job control mode:

Page 198: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 198

Data Pump

• Step-by-step7) Attach to a running job and stop it:

• Hit CTRL-C to enter the interactive job control

• Job name:

• Attach:

• Stop the job:

Page 199: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 199

Data Pump

• Behind the scenes• Starting data pump creates a master table in the database user schema of the user calling expdp

• By default the table name is identical to the job name

• Master table acts as the "commemoration" and is essential for the job control

• At the end of a run of expdp the master table will be moved into the dump file

• Metadata will be unloaded as XML and can be extracted easily

Page 200: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 200

Data Pump Capabilities

• Some important features• ReMapping of tablespaces, files and schemas

• Extract all DDLs from a dump file

• Include or exclude specific objects/users with EXCLUDE and INCLUDE - wildcard usage possible

• Import via a network without creating a dump file•

• Compression - dump file size reduction by 50 % or more possible

• Advanced Compression Option license required

• Encryption - encrypt dump files or data - requires Advanced Security Option

expdp system/orc DUMPFILE=DPDIR:full.dmpFULL=y NOLOGFILE=y COMPRESSION=all

expdp system/orc DUMPFILE=DPDIR:full.dmpFULL=y NOLOGFILE=y COMPRESSION=all

impdp system/orc NETWORK_LINK=db_link1 FULL=Y impdp system/orc NETWORK_LINK=db_link1 FULL=Y

expdp system/orc DUMPFILE=DPDIR:enc.dmpENCRYPTION_PASSWORD=secret ENCRYPTION_ALGORITHM=AES128

expdp system/orc DUMPFILE=DPDIR:enc.dmpENCRYPTION_PASSWORD=secret ENCRYPTION_ALGORITHM=AES128

Page 201: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 201

Preparation

Agenda

Upgrade

Diagnostics & Tuning

Best Practices

News and Task List

Performance Testing

ParametersProcesses

MiscellaneousTools

AutomationLOB & SecureFiles

FlashbackADR

Compression

Page 202: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 202

Automation in 11g

• Predefined Jobs: DBA_SCHEDULER_JOBS

Disable them in 11.1.0.6:exec dbms_scheduler.disable(‚<jobname>');

Page 203: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 203

Automation in 11g

• Jobs – Default Maintenance Windows

240min = 4h ... 1200min = 20h

Page 204: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 204

Automation in 11g

• Configure automatically defines maintenance jobs

Page 205: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 205

Automation in 11g

• Segment Advisor job identifies space to free up

Page 206: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 206

High

Watermark

High

Watermark

Copy tables

• Additional storage needed• Remove old tables• Maintenance on indexes

Mechanism: scale down tables in

Page 207: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 207

Move dataHigh

Watermark

High

Watermark

• Online• Indexes are maintained• Triggers won't be executed

• But: TS must be ASSM

• Exclusive Table Lock for HWM

ALTER TABLE <tablename> SHRINK SPACE;ALTER TABLE <tablename> SHRINK SPACE;

Mechanism: scale down tables in:

Page 208: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 208

Preparation

Agenda

Upgrade

Diagnostics & Tuning

Best Practices

News and Task List

Performance Testing

ParametersProcesses

MiscellaneousTools

AutomatismsLOB & SecureFiles

FlashbackADR

Compression

Page 209: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 209

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 210: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 210

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 ); ALTER TABLE long_tab MODIFY ( long_col CLOB );

Page 211: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 211

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 (

DEDUPLICATE);

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

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

DEDUPLICATE);

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

DB_SECUREFILE = [NEVER | PERMITTED | ALWAYS | IGNORE]DB_SECUREFILE = [NEVER | PERMITTED | ALWAYS | IGNORE]

Page 212: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 212

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 213: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 213

Preparation

Agenda

Upgrade

Diagnostics & Tuning

Best Practices

News and Task List

Performance Testing

ParametersProcesses

MiscellaneousTools

AutomatismsLOB & SecureFiles

FlashbackADR

Compression

Page 214: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 214

UndoUndo

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

UndoUndo

Flashback Logs

� Enabled by default

� Enabled by default

� Has to be enabled

� Has to be enabled

Page 215: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 215

Flashback in EM

• In Enterprise Manager:

Page 216: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 216

Restore Points

• Restore point – specifies a jump label

• Named Restore Point• Similar to a bookmark

• "Can be" - but no guarantee

• Will be recorded to the control file

• Guaranteed Restore Point• Similar to storage snapshots

• Overrides the FLASHBACK_RETENTION_TARGET

• Attention: A guarantee restore point can stop the whole database �

SQL> CREATE RESTORE POINT rpt;SQL> FLASHBACK DATABASE TO RESTORE POINT rpt;SQL> CREATE RESTORE POINT rpt;SQL> FLASHBACK DATABASE TO RESTORE POINT rpt;

SQL> CREATE RESTORE POINT grptGUARANTEE FLASHBACK DATABASE;

SQL> FLASHBACK DATABASE TO RESTORE POINT grpt;

SQL> CREATE RESTORE POINT grptGUARANTEE FLASHBACK DATABASE;

SQL> FLASHBACK DATABASE TO RESTORE POINT grpt;

Page 217: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 217

Flashback Query

• Review into the status or to the changes happened to a table• Flashback Query

• Query a specific state (date, SCN ...)

• Flashback Versions Query

• Display changes happened in the past

• Flashback Transaction Query

• Detect change transactions from within the past

• Example:

• select * from EMP as of timestamp ...

Page 218: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 218

• Example:� Change data:

> update EMP set SAL=60000 where ENAME='KING';

� Query data BEFORE it has changed:

> select * from EMP as of timestamp TO_TIMESTAMP('2005-08-01 20:30:00',

'YYYY-MM-DD HH24:MI:SS')where ENAME='KING';

� Result: 5000

� Change the data back to its original status:

> update EMP set SAL= (select SAL from EMP as of timestamp

TO_TIMESTAMP('2005-08-01 20:30:00','YYYY-MM-DD HH24:MI:SS')

where ENAME='KING') where ENAME='KING';

Flashback Query

Page 219: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 219

Flashback Table

• Requirements:• Row movement has to be switched on for the table

• alter table EMP enable row movement;

• Purpose:• Recover a table point-in-time

• Example:• flashback table EMP to timestamp

to_timestamp(...);

• Annotation: • Maintains indexes, takes care on constraints

• Triggers are disabled

• Afterwards statistics will be stale

Page 220: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 220

• Example:� Change data:

> delete from EMP;

� Flashback the table:

> flashback table EMP to timestampto_timestamp('01.08.2005 21:39:00',

'dd.mm.yyyy hh24:mi:ss');

� Table now has the state of before-delete

Flashback Table

Page 221: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 221

• Requirements:• Init parameter recyclebin is set to ON

• Tablespace is locally managed and <> SYSTEM• Owner <> SYS, SYSTEM

• Purpose:• Recover deleted tables with their dependent objects

• Example:> flashback table EMP to before drop;

Flashback Drop

Page 222: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 222

• How does it work?• drop table

• Pointer to the table will be redirected:This includes:Dependent objects like indexes, constraints, trigger, nested tables, LOB segments and LOB index segments

• Objects stay in DBA_Views but have a different name:BIN$$globalUID$version

• Table can now be undroped with a single command

Flashback Drop

Page 223: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 223

• Example:� Delete a table:

> drop table EMP;

� Query the USER_RECYCLEBIN:

> OBJECT_NAME ORIG OPER TYPE CANBIN$/U0DO44XUeXgMFaMimgQ==$0 EMP DROP TABLE YES

� Check the table contents:

> select * from "BIN$/U0DO44XUeXgMFaMimgQ==$0"

� Recover the table:

> flashback table EMP to before drop;

> flashback table "BIN$/..." to before drop;

> flashback table EMP to before droprename to EMP_version1;

Flashback Drop

Page 224: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 224

• Sometimes there‘s a misunderstanding ... • Tablespace won‘t overflow...

Flashback Drop

Tablespace TEST

Table EMP

Tablespace TEST

Table BIN$. exEMP

Tablespace TEST

Table BIN$. exEMP

Table NEWEMP

DROP TABLE EMP

Tablespace TEST

Table NEWEMP

Page 225: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 225

• Search the recyclebin in SQL Developer:

Flashback Drop

Page 226: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 226

• How does it work?• Before-Images of changeddata blocks will be writteninto flashback logs in intervals

• Not every changed block will bewritten into the flashback logs• Therefore the database has to be in archivelog mode

• Example:> flashback database to scn 47110815;

• Annotation:Flashback logs have to be in the flash recovery area

Flashback Database

Page 227: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 227

• Example:� User droped accidentially:

> drop user SCOTT cascade;

� Flashback the whole database:

> shutdown immediate;

> flashback database to scn 47110815;

> alter database open resetlogs;

Flashback Database

Page 228: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 228

• (Almost) as fast as lightning ... ☺

Flashback Database

Database size

Flashback

Recovery

Restore

0

100

200

300

400

500

600

700

10 GB 100 GB 1 TB 10 TB

Tim

e in m

inute

s

2 3 4 651

114

250

627

Page 229: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 229

• Typical questions:• Q: How much flashback data will be generated?A: About the same amount of data as for redologs

• Q: Are the logs cleared automatically ?A: Yes, flashback logs get cleared automatically to reclaim space

• Q: Can Flashback Logs be administered?A: No !!!

• Q: Is this available in a Standard Edition (one) database, too?A: No, Flashback Database is a EE feature

• Q: How can do performance tuning?A: Switch off OS file caching, use lots of disc spindles, use a small stripe-size (~128 kB)

Flashback Database

Page 230: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 230

• How does it work?• Background process FBDAwill track data changes(only UPDATEs and DELETEs) onmonitored tables inthe Flashback DataArchive (asynchronous)

• Data gets extracted from undo information

• Default capture interval:5min

• Capture intervall will be changed automaticallyupon system work load

• Licensable option

Flashback Data Archive - Total Recall

FBDAFBDA

Page 231: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 231

• Requirements:• Tablespace for FBDA has to be ASSM managed• Ideally separate tablespaces get created for the flashback data archives and reside on cheaper storage for cost efficiency

• Create a flashback data archive:

• Switch on flashback archiving for a specific object:

Flashback Data Archive - Total Recall

CREATE FLASHBACK ARCHIVE fda1TABLESPACE fdaRETENTION 1 year;

CREATE FLASHBACK ARCHIVE fda1TABLESPACE fdaRETENTION 1 year;

ALTER TABLE t1 FLASHBACK ARCHIVE fda1;ALTER TABLE t1 FLASHBACK ARCHIVE fda1;

Page 232: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 232

• Behind the scenes:• In tablespace fda some structures will be created:

• 23107 is the OBJECT_ID of the table getting monitored/archived

• Tracks the changes• If the defined retention is reached the required data will be deleted automatically

• Absolutely transparent - no changes to any application necessary• Partitioning happens automatically

Flashback Data Archive - Total Recall

NAME TYP------------------------------ ------------------SYS_FBA_DDL_COLMAP_23107 TABLESYS_FBA_HIST_23107 TABLE PARTITIONSYS_FBA_TCRV_23107 TABLESYS_FBA_TCRV_IDX_23107 INDEX

NAME TYP------------------------------ ------------------SYS_FBA_DDL_COLMAP_23107 TABLESYS_FBA_HIST_23107 TABLE PARTITIONSYS_FBA_TCRV_23107 TABLESYS_FBA_TCRV_IDX_23107 INDEX

Page 233: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 233

• Is it possible to change data in the FDA?• Data will be stored such as:

• Data can‘t be manipulated:

Flashback Data Archive - Total Recall

ROWID STARTSCN ENDSCN O COL1------------------ ---------- ---------- - ----------AAAFplAAGAAAAAVAAA 1114797 1115141 I 1AAAFplAAGAAAAAVAAB 1114797 1115141 I 2AAAFplAAGAAAAAVAAC 1114797 1115141 I 23AAAFplAAGAAAAAVAAD 1114797 1115141 I 24AAAFplAAGAAAAAVAAE 1114797 1115141 I 25AAAFplAAGAAAAAVAAF 1115141 1116039 U 2...

ROWID STARTSCN ENDSCN O COL1------------------ ---------- ---------- - ----------AAAFplAAGAAAAAVAAA 1114797 1115141 I 1AAAFplAAGAAAAAVAAB 1114797 1115141 I 2AAAFplAAGAAAAAVAAC 1114797 1115141 I 23AAAFplAAGAAAAAVAAD 1114797 1115141 I 24AAAFplAAGAAAAAVAAE 1114797 1115141 I 25AAAFplAAGAAAAAVAAF 1115141 1116039 U 2...

SQL> update SYS_FBA_HIST_23107 set col1=col1-1;update SYS_FBA_HIST_23107 set col1=col1-1

*ERROR at line 1:

ORA-55622: DML, ALTER and CREATE UNIQUE INDEX operations arenot allowed on table "SYS"."SYS_FBA_HIST_23107"

SQL> update SYS_FBA_HIST_23107 set col1=col1-1;update SYS_FBA_HIST_23107 set col1=col1-1

*ERROR at line 1:

ORA-55622: DML, ALTER and CREATE UNIQUE INDEX operations arenot allowed on table "SYS"."SYS_FBA_HIST_23107"

Page 234: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 234

• How to access the historical data?•

Flashback Data Archive - Total Recall

SELECT * FROM t1AS OF TIMESTAMP '27-AUG-07 2:15:00pm';

COL1----------

12

23

SELECT * FROM t1AS OF TIMESTAMP '27-AUG-07 2:30:00pm';

COL1----------

23

24

SELECT * FROM t1AS OF TIMESTAMP '27-AUG-07 2:15:00pm';

COL1----------

12

23

SELECT * FROM t1AS OF TIMESTAMP '27-AUG-07 2:30:00pm';

COL1----------

23

24

Page 235: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 235

• Switch background process FBDA off?•

Flashback Data Archive - Total Recall

SQL> ALTER SYSTEM SET"_disable_flashback_archiver"=1scope=spfile;

SQL> STARTUP FORCE

$ ps -ef | grep fbda

SQL> ALTER SYSTEM SET"_disable_flashback_archiver"=1scope=spfile;

SQL> STARTUP FORCE

$ ps -ef | grep fbda

Page 236: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 236

Preparation

Agenda

Upgrade

Diagnostics & Tuning

Best Practices

News and Task List

Performance Testing

ParametersProcesses

MiscellaneousTools

AutomatismsLOB & SecureFiles

FlashbackADR

Compression

Page 237: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 237

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

Automatic Diagnostic Repository

Page 238: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 238

• ADR: systemwide logging/tracing directory• "Oh ... my alert.log is now in XML format ...?"

• No panic:• Files are still kept also in text mode• There are two very comfortable interfaces:

• adrci

• EM interface

• Error categories• Problem (Critical error like ORA-600, ORA-7445, ORA-4031 ...)• Incident (Singular error - if it gets raised more often it'll become a PROBLEM!!)

Automatic Diagnostic Repository

Page 239: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 239

•V$DIAG_INFO:

Automatic Diagnostic Repository

SQL> SELECT name, value FROM v$diag_info;

NAME WERT----------------------- ----------------------------------------Diag Enabled TRUEADR Base c:\oracleADR Home c:\oracle\diag\rdbms\source\sourceDiag Trace c:\oracle\diag\rdbms\source\source\traceDiag Alert c:\oracle\diag\rdbms\source\source\alertDiag Incident c:\oracle\diag\rdbms\source\source\incidDiag Cdump c:\oracle\diag\rdbms\source\source\cdumpHealth Monitor c:\oracle\diag\rdbms\source\source\hmDefault Trace File c:\oracle\diag\rdbms\source\source\traceActive Problem Count 1Active Incident Count 7

SQL> SELECT name, value FROM v$diag_info;

NAME WERT----------------------- ----------------------------------------Diag Enabled TRUEADR Base c:\oracleADR Home c:\oracle\diag\rdbms\source\sourceDiag Trace c:\oracle\diag\rdbms\source\source\traceDiag Alert c:\oracle\diag\rdbms\source\source\alertDiag Incident c:\oracle\diag\rdbms\source\source\incidDiag Cdump c:\oracle\diag\rdbms\source\source\cdumpHealth Monitor c:\oracle\diag\rdbms\source\source\hmDefault Trace File c:\oracle\diag\rdbms\source\source\traceActive Problem Count 1Active Incident Count 7

Page 240: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 240

•adrci

• Step 1: Check and set ADRCI homes• adrci> show homes

• adrci> set homepath diag\rdbms\source\source

• Step 2: Define the editor, e.g.:• adrci> set editor uedit32

• Step 3: Check alert.log, problems and incidents• adrci> show alert -tail 50 -f

• adrci> show problem

• adrci> show incident

Automatic Diagnostic Repository

ADRCI: Release 11.1.0.7.0 - Production on Mon Apr 27 16:58:37 2009

Copyright (c) 1982, 2007, Oracle. All rights reserved.

ADR base = "c:\oracle"adrci> help

ADRCI: Release 11.1.0.7.0 - Production on Mon Apr 27 16:58:37 2009

Copyright (c) 1982, 2007, Oracle. All rights reserved.

ADR base = "c:\oracle"adrci> help

Page 241: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 241

•adrci

• Helpful notes:• Note: 443529.111g How To Package And Send ORA-00600/ORA-07445 Diagnostic Information To Support.

• Note: 564269.1Retention Policy for ADR Incidents

• SHORTP_POLICY:Used to purge informations that have a short life.Default: 720 => 30 days

• LONGP_POLICY:To purge ADR contents that have a long life.Default: 8760 => 365 days

Automatic Diagnostic Repository

Page 242: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 242

• DatabaseControl

Automatic Diagnostic Repository

Page 243: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 243

• DatabaseControl

Automatic Diagnostic Repository

Page 244: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 244

Preparation

Agenda

Upgrade

Diagnostics & Tuning

Best Practices

News and Task List

Performance Testing

ParametersProcesses

MiscellaneousTools

AutomatismsLOB & SecureFiles

FlashbackADR

Compression

Page 245: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 245

Compression

• Index compression available since 8i

• Table compression available since 9.2• Designated for DWH

• Direct path and bulk INSERTs, CREATE TABLE .. AS SELECT

• Didn't work for INSERT/UPDATE/DELETE

• Before 11g syntax:

• New 11g syntax:

CREATE TABLE sales_history… COMPRESSCREATE TABLE sales_history… COMPRESS

CREATE TABLE sales_history…COMPRESS FOR DIRECT_LOAD OPERATIONS

CREATE TABLE sales_history…COMPRESS FOR DIRECT_LOAD OPERATIONS

Page 246: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 246

Advanced Compression

• Advanced Compression in Oracle 11g works for:• Structured and unstructured data• Backups• Datapump exports• Data Guard gap resolution (11.1.0.7 => LGWR ASYNC)

• Reduces resource requirements and costs!!! • Storage

• Typically 2x to 4x compression possible

DMLuncompressed

PCTFREE reached:

Compression!

Further DML uncompressed

PCTFREE reached:

Compression!Overhead

Free Space

uncompressed

compressed

Page 247: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 247

‘Real World’ Compression10 largest ERP database tables

3x Savings

MB

Space

Table ScansTime

(seconds)

0

0.1

0.2

0.3

0.4

2.5x faster

DML Performance

0

10

20

30

40

Time

(seconds)

< 3% overhead

Page 248: Oracle Upgrade11gr1 Workshop1

© 2009 Oracle Corporation 248

Compression Advisor - Free Download

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