best practice

60
1 © 2012 Oracle Corporation Proprietary and Confidential

Upload: ankurdiwan

Post on 25-Sep-2015

232 views

Category:

Documents


4 download

DESCRIPTION

Best Practices for Upgrading Oracle Database to 11g R2

TRANSCRIPT

  • 1 2012 Oracle Corporation Proprietary and Confidential

  • 2

    AGENDA

    Presentation approximately 45 minutes

    Q&A Session approximately 15 minutes

    Web attendees can ask questions via Q&A panel

    Phone attendees can ask questions via Q&A panel or

    phone (operator assisted)

    2012 Oracle Corporation Proprietary and Confidential

  • 3

    ATTENTION AUDIO Options

    You can

    either listen the audio broadcast on your computer

    or join teleconference (dial in)

    2012 Oracle Corporation Proprietary and Confidential

  • 4

    Voice Streaming Audio Broadcast

    Listen only mode Advantage: no need to dial in What about Questions? Type your questions into WebEx Q&A panel

    If you prefer full audio access in order to ask questions directly, please connect to

    our teleconference

    Connect details you will find at next slide

    2012 Oracle Corporation Proprietary and Confidential

  • 5

    ATTENTION AUDIO INFORMATION

    Teleconference Connect details:

    1. Conference ID: 57559830

    2. International dial in: +44 (0) 1452 562 665

    3. US Free call: 1866 230 1938 US local call: 1845 608 8023

    4. List with national toll free numbers is available in note 1148600.1

    You can view this info anytime during the conference using

    Communicate > Teleconference > Join Teleconference

    from your WebEx menu

    2012 Oracle Corporation Proprietary and Confidential

  • 6

    Best Practices for Upgrading Oracle Database to

    11g Release 2

    Agrim Pandit

    Principal Software Engineer

    2012 Oracle Corporation Proprietary and Confidential

  • 7

    AGENDA

    Presentation approximately 45 minutes

    Q&A Session approximately 15 minutes

    Web attendees can ask questions via Q&A panel only

    Phone attendees can ask questions via Q&A panel or phone (operator assisted)

    Advisor Webcast Archived Recordings DocID 740964.1

    2012 Oracle Corporation Proprietary and Confidential

  • 8

    AUDIO INFO - Teleconference

    Connect details:

    1. Conference ID: 57559830

    2. International dial in: +44 (0) 1452 562 665

    3. US Free call: 1866 230 1938 US local call: 1845 608 8023

    4. List with national toll free numbers is available in note 1148600.1

    You can view this info anytime during the conference using

    Communicate > Teleconference > Join Teleconference

    from your WebEx menu

    2012 Oracle Corporation Proprietary and Confidential

  • 9

    type your question here 1

    Q&A panel

    Send your question 3

    Ask: ALL PANELLIST leave default! 2

    2012 Oracle Corporation Proprietary and Confidential

  • 10

    your question pop-up here

    2012 Oracle Corporation Proprietary and Confidential

  • 11

    The following is intended to outline our general

    product direction. It is intended for information

    purposes only, and may not be incorporated into

    any contract. It is not a commitment to deliver any

    material, code, or functionality, and should not be

    relied upon in making purchasing decision. The

    development, release, and timing of any features

    or functionality described for Oracles products

    remains at the sole discretion of Oracle.

    Safe Harbor Statement

    2012 Oracle Corporation Proprietary and Confidential

  • 12

    2012 Oracle Corporation Proprietary and Confidential

    Best Practices for Upgrading Oracle Database to

    11g Release 2

    Agrim Pandit

    Principal Software Engineer

  • 13

    Agenda

    Why Upgrade?

    What Is An Upgrade?

    10 Best Practices

    Common Issues

    Real World Examples

    Q&A

    2012 Oracle Corporation Proprietary and Confidential

  • 14

    Why Upgrade?

    Oracle Database 11g R2 is fully proven

    New features of Oracle Database 11gR2

    Length of Support Period

    Staying on a version in Premier Support avoids Extended Support fees for older versions

    Availability of Patchset, CPU, PSU, and other bug fixes .

    2012 Oracle Corporation Proprietary and Confidential

  • 15

    t 2008

    2003

    2004

    2005

    2006

    2007

    2002

    2009

    2010

    today

    20

    11

    2012

    2013

    2014

    Sustaining Support

    Premier Support

    R2 July 2007

    Extended Support July 2010

    January 2009 January 2012

    R2 July 2010 July 2013

    2015

    2016

    August 2012 August 2015

    July 2008

    July 2011

    R2

    2017

    2018

    January 2015 January 2018

    Why Upgrade Continued

    2012 Oracle Corporation Proprietary and Confidential

  • 16

    What is upgrade?

    Upgrade is the process of changing the data dictionary contents of a

    database to reflect a newer release of the server.

    Upgrades and downgrades supported from a specific set of versions.

    Upgrading from 10.2 to 11.2 is a major release upgrade.

    Upgrading from 11.2.0.1 to 11.2.0.3 is a patch set upgrade.

    Two most common upgrade methods Manual Upgrade: Consists of using SQLplus to manually performing the

    steps to prepare for upgrade, running the upgrade scripts, and analyzing

    the upgrade results.

    Database Upgrade Assistant (DBUA): A graphical user interface (GUI) tool that interactively steps you through the upgrade process and

    configures the database to run with the new release. DBUA is the Oracle

    recommended method.

    2012 Oracle Corporation Proprietary and Confidential

  • 17 2012 Oracle Corporation Proprietary and Confidential

    R2

    R2

    10.2.0.2

    10.1.0.5

    R2

    7.3.4

    8.0.6

    8.1.7.4

    9.0.1.4

    9.2.0.8

    9.2.0.4

    "Empty" arrows mean: no specific patch release required

    Upgrade Path to Oracle Database 11gR2

  • 18 2012 Oracle Corporation Proprietary and Confidential

    10 Best Practices

  • 19

    Best Practice #1

    Read the FRIENDLY manuals! Upgrade Advisor

    Upgrade Companion Guide

    Upgrade Guide

    Upgrade checklist

    OTN Upgrade Page

    Upgrade Blog

    2012 Oracle Corporation Proprietary and Confidential

  • 20

    Documentation

    Note 250.1 Upgrade Advisors

    2012 Oracle Corporation Proprietary and Confidential

  • 21

    Documentation

    Note:251.1 Database Upgrades from 10.2 to 11.2

    2012 Oracle Corporation Proprietary and Confidential

  • 22

    Documentation

    Note:785351.1 Upgrade Companion 11g Release 2

    2012 Oracle Corporation Proprietary and Confidential

  • 23

    References

    Note264.1 : Database Upgrades from 9.2 to 11.2

    Note785351.1: Upgrade Companion 11g Release 2

    Note 837570.1 : Complete Checklist for Manual Upgrades to 11g Release 2

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

    Upgrade Guides: http://download.oracle.com/docs/cd/E11882_01/server.112/e108

    19/toc.htm

    OTN Upgrade Page: http://www.oracle.com/technetwork/database/upgrade/index.html

    Upgrade Blog: www.blogs.oracle.com/UPGRADE

    2012 Oracle Corporation Proprietary and Confidential

  • 24

    Best Practice #2

    Use the Upgrade Planner in My Oracle Support

    2012 Oracle Corporation Proprietary and Confidential

  • 25

    Best Practice #3

    Install the latest 11gR2 patch set into a new ORACLE_HOME to upgrade database

    Download patch set 11.2.0.x from support.oracle.com

    The latest patch set are listed in the following note:

    Note 753736.1 :Quick Reference to Patchset Patch

    Numbers

    Apply latest available CPU/PSU patch to your new $ORACLE_HOME before upgrade

    Apply recommended patch bundles and one-off patches

    2012 Oracle Corporation Proprietary and Confidential

  • 26 2012 Oracle Corporation Proprietary and Confidential

  • 27

    Best Practice #4

    Pre-upgrade sanity operations

    Oracle provided invalid objects.

    Database components .

    Duplicate objects .

    Gather Dictionary Statistics.

    Pre-Process AUD$ record.

    Purge recycle bin.

    Remove obsolete, deprecated and hidden parameters .

    2012 Oracle Corporation Proprietary and Confidential

  • 28 2012 Oracle Corporation Proprietary and Confidential

    Sanity Operations: Invalid Objects

    Always check for INVALID objects

    Fix all INVALID objects BEFORE the upgrade/migration

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

    Recompile invalid objects with utlrp.sql before the upgrade

    SQL> select unique OBJECT_NAME, OBJECT_TYPE, OWNER

    from DBA_OBJECTS where STATUS='INVALID';

  • 29

    Sanity Operations: Database Components

    Resolve invalid database components before you upgrade:

    Remove components manually which are not in use.

    Fix components manually which are in use but invalid.

    Reference:

    Note 472937.1: Information On Installed Database Components/Schemas

    Note 300056.1 : Debug and Validate Invalid Objects

    Note 753041.1 :How to diagnose Components with NON VALID status

    Note 733667.1 :How to Determine if XDB is Being Used in the Database?

    2012 Oracle Corporation Proprietary and Confidential

  • 30

    Sanity Operations: Duplicate Objects

    2012 Oracle Corporation Proprietary and Confidential

    Always check for DUPLICATE objects in SYS/SYSTEM

    Some Duplicate objects SHOULD exist and are documented in

    Note:837570.1 Complete Checklist for Manual Upgrades to 11g

    Release 2

    Note1030426.6 : How to Clean Up Duplicate Objects Owned by SYS

    and SYSTEM Schema

    SQL> select OBJECT_NAME, OBJECT_TYPE from DBA_OBJECTS

    where OBJECT_NAME||OBJECT_TYPE in (select

    OBJECT_NAME||OBJECT_TYPE from DBA_OBJECTS where

    OWNER='SYS') and OWNER='SYSTEM' and OBJECT_NAME not in

    ('AQ$_SCHEDULES_PRIMARY', 'AQ$_SCHEDULES',

    'DBMS_REPCAT_AUTH');

  • 31

    Sanity Operations: Gather Dictionary Stats.

    Create dictionary statistics in Oracle 9i:

    Create dictionary statistics in Oracle 10g/11g:

    SQL> exec DBMS_STATS.GATHER_SCHEMA_STATS

    ('SYS', options => 'GATHER',estimate_percent => DBMS_STATS.AUTO_SAMPLE_SIZE, method_opt => 'FOR

    ALL COLUMNS SIZE AUTO', cascade => TRUE);

    SQL> exec DBMS_STATS.GATHER_DICTIONARY_STATS;

    2012 Oracle Corporation Proprietary and Confidential

  • 32

    Sanity operations :

    Pre-Process AUD$ record or Truncate SYS.AUD$ (if not required)

    Note 1329590.1 : How to Pre-Process SYS.AUD$ Records Pre-Upgrade From 10.1 or later to 11gR1 or later. OR

    SQL> truncate SYS.AUD$;

    SQL> purge DBA_RECYCLEBIN;

    _always_semi_join=off

    _unnest_subquery=false

    optimizer_features_enable=9.0.1

    event = "10061 trace name context forever, level 10"

    Purge the recyclebin

    Remove obsolete,deprecated & hidden parameters

    2012 Oracle Corporation Proprietary and Confidential

  • 33

    Best Practice #5

    Always run the pre-upgrade script regardless of using the DBUA or Manual Upgrade process

    Always implement the recommendation suggested by pre-upgrade script .

    Stored in: $OH_11g/rdbms/admin OR Download the newest version of the pre-upgrade check script utlu112i.sql:

    Note 884522.1: How to Download and Run Oracle's Database

    Pre-Upgrade Utility

    Download and run dbupgdiag.sql script before & after upgrade

    Note 556610.1: Script to Collect DB Upgrade/Migrate Diagnostic

    Information (dbupgdiag.sql)

    dbupgdiag script as an information gathering script. It does not replace the utlu112i.sql it complements it.

    2012 Oracle Corporation Proprietary and Confidential

  • 34

    Pre-Upgrade Checks

    Upgrade information script: utlu112i.sql

    Run in the environment of the source database

    Spool the output into a file:

    Checks all init parameters and displays warnings for obsolete and

    deprecated parameters

    Does checks for:

    Components status

    Tablespace SYSAUX

    Character set

    Time zone file version

    Cluster

    2012 Oracle Corporation Proprietary and Confidential

  • 35

    Preparation: In RAC environment

    Always upgrade Grid Infrastructure (Cluster ware and ASM) First!

    The grid infrastructure version must be greater than or equal to the version of the resources it manages .

    With Oracle Grid Infrastructure 11.2, ASM and Oracle Clusterware are installed into a single home directory, which is referred to as the Grid Infrastructure home.

    2012 Oracle Corporation Proprietary and Confidential

  • 36

    Preparation: Database Vault

    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 ioracle]

    Windows:

    Rename oradv11.dll in ORACLE_HOME\bin

    Upon restart:

    After upgrading relink with dv_on or rename the DLL and enable

    Database Vault again:

    $ chopt disable dv

    $ chopt disable dv

    $ chopt enable dv

    2012 Oracle Corporation Proprietary and Confidential

  • 37

    Preparation: Time zone Patches - 11g Release 2

    2012 Oracle Corporation Proprietary and Confidential

    Upgrade to Oracle Database 11g Release 2:

    New 11.2.0.1 -$OH has timezone V11

    New 11.2.0.2 and 11.2.0.3 -$OH has timezone V14

    No need to patch the source $OH if TZ version < Target $OH

    Database only needs to be adjusted if you are using the datatype TIMESTAMP WITH TIMEZONE

    Conversion done after the upgrade

    See Note 944122.1

    Package DBMS_DST

    DBMS_DST.FIND_AFFECTED_TABLES

    DBMS_DST.BEGIN_UPGRADE

    DBMS_DST.UPGRADE_DATABASE

    DBMS_DST.END_UPGRADE

  • 38

    Preparation :Preserve performance statistics

    2012 Oracle Corporation Proprietary and Confidential

    Collecting sufficient performance data prior to the upgrade is of vital importance, Sufficient means:

    Starting at least 4 weeks before the upgrade

    Gather accurate performance statistics

    In Oracle 8i/9i: Use STATSPACK

    Export the PERFSTAT user right before the upgrade

    Note:466350.1 STATSPACK before/after upgrade

    In Oracle 10g/11g: Use AWR

    Take snapshots every 30-60 minutes retention: >30 days Export the AWR with DBMS_SWRF_INTERNAL.AWR_EXTRACT

    Use AWR DIFF reports to compare before & after upgrade performance: DBMS_WORKLOAD_REPOSITORY.AWR_DIFF_REPORT_HTML

  • 39

    Best Practice #6

    Leave COMPATIBLE at the original value for a week before changing to 11.2.

    COMPATIBLE has to be at least 10.1.0 for an 11g database

    No way back once >= 11.2.0 has been enabled

    Supported release downgrade to 10.1.0.5, >=10.2.0.2, >=11.1.0.6

    No ALTER DATABASE RESET COMPATIBILITY command anymore

    2012 Oracle Corporation Proprietary and Confidential

  • 40

    Best Practice #7

    Test fallback strategy

    In any case: Take a backup!!!

    Always:

    Create a valid and complete online backup with RMAN

    Test the restore and the recovery at least once!!!

    Make sure your fallback strategy covers both cases:

    Problems encountered during the upgrade

    Problems found days, weeks after the upgrade

    If anything unforeseen happens and you'll have to step back, will you be allowed to lose data (i.e. changes done to the data in the system

    after the upgrade): YES or NO?

    If YES: restore a backup, flashback (since 10g)

    If NO: export/import, downgrade, Oracle Streams, Oracle Golden Gate

    2012 Oracle Corporation Proprietary and Confidential

  • 41

    Fallback strategy: Issues during upgrade

    2012 Oracle Corporation Proprietary and Confidential

  • 42

    Fallback strategy: Issues After upgrade

    Assumption: No data loss allowed

    2012 Oracle Corporation Proprietary and Confidential

  • 43

    Best Practice #8

    2012 Oracle Corporation Proprietary and Confidential

    Choose Upgrade PATH

  • 44

    Upgrade alternatives: Minimal Downtime

    2012 Oracle Corporation Proprietary and Confidential

  • 45

    Upgrading database Step-by-Step

    2012 Oracle Corporation Proprietary and Confidential

  • 46

    Best Practice #9

    The DBUA has "spool" and "echo" on by default, Find the logs at:

    For DBUA $ORACLE_HOME/cfgtoollogs/dbua//upgrade/

    For manual method logs can be found at spooled location.

    Recompiling invalid objects

    Post-upgrade tool/utility

    Check if all components are valid: utlu112s.sql or query DBA_REGISTRY view for current status

    Dbupgdiag.sql output (run and check script to collect DB Upgrade/Migrate Diagnostic Information Note 556610.1)

    Check alert.log

    2012 Oracle Corporation Proprietary and Confidential

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

    Verify upgrade

  • 47

    Best Practice #10: Post Upgrade

    Create system statistics during a regular workload period - otherwise non-appropriate values for the CBO will be used:

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

    Prevents rewrite in case of setting wrong parameters or forced edit

    Keep in mind:

    The SPFILE is binary file!!! Don't edit it!! Default since Oracle 9.0

    It simply will exist after using DBUA or DBCA

    Parameter can be changed by:

    SQL> exec DBMS_STATS.GATHER_SYSTEM_STATS('start');

    ... gather statistics while running a typical workload

    SQL> exec DBMS_STATS.GATHER_SYSTEM_STATS('stop');

    SQL> create pfile='/tmp/initDB.ora' from spfile;

    SQL> startup force pfile=/tmp/initDB.ora

    SQL> create spfile from pfile;

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

    2012 Oracle Corporation Proprietary and Confidential

  • 48

    Common issues

    Cause registry$database table does not have the TZ_VERSION column OR Time zone file version was not updated in registry$database.

    Solution :Restore the database and run ultu112i.sql script on the source database then upgrade the database .

    ORA-00904: "TZ_VERSION": invalid identifier

    ORA-39701: database must be mounted EXCLUSIVE for UPGRADE or DOWNGRADE

    Cause: It is a RAC database and was mounted for SHARED cluster access.

    Solution: Set the CLUSTER_DATABASE initialization parameter to FALSE in spfile/pfile and restart the server with the UPGRADE or DOWNGRADE option.

    2012 Oracle Corporation Proprietary and Confidential

  • 49

    Common issues continued

    TimeZone Patch

    Cause : Source database is using TZ version files higher than defaultTZ version files shipped with Oracle 11gR2.

    Solution: Apply the TZ version patch on the Oracle 11gR2 home to match the TZ version files at source.

    Oracle Database Vault

    Cause: Upgrades cannot be run with the Oracle Database Vault option set to TRUE since AS SYSDBA connections are restricted.

    Solution: relink the server without the Database Vault option (but with the OLS option), and restart the server using UPGRADE.

    Oracle Label Security

    Cause: If Database Vault is installed in the database but the Oracle Label Security option is FALSE.

    Solution: relink the server with the OLS option and restart the server using UPGRADE.

    ORA-01722: invalid number

    2012 Oracle Corporation Proprietary and Confidential

  • 50

    Common issues continued

    Cause: You have set the compatible to the higher release and now try to open or downgrade the database with lower release binaries .

    Solution: Restore the database using backup and then open the with lower release binaries .

    ORA-00201 control file version incompatible with Oracle version

    2012 Oracle Corporation Proprietary and Confidential

  • 51

    Real world examples

    From support experience few interesting cases,

    Very small shared pool size when upgrading from 8i to 10g:

    Database upgrade run 48 hours instead of 1 hour

    Millions of audit records in SYS.AUD$

    Upgrade took 24 hours once truncated upgrade completed in under 1 hour

    Objects of SYS users in user tablespace, upgrade fails with ora-0600

    Customers forgot to analyze Dictionary Database

    Especially in huge dictionary database (like E-business suite or SAP) a big problem as we create stats while the upgrade runs

    2012 Oracle Corporation Proprietary and Confidential

  • 52

    Summary: Upgrade Best Practice

    Planning is a key to successful upgrade. A successful upgrade,

    requires minimal downtime,

    requires minimized, predictable efforts to upgrade,

    It produces a stable upgraded environment without any surprises.

    It identifies issues proactively and addresses them during the planning and testing phase.

    2012 Oracle Corporation Proprietary and Confidential

  • 53

    Summary: Upgrade Best Practice (cont.)

    Drive upgrade as a project which should have Evaluate, Plan, Configure, Test, Implement stages.

    Upgrade Advisor Note 251.1

    Take consistent backup which is useful when its needed for recovery.

    Test upgrade in test environment, Optimize steps of upgrade to minimize upgrade window.

    Leverage tools of PreUpgrade, PostUpgrade even though DBUA is used.

    2012 Oracle Corporation Proprietary and Confidential

  • 54

    Summary: Upgrade Best Practice (cont.)

    Dont underestimate test efforts, reserve enough time and resource for testing. Always use real world data

    for testing

    Create and test fallback strategy ( Does it really works ?)

    Document all changes detailed and clearly in change log.

    2012 Oracle Corporation Proprietary and Confidential

  • 55 2012 Oracle Corporation Proprietary and Confidential

  • 56

    type your question here 1

    Q&A panel

    Send your question 3

    Ask: ALL PANELLIST leave default! 2

    2012 Oracle Corporation Proprietary and Confidential

  • 57

    Further Info & Help

    Advisor Webcast Archived Recordings (Doc ID 740964.1)

    Advisor Webcast Current Schedule (Doc ID 740966.1)

    DB Newsletter (Doc ID 1284265.1)

    MOS Community DB Install

    2012 Oracle Corporation Proprietary and Confidential

  • 58 2012 Oracle Corporation Proprietary and Confidential

  • 59 2012 Oracle Corporation Proprietary and Confidential

  • 60 2012 Oracle Corporation Proprietary and Confidential

    THANK YOU