Download as pdf or txt
Download as pdf or txt
You are on page 1of 41

Being Smarter Than Chuck Norris:

Fallback Strategies for Upgrades


Mike Dietrich
Master Product Manager
Database Upgrade and Migrations Updated: 7-SEP-2019
Oracle Corporation

Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Being Smarter Than Chuck Norris: Fallback Strategies
a n y
G e rm

Mike Dietrich hIps://MikeDietrichDE.com


Master Product Manager
Oracle Database Upgrade and MigraOons MikeDietrichDE

Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Being Smarter Than Chuck Norris: Fallback Strategies 2
Slides and more | https://MikeDietrichDE.com

Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Being Smarter Than Chuck Norris: Fallback Strategies 3
Fallback Strategies
Being smarter than Chuck Norris

Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Being Smarter Than Chuck Norris: Fallback Strategies 4
Considera?ons
Fallback Introduc/on

Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Being Smarter Than Chuck Norris: Fallback Strategies 5
Considerations
• Service Level Agreements • COMPATIBLE Change?

COMPATIBLE
?

Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Being Smarter Than Chuck Norris: Fallback Strategies 6
Fallback Strategy | COMPATIBLE COMPATIBLE
?
• Recommendation:
– Update COMPATIBLE 7-10 days after upgrade
• Why wait?
– Allows fallback options: downgrade, flashback
• Why change?
– Enable new features (e.g. online datafile move, sharding etc)
– Minimum COMPATIBLE for 19c is 11.0.0
– COMPATIBLE is independent of OPTIMIZER_FEATURES_ENABLE
• How?
n
– alter system set compatible='19.0.0' scope=spfile; D ow
T im e

Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Being Smarter Than Chuck Norris: Fallback Strategies 7
Fallback Strategy | COMPATIBLE
• When should you change COMPATIBLE?
– 7-10 days aKer the upgrade
• Change COMPATIBLE for RUs?
– NEVER!
• Which value?
– 11.2.0
– 12.1.0
– 12.2.0
– 18.0.0
– 19.0.0

Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Being Smarter Than Chuck Norris: Fallback Strategies 8
Fallback Strategy | COMPATIBLE
• When should you change COMPATIBLE? • Change COMPATIBLE when you apply RUs?
– hIps://mikedietrichde.com/2019/04/17/when – hIps://mikedietrichde.com/2019/04/10/should-
-and-how-should-you-change-compaQble/ you-change-compaQble-when-you-apply-an-ru/

Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Being Smarter Than Chuck Norris: Fallback Strategies 9
Fallback Strategy | Install and Patching
Update in Place Clone, Update and Switch Deploy Gold Image, Switch

1 2 3 1 2 3 1 2
• Complex • Complex • Build gold image once,
• Error prone • Error prone use everywhere
• Longest down-time and • Shorter down-Kme and • Fewest steps, simplest
maintenance window maintenance window process
• No fallback • Built-in Fallback • Shorter down-Kme and
maintenance window
• No standardization • No standardizaKon
• Built-in Fallback
• Built-in standardizaKon

Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Being Smarter Than Chuck Norris: Fallback Strategies 10
Database Upgrade Blog | Fallback Exercises
• https://MikeDietrichDE.com/hands-on-lab/hol-19c-fallback-strategies/

Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Being Smarter Than Chuck Norris: Fallback Strategies 11
Database Upgrade Blog | Exercise is important

Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Being Smarter Than Chuck Norris: Fallback Strategies 12
ProtecCon
• Issues during upgrade • Issues after upgrade

During Upgrade ANer Upgrade

Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Being Smarter Than Chuck Norris: Fallback Strategies 13
Fallback Strategy | Issues during upgrade During Upgrade

• Online Backup • Partial Offline Backup • Guaranteed Restore Point


– SoluCon: – Solution: – SoluCon:
• Restore online backup • Restore partial offline Backup • Flashback to GRP
– RecommendaCon: – Recommendation: – RecommendaCon:
• Mandatory strategy • Only for VLDBs and • Very fast, simply - but EE only
databases in NOARCHIVELOG
mode
• For Standard Edition DBs

COMPATIBLE COMPATIBLE COMPATIBLE

Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Being Smarter Than Chuck Norris: Fallback Strategies 14
Fallback | Online Backup
• Strategy: Restore a backup and recover
– Complete online backup (RMAN)
– Please verify:
• Where is your backup located?
• Does the restore work?
• How long will the restore take?
• How long will the recovery take?
– RecommendaSon:
• Have a valid online backup in any case
– And test the restore/recovery!!!

Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Being Smarter Than Chuck Norris: Fallback Strategies 15
Fallback | Schroedinger's Backup

© MDWidlake

Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Being Smarter Than Chuck Norris: Fallback Strategies 16
Fallback | Offline Backup
• Restore a parFal offline backup

TOOLS TOOLS
SYSTEM SYSTEM
SHUTDOWN IMMEDIATE
XDB USERS ----- XDB
ReadCOPY
Only ALL FILES
SYSAUX SYSAUX
DRSYS DATA DRSYS
Read Only

UNDO ODM UNDO ODM


SHUTDOWN IMMEDIATE
-----
CONTROL COPY ALL FILES CONTROL
FILES REDO FILES REDO
REDO REDO
REDO
REDO REDO

Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Being Smarter Than Chuck Norris: Fallback Strategies 17
Find this video here:
https://youtu.be/q1W1kpZHYkw
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Being Smarter Than Chuck Norris: Fallback Strategies 18
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |
Fallback | Guaranteed Restore Point
• COMPATIBLE must not be changed
Pre Upgrade Environment Post Upgrade Environment
CREATE RESTORE POINT grpt
GUARANTEE FLASHBACK DATABASE;
UPGRADE
SHUTDOWN IMMEDIATE
STARTUP MOUNT;
FLASHBACK DATABASE TO RESTORE POINT grpt;
SHUTDOWN IMMEDIATE
STARTUP MOUNT;
ALTER DATABASE OPEN RESETLOGS;
DROP RESTORE POINT grpt;

Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Being Smarter Than Chuck Norris: Fallback Strategies 20
Find this video here:
https://youtu.be/28CmWEkkOVQ
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Being Smarter Than Chuck Norris: Fallback Strategies 21
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Being Smarter Than Chuck Norris: Fallback Strategies 23
Fallback Strategy | Issues after upgrade AQer Upgrade

• Data Pump • Oracle GoldenGate • Downgrade


– SoluDon: – Solution: – COMPATIBLE change: No
• Reimport data • Apply changes to previous – Solution:
system
– RecommendaDon: • Run the downgrade scripts
• Simple but potenDally slow – Recommendation:
– Recommendation:
• Fastest and best solution
• Fast and easy

COMPATIBLE COMPATIBLE
COMPATIBLE

Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Being Smarter Than Chuck Norris: Fallback Strategies 24
Fallback | Data Pump
• Downgrade with expdp/impdp
• MOS Note:553337.1
– Prepare an empty database for the import “just in case”
– Then:
– Run expdp from the 19c database home with the VERSION parameter equal to the target database
COMPATIBLE setting
– Import using impdp from the target
database home
– NETWORK_LINK can't be used
for downgrades
– Beware of Time Zone differences
• Time zone can't be downgraded!

Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Being Smarter Than Chuck Norris: Fallback Strategies 25
Fallback | Data Pump

11.2.0.4 19c
impdp expdp …
VERSION=11.2.0.4

DUMP FILE DUMP FILE

Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Being Smarter Than Chuck Norris: Fallback Strategies 26
Fallback | GoldenGate
• Downgrade with Oracle GoldenGate
– Version/platform independent

Source
Upgraded
2 destination
database

“Downgrade”
1

Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Being Smarter Than Chuck Norris: Fallback Strategies 27
Fallback | Database Downgrade
• Downgrade with catdwgrd.sql
• Resources:
– Upgrade Guide – Downgrading a database to an earlier release:
hJps://docs.oracle.com/en/database/oracle/oracle-database/19/upgrd/downgrading-oracle-db-aMer-
upgrade.html#GUID-CAD9888A-2E6E-48F8-938C-B3E861738606
– Important MOS notes:
• MOS Note: 2548962.1 - Oracle 19c - How to Downgrade a 19c Mul\tenent Database (CDB) or Non
CDB Database to Previous Release
• MOS Note: 551141.1 - Database Server Upgrade/Downgrade Compa\bility Matrix
• MOS Note: 2539751.1 - Patches to apply before upgrading Oracle GI and DB to 19c or downgrading
to previous release
– Downgrade possible to 11.2.0.4 and up (for non-CDB), and 12.1.0.2 and up (CDB/PDB)
• Do not change COMPATIBLE
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Being Smarter Than Chuck Norris: Fallback Strategies 28
Fallback | Database Downgrade
• Basic steps to downgrade with catdwgrd.sql
– In Oracle Database 19c environment:
SQL> SPOOL /tmp/downgrade.log
SQL> STARTUP DOWNGRADE
SQL> @catdwgrd.sql
SQL> SHUTDOWN IMMEDIATE
SQL> SPOOL OFF

– In Oracle Database 11.2.0.4 - 18c environment:


SQL> STARTUP UPGRADE
SQL> SPOOL /tmp/reload.log
SQL> @catrelod.sql
SQL> SPOOL OFF

Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Being Smarter Than Chuck Norris: Fallback Strategies 29
Find this video here:
hJps://youtu.be/Jm7g_RAoa4Y
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Being Smarter Than Chuck Norris: Fallback Strategies 30
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Being Smarter Than Chuck Norris: Fallback Strategies
Fallback | Grid Infrastructure Downgrade
• For details see:
hHps://docs.oracle.com/en/database/oracle/oracle-database/19/cwlin/downgrading-oracle-clusterware-aKer-an-
upgrade.html#GUID-ACE6E5EB-5583-4DD9-8BA5-AD3F382B629A

Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Being Smarter Than Chuck Norris: Fallback Strategies 32
Fallback | non-CDB to PDB MigraGon
• Moving from non-CDB to PDB is always a migration
– You move from one database (non-CDB) to another database (CDB)
– No GRP possible
– No downgrade possible
– Minimal downtime downgrade is a challenge

Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Being Smarter Than Chuck Norris: Fallback Strategies 33
Move to PDB | Upgrade - Plugin - Convert

Oracle 11.2.0.4

!
AutoUpgrade " Plug into CDB
to Oracle 19c

PDB$ # noncdb_to_pdb.sql PDB$


SEED SEED
Oracle 19.3.0 CDB CDB
Oracle 19.3.0 Oracle 19.3.0

Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Being Smarter Than Chuck Norris: Fallback Strategies 34
Move to PDB | Fallback for Upgrade - Plugin - Convert
(A)
(B) Data
Ora Pum
c le
Go p exp
ld e d p /
nG
Oracle 11.2.0.4 a te i m p d
p
AutoUpgrade
to Oracle 19c

Flashback
to GRP " Plug into CDB
!

PDB$ # noncdb_to_pdb.sql PDB$


SEED SEED
Oracle 19.3.0 CDB CDB
Oracle 19.3.0 Oracle 19.3.0

Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Being Smarter Than Chuck Norris: Fallback Strategies 35
Move to PDB | AlternaCve Fallback?
??? PDB$
SEED
Oracle 12.1.0.2
CDB
AutoUpgrade
to Oracle 19c

Oracle 12.1.0.2
" Plug into CDB COMPATIBLE=12.1.0

Downgrade
! and unplug
to Oracle 12c

PDB$ # noncdb_to_pdb.sql PDB$


SEED SEED
Oracle 19.3.0
COMPATIBLE=12.1.0 CDB CDB
Oracle 19.3.0 Oracle 19.3.0
COMPATIBLE=12.1.0 COMPATIBLE=12.1.0

Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Being Smarter Than Chuck Norris: Fallback Strategies 36
Fallback is important
Never approach an upgrade or migra1on
without tes1ng your fallback op1ons!

Photo by Asa Rodger on Unsplash


Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Being Smarter Than Chuck Norris: Fallback Strategies
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Being Smarter Than Chuck Norris: Fallback Strategies 38
Slides and more | https://MikeDietrichDE.com

Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Being Smarter Than Chuck Norris: Fallback Strategies 39
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Being Smarter Than Chuck Norris: Fallback Strategies 40

You might also like