introduction to oracle data guard broker

52
Zohar Elkayam www.realdbamagic.com Twitter: @realmgic Oracle Data Guard Broker: Overview

Upload: zohar-elkayam

Post on 14-Apr-2017

101 views

Category:

Technology


1 download

TRANSCRIPT

Page 1: Introduction to Oracle Data Guard Broker

Zohar Elkayam www.realdbamagic.com

Twitter: @realmgic

Oracle Data Guard Broker: Overview

Page 2: Introduction to Oracle Data Guard Broker

Who am I?• Zohar Elkayam, CTO at Brillix

• Programmer, DBA, team leader, database trainer, public speaker, and a senior consultant for over 18 years

• Oracle ACE Associate • Part of ilOUG – Israel Oracle User Group• Blogger – www.realdbamagic.com and www.ilDBA.co.il

2 http://brillix.co.il

Page 3: Introduction to Oracle Data Guard Broker

3

About Brillix• We offer complete, integrated end-to-end solutions based on best-of-

breed innovations in database, security and big data technologies• We provide complete end-to-end 24x7 expert remote database

services• We offer professional customized on-site trainings, delivered by our

top-notch world recognized instructors

http://brillix.co.il

Page 4: Introduction to Oracle Data Guard Broker

Some of Our Customers

http://brillix.co.il4

Page 5: Introduction to Oracle Data Guard Broker

http://brillix.co.il5

Agenda• Oracle Data Guard overview• Dataguard broker introduction• Configuring and using the data guard• Live Demos

Page 6: Introduction to Oracle Data Guard Broker

What is Oracle Dataguard Broker

http://brillix.co.il6

Page 7: Introduction to Oracle Data Guard Broker

7

What Is Oracle Data Guard?Primarydatabase

Standbydatabase

Database Database copy

Redo transport

Orac

le N

et

Page 8: Introduction to Oracle Data Guard Broker

8

Oracle Data Guard: Architecture (Overview)

Primary databasetransactions MRP or

LSP Standbydatabase

Archived redo logs

BackupOnlineredologs

ARC0

RFS

Archived redo logs

ARC0 Reports

Standbyredo logsOr

acle

ne

t

LNSn

(Real-time apply)

LGWR

Redo buffer

Gap resolution

Page 9: Introduction to Oracle Data Guard Broker

9

Primary Database ProcessesPrimary databasetransactions MRP or

LSP Standbydatabase

Archived redo logs

BackupOnlineredologs

ARC0

RFS

Archived redo logs

ARC0 Reports

Standbyredo logsOr

acle

ne

t

LNSn

(Real-time apply)

LGWR

Redo buffer

Gap resolution

Page 10: Introduction to Oracle Data Guard Broker

10

Standby Database ProcessesPrimary databasetransactions MRP or

LSP Standbydatabase

Archived redo logs

BackupOnlineredologs

ARC0

RFS

Archived redo logs

ARC0 Reports

Standbyredo logsOr

acle

ne

t

LNSn

(Real-time apply)

LGWR

Redo buffer

Gap resolution

Page 11: Introduction to Oracle Data Guard Broker

11

Oracle Data Guard Broker• The Oracle Data Guard broker is a distributed management framework

• The broker automates and centralizes the creation, maintenance, and monitoring of Data Guard configurations

• With the broker, you can perform all management operations locally or remotely with easy-to-use interfaces:

• Oracle Enterprise Manager Grid/Cloud Control• DGMGRL (a command-line interface)

Page 12: Introduction to Oracle Data Guard Broker

12

Benefits of Using the Data Guard Broker• Enhances the high-availability, data protection, and disaster protection capabilities inherent in Oracle Data Guard by automating both configuration and monitoring tasks

• Streamlines the process for any one of the standby databases to replace the primary database and take over production processing

• Enables easy configuration of additional standby databases

Page 13: Introduction to Oracle Data Guard Broker

13

Benefits of Using the Data Guard Broker (2)• Provides simplified, centralized, and extended management

• Automatically communicates between the databases in a Data Guard configuration by using Oracle Net Services

• Provides built-in validation that monitors the health of all databases in the configuration

Page 14: Introduction to Oracle Data Guard Broker

14

Comparing Configurations CapabilitiesWith the Broker Without the Broker

General Manage databases as one Manage databases separately

Creation of the standby database

Use Grid Control wizards Manually create files

Configuration and management

Configure and manage from single interface

Set up services manually for each database

Monitoring • Monitor continuously• Unified status and reports• Integrate with EM events

Monitor each database individually through views and scripts

Control Invoke role transitions with a single command

Coordinate sequences of multiple commands across database sites for role transitions

Page 15: Introduction to Oracle Data Guard Broker

15

Data Guard Broker: Components• Client-side:

• Oracle Enterprise Manager Grid Control• DGMGRL (command-line interface)

• Server-side: Data Guard monitor• DMON process• Configuration files

Page 16: Introduction to Oracle Data Guard Broker

16

Oracle Data Guard Broker Framework

CLI management client

Oracle Management

Server

Enterprise Manager

Repository

PrimarydatabaseData

Guardbroker

DataGuardbroker

AgentAgentStandbydatabas

e

Page 17: Introduction to Oracle Data Guard Broker

17

Data Guard Broker: Configurations• The most common configuration is a primary database at one location and a standby database at another location.

pc00prmy

Primary site

pc00sby1

Standby site

Oracle Net

Page 18: Introduction to Oracle Data Guard Broker

18

Data Guard Broker: Management ModelData Guard Broker Configuration

Primary database

Broker-controlled databases

Standby databaseStandby database

Standby databaseStandby database

Standby databaseStandby database

Standby databaseStandby database

Standby database

Instances Instances

Page 19: Introduction to Oracle Data Guard Broker

20

Data Guard Monitor: DMON Process• Server-side background process• Part of each database instance in the configuration• Created when you start the broker• Performs requested functions and monitors the resource• Communicates with other DMON processes in the configuration• Updates the configuration file• Creates the drc<SID> trace file in the location set by the DIAGNOSTIC_DEST initialization parameter

• Modifies initialization parameters during role transitions as necessary

Page 20: Introduction to Oracle Data Guard Broker

21

Data Guard Broker Interfaces• Command-line interface (CLI):

• Is started by entering DGMGRL at the command prompt where the Oracle server or an Oracle client is installed

• Enables you to control and monitor a Data Guard configuration from the prompt or in scripts

• Oracle Enterprise Manager Grid Control:• Provides wizards to simplify creating and managing standby databases

Page 21: Introduction to Oracle Data Guard Broker

22

Using DGMGRL CLIDGMGRL> connect sys/oracleConnected.DGMGRL> show configuration verbose

Configuration Name: DGConfig1 Enabled: YES Protection Mode: MaxAvailability Databases: pc00prmy - Primary database pc00sby1 - Physical standby database

Fast-Start Failover: DISABLED

Current status for "DGConfig1":SUCCESS

Page 22: Introduction to Oracle Data Guard Broker

Creating a Data Guard Broker Configuration

23

Page 23: Introduction to Oracle Data Guard Broker

24

Data Guard Broker: Requirements• Oracle Database Enterprise Edition• Single-instance or multi-instance environment• COMPATIBLE parameter: Set to 10.2.0.1.0 or later for both the

primary and standby databases• Oracle Net Services network files: Must be configured for the

primary database and any existing standby databases. Enterprise Manager Grid Control configures files for new standby databases.

• GLOBAL_DBNAME attribute: Set to a concatenation of db_unique_name_DGMGRL.db_domain

Page 24: Introduction to Oracle Data Guard Broker

25

Data Guard Broker: Requirements• DG_BROKER_START initialization parameter set to TRUE• Dataguard configuration in place and syncing• All databases: MOUNT or OPEN mode• DG_BROKER_CONFIG_FILEn: Configured for any RAC databases

Page 25: Introduction to Oracle Data Guard Broker

26

Data Guard Broker and the SPFILE• You must use a server parameter file (SPFILE) for initialization parameters

• Using the SPFILE enables the Data Guard broker to keep its configuration file and the database SPFILE consistent

• If you use the broker, use Enterprise Manager or DGMGRL to update dataguard related parameters

Page 26: Introduction to Oracle Data Guard Broker

27

Data Guard Monitor: Configuration File• The broker configuration file is:

• Automatically created and named using a default path name and file name when the broker is started

• Managed automatically by the DMON process• The configuration file and a copy are created at each managed site with default

names:• dr1<db_unique_name>.dat• dr2<db_unique_name>.dat

• Configuration file default locations are operating-system specific:• Default location for UNIX and Linux: ORACLE_HOME/dbs • Default location for Windows: ORACLE_HOME\database

• Use DG_BROKER_CONFIG_FILEn to override the default path name and file name.

Page 27: Introduction to Oracle Data Guard Broker

28

Data Guard Broker: Log Files• The broker log files contain information recorded by the DMON process

• There is one file for each database in the broker configuration

• Broker log files are created in the same directory as the alert log and are named drc<$ORACLE_SID>.log

Page 28: Introduction to Oracle Data Guard Broker

29

Creating a Broker Configuration1.Invoke DGMGRL and connect to the primary

database2.Define the configuration, including a profile for the

primary database3.Add standby databases to the configuration4.Enable the configuration, including the databases

Page 29: Introduction to Oracle Data Guard Broker

30

Defining the Broker Configuration (Primary)

DGMGRL> CREATE CONFIGURATION 'DGConfig1' AS> PRIMARY DATABASE IS pc00prmy> CONNECT IDENTIFIER IS pc00prmy;Configuration "DGConfig1" created with primary

database "pc00prmy"DGMGRL>

Page 30: Introduction to Oracle Data Guard Broker

31

Adding Standby Databases to the Configuration

DGMGRL> ADD DATABASE pc00sby1 AS> CONNECT IDENTIFIER IS pc00sby1;Database "pc00sby1" addedDGMGRL>

Page 31: Introduction to Oracle Data Guard Broker

32

Enabling the ConfigurationDGMGRL> ENABLE CONFIGURATION;Enabled.DGMGRL> SHOW CONFIGURATION

Configuration Name: DGConfig1 Enabled: YES Protection Mode: MaxPerformance Databases: pc00prmy - Primary database pc00sby1 - Physical standby database

Fast-Start Failover: DISABLED

Current status for "DGConfig1":SUCCESS

Page 32: Introduction to Oracle Data Guard Broker

33

Changing Database Properties and States• To alter a database property:

• To alter the state of the standby database:

• To alter the state of the primary database:

DGMGRL> EDIT DATABASE pc00sby1 > SET PROPERTY LogXptMode='SYNC';

DGMGRL> EDIT DATABASE pc00sby1 SET STATE='APPLY-OFF';

DGMGRL> EDIT DATABASE pc00prmy > SET STATE='TRANSPORT-OFF';

Page 33: Introduction to Oracle Data Guard Broker

34

Managing Redo Transport Services Using DGMGRL• Specify database properties to manage redo transport services:

• DGConnectIdentifier• StaticConnectIdentifier• LogShipping• LogXptMode (SYNC/ASYNC)

Page 34: Introduction to Oracle Data Guard Broker

35

Using the DGConnectIdentifier Property• DGConnectIdentifier:

• Specifies the connection identifier that is used by the broker to connect to a database

• Is set when a database is either added to the Data Guard broker configuration to the value specified in the optional CONNECT IDENTIFIER CLAUSE, or is extracted from the SERVICE attribute of the LOG_ARCHIVE_DEST_n initialization parameter

• The DGConnectIdentifier value is used in the FAL_SERVER and FAL_CLIENT initialization parameters

• Changing the value of DGConnectIdentifier causes an update of the LOG_ARCHIVE_DEST_n SERVICE attribute and the FAL_SERVER and FAL_CLIENT parameters

Page 35: Introduction to Oracle Data Guard Broker

Using StaticConnectIdentifier • In order to have seamless switchover, failover and convert operation we must define a static listener entry

• Failing to configure static entries will result with manual steps during these operations

• The default entry should be named “<sid>_DGMGRL” but can be modified by changing the StaticConnectIdentifier parameter http://brillix.co.il36

Page 36: Introduction to Oracle Data Guard Broker

37

Controlling the Shipping of Redo Data •LogShipping controls whether archived redo log files are sent to a specified standby database.

•LogShipping is applicable only when the primary database state is set to TRANSPORT-ON.

Page 37: Introduction to Oracle Data Guard Broker

Creating the Broker Demo

38

Page 38: Introduction to Oracle Data Guard Broker

39

Switchover• Transitions the roles of the primary and standby databases

• Requires no resetting of the online redo logs of the new primary database

• Incurs no data loss• Causes users to disconnect from primary

Page 39: Introduction to Oracle Data Guard Broker

40

Performing a Switchover by Using DGMGRL• After verifying the conditions required for a switchover, execute the SWITCHOVER command:

DGMGRL> switchover to orcldgPerforming switchover NOW, please wait...Operation requires a connection to instance "orcldg" on database "orcldg"Connecting to instance "orcldg"...Connected.New primary database "orcldg" is opening...Operation requires startup of instance "orcl" on database "orcl"Starting instance "orcl"...ORACLE instance started.Database mounted.Database opened.witchover succeeded, new primary is "orcldg"

Page 40: Introduction to Oracle Data Guard Broker

41

Failover

Standbydatabase becomes primary

database.

Read/writetransactions

Online redologs

Local archiving

San FranciscoBoston

Archived redologs

Application

Online RedoLogs

Local Archiving

Archived redologs

Primary database

Page 41: Introduction to Oracle Data Guard Broker

42

Performing a Failover Using DGMGRL1.Execute the FAILOVER command to initiate the

failover operation:

2.Reset the protection mode (if necessary)3.Reinstate the primary database to serve as a

standby database in the configuration4.Reinstate or re-create other disabled standby

databases in the configuration

DGMGRL> FAILOVER TO 'orcldg' [IMMEDIATE];

Page 42: Introduction to Oracle Data Guard Broker

43

Re-enabling Disabled Databases Using DGMGRL• Disabled databases must be reinstated or re-created to re-enable broker management.

• Reinstate a database using REINSTATE DATABASE:

• If you cannot reinstate a database, re-create it from a copy of the primary database and then re-enable the database by using ENABLE DATABASE:

DGMGRL> REINSTATE DATABASE orcl;

DGMGRL> ENABLE DATABASE orcl;

Page 43: Introduction to Oracle Data Guard Broker

44

Snapshot Standby Databases: Overview• A snapshot standby database is a fully updatable standby database created by converting a physical standby database.

• Snapshot standby databases receive and archive—but do not apply—redo data from a primary database.

• When the physical standby database is converted, an implicit guaranteed restore point is created and Flashback Database is enabled.

Page 44: Introduction to Oracle Data Guard Broker

45

Snapshot Standby Database: Architecture

LGWR

Primary database

transactions

Onlineredologs

ARC0

RFS

MRP

Archived redo logs

ARC0

Standbyredo logs

Archived redo logs

Orac

le

net

LNSn

Transactions

Snapshotstandbydatabase

Page 45: Introduction to Oracle Data Guard Broker

46

Converting to a Snapshot Standby Database• To convert a physical standby database to a snapshot standby database:

DGMGRL> convert database orcl to snapshot standby;Converting database "orcl" to a Snapshot Standby

database, please wait...Database "orcl" converted successfully

Page 46: Introduction to Oracle Data Guard Broker

47

Converting Snapshot Standby to Physical Standby• Convert the snapshot standby database back to a physical standby database:

DGMGRL> CONVERT DATABASE orcl>TO PHYSICAL STANDBY;[…]Database "orcl" converted successfully

Page 47: Introduction to Oracle Data Guard Broker

48

• Disable broker management of the configuration:

• Disable broker management of a standby database:

Disabling Broker Management

DGMGRL> DISABLE CONFIGURATION;

DGMGRL> DISABLE DATABASE 'orcl';

Page 48: Introduction to Oracle Data Guard Broker

49

Removing the Configuration or Standby Database• Remove a standby database from the configuration:

• Remove the configuration:

DGMGRL> REMOVE DATABASE 'orcldg';

DGMGRL> REMOVE CONFIGURATION;

Page 49: Introduction to Oracle Data Guard Broker

Switchover and Snapshot Standby Demo

http://brillix.co.il50

Page 50: Introduction to Oracle Data Guard Broker

http://brillix.co.il51

Q&A

Page 51: Introduction to Oracle Data Guard Broker

http://brillix.co.il52

Summary• We talked about Oracle Data Guard Broker• We configured a broker for primary and standby• We learned about several of the important parameters

Page 52: Introduction to Oracle Data Guard Broker

http://brillix.co.il53

Thank YouZohar Elkayam

twitter: @[email protected]

www.realdbamagic.com