otn tour day 2011 oracle active data guard joel perez

54
<Insert Picture Here> Joel Perez Senior DBA Oracle Oracle ACE Implanting Oracle Active Data Guard Data Availability & Disaster Protection

Upload: juan-martinez-ochoa

Post on 19-Jan-2016

32 views

Category:

Documents


5 download

TRANSCRIPT

Page 1: OTN TOUR DAY 2011 Oracle Active Data Guard Joel Perez

<Insert Picture Here>

Joel Perez – Senior DBA Oracle

Oracle ACE

Implanting Oracle Active Data Guard Data Availability & Disaster Protection

Page 2: OTN TOUR DAY 2011 Oracle Active Data Guard Joel Perez

2

<Insert Picture Here>

Agenda

• Introduction

• Process Architecture & Protection Modes

• Active Data Guard

• Creating an Oracle RAC Physical Standby Database

• Opening a Standby in Read-Only Mode with Oracle

Active Data Guard

• Switchover and Failover

• Resources

Page 3: OTN TOUR DAY 2011 Oracle Active Data Guard Joel Perez

3

<Insert Picture Here>

Data Guard History

• Oracle7 in the early 1990s Media Recovery

• Oracle8i “Automatic Standby” feature

• Oracle9i Data Guard

• Oracle9i R2 SQL Apply

• Oracle10g Data Broker

• Oracle11g R1 & R2 Active Data Guard

Page 4: OTN TOUR DAY 2011 Oracle Active Data Guard Joel Perez

4

What is Data Guard?

• Data Availability & Data Protection solution for Oracle

• Up to 30 standby databases, any combination of physical or logical

• Use standby databases for queries, reports, test, or backups while in standby role

Physical,

Snaphot

and

Logical

Standby

Database

Standby Site

Primary

Database

Primary Site

Data Guard

Page 5: OTN TOUR DAY 2011 Oracle Active Data Guard Joel Perez

5

<Insert Picture Here>

Agenda

• Introduction

• Process Architecture & Protection Modes

• Active Data Guard

• Creating an Oracle RAC Physical Standby Database

• Opening a Standby in Read-Only Mode with Oracle

Active Data Guard

• Switchover and Failover

• Resources

Page 6: OTN TOUR DAY 2011 Oracle Active Data Guard Joel Perez

6

Standby

Redo

Logs

RFS LNS

Online

Redo

Logs

Oracle Net Primary

Database

LGWR

Data Guard 11g Process Architecture Synchronous Redo Transport (SYNC)– Zero Data Loss

SGA

Redo Buffer

MRP - physical

LSP - logical

Active

Standby

Database

Queries, Reports

Testing & Backups

MRP

LSP

User Transactions

PM

Page 7: OTN TOUR DAY 2011 Oracle Active Data Guard Joel Perez

7

Standby

Redo

Logs

RFS LNS

Online

Redo

Logs

Oracle Net Primary

Database

LGWR

Data Guard 11g Process Architecture Asynchronous Redo Transport (ASYNC)

SGA

Redo Buffer

MRP - physical

LSP - logical

Active

Standby

Database

Queries, Reports

Testing & Backups

MRP

LSP

User Transactions

Page 8: OTN TOUR DAY 2011 Oracle Active Data Guard Joel Perez

8

Standby

Redo

Logs

RFS LNS

Online

Redo

Logs

Oracle Net Primary

Database

LGWR

Data Guard 11g Process Architecture ASYNC – If Network Can’t Keep Pace

SGA

Redo Buffer

MRP - physical

LSP - logical

Active

Standby

Database

Queries, Reports

Testing & Backups

MRP

LSP

User Transactions

Page 9: OTN TOUR DAY 2011 Oracle Active Data Guard Joel Perez

9

Online

Redo

Logs

Oracle Net

Primary

Database

Transactions

LGWR

Archived

Redo Logs

Redo Buffer

SGA

ping

Standby

Redo

Logs

RFS LNS SYNC

ASYNC

ARCH

Data Guard 11g Process Architecture Automatic Gap Resolution

ARCH

Active

Standby

Database

Queries

Reports

Testing

Backups

MRP

LSP

RFS

Page 10: OTN TOUR DAY 2011 Oracle Active Data Guard Joel Perez

10

Redo Transport vs. Protection Mode Protection Mode Controls Response to Failure Events

Mode Risk of data loss Transport If no acknowledgement from standby:

Maximum

Protection

Zero Data Loss

Double Failure

Protection

SYNC Stall primary until acknowledgement is

received from replica

Maximum

Availability

Zero Data Loss

Single Failure

Protection

SYNC Stall primary until acknowledgement is

received or timeout threshold period expires

– then resume processing

Maximum

Performance

Potential for

Minimal Data Loss ASYNC

Primary never waits for standby

acknowledgement

NET_TIMEOUT

Data Guard 11g default = 30 seconds

Page 11: OTN TOUR DAY 2011 Oracle Active Data Guard Joel Perez

11

Physical or Logical Standby Which is best for my requirement?

Choose Physical Standby if:

1. Management simplicity is preferred

2. An exact replica of the primary

3. Standby database also serves QA role - Snapshot Standby

4. A current, read-only standby can offload primary database*

5. The standby is used to offload backups from the primary

6. Protection from lost writes in the storage layer is desired

7. Data type restrictions exclude using Logical

* Requires additional license for Oracle Active Data Guard

Page 12: OTN TOUR DAY 2011 Oracle Active Data Guard Joel Perez

12

Physical or Logical?

Choose Logical Standby if:

• Read-write access to the standby database is required

• You wish to add local tables, additional schemas, indexes, materialized views, or other structures to the standby database to optimize for uses different from the primary

Page 13: OTN TOUR DAY 2011 Oracle Active Data Guard Joel Perez

13

<Insert Picture Here>

Agenda

• Introduction

• Process Architecture & Protection Modes

• Active Data Guard

• Creating an Oracle RAC Physical Standby Database

• Opening a Standby in Read-Only Mode with Oracle

Active Data Guard

• Switchover and Failover

• Resources

Page 14: OTN TOUR DAY 2011 Oracle Active Data Guard Joel Perez

14

Real-time

Queries

Production

Database

Continuous redo

shipping, validation & apply

Real-time

Reporting

Fast

Incremental

Backups

• Use fast incremental backups on a physical standby – up to 20x faster

Fast

Incremental

Backups

• Offload read-only queries to an up-to-date physical standby

Real-time

Reporting

Active Standby

Database

Active Data Guard 11g Offload Processing– Improve Primary Performance!

Read-write

Workload

Page 15: OTN TOUR DAY 2011 Oracle Active Data Guard Joel Perez

15

queries queries

Active Data Guard Reader Farm

Active Data Guard 11g Scale-out Query Performance

Production

Database

queries updates

Standby

Database

Using

Oracle RAC queries queries

Page 16: OTN TOUR DAY 2011 Oracle Active Data Guard Joel Perez

16

Supported Operations for Read Only

• When connected to an Active Data Guard standby database, read-only applications can perform/use:

• Selects

• Alter session / system

• Set role

• Lock table

• Call stored procedures

• DBlinks to write to remote databases

• Stored procedures to call remote procedures via DBlinks

• SET TRANSACTION READ ONLY for transaction level read consistency

• Complex queries e.g. grouping set queries and with clause queries

Page 17: OTN TOUR DAY 2011 Oracle Active Data Guard Joel Perez

17

Updates

Primary

Database Physical Standby

Database

Queries

Data Guard Snapshot Standby Use Standby Databases as Test Systems

Snapshot Standby

Database

Updates

redo data

Queries

Physical Standby

Database

Page 18: OTN TOUR DAY 2011 Oracle Active Data Guard Joel Perez

18

Network Compression for Gaps Improved Data Protection

• To enable compression:

• Set Data Guard broker property, or

• Set compression attribute of redo transport destination

• Resolves gaps up to 3x faster

• Better data protection

• Given there is sufficient CPU

• Negligible impact on response time

• Negligible impact on throughput

• Requires Oracle Advanced Compression Option 11g

0

10

20

30

40

50

60

70

80

elapsed time to resolve gap

uncompressed compressed

seconds

Page 19: OTN TOUR DAY 2011 Oracle Active Data Guard Joel Perez

19

<Insert Picture Here>

Agenda

• Introduction

• Process Architecture & Protection Modes

• Active Data Guard

• Creating an Oracle RAC Physical Standby

Database

• Opening a Standby in Read-Only Mode with Oracle

Active Data Guard

• Switchover and Failover

• Resources

Page 20: OTN TOUR DAY 2011 Oracle Active Data Guard Joel Perez

20

Creating an Oracle RAC

Physical Standby Database ( Step 1 )

Page 21: OTN TOUR DAY 2011 Oracle Active Data Guard Joel Perez

21

Creating an Oracle RAC

Physical Standby Database ( Step 2 )

• Create a static listener entry for the standby database on the node used for instantiation

Page 22: OTN TOUR DAY 2011 Oracle Active Data Guard Joel Perez

22

Creating an Oracle RAC

Physical Standby Database ( Step 3 )

• Create Transparent Network Substrate (TNS) aliases to

support log shipment and communication between the

primary and standby databases using the SCAN

Page 23: OTN TOUR DAY 2011 Oracle Active Data Guard Joel Perez

23

Creating an Oracle RAC

Physical Standby Database ( Step 4 )

• Ensure that the Primary database is in archivelog mode

Page 24: OTN TOUR DAY 2011 Oracle Active Data Guard Joel Perez

24

Creating an Oracle RAC

Physical Standby Database ( Step 5 )

• Nologging operations performed on the primary

database can result in missing data on the standby

database

Page 25: OTN TOUR DAY 2011 Oracle Active Data Guard Joel Perez

25

Creating an Oracle RAC

Physical Standby Database ( Step 6 )

• Oracle Data Guard uses Oracle Net for log transport

services; therefore,authentication is required for the log

transport services. With Oracle 11g Release

2,authentication can be achieved by using Secure

Sockets Layer (SSL) or by using thetraditional remote

login password file.

Page 26: OTN TOUR DAY 2011 Oracle Active Data Guard Joel Perez

26

Creating an Oracle RAC

Physical Standby Database ( Step 7 )

• Standby redo logs are a highly recommended best

practice when in maximum performance mode because

they will allow real-time apply to be used on the standby

database.

• When creating standby redo logs, you must create them

to be the same size as the online redo logs, and best

practice is to create one additional standby redo log

group per thread beyond what exists for the online redo

logs

Page 27: OTN TOUR DAY 2011 Oracle Active Data Guard Joel Perez

27

Creating an Oracle RAC

Physical Standby Database ( Step 7 )

Page 28: OTN TOUR DAY 2011 Oracle Active Data Guard Joel Perez

28

Creating an Oracle RAC

Physical Standby Database ( Step 8 )

• When configuring initialization parameters on the primary

database, we need to consider future role transitions.

Page 29: OTN TOUR DAY 2011 Oracle Active Data Guard Joel Perez

29

Creating an Oracle RAC

Physical Standby Database ( Step 9 )

• Two RMAN methods can be used to perform the

instantiation of the standby database: backup-based

duplication and active database duplication.

• RMAN active database duplication was introduced in

11g Release 1

Page 30: OTN TOUR DAY 2011 Oracle Active Data Guard Joel Perez

30

Creating an Oracle RAC

Physical Standby Database ( Step 10 )

• We will be specifying the SPFILE clause in the RMAN

duplicate command to allow RMAN to duplicate and

appropriately modify the SPFILE as part of the database

duplication process

Page 31: OTN TOUR DAY 2011 Oracle Active Data Guard Joel Perez

31

Creating an Oracle RAC

Physical Standby Database ( Step 11 )

• Because RMAN active database duplication uses Oracle

.NET, we must create a password file on each of the

standby systems. Oracle 11g uses strong password

authentication by default, so we must copy (not re-

create) the password file from the primary systems to the

standby systems.

Page 32: OTN TOUR DAY 2011 Oracle Active Data Guard Joel Perez

32

Creating an Oracle RAC

Physical Standby Database ( Step 12 )

• Create directories for standby database

• $ORACLE_BASE/admin/<db_name>/adump

• $ORACLE_BASE/admin/cosp/

• $ORACLE_BASE/admin/cosp/adump

• $ORACLE_BASE/admin/cosp/bdump

Page 33: OTN TOUR DAY 2011 Oracle Active Data Guard Joel Perez

33

Creating an Oracle RAC

Physical Standby Database ( Step 13 )

• When using RMAN duplicate functionality, the standby

database must be started in nomount state. To start the

database, set the ORACLE_SID appropriately and

issue a startup nomount within SQL*Plus

Page 34: OTN TOUR DAY 2011 Oracle Active Data Guard Joel Perez

34

Creating an Oracle RAC

Physical Standby Database ( Step 14 )

• RMAN active database duplication: We will use the

following RMAN duplicate parameters to create our

standby

Page 35: OTN TOUR DAY 2011 Oracle Active Data Guard Joel Perez

35

Creating an Oracle RAC

Physical Standby Database ( Step 14 )

Page 36: OTN TOUR DAY 2011 Oracle Active Data Guard Joel Perez

36

Creating an Oracle RAC

Physical Standby Database ( Step 15,16 )

• RMAN duplicate will create the SPFILE in the

$ORACLE_HOME/dbs directory as part of the

duplication process. Because we are creating an Oracle

RAC standby, we must move this SPFILE to a shared

location to allow it to be accessed by all standby

database instances.

Page 37: OTN TOUR DAY 2011 Oracle Active Data Guard Joel Perez

37

Creating an Oracle RAC

Physical Standby Database ( Step 17 )

• Now we’ll restart our standby database in mount state

and place it in managed recovery mode.

• To start Real-Time Apply, you initiate MRP by issuing the

following command

Page 38: OTN TOUR DAY 2011 Oracle Active Data Guard Joel Perez

38

Creating an Oracle RAC

Physical Standby Database ( Step 18 )

• We deferred LOG_ARCHIVE_DEST_2 on the primary

database until we had the standby mounted. Now it is

time to enable that destination and begin shipping redo

data the standby. On the primary database, enter the

following command:

Page 39: OTN TOUR DAY 2011 Oracle Active Data Guard Joel Perez

39

Creating an Oracle RAC

Physical Standby Database ( Step 19 )

• Now we’ll perform a log switch on the primary and verify

that the transmission of that log was successful:

Page 40: OTN TOUR DAY 2011 Oracle Active Data Guard Joel Perez

40

<Insert Picture Here>

Agenda

• Introduction

• Process Architecture & Protection Modes

• Role Transition & Management Interface

• Active Data Guard

• Creating an Oracle RAC Physical Standby Database

• Opening a Standby in Read-Only Mode with

Oracle Active Data Guard

• Switchover and Failover

• Resources

Page 41: OTN TOUR DAY 2011 Oracle Active Data Guard Joel Perez

41

Opening a Standby in Read-Only

Mode with Oracle Active Data Guard ( Step 1,2 & 3 )

• We must first ensure that the database COMPATIBLE

initialization parameter is set to a minimum of 11.1.0.0

• To open the standby database in read-only mode, we

must first cancel the active managed recovery

• To open the standby database in read-only mode, we

issue the following SQL statement:

Page 42: OTN TOUR DAY 2011 Oracle Active Data Guard Joel Perez

42

Opening a Standby in Read-Only

Mode with Oracle Active Data Guard ( Step 4 )

• When we are open in read-only mode, no updates to the

database can occur. So we have to handle user queries

that need sorting space

• To enable real-time query, we simply need to restart the

managed recovery process with the database opened in

read-only mode

Page 43: OTN TOUR DAY 2011 Oracle Active Data Guard Joel Perez

43

Opening a Standby in Read-Only

Mode with Oracle Active Data Guard ( Step 5 )

• If we query open_mode from gv$database, we can

see that the open mode is now READ-ONLY WITH

APPLY

• If you plan on using Oracle Active Data Guard as a

permanent solution within your environment

Page 44: OTN TOUR DAY 2011 Oracle Active Data Guard Joel Perez

44

Opening a Standby in Read-Only

Mode with Oracle Active Data Guard

• Automatic Block Recovery avoids the dreaded ORA-

1578 block corruption errors that an end user would

typically see when a block corruption is encountered.

How does it do that? Upon detection of a block

corruption on the primary database that would normally

result in an ORA-1578 error, the corrupt block is shipped

from the standby database, and the corrupt block on the

primary database is replaced with the standby copy of

the block. The user who ran the query to “discover” the

block corruption will notice a slight pause in his/her query

while the block is replaced, but no error is ever thrown.

No human intervention is required.

Page 45: OTN TOUR DAY 2011 Oracle Active Data Guard Joel Perez

45

Opening a Standby in Read-Only

Mode with Oracle Active Data Guard ( Optional )

• We will now configure the

STANDBY_MAX_DATA_DELAY session parameter to

specify the lag tolerance for queries issued against the

standby database

• Another approach is to synchronize the standby

database prior to running a query

Page 46: OTN TOUR DAY 2011 Oracle Active Data Guard Joel Perez

46

<Insert Picture Here>

Agenda

• Introduction

• Process Architecture & Protection Modes

• Active Data Guard

• Creating an Oracle RAC Physical Standby Database

• Opening a Standby in Read-Only Mode with Oracle

Active Data Guard

• Switchover and Failover

• Resources

Page 47: OTN TOUR DAY 2011 Oracle Active Data Guard Joel Perez

47

Switchover and Failover

• Switchover

• Planned role reversal

• No database reinstantiation required

• Used for maintenance of OS or hardware

• Failover

• Unplanned failure of primary

• Use Flashback Database to reinstate original primary

• Manually execute via SQL or simple GUI interface, or

• Automate failover using Data Guard Fast-Start Failover

Page 48: OTN TOUR DAY 2011 Oracle Active Data Guard Joel Perez

48

Data Guard Switchover Reduce Downtime for Planned Events

• Database Rolling Upgrades

• Scheduled power outages and site maintenance

• Data center moves

• Migrations to ASM and/or RAC

• Technology refresh – servers and storage

• Windows/Linux migrations *

• 32bit/64bit migrations*

• HP-UX/PA RISC to HP-UX/IPF migrations*

* see Metalink Note 413484.1

Page 49: OTN TOUR DAY 2011 Oracle Active Data Guard Joel Perez

49

Location How far apart can I locate my standby site?

• The greater the distance, the greater the protection

• Use multiple standby databases, or a combination of logical and physical

• See: MAA Best Practices for Multi-Standby Configurations

Austin Texas - Preferred Failover Target

• Maximum Availability – SYNC

• Zero data loss at greatest possible distance

200 miles

1,500 miles

New York, NY

ASYNC

Physical

Dallas, TX

Primary Site

Austin, TX

SYNC

Physical

New York - Secondary Failover Target

• Maximum Performance – ASYNC

• No distance limitations – best protection

Page 50: OTN TOUR DAY 2011 Oracle Active Data Guard Joel Perez

50

Managing Data Guard Which management interface should I use?

• Enterprise Manager Grid Control – Recommended!

• Easy standby creation and mgmt, most comprehensive monitoring

• GUI interface that requires the Data Guard Broker for full functionality

• Data Guard Broker

• DGMGRL command line - attach to any database in a Data Guard

configuration and manage all databases as a single configuration

• SQL*Plus Command Line

• Requires connecting to each database, primary and standby

• Described in detail in Data Guard Concepts and Administration

Page 51: OTN TOUR DAY 2011 Oracle Active Data Guard Joel Perez

51

OEM Grid Control 10.2.0.5 Enhancements

• Easily create standby databases directly from the primary database

without interim storage at either location

• Easily create standby databases from existing RMAN backups

• Easily convert a single instance standby databases to Oracle RAC using

an EM wizard

• Automated conversion of standby databases for reporting, development,

and test

• Fault-tolerant observer for Fast-Start Failover

Page 52: OTN TOUR DAY 2011 Oracle Active Data Guard Joel Perez

52

<Insert Picture Here>

Agenda

• Introduction

• Process Architecture & Protection Modes

• Role Transition & Management Interface

• Active Data Guard

• Creating an Oracle RAC Physical Standby Database

• Opening a Standby in Read-Only Mode with Oracle

Active Data Guard

• Switchover and Failover

• Resources

Page 53: OTN TOUR DAY 2011 Oracle Active Data Guard Joel Perez

53

• Oracle Data Guard on OTN http://www.oracle.com/technology/deploy/availability/htdocs/DataGuardOverview.html

• Oracle HA Portal on OTN http://www.oracle.com/technology/deploy/availability/

• Maximum Availability Architecture (MAA) white papers and demonstrations http://www.oracle.com/technology/deploy/availability/htdocs/maa.htm

• Oracle HA Customer Success Stories on OTN: http://www.oracle.com/technology/deploy/availability/htdocs/HA_CaseStudies.html

• Taneja Group - New Approaches to Data Protection and DR http://www.oracle.com/technology/deploy/availability/htdocs/analysts/tanejagroupdatabasestorage.pdf

• Enterprise Strategy Group – Data Protection and Disaster Recovery http://www.oracle.com/technology/deploy/availability/htdocs/analysts/enterprisestrategygroupdataguard.pdf

Resources

Page 54: OTN TOUR DAY 2011 Oracle Active Data Guard Joel Perez

54