Mike Dietrich BU Database Technologies ORACLE Deutschland GmbH - - PDF document

mike dietrich
SMART_READER_LITE
LIVE PREVIEW

Mike Dietrich BU Database Technologies ORACLE Deutschland GmbH - - PDF document

IT-Symposium 2005 Mike Dietrich BU Database Technologies ORACLE Deutschland GmbH Page 1 www.decus.de 1 IT-Symposium 2005 Total synchron Daten retten ohne Downtime ?! Oracle DataGuard und Flashback Agenda Oracle Oracle DataGuard


slide-1
SLIDE 1

IT-Symposium 2005 www.decus.de 1

Page 1

Mike Dietrich

BU Database Technologies

ORACLE Deutschland GmbH

slide-2
SLIDE 2

IT-Symposium 2005 www.decus.de 2

Page 2

Total synchron

Daten retten ohne Downtime ?!

Oracle DataGuard und Flashback Agenda Oracle DataGuard Oracle DataGuard Flashback Flashback Daten retten

  • hne Downtime

Daten retten

  • hne Downtime

Zusatznutzen Zusatznutzen

slide-3
SLIDE 3

IT-Symposium 2005 www.decus.de 3

Page 3

  • Die Kardinal-Fragen:

Was kostet ein Ausfall pro Minute/Stunde/Tag ?

Was kostet Datenverlust ?

Wie sichtbar ist ein Ausfall ?

Wieviel Downtime ist gestattet ?

Wie stark sind die Nerven der DBA's ?

Einführung Einführung

Wie ... ???

Batch-Job ... Daten gelöscht ... aus Versehen ... ?!?

slide-4
SLIDE 4

IT-Symposium 2005 www.decus.de 4

Page 4

Agenda Oracle DataGuard Oracle DataGuard Flashback Flashback Daten retten

  • hne Downtime

Daten retten

  • hne Downtime

Zusatznutzen Zusatznutzen

Desaster Recovery Lösung für Oracle DB's Kostenfreies Feature der Oracle Enterprise Edition Automatisiert das Anlegen und den Betrieb einer

  • der mehrerer Standby-Datenbanken

Ausfall der Produktionsdatenbank Standby-Datenbank übernimmt x1000km Entfernung möglich

Oracle DataGuard

slide-5
SLIDE 5

IT-Symposium 2005 www.decus.de 5

Page 5

Datenbank-Releases

gleicher Release-Stand

gleiche Bit-ness

Oracle DataGuard

Betriebssystem-Releases

gleiches OS

unterschiedliche Bit-ness möglich, aber nicht empfohlen

unterschiedliche Release-Stände möglich, aber nicht empf.

Empfehlung:

identische Hardware, identische Betriebssysteme, identische Patchlevel, identische Oracle-Patches Primary Primary Site Site

Clients

Standby Standby Site Site Log Informationen Log Informationen

Broker Agent Broker Agent

Data Guard Broker

Clients

Backup

DIGITAL DATA STORAGE

Failover/Switchover Failover/Switchover Gap Detection Gap Detection No Data Loss No Data Loss Protection Modes Protection Modes

Oracle DataGuard

slide-6
SLIDE 6

IT-Symposium 2005 www.decus.de 6

Page 6

2 Typen von Standby-Datenbanken

– Physical Standby

Redolog-Dateien werden recovert Entweder Recovery Modus oder Read-Only Blockidentische Kopie der Produktionsdatenbank Desaster Recovery (Failover)

– Logical Standby

Redolog-Dateien werden extrahiert SQL-Statements werden auf die Standby angewendet Logische Kopie der Produktionsdatenbank Online Reporting, Rolling Upgrades

Oracle DataGuard

? 3 Möglichkeiten zur Administration

– Pures SQL – DataGuard Broker und DGMGRL – DataGuard Broker und EM GridControl

Oracle DataGuard

slide-7
SLIDE 7

IT-Symposium 2005 www.decus.de 7

Page 7

Oracle DataGuard - 10g New Features

init-Parameter LOG_ARCHIVE_DEST_n: VALID_FOR-Attribute

– erlaubt eine init.ora für alle Rollen – kein Tauschen der Init-Dateinen mehr nach Failover

  • der Switchover

– Beispiel:

*.log_archive_dest_2= 'SERVICE=phys LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES, ALL_ROLES) DB_UNIQUE_NAME=PHYS' Primary Primary Site Site

Clients

Standby Standby Site Site

Broker Agent Broker Agent

Data Guard Broker

REAL TIME APPLY REAL TIME APPLY

  • Redo-Records werden

sofort angewendet

  • kein Warten auf ARCH

Oracle DataGuard - 10g New Features

slide-8
SLIDE 8

IT-Symposium 2005 www.decus.de 8

Page 8

RFS

Standby Redo Logs

ARCH

Archivierte Redo Logs Online Redo Logs

Oracle Net

Archivierte Redo Logs

Primär Datenbank

Transaktionen

LGWR ARCH Up-to-date Standby DB MRP/ LSP Real Time Apply

Oracle DataGuard - 10g New Features

Engere Synchronisation der Standby mit der Poduktivdatenbank

– Up-to-Date Echt-Zeit-Reporting – Schnelles Switchover und Failover

Verringert geplante und ungeplante Ausfallzeiten Bessere Recovery Time Objective (RTO) beim Desaster Recovery Kein Delay !!!

  • SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE

USING CURRENT LOGFILE; Physical Standby

  • SQL> ALTER DATABASE START LOGICAL STANDBY APPLY

IMMEDIATE; Logical Standby

Oracle DataGuard - 10g New Features

slide-9
SLIDE 9

IT-Symposium 2005 www.decus.de 9

Page 9

Agenda Oracle DataGuard Oracle DataGuard Flashback Flashback Daten retten

  • hne Downtime

Daten retten

  • hne Downtime

Zusatznutzen Zusatznutzen Flashback

Logische Korruptionen, die durch Benutzerfehler entstehen, sind für

  • ca. 40% aller Ausfälle

verantwortlich !!!

Benutzer- Fehler Andere Ursachen für Ausfälle

slide-10
SLIDE 10

IT-Symposium 2005 www.decus.de 10

Page 10

Flashback

Traditioneller Ansatz:

Backup vom Tape einspielen Recovery mit archivierten Logfiles + Online Redologs

Fehler F e h l e r b e h e b u n g

t

Fehler Fehler- behebung

t

Mit Flashback:

Einfach die Daten zum Zeitpunkt X aus dem Flashback-Log wiederherstellen - ein Kommando !!!

3 Ausprägungen von FLASHBACK

– Flashback Query

Versions Query Transaction Query

– Flashback Table / Drop – Flashback Database

Point-In-Time-Recovery Kein Restore des Backups Nahtlose Integration in den RMAN

Flashback

Undo Segmente Recycle Bin Flashback Logs

slide-11
SLIDE 11

IT-Symposium 2005 www.decus.de 11

Page 11

Rückspulknopf

in der Datenbank

Flashback

Enthält vorherige Blockinhalte

Flashback Log

Blockinhalt - vorherige Versionen geänderter Block Disk Write

Flashback Konfiguration:

Initialisierungsparameter (init.ora / spfile)

db_recovery_file_dest db_recovery_file_dest_size db_flashback_retention_target

[Default: 1440]

Flash Recovery Area SQL> ALTER DATABASE FLASHBACK ON; Festlegen der Vorhaltezeit

Flashback

Flashback Log

slide-12
SLIDE 12

IT-Symposium 2005 www.decus.de 12

Page 12

Oracle DataGuard Oracle DataGuard Flashback Flashback Daten retten

  • hne Downtime

Daten retten

  • hne Downtime

Zusatznutzen Zusatznutzen Agenda

Real Time Apply

DataGuard und Flashback

FLASHBACK ON FLASHBACK ON

slide-13
SLIDE 13

IT-Symposium 2005 www.decus.de 13

Page 13

I. Flashback auf PHYS Standby

Ziel: Wiederherstellen von Daten

  • II. Flashback auf PROD

Ziel: PITR auf Produktion ohne Verlust der Standby

  • III. Flashback nach Failover zu PHYS

Ziel: kein Neuaufbau der Standby nach Failover

Szenarien DataGuard und Flashback

  • Ausgangspunkt:

TRUNCATE TABLE

  • Ziel:

Daten wiederherstellen, keine Downtime auf PROD

  • Vorgehensweise:

1) PHYS mit FLASHBACK STANDBY DATABASE zurückfahren 2) PHYS read-only öffnen 3) Benötigte Daten exportieren 4) Automatische Resynchronisation der Standby 5) Daten auf PROD wieder einspielen

  • I. Flashback auf PHYS

TRUNCATE TABLE

slide-14
SLIDE 14

IT-Symposium 2005 www.decus.de 14

Page 14

  • I. Flashback auf PHYS

PROD: PROD:

SQL> SQL> select select current_scn current_scn from from v$database v$database; ; SQL> SQL> truncate truncate table table scott.emp scott.emp; ; SQL> SQL> select select oldest_flashback_scn

  • ldest_flashback_scn

from from v$flashback_database_log v$flashback_database_log; ; $> $> imp imp scott scott/ /tiger tiger file=exp.dmp file=exp.dmp

** Daten stehen wieder zur Verfügung ** ** Keine Downtime auf der PROD-DB **

PHYS: PHYS:

SQL> SQL> shutdown shutdown immediate; immediate; SQL> SQL> startup startup mount mount; ; SQL> SQL> flashback flashback standby standby database database to to scn scn <CURRENT_SCN von PROD>; <CURRENT_SCN von PROD>; SQL> alter SQL> alter database database open

  • pen read

read only

  • nly;

; $> $> exp exp scott scott/ /tiger tiger tables=emp tables=emp SQL> SQL> shutdown shutdown immediate; immediate; SQL> SQL> startup startup mount mount; ; SQL> alter SQL> alter database database recover recover managed managed standby standby database database using using current current logfile logfile disconnect disconnect; ; ** automatische Synchronisation **

SQL> SQL> select select current_scn current_scn from from v$database v$database; ; SQL> SQL> truncate truncate table table scott.emp scott.emp; ; SQL> SQL> select select oldest_flashback_scn

  • ldest_flashback_scn

from from v$flashback_database_log v$flashback_database_log; ; SQL> SQL> shutdown shutdown immediate; immediate; SQL> SQL> startup startup mount mount; ; SQL> SQL> flashback flashback standby standby database database to to scn scn <CURRENT_SCN von PROD>; <CURRENT_SCN von PROD>; SQL> alter SQL> alter database database open

  • pen read

read only

  • nly;

; $> $> exp exp scott scott/ /tiger tiger tables=emp tables=emp SQL> SQL> shutdown shutdown immediate; immediate; SQL> SQL> startup startup mount mount; ; SQL> alter SQL> alter database database recover recover managed managed standby standby database database using using current current logfile logfile disconnect disconnect; ; ** automatische Synchronisation ** $> $> imp imp scott scott/ /tiger tiger file=exp.dmp file=exp.dmp

** Daten stehen wieder zur Verfügung ** ** Keine Downtime auf der PROD-DB **

Agenda Oracle DataGuard Oracle DataGuard Flashback Flashback Daten retten

  • hne Downtime

Daten retten

  • hne Downtime

Zusatznutzen Zusatznutzen

slide-15
SLIDE 15

IT-Symposium 2005 www.decus.de 15

Page 15

PITR

  • Ausgangspunkt:

Point-In-Time-Recovery der PROD-Datenbank notwendig

  • Ziel:

Erhalt der Standby trotz RESETLOGS auf PROD

  • Vorgehensweise:

1) Flashback Database auf PROD als PITR 2) Öffnen der PROD mit OPEN RESETLOGS 3) RESETLOGS_CHANGE#-2 auslesen 4) FLASHBACK STANDBY DATABASE auf PHYS durchführen 5) Automatische Resynchronisation von PHYS

  • II. Flashback auf PROD
  • II. Flashback auf PROD

PROD: PROD:

SQL> select current_scn from SQL> select current_scn from v$database; v$database; SQL> update emp set sal=1; SQL> update emp set sal=1; SQL> commit; SQL> commit; SQL> shutdown abort; SQL> shutdown abort; SQL> startup mount; SQL> startup mount; SQL> flashback database to scn SQL> flashback database to scn <CURRENT_SCN von oben>; <CURRENT_SCN von oben>; SQL> alter database open SQL> alter database open resetlogs resetlogs; ; SQL> select SQL> select resetlogs_change# resetlogs_change#-

  • 2

2 from v$database; from v$database; SQL> select sal from scott.emp; SQL> select sal from scott.emp;

** Daten stehen wieder zur Verfügung **

PHYS: PHYS:

SQL> shutdown immediate; SQL> shutdown immediate; SQL> startup mount; SQL> startup mount; SQL> flashback standby database SQL> flashback standby database to scn < to scn <RESETLOGS_CHANGE# RESETLOGS_CHANGE#-

  • 2

2 P>; P>; SQL> shutdown immediate; SQL> shutdown immediate; SQL> startup mount; SQL> startup mount; SQL> alter database recover managed SQL> alter database recover managed standby database using current standby database using current logfile disconnect; logfile disconnect;

** automatische Synchronisation **

SQL> select current_scn from SQL> select current_scn from v$database; v$database; SQL> update emp set sal=1; SQL> update emp set sal=1; SQL> commit; SQL> commit; SQL> shutdown abort; SQL> shutdown abort; SQL> startup mount; SQL> startup mount; SQL> flashback database to scn SQL> flashback database to scn <CURRENT_SCN von oben>; <CURRENT_SCN von oben>; SQL> alter database open SQL> alter database open resetlogs resetlogs; ; SQL> select SQL> select resetlogs_change# resetlogs_change#-

  • 2

2 from v$database; from v$database; SQL> select sal from scott.emp; SQL> select sal from scott.emp; ** Daten stehen wieder zur Verfügung ** SQL> shutdown immediate; SQL> shutdown immediate; SQL> startup mount; SQL> startup mount; SQL> flashback standby database SQL> flashback standby database to scn < to scn <RESETLOGS_CHANGE# RESETLOGS_CHANGE#-

  • 2

2

Prod Prod>;

>; SQL> shutdown immediate; SQL> shutdown immediate; SQL> startup mount; SQL> startup mount; SQL> alter database recover managed SQL> alter database recover managed standby database using current standby database using current logfile disconnect; logfile disconnect; ** automatische Synchronisation **

slide-16
SLIDE 16

IT-Symposium 2005 www.decus.de 16

Page 16

  • Ausgangspunkt:

Failover von PROD nach PHYS ist erfolgt

  • Ziel:

Neuaufbau der Standby-Datenbank umgehen

  • Vorgehensweise:

1) Failover von PROD nach PHYS ist erfolgt - PHYSalt ist PRODneu 2) Flashback der PRODproblem bis STANDBY_BECAME_PRIMARY_SCN 3) Flashback Logs bereinigen 4) Standby-Controlfile anlegen 5) Log-Transport wiedereinschalten und ggf. Switchover

  • III. Flashback nach Failover
  • III. Flashback nach Failover

ex ex-

  • PROD/new

PROD/new-

  • PHYS:

PHYS:

SQL> shutdown immediate; SQL> shutdown immediate; SQL> startup mount; SQL> startup mount; SQL> flashback database to scn SQL> flashback database to scn < <STANDBY_BECAME_PRIMARY_SCN STANDBY_BECAME_PRIMARY_SCN>; >; SQL> alter database flashback off; SQL> alter database flashback off; SQL> alter database create standby SQL> alter database create standby controlfile as <file controlfile as <filename> name>; ; SQL> shutdown immediate; SQL> shutdown immediate; SQL> startup mount SQL> startup mount SQL> alter database flashback on; SQL> alter database flashback on; SQL> alter database recover managed SQL> alter database recover managed standby database using current standby database using current logfile disconnect; logfile disconnect;

** Jetzt kontrollierter Rollentausch ** ** (Switchover) möglich, um zur ** ** Ausgangssituation zurückzukehren **

ex ex-

  • PHYS/new

PHYS/new-

  • Prod:

Prod:

SQL> select SQL> select standby_became_primary_scn standby_became_primary_scn from v$database; from v$database; SQL> alter system set SQL> alter system set log_archive_dest_state_2=enable; log_archive_dest_state_2=enable;

SQL> select SQL> select standby_became_primary_scn standby_became_primary_scn from v$database; from v$database; SQL> shutdown immediate; SQL> shutdown immediate; SQL> startup mount; SQL> startup mount; SQL> flashback database to scn SQL> flashback database to scn < <STANDBY_BECAME_PRIMARY_SCN STANDBY_BECAME_PRIMARY_SCN>; >; SQL> alter database flashback off; SQL> alter database flashback off; SQL> alter database create standby SQL> alter database create standby controlfile as <file controlfile as <filename> name>; ; SQL> shutdown immediate; SQL> shutdown immediate; SQL> startup mount SQL> startup mount SQL> alter database flashback on; SQL> alter database flashback on; SQL> alter system set SQL> alter system set log_archive_dest_state_2=enable; log_archive_dest_state_2=enable; SQL> alter database recover managed SQL> alter database recover managed standby database using current standby database using current logfile disconnect; logfile disconnect;

** Jetzt kontrollierter Rollentausch ** ** (Switchover) möglich, um zur ** ** Ausgangssituation zurückzukehren **

slide-17
SLIDE 17

IT-Symposium 2005 www.decus.de 17

Page 17

Ende gut, alles gut ... :-)

Q U E S T I O N S Q U E S T I O N S A N S W E R S A N S W E R S

slide-18
SLIDE 18

IT-Symposium 2005 www.decus.de 18

Page 18