data guard slides study guide_shahul

392
1 Copyright © 2006, Oracle. All rights reserved. Oracle Data Guard: Overview

Upload: mohd1985ibrahim

Post on 06-Apr-2015

217 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Data Guard Slides Study Guide_shahul

1Copyright © 2006, Oracle. All rights reserved.

Oracle Data Guard: Overview

Page 2: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 2

Copyright © 2006, Oracle. All rights reserved.1 - 2

Objectives

After completing this lesson, you should be able to do the following:• Describe the factors that affect planned and unplan ned

downtime• Describe the basic components of Oracle Data Guard• Explain the differences between physical and logica l

standby databases• Explain the benefits of creating a Data Guard

environment• Explain the use of Data Guard in high-availability

architectures

Page 3: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 3

Copyright © 2006, Oracle. All rights reserved.1 - 3

Causes of Data Loss

Source: Disaster Recovery Journal

Natural disasters 3%

Software corruption 4%

Computer viruses 7%

Human errors 36%

Hardware & system errors 49%

Causes of Data Loss

According to a survey published in the Disaster Recovery Journal(DRJ), the leading causes of data loss were not natural disasters but hardware failures and human errors.

The goal of Oracle Data Guard is to provide an effective safeguard against data loss. Data Guard provides enterprises with complete data protection, data recovery, and data availability, ensuring round-the-clock business continuity.

Page 4: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 4

Copyright © 2006, Oracle. All rights reserved.1 - 4

Understanding the Causes of Downtime

Planneddowntime

Unplanneddowntime

Systemchanges

Datachanges

Datafailures

Computerfailures

Corruption

Human error

Sitefailure

Storagefailure

Understanding the Causes of Downtime

Every system faces both unplanned and planned downtime. It is important to consider causes of both unplanned and planned downtime when designing a fault-tolerant, resilient infrastructure.Unplanned downtime consists of the following:

• Computer failures: Downtime occurs when there is a power outage or a system crash.• Data failures: Data failure is the loss, damage, or corruption of critical enterprise data.

Causes of data failure include:- Storage failure: Disk crash or space limitations- Human error: Downtime occurs when someone inadvertently drops a table or the

system administrator makes an error.- Corruption: Caused by a faulty component in the I/O stack- Site failure: Downtime occurs when there is some sort of data corruption or natural

disaster such as a flood, fire, or earthquake.

Planned downtime includes routine operations, periodic maintenance, and new deployments. Planned downtime includes the following:

• Data changes:Table redefinition and index rebuild• System changes:Downtime occurs during hardware and operating-system upgrades.

Page 5: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 5

Copyright © 2006, Oracle. All rights reserved.1 - 5

What Is Oracle Data Guard?

Primarydatabase

Standbydatabase

Database Database copy

Redo transport

Ora

cle

Net

What Is Oracle Data Guard?

Oracle Data Guard is a management, monitoring, and automation software infrastructure that works with a production database and one or more standby databases to protect your data against failures, errors, and corruptions that might otherwise destroy your database. It protects critical data by providing facilities to automate the creation, management, and monitoring of the databases and other components in a Data Guard configuration. It automates the process of maintaining a copy of an Oracle production database (called a standby database) that can be used if the production database is taken offline for routine maintenance or becomes damaged.

In a Data Guard configuration, a production database is referred to as a primary database. A standby databaseis a synchronized copy of the primary database. Using a backup copy of the primary database, you can create from one to nine standby databases. The standby databases, together with the primary database, make up a Data Guard configuration. Each standby database is associated with only one primary database.

Note: You can use the Cascaded Redo Log Destinations feature to incorporate more than nine standby databases in your configuration. Refer to the “Other Considerations for Oracle Data Guard” lesson for additional information about this feature.

Page 6: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 6

Copyright © 2006, Oracle. All rights reserved.1 - 6

Types of Standby Databases

There are two types of standby databases:• Physical standby database

– Identical to the primary database on a block-for-bl ock basis

– Synchronized with the primary database through application of redo data received from the primary database

• Logical standby database– Shares the same schema definition– Synchronized with the primary database by transform ing

the data in the redo received from the primary data base into SQL statements and then executing the SQL statements

Types of Standby Databases

Physical Standby Database

A physical standby database is physically identical to the primary database, with on-disk database structures that are identical to the primary database on a block-for-block basis. The physical standby database is updated by performing recovery using redo data that is received from the primary database. The physical standby database can be either recovering data or open for read-only reporting.

Logical Standby Database

A logical standby database contains the same logical information (unless configured to skipcertain objects) as the production database, although the physical organization and structure of the data can be different. The logical standby database is kept synchronized with the primary database by transforming the data in the redo received from the primary database into SQL statements and then executing the SQL statements on the standby database. This is done with the use of LogMiner technology on the redo log information received from the primary database. The tables in a logical standby database can be used simultaneously for recovery and for other tasks such as reporting, summations, and queries.

For more information about LogMiner, refer to Oracle Database Utilities.

Page 7: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 7

Copyright © 2006, Oracle. All rights reserved.1 - 7

Oracle Data Guard Broker Framework

CLI management client

Enterprise Manager

Repository

Primarydatabase

DataGuardbroker

Oracle Management

Server

DataGuardbroker

Agent

Standbydatabase

Agent

Oracle Data Guard Broker

The Oracle Data Guard broker is a distributed management framework that automates and centralizes the creation, maintenance, and monitoring of Data Guard configurations. After the broker creates the Data Guard configuration, the broker monitors the activity, health, and availability of all systems in the Data Guard configuration. You can use Oracle Enterprise Manager Grid Control or the Data Guard broker’s own specialized command- line interface (DGMGRL) to take advantage of the broker’s management capabilities.

Enterprise Manager provides a Web-based interface that combines with the broker’s centralized management and monitoring capabilities so that you can easily view, monitor, and administer primary and standby databases in a Data Guard configuration.

You can also use the Data Guard command- line interface (CLI) to control and monitor a Data Guard configuration. You can perform most of the activities that are required to manage and monitor the databases in the configuration from the CLI prompt (DGMGRL) or in scripts.

Page 8: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 8

Copyright © 2006, Oracle. All rights reserved.1 - 8

Types of Services

There are three types of services provided with Dat a Guard:• Redo transport services• Log apply services

– Redo Apply– SQL Apply

• Role-management services

Types of Services

The following types of services are available with Data Guard:• Redo transport services:Control the automated transmittal of redo information from the

primary database to one or more standby databases or destinations• Log apply services:Control when and how the redo logs are applied to the standby database

- Redo Apply: Technology used for physical standby databases. Redo data is applied on the standby database by using the standard recovery techniques of an Oracle database.

- SQL Apply: Technology used for logical standby databases. The received redo data is first transformed into SQL statements, and then the generated SQL statements are executed on the logical standby database.

• Role-management services:A database operates in one of two mutually exclusive roles: primary or standby. Role-management services operate in conjunction with the redo transport services and log apply services to change these roles dynamically as a planned transition (called a switchover operation) or as a result of a database failure through a failover operation.

Page 9: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 9

Copyright © 2006, Oracle. All rights reserved.1 - 9

Role Transitions: Switchover and Failover

• Oracle Data Guard supports two role-transition operations:– Switchover

— Planned role reversal— Used for OS or hardware maintenance

– Failover— Unplanned role reversal— Use in emergency— Zero or minimal data loss depending on choice

of data protection mode

— Can be initiated automatically when fast-start fail over is enabled

• Role-transition operations are not automatically invoked.

Role Transitions: Switchover and Failover

Data Guard enables you to change the role of a database dynamically by issuing SQL statements or by using either of the Data Guard broker’s interfaces. Oracle Data Guard supports two role-transition operations:

• Switchover: The switchover feature provides you with the ability to switch the role of the primary database to one of the available standby databases. The chosen standby database becomes the primary database, and the original primary database then becomes a standby database.

• Failover: You invoke a failover operation when a catastrophic failure occurs on the primary database and there is no possibility of recovering the primary database in a timely manner. During a failover operation, the failed primary database is removed from the Data Guard environment, and a standby database assumes the primary database role. You invoke the failover operation on the standby database that you want to fail over to the primary role. In Oracle Database 10g Release 2, you can enable fast-start failover that allows Data Guard to automatically and quickly fail over to a previously chosen, synchronized standby database. Fast-start failover is discussed in detail in the lesson titled “Enabling Fast-Start Failover.”

Page 10: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 10

Role Transitions: Switchover and Failover (continue d)

Databases that have been disabled after a role transition are not removed from the broker configuration, but they are disabled in the sense that the databases are no longer managed by the broker. To reenable broker management of these databases, you must reinstate or re-create the databases. Refer to the lesson titled “Performing Switchover and Failover” for detailed information.

Page 11: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 11

Copyright © 2006, Oracle. All rights reserved.1 - 11

Data Protection Modes

• Maximum protection• Maximum availability• Maximum performance

Data Protection Modes

Data Guard provides three high- level modes of data protection that you can configure to balancecost, availability, performance, and transaction protection. You can configure the Data Guard environment to maximize data protection, availability, or performance.

Maximum Protection

This protection mode guarantees that no data loss occurs if the primary database fails. To provide this level of protection, the redo data that is needed to recover each transaction must be written to both the local online redo log and the standby redo log (used to store redo data received from another database) on at least one standby database before the transaction commits. To ensure that data loss does not occur, the primary database shuts down if a fault prevents it from writing its redo stream to at least one remote standby redo log. For multiple- instance Real Application Clusters (RAC) databases, Data Guard shuts down the primary database if it is unable to write the redo records to at least one properly configured database instance.

Page 12: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 12

Data-Protection Modes (continued)

Maximum Availability

This protection mode provides the highest possible level of data protection without compromising the availability of the primary database. As with maximum protection mode, a transaction does not commit until the redo needed to recover that transaction is written to the local online redo log and to at least one remote standby redo log. Unlike maximum protection mode, the primary database does not shut down if a fault prevents it from writing its redo stream to a remote standby redo log. Instead, the primary database operates in maximum performance mode until the fault is corrected and all the gaps in the redo log files are resolved. When all the gaps are resolved, the primary database automatically resumes operating in maximum availability mode.

This mode guarantees that no data loss occurs if the primary database fails, but only if a second fault does not prevent a complete set of redo data from being sent from the primary database to at least one standby database.

Maximum Performance (Default)

This default protection mode provides the highest possible level of data protection without affecting the performance of the primary database. This is accomplished by allowing a transaction to commit as soon as the redo data needed to recover that transaction is written to the local online redo log. The primary database’s redo data stream is also written to at least one standby database, but that redo stream is written asynchronously with respect to the commitment of the transactions that create the redo data.

When network links with sufficient bandwidth are used, this mode provides a level of data protection that approaches that of maximum availability mode with minimal impact on primary database performance.

Page 13: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 13

Copyright © 2006, Oracle. All rights reserved.1 - 13

Benefits of ImplementingOracle Data Guard

Oracle Data Guard provides the following benefits:• Continuous service through disasters or crippling d ata

failures• Complete data protection against corruptions and da ta

loss• Efficient use of system resources• Elimination of idle standby systems• Flexible configuration of your system to meet busin ess

protection and recovery requirements• Centralized management

Benefits of Implementing Oracle Data Guard

Oracle Data Guard provides the following benefits:• Continuous service:With the use of switchover and failover between systems, your business

need not halt because of a disaster at one location.• Complete data protection:Data Guard guarantees no data loss and provides a safeguard

against data corruption and user errors. Redo data is validated when applied to the standby database.

• Efficient use of system resources:Standby databases can be used for reporting in addition to providing a safeguard for disaster recovery. You can use a logical standby for real- time reporting and the physical standby database for point- in-time reporting. You can also use the physical standby database for backups of the primary database.

• Elimination of idle standby systems:A standby database does not have to be idle when you implement a logical standby database. This database is open and ready for reporting at all times.

• Flexible configurations: You can use Data Guard to configure the system to your needs. With the use of protection modes and several tunable parameters, you can tailor the configuration to your needs.

• Centralized management:You can use Enterprise Manager Grid Control to manage all configurations in your enterprise.

Page 14: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 14

Copyright © 2006, Oracle. All rights reserved.1 - 14

Role of Data Guard in a High-Availability Architecture

RAC

ASM

Flashback technology

Datafailures

Computerfailures

Corruption

Human error

Sitefailure

Storagefailure

Oracle HARDRMAN

Data Guard

Role of Data Guard in a High-Availability Architect ure

Oracle Database offers many features to protect your system from common types of downtime. This course focuses on the use of Data Guard. Data Guard addresses data failure and disaster recovery in high-availability architectures.

Real Application Clusters (RAC) enables you to build highly available and scalable database servers across multiple systems. For more information about Real Application Clusters, you can attend the Oracle Database 10g: Real Application Clusters course or review the Oracle Real Application Clusters Administrator’s Guide.

Oracle Database 10g introduces the Automatic Storage Management (ASM) feature, which provides a vertically integrated file system and volume manager in the Oracle kernel. For additional information about ASM, see Oracle Database Conceptsand theOracle Database Administrator’s Guide.

Oracle Database 10g includes flashback technologies to address human errors, including Flashback Query, Flashback Versions Query, Flashback Transaction Query, Flashback Database, Flashback Table, and Flashback Drop. For additional information about these features, see the Oracle Database Administrator’s Guide.

Oracle’s Hardware Assisted Resilient Data (HARD) is a comprehensive program designed to prevent data corruptions before they happen. Refer to Oracle High Availability Architecture and Best Practicesfor additional information about the HARD initiative.

Page 15: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 15

Copyright © 2006, Oracle. All rights reserved.1 - 15

Role of Data Guard in a High-Availability Architecture

Datachanges

System changes

• Online schema anddata reorganization

• Partitioned tablesand indexes

• Dynamic resourceprovisioning

• Rolling patch updates• Rolling release upgrade

using Data GuardSQL Apply

Planneddowntime

Role of Data Guard in a High-Availability Architect ure (continued)

There are a number of features in Oracle Database to support planned downtime that encompasses data changes. Tables can be redefined without interruption to users who are viewing or updating the data. Indexes can be added, rebuilt, or defragmented while the tables that they index are being queried or updated. See the Oracle Database Administrator’s Guidefor additional information about these features.

Oracle Database dynamically accommodates a number of hardware configuration changes.

Patches can be applied to a RAC system in a rolling fashion.

Oracle Database 10g supports the installation of database software upgrades (and the application of patchsets) in a rolling fashion by using Data Guard SQL Apply.

Page 16: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 16

Copyright © 2006, Oracle. All rights reserved.1 - 16

Oracle Data Guard and Real Application Clusters

Oracle Data Guard and Real Application Clusters are complementary and can be used together.• Real Application Clusters provides high availabilit y.• Oracle Data Guard provides disaster protection and

prevents data loss.

Oracle Data Guard and Real Application Clusters

RAC provides the following for high availability:• Rapid and automatic recovery from node failures or an instance crash• Increased scalability

Oracle Data Guard provides disaster protection and prevents data loss by:• Maintaining transactionally consistent copies of the primary database• Protecting against data corruption• Protecting against user errors• Not requiring expensive and complex mirroring of hardware or software

RAC is covered in greater detail in the lesson titled “Using Data Guard in a Real Application Clusters Configuration.”

Page 17: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 17

Copyright © 2006, Oracle. All rights reserved.1 - 17

Maximum Availability Architecture

RAC productiondatabase

RAC physicalstandby database

Oracle Application

Server

Oracle Application

Server

WAN traffic manager

Clients

Data Guard RAC logical

standby database

Maximum Availability Architecture

RAC and Data Guard provide the basis for the database maximum availability architecture (MAA) solution. MAA provides a comprehensive architecture for reducing downtime for scheduled outages and preventing, detecting, and recovering from unscheduled outages. The recommended MAA has two identical sites. The primary site contains the RAC database, and the secondary site contains both a physical standby database and a logical standby database on RAC.

Identical site configuration is recommended to ensure that performance is not sacrificed after a failover or switchover. Symmetric sites also enable processes and procedures to be kept the same between sites, making operational tasks easier to maintain and execute.

For more information about MAA, refer to the Oracle Database High Availability Overview manual.

This course focuses on the Data Guard component of MAA.

Page 18: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 18

Copyright © 2006, Oracle. All rights reserved.1 - 18

Summary

In this lesson, you should have learned how to:• Describe the basic components of Oracle Data Guard• Describe the differences between physical and logic al

standby databases• Determine when Oracle Data Guard is an appropriate

solution in your Oracle Database configuration• Explain the use of Data Guard in high-availability

architectures

Page 19: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 19

Copyright © 2006, Oracle. All rights reserved.1 - 19

Practice 1: Overview

This practice covers the following topics:• Reviewing the factors that affect planned and

unplanned downtime• Reviewing the differences between physical and logi cal

standby databases• Reviewing the components of Oracle Data Guard

Page 20: Data Guard Slides Study Guide_shahul
Page 21: Data Guard Slides Study Guide_shahul

2Copyright © 2006, Oracle. All rights reserved.

Understanding the OracleData Guard Architecture

Page 22: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 22

Copyright © 2006, Oracle. All rights reserved.2 - 22

Objectives

After completing this lesson, you should be able to do the following:• Describe the Data Guard architecture• Explain the operational requirements of Data Guard• Describe how Data Guard processes, transports, and

applies redo logs• Describe standby database modes

Page 23: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 23

Copyright © 2006, Oracle. All rights reserved.2 - 23

Data Guard Operational Requirements: Hardware and Operating System

• The hardware can be different for the primary and standby databases.

• The operating system and platform architecture for the primary and standby databases must be the same.

• The operating system releases for the primary and standby databases can be different.

• If all databases are on the same system, verify tha t the OS allows you to mount more than one database with the same name.

Hardware and Operating System Requirements

These are the operational requirements for Data Guard with respect to the hardware and the operating system:

• The hardware for the primary and standby database systems can be different. For example, the number of CPUs, the memory size, and the storage configuration can differ.

• The operating system and platform architecture for the primary and standby databases must be the same.

• The operating system on both databases must be the same, but the operating system release does not need to be the same. Note: Standby databases can use a different directory structure from the primary database.

• If both the primary and the standby databases are on the same server, you must ensure that the operating system allows you to mount two databases with the same name on the same system simultaneously. There are certain parameters that must be specified to support this configuration, as discussed in the lesson titled “Creating a Physical Standby Database by Using SQL.”

Page 24: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 24

Copyright © 2006, Oracle. All rights reserved.2 - 24

Data Guard Operational Requirements: Oracle Database Software

• Same release of Oracle Database Enterprise Edition must be installed for all databases.

• SYSDBAprivileges are required for the accounts used to manage the database instances.

• Each database must have its own control file.• Primary database must operate in ARCHIVELOGmode.• Enable FORCE LOGGINGon the primary database before

taking data file backups for standby creation.• If any databases use ASM and/or OMF, all should use

the same combination.

Oracle Database Software Requirements

These are the operational requirements for Data Guard with respect to Oracle Database software:• You must install the same release of Oracle Database Enterprise Edition for the primary

database and all standby databases in your Data Guard configuration.• You must have SYSDBAsystem privileges for the user accounts that you use to manage the

primary and standby database instances. Furthermore, the SYSuser must have the same password on all databases in the configuration.

• The primary database and each standby database must have their own control files.• The primary database must be configured in ARCHIVELOGmode.

Page 25: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 25

Oracle Database Software Requirements (continued)• Some data definition language (DDL) statements permit the NOLOGGINGclause, which

causes some database operations not to generate redo records in the database redo log. The NOLOGGINGsetting can speed up operations that can be easily recovered outside of the database recovery mechanisms, but it can negatively affect media recovery and standby databases. You can enable FORCE LOGGINGto force the writing of redo records even when NOLOGGINGhas been specified in DDL statements. To protect against unlogged direct writes in the primary database that cannot be propagated to the standby database, enable FORCE LOGGINGon the primary database before taking data file backups for standby creation. You should maintain FORCE LOGGINGmode as long as the standby database is active.

• If you use Oracle Automatic Storage Management (ASM) and Oracle Managed Files (OMF) in a Data Guard configuration, you should use ASM and OMF symmetrically on the primary and standby database. If any database in your Data Guard configuration uses ASM, OMF, or both, then every database in the configuration should use ASM, OMF, or both, respectively.

Page 26: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 26

Copyright © 2006, Oracle. All rights reserved.2 - 26

Oracle Data Guard: Architecture

LGWR

Primary database

transactions

Onlineredologs

ARC0

FAL

RFS

MRP or LSP

Archived redo logs

ARC0

Standbydatabase

Reports

(MRP only)

Standbyredo logs

Archived redo logs

BackupOra

cle

net

LNSn

(Real-time apply)

Oracle Data Guard: Architecture

Oracle Data Guard leverages the existing database redo generation architecture to keep the standby databases in the configuration synchronized with the primary database. By using the existing architecture, Oracle Data Guard minimizes its impact on the primary database.

Oracle Data Guard uses several processes to achieve the automation that is necessary for disaster recovery and high availability. Some of these processes existed before the introduction of Data Guard; others were created specifically to support Oracle Data Guard. These processes are discussed in more detail on the next few pages.

Page 27: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 27

Copyright © 2006, Oracle. All rights reserved.2 - 27

Primary Database Flow

LGWR

Primary database

transactions

Onlineredologs

ARC0

FAL

RFS

MRP or LSP

Archived redo logs

ARC0

Standbydatabase

Reports

(MRP only)

Standbyredo logs

Archived redo logs

BackupOra

cle

net

LNSn

(Real-time apply)

Primary Database Flow

On the primary database, Data Guard redo transport services use the following processes:• Log writer (LGWR) process: LGWR collects transaction redo information and updates the

online redo logs. In synchronous mode, it ships redo information directly to the remote file server (RFS) process on the standby database and waits for a confirmation before proceeding. In asynchronous mode, it ships the redo information directly but does not wait before proceeding. In asynchronous mode, LGWR submits the network I/O request to the network server (LNSn) process for that destination.

• Archiver (ARC n) process: ARCn, or a SQL session performing an archival operation, creates a copy of the online redo logs locally for use in a primary database recovery. The ARCn process may also ship the redo stream to the RFS process while simultaneously archiving the online log. ARCn is also responsible for proactively detecting and resolving gaps on all standby databases.

• Fetch archive log (FAL) (physical standby databases only): FAL provides a client/server mechanism for resolving gaps detected in the range of archived redo logs that are generated at the primary database and received at the standby database. This process is started only when needed and shuts down as soon as it is finished. It is very likely you will not see this process running.

Note: You can configure a primary database to ship redo information to a single standby database by using either LGWR or ARCn, but not both.

Page 28: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 28

Copyright © 2006, Oracle. All rights reserved.2 - 28

Standby Database Flow

LGWR

Primary database

transactions

Onlineredologs

ARC0

FAL

RFS

MRP or LSP

Archived redo logs

ARC0

Standbydatabase

Ora

cle

net

Reports

(MRP only)

Standbyredo logs

Archived redo logs

Backup

LNSn

(Real-time apply)

Standby Database Flow

On the standby database, Data Guard log apply services use the following processes:• Remote file server (RFS) process: RFS receives redo information from the primary

database. RFS can write the redo into standby redo logs or directly to archived redo logs. Each LNSn and ARCn process from the primary database has its own RFS process. Note: The use of standby redo logs is discussed in more detail later in the lesson.

• Archiver (ARC n) process: The ARCn process archives the standby redo logs. • Managed recovery process (MRP): For physical standby databases only, MRP applies

archived redo log information to the physical standby database. If you start the managed recovery with the ALTER DATABASE RECOVER MANAGED STANDBY DATABASESQL statement, this foreground session performs the recovery. If you use the optional DISCONNECT [FROM SESSION]clause, the MRP background process starts. If you use Data Guard broker to manage your standby databases, the broker always starts the MRPbackground process for a physical standby database.

• Logical standby process (LSP): For logical standby databases only, LSP controls the applying of archived redo log information to the logical standby database.

Page 29: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 29

Copyright © 2006, Oracle. All rights reserved.2 - 29

Standby Redo Logs

Redo from primary database

RFS ARC0

Standbyredo logs

Archivedredo logs

MRP/LSP

Standby database

Standby Redo Logs

A standby redo log is used only when the database is in the standby role to store redo data received from the primary database. Standby redo logs form a separate pool of log file groups.

Configuring standby redo log files is highly recommended on all standby databases in a Data Guard configuration, including the primary database to aid in role reversal.

A standby redo log is required to implement:• The maximum protection and maximum availability levels of data protection • Real-time apply • Cascaded redo log destinations

Standby redo logs are recommended for maximum performance data protection mode.

Unless you are using the real-time apply feature, standby redo logs must be archived before the data can be applied to the standby database. The standby archival operation occurs automatically.

Note: The real-time apply feature is discussed in more detail later in this lesson.

Page 30: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 30

Copyright © 2006, Oracle. All rights reserved.2 - 30

Physical Standby Database: Redo Apply Architecture

Physical standby database

Primary database

Productiondatabase

Physical standbydatabase

Redoapply

Redo stream

Redotransport

Backup

Data Guard Redo Apply: Architecture

The Data Guard physical standby Redo Apply architecture consists of:• A production (primary) database, which is linked to one or more standby databases (up to

nine) that are identical copies of the production database - The limit of nine standby databases is imposed by the LOG_ARCHIVE_DEST_n

parameter. In Oracle Database 10g, the maximum number of destinations is 10. One is used as the local archive destination, leaving the other nine for uses such as the standby database. Note: You can use the Cascaded Redo Log Destinations feature to incorporate more than nine standby databases in your configuration. Refer to the lesson titled “Other Considerations for Oracle Data Guard” for additional information about this feature.

- The primary database is open and active. The standby databases are either in recovery mode or open in read-only mode, but not both.

Page 31: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 31

Data Guard Redo Apply: Architecture (continued)

• The standby database, which is updated by redo that is automatically shipped from the primary database. The redo can be shipped because it is generated or archived on the primary database.

- Redo is applied to each standby database by using standard Oracle recovery techniques.- During planned downtime, you can perform a switchover to a standby database.- When a failure occurs, you may perform a failover to one of the standby databases. - The physical standby database can also be used to back up the primary database.

Page 32: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 32

Copyright © 2006, Oracle. All rights reserved.2 - 32

Logical Standby Database:SQL Apply Architecture

Primarydatabase

Redo transport

Transform redo information into

SQL

SQL Apply

Reports

Productiondatabase

Logical standbydatabase

Logical standby database

Data Guard SQL Apply: Architecture

In a logical standby database configuration, Data Guard SQL Apply uses redo information shipped from the primary system. However, instead of using media recovery to apply changes (as in the physical standby database configuration), archived redo log information is transformed into equivalent SQL statements by using LogMiner technology. These SQL statements are then applied to the logical standby database. The logical standby database is open in read/write mode and is available for reporting capabilities.

Page 33: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 33

Copyright © 2006, Oracle. All rights reserved.2 - 33

Redo records

LCRLCR

:

Shared pool

Transaction groups

Transactions sorted in

dependency order

Log Mining

Apply processing

Logical change records not grouped into transactions

Transactions to be applied

Reader Preparer Builder

AnalyzerCoordinatorApplier

Data files

Redo data from primary database

SQL Apply Process: Architecture

SQL Apply Process: Architecture

SQL Apply uses a collection of parallel execution servers and background processes that apply changes from the primary database to the logical standby database as follows:

• The reader process reads redo records from the archived redo log files. • The preparer processes convert the block changes into table changes or logical change

records (LCRs). At this point, the LCRs do not represent any specific transactions.• The builder process assembles completed transactions from the individual LCRs.• The analyzer process examines the records, possibly eliminating transactions and identifying

dependencies between the different transactions. • The coordinator process (LSP):

- Assigns transactions- Monitors dependencies between transactions and coordinates scheduling- Authorizes the commitment of changes to the logical standby database

• The applier process: - Applies the LCRs to the database- Asks the coordinator process to approve transactions with unresolved dependencies (the

transactions are scheduled appropriately so that the dependencies are resolved) - Commits the transactions

Page 34: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 34

Copyright © 2006, Oracle. All rights reserved.2 - 34

Real-Time Apply

RFS

Standbyredo log

files

MRP or LSP

ARC0

Primary database

Standby database

Archivedredo log

files

Real-Time Apply

When you enable the optional real- time apply feature, log apply services apply the redo data from standby redo log files in real time (at the same time the log files are being written to) as opposed to recovering redo from archived redo log files when a log switch occurs. If for some reason the apply service is unable to keep up (for example, if you have a physical standby in READ ONLYmode for a period of time), then the apply service automatically goes to the archived redo log files as needed. The apply service also tries to catch up and go back to reading the standby redo log files as soon as possible.

Real-time application of redo information provides a number of benefits, including quicker switchover and failover operations, instantly up-to-date results after you change a physical standby database to read-only, up-to-date reporting from a logical standby database, and the ability to leverage larger logs files.

Having larger log files with real-time apply is desirable because the apply service stays with a log longer and the overhead of switching has less impact on the real-time apply processing.

The RECOVERY_MODEcolumn of the V$ARCHIVE_DEST_STATUSview contains the value MANAGED REAL TIME APPLYwhen log apply services are running in real- time apply mode.

Page 35: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 35

Real-Time Apply (continued)If you define a delay on a destination (with the DELAYattribute) and use real- time apply, the delay is ignored.

For physical standby databases, the managed recovery process (MRP) applies the redo from the standby redo log files after the remote file server (RFS) process finishes writing. To start real- time apply for a physical standby database, issue the following command:

ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE;

For logical standby databases, the logical standby process (LSP) applies the redo from the standby redo log files after the RFS process finishes writing. To start real- time apply for a logical standby database, issue the following command:

ALTER DATABASE START LOGICAL STANDBY APPLY IMMEDIATE;

Note: Standby redo log files are required for real-time apply. It is highly recommended that you have one more standby redo log group than the number of online log groups on the primary database.

Real-time apply is supported by the broker.

Page 36: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 36

Copyright © 2006, Oracle. All rights reserved.2 - 36

Setting the DB_UNIQUE_NAMEParameter

DB_UNIQUE_NAME = SF1_DB

San Francisco

SF1_DB

Setting the DB_UNIQUE_NAMEParameter

Data Guard identifies all the databases in its configuration by using the DB_UNIQUE_NAMEinitialization parameter. Choose a unique name for each database and assign it with this parameter. TheDB_UNIQUE_NAMEvalue must remain constant for a given database. Therefore, you should choose names that are easy for you to remember and identify, and you should not change the names after you have assigned them.

Each DB_UNIQUE_NAMEvalue can be up to 30 characters long and must be the same for all instances in a RAC database.

The default is the database name. If you use Enterprise Manager to create a standby database, it sets this to a unique value for the new standby database.

Page 37: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 37

Copyright © 2006, Oracle. All rights reserved.2 - 37

Specifying Role-Based Destinations

Primarydatabase

Standbydatabase

LOG_ARCHIVE_DEST_2= location= "/u01/app/oracle/oradata/orcldg2/arc", valid_for=(STANDBY_LOGFILE,STANDBY_ROLE)DB_UNIQUE_NAME = HRDB2

Not used

Specifying Role-Based DestinationsThe VALID_FORattribute of the LOG_ARCHIVE_DEST_n initialization parameter allows you to identify exactly when the archive destination is to be used, as well as for which type of log file it is used. The attribute uses a keyword pair to identify the source of the archival as well as the database role.

In the example in the slide, there is a destination on the standby database and the primary database defined with the VALID_FORsetting shown. This destination is to be used on the standby database only after a switchover, when the standby becomes a primary. The destination on the old primary is ignored when it becomes a standby.

You supply two values for the VALID_FORattribute: archival_source and database_role.

The archival_source keywords are the following:• ONLINE_LOGFILE: This destination is used only when archiving online redo log files.• STANDBY_LOGFILE: This destination is used only when archiving standby redo log files or

receiving archive logs from another database. • ALL_LOGFILES: This destination is used when archiving either online or standby redo log

files.

Page 38: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 38

Specifying Role-Based Destinations (continued)The database_role keywords are the following:

• PRIMARY_ROLE: This destination is used only when the database is in the primary database role.

• STANDBY_ROLE: This destination is used only when the database is in the standby (logical or physical) role.

• ALL_ROLES: This destination is used when the database is in either the primary or standby (logical or physical) role.

Note: Because the keywords are unique, the archival_source and database_rolevalues can be specified in any order. For example, VALID_FOR=(PRIMARY_ROLE,ONLINE_LOGFILE) is functionally equivalent to VALID_FOR=(ONLINE_LOGFILE,PRIMARY_ROLE).

Page 39: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 39

Copyright © 2006, Oracle. All rights reserved.2 - 39

Combinations for VALID_FOR

ValidValidValidALL_LOGFILES, ALL_ROLES

ValidValidIgnoredALL_LOGFILES, STANDBY_ROLE

IgnoredIgnoredValidALL_LOGFILES, PRIMARY_ROLE

ValidValidIgnoredSTANDBY_LOGFILE, ALL_ROLES

ValidValidIgnoredSTANDBY_LOGFILE,STANDBY_ROLE

Ignored

Ignored

Ignored

Physical

ValidValidONLINE_LOGFILE, ALL_ROLES

ValidIgnoredONLINE_LOGFILE, STANDBY_ROLE

IgnoredValidONLINE_LOGFILE, PRIMARY_ROLE

LogicalPrimaryCombination

Combinations for VALID_FOR

In the table, the word Valid means that the archive log destination is used in a database that is in the role defined by the column heading. The Ignoredvalue means the archive log destination is not appropriate and a destination of this type is ignored. An ignored destination does not generate an error.

ALL_LOGFILES, ALL_ROLES is not a recommended setting for a logical standby for any destination. Because a logical standby is an open database that is creating its own redo, there is a real possibility of having the log files overwrite each other. This gives you a system that is unrecoverable and/or unable to keep synchronized with the primary database.There is only one invalid combination: STANDBY_LOGFILE, PRIMARY_ROLE. If this is specified, it causes an error for all database roles. If this is set, you receive the following error at startup:

ORA-16026: The parameter LOG_ARCHIVE_DEST_n contain s an invalid attribute value

Note: Both the single and plural forms of the keywords are valid. For example, you can specify either PRIMARY_ROLEor PRIMARY_ROLES, and ONLINE_LOGFILE or ONLINE_LOGFILES.

Page 40: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 40

Copyright © 2006, Oracle. All rights reserved.2 - 40

Identifying Destination Settings

SQL> SELECT DEST_ID,VALID_TYPE,VALID_ROLE,VALID_NOW

2 FROM V$ARCHIVE_DEST;

DEST_ID VALID_TYPE VALID_ROLE VALID_NOW

------- --------------- ------------ --------------

1 ALL_LOGFILES ALL_ROLES YES

2 STANDBY_LOGFILE STANDBY_ROLE WRONG VALID_TYPE

3 ONLINE_LOGFILE STANDBY_ROLE WRONG VALID_ROLE

4 ALL_LOGFILES ALL_ROLES UNKNOWN

5 ALL_LOGFILES ALL_ROLES UNKNOWN

6 ALL_LOGFILES ALL_ROLES UNKNOWN

7 ALL_LOGFILES ALL_ROLES UNKNOWN

8 ALL_LOGFILES ALL_ROLES UNKNOWN

9 ALL_LOGFILES ALL_ROLES UNKNOWN

10 ALL_LOGFILES ALL_ROLES UNKNOWN

11 ALL_LOGFILES ALL_ROLES YES

11 rows selected.

Identifying Destination SettingsThe VALID_NOWcolumn in V$ARCHIVE_DESTindicates whether or not the archive log destination is used. The column values are the following:

• YES: This value indicates that the archive log destination is appropriately defined for the current database role.

• WRONG VALID_TYPE: This value indicates that the archive log destination is appropriately defined for the current database role but cannot be used. For example, LOG_ARCHIVE_DEST_2is set to (STANDBY_LOGFILES,STANDBY_ROLE), but WRONG VALID_TYPEis returned because this standby destination does not have a standby redo log implemented.

• WRONG VALID_ROLE: This value indicates that the archive log destination is not appropriately defined for the current database role. For example, LOG_ARCHIVE_DEST_3is set to (ONLINE_LOGFILES,STANDBY_ROLE), but WRONG VALID_ROLEis returned because this destination is currently running in the primary database role.

• UNKNOWN: This value indicates that the archive log destination is not defined.

The VALID_TYPE and VALID_ROLEcolumns are the respective values from the VALID_FORattribute that is specified for each archive log destination.

Page 41: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 41

Copyright © 2006, Oracle. All rights reserved.2 - 41

Standby Redo Log Configuration

Redo shipment

RFS

Standbyredo logs

Onlineredo logs

Primarydatabase

Standbydatabase

Standby Redo Log Configuration

You must create at least the same number of standby redo log files as are contained on the primary database. It is highly recommended that you have one more standby redo log group than you have online redo log groups as the primary database. In addition, the files must be the same size or larger than the primary database’s online redo logs. If your online redo log files are of different sizes, the RFS process automatically uses the same size standby redo log as the online redo log file.

The RFS process writes to an archive redo log file if any of the following conditions are met:• There are no standby redo logs.• It cannot find the same size standby redo log as the incoming online redo log file.• All of the standby redo logs of the correct size have not yet been archived.

Page 42: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 42

Copyright © 2006, Oracle. All rights reserved.2 - 42

Using SQL to Add Standby Redo Logs

• Use the ALTER DATABASEstatement to create the standby redo log files:

• Add members to a group with the following statement :

• View information about the groups as follows:

SQL> ALTER DATABASE ADD STANDBY LOGFILE MEMBER 2 '/oracle/oradata/orcl/log2b.rdo' TO GROUP 2;

SQL> ALTER DATABASE ADD STANDBY LOGFILE2 ('/oracle/oradata/orcl/log1c.rdo',3 '/oracle/oradata/orcl/log2c.rdo') SIZE 500K;

SQL> SELECT * FROM v$standby_log;SQL> SELECT * FROM v$logfile

2 WHERE type = 'STANDBY';

Using SQL to Add Standby Redo LogsYou can create standby redo logs by using the ADD STANDBY LOGFILEclause of the ALTERDATABASEstatement. Although standby redo logs are used only when the database is operating in the standby role, you should create standby redo logs on the primary database so that switching roles does not require additional DBA intervention.

To verify that standby redo logs have been created, query V$STANDBY_LOGor V$LOGFILEwith SELECT * FROM v$logfile WHERE type = 'STANDBY' .

The standby redo log status is shown as ACTIVE or UNASSIGNED.

The following is an example of output from V$STANDBY_LOG:SQL> SELECT group#,status,first_change#

2 FROM v$standby_log;GROUP# STATUS FIRST_CHANGE#------ ---------- -------------

3 ACTIVE 1445454 UNASSIGNED 05 UNASSIGNED 0

Page 43: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 43

Copyright © 2006, Oracle. All rights reserved.2 - 43

Using Enterprise Managerto Add Standby Redo Logs

Using Enterprise Manager to Add Standby Redo Logs

When you create a standby configuration with Enterprise Manager, it recommends a configuration of standby redo logs. This recommendation includes creating the standby redo logs on the primary database as well as on any standby databases in the configuration.

Configuring standby redo logs is covered in more detail in the lesson titled “Creating a Configuration and Physical Standby Database by Using Enterprise Manager.”

Page 44: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 44

Copyright © 2006, Oracle. All rights reserved.2 - 44

Standby Database Modes

You can maintain the standby data in one of the fol lowing modes:• For physical standby databases

– Redo Apply– Open read-only mode

• For logical standby databases– Open read/write mode

Standby Database Modes

You can use log apply services to maintain your physical standby database in one of the following modes:

• Redo Apply: In this mode, redo transport services archive the logs to the standby database, and log apply services automatically apply these logs. The database is in the MOUNTstate; no reads of the data are possible.

• Open read-only mode:If you want to use the standby database for reporting purposes, then open it in read-only mode in a Data Guard environment. Log apply services cannot apply archived redo logs to the standby database when it is in this mode, but the primary database continues to ship redo to the standby database.

You can easily change between managed recovery mode and read-only mode. In most implementations of a Data Guard environment, you may want to make this transition at various times so that you can do one of the following:

• Update a physical standby database that is used primarily for reporting• Ensure that data is correctly applied to a physical standby database that is used primarily for

disaster protection

Page 45: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 45

Standby Database Modes (continued)

• Open read/write mode:In this mode, log apply services continue to manage the application of log information from archived redo logs. In addition, the database is open for reporting.

The logs are being applied to the logical standby database while users are allowed to perform queries on the tables that are being updated by the log apply service. Users are not allowed to perform DML on the tables in the schemas that the log apply service is maintaining. However, users can modify database objects in other schemas that are not being maintained by the log apply service.

Page 46: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 46

Copyright © 2006, Oracle. All rights reserved.2 - 46

Summary

In this lesson, you should have learned how to desc ribe the following:• Data Guard architecture processes• Operational requirements of a Data Guard environmen t• How Data Guard processes, transports, and applies

redo logs• Modes of standby databases and when to use each

mode

Page 47: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 47

Copyright © 2006, Oracle. All rights reserved.2 - 47

Practice 2-1: Architecture Review

This practice covers the following topics:• Reviewing the Oracle Data Guard architecture• Reviewing the processes that Data Guard uses to

transport and apply redo logs• Reviewing the modes that are used to recover a

primary database

Page 48: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 48

Copyright © 2006, Oracle. All rights reserved.2 - 48

Practice 2-2: Installing the Oracle Management Agent

This practice covers the following topics:• Installing the Oracle Management Agent• Configuring monitoring credentials for your databas e

Page 49: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 49

Copyright © 2006, Oracle. All rights reserved.2 - 49

Practice 2-3: Configuring Your Primary Database

This practice covers the following topics:• Reviewing your primary database configuration • Configuring your primary database in preparation fo r

creating a Data Guard configuration

Page 50: Data Guard Slides Study Guide_shahul
Page 51: Data Guard Slides Study Guide_shahul

3Copyright © 2006, Oracle. All rights reserved.

Using Data Guard Brokerand Enterprise Manager

Page 52: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 52

Copyright © 2006, Oracle. All rights reserved.3 - 52

Objectives

After completing this lesson, you should be able to do the following:• Describe the Data Guard broker architecture• Describe the Data Guard broker components• Explain the benefits of the Data Guard broker• Explain Data Guard broker configurations• Use Enterprise Manager to manage your Data Guard

configuration• Invoke DGMGRL to manage your Data Guard

configuration

Page 53: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 53

Copyright © 2006, Oracle. All rights reserved.3 - 53

Features of Data Guard Broker

• The 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 through easy-to-use interfaces: – Oracle Enterprise Manager 10 g Grid Control– A command-line interface: DGMGRL

Features of Data Guard Broker

The Oracle Data Guard broker is a distributed management framework that automates and centralizes the creation, maintenance, and monitoring of Data Guard configurations. The following are some of the operations that the broker automates and simplifies:

• Automated creation of Data Guard configurations incorporating a primary database, a new or existing (physical or logical) standby database, redo transport services, and log apply servicesNote: Any of the databases in the configuration can be a RAC database.

• Adding up to eight new or existing (physical or logical, RAC or non-RAC) standby databases to each existing Data Guard configuration, for a total of one primary database, and from one to nine standby databases in the same configuration

• Managing an entire Data Guard configuration (including all databases, redo transport services, and log apply services) through a client connection to any database in the configuration

• Invoking switchover or failover with a single command to initiate and control complex role changes across all databases in the configuration

• Monitoring the status of the entire configuration, capturing diagnostic information, reporting statistics such as the log apply rate and the redo generation rate, and detecting problems quickly with centralized monitoring, testing, and performance tools

Page 54: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 54

Copyright © 2006, Oracle. All rights reserved.3 - 54

Data Guard Broker: Components

• Client-side:– Oracle Enterprise Manager 10 g Grid Control– DGMGRL (command-line interface)

• Server-side: Data Guard monitor– DMONprocess

– Configuration files

Data Guard Broker: Components

The Oracle Data Guard broker consists of components that reside on the client and the server in the configuration.

On the client, you can use the following Data Guard components to define and manage a configuration:

• Oracle Enterprise Manager• DGMGRL, which is the Data Guard command- line interface (CLI)

On the server, Data Guard monitor is a broker component that is integrated with the Oracle database. Data Guard monitor comprises the Data Guard monitor process (DMON) and broker configuration files, with which you can control the databases of that configuration, modify their behavior at run time, monitor the overall health of the configuration, and provide notification of other operational characteristics.

The configuration file contains profiles that describe the states and properties of the databases in the configuration. Associated with each database are various propertiesthat the DMONprocess uses to control the database’s behavior. The properties are recorded in the configuration file as a part of the database’s object profile that is stored there. Many database properties are used to control database initialization parameters related to the Data Guard environment.

Page 55: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 55

Copyright © 2006, Oracle. All rights reserved.3 - 55

Data Guard Broker: Configurations

The most common configuration is a primary database at one location and a standby database at another loca tion.

Chicago

Primary site

Boston

Standby site

Oracle Net

Data Guard Broker: Configurations

A Data Guard configuration consists of one primary database and up to nine standby databases. The databases in a Data Guard configuration are typically dispersed geographically and are connected by Oracle Net.

A Data Guard broker configuration is a logical grouping of the primary and standby databases in a Data Guard configuration. The broker’s DMONprocess configures and maintains the broker configuration components as a unified group of resource objects that you can manage and monitor as a single unit.

Page 56: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 56

Copyright © 2006, Oracle. All rights reserved.3 - 56

Data Guard Broker: Management Model

Data Guard Broker Configuration

Primary database

Broker-controlled databases

Standby databaseStandby database

Standby databaseStandby database

Standby databaseStandby database

Standby databaseStandby database

Standby database

InstancesInstances

Data Guard Broker: Management Model

The Data Guard broker performs operations on logical objects:• Configuration of databases• A single database

A broker configuration consists of:• A configuration object: A named collection of database profiles. A database profileis a

description of a database object, including its current state, current status, and properties. • Database objects: Objects corresponding to primary or standby databases • Instance objects: A database object may comprise one or more instance objects if it is a RAC

database.

The broker supports one or more Data Guard configurations, each of which includes a profile for one primary database as well as profiles for up to nine physical, logical, RAC or non-RAC standby databases.

Page 57: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 57

Copyright © 2006, Oracle. All rights reserved.3 - 57

Primary site

Standby site 9

Standby site 2

Data Guard Broker: Architecture

Graphical user interfaceor

command-line interface

DMON

Archivedredo logs

Onlineredo logs

Standby site 1

OracleNet

Standbyredo logs

Archivedredo logs

Logapply

services

Data Guard Configuration

Logtransportservices

Primary database

DMON

Configurationfiles

Configurationfiles Standby

database

Data Guard Broker: Architecture

The Data Guard broker helps you create, control, and monitor a Data Guard configuration. This configuration consists of a primary database that is protected by one or more standby databases. After the broker has created the Data Guard configuration, the broker monitors the activity, health, and availability of all systems in the Data Guard configuration.

The Data Guard monitor process (DMON) is an Oracle background process that runs on every site that is managed by the broker. When you start the Data Guard broker, a DMONprocess is created.

When you use Enterprise Manager or the Data Guard command- line interface (CLI), the DMONprocess is the server-side component that interacts with the local instance and the DMONprocesses that are running on other sites to perform the requested function. The DMONprocess is also responsible for monitoring the health of the broker configuration and for ensuring that every site has a consistent copy of the configuration files in which the DMONprocess stores its configuration data. There are two multiplexed versions of the configuration file on each site.

Page 58: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 58

Copyright © 2006, Oracle. All rights reserved.3 - 58

Life Cycle of a Broker Configuration

Createconfiguration

Enableconfiguration

Make state orrole changes

Update databaseproperties

Monitor and tuneconfiguration

Life Cycle of a Broker Configuration

You can use the Add Standby Database Wizard in Enterprise Manager to add an existing standby database to the configuration or create a new standby database and add it to the configuration. The standby database can be either a physical or a logical database.

Note: If you are creating a new database, it must be a non-RAC database.

If you are using the CLI, the primary database and standby database must already exist. You must construct the standby database from backups of the primary database control files and data files, and then prepare it for recovery.

Page 59: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 59

Copyright © 2006, Oracle. All rights reserved.3 - 59

Data Guard Broker: Requirements

• Enterprise Edition of Oracle Database 10 g• Single-instance or multi-instance environment• COMPATIBLEmust be set to 9.2.0.1.0 or higher for

primary and standby databases.• Oracle Net network files must be configured for

databases that you add to the configuration.• LOCAL_LISTENERon each instance must resolve to an

address that is reachable by all members.• GLOBAL_DBNAMEattribute must be set to a

concatenation of: db_unique_name_DGMGRL.db_domain

Data Guard Broker: Requirements

To use the Data Guard broker, you must comply with the following requirements:• You must use the Enterprise Edition of Oracle Database 10g.• You can use a single- instance or multi- instance environment.• You must set the COMPATIBLEinitialization parameter to 9.2.0.1.0 or higher for the

primary and standby databases. To take advantage of new Oracle Database 10g features, set the COMPATIBLEparameter to 10.2.0.0.

• Enterprise Manager automatically configures the Oracle Net network files when it creates a standby database. If you configure an existing standby database in the broker configuration, you must configure the network files. You must use TCP/IP.

• The value of the LOCAL_LISTENERinitialization parameter on each instance that is part of your Data Guard broker configuration must resolve to a listener address that is reachable by all members of the configuration.

• To enable the Data Guard broker CLI to restart instances during the course of broker operations, a service with a specific name must be statically registered with the local listener of each instance. The value of the GLOBAL_DBNAMEattribute must be set to a concatenation of db_unique_name_DGMGRL.db_domain .

Note: Oracle Enterprise Manager 10g can manage a 9.2 Data Guard configuration.

Page 60: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 60

Copyright © 2006, Oracle. All rights reserved.3 - 60

Data Guard Broker: Requirements

• DG_BROKER_START = TRUE

• The primary database must be in ARCHIVELOGmode.• All databases must be in MOUNTor OPENmode.• Configure DG_BROKER_CONFIG_FILEn for any RAC

databases.• START_OPTIONSfor any RAC databases must be set to

MOUNTin the Oracle Cluster Repository (OCR).

Data Guard Broker: Requirements (continued)• You must set the DG_BROKER_STARTinitialization parameter to TRUE. This enables the

DMONprocess. Note: When you use Enterprise Manager to create your configuration, this parameter is automatically set to TRUE.

• The primary database must be in ARCHIVELOGmode.• Any database that is managed by the broker (including, for a RAC database, all instances of

the database) must be mounted or open. The broker cannot start an instance.• If any database in your configuration is a RAC database, you must configure the

DG_BROKER_CONFIG_FILEn initialization parameters for that database so that they point to the same shared files for all instances of that database. You cannot use the default values for these parameters. Note: The shared files could be files on a cluster file system, if available, or on raw devices.

• If any database in your configuration is a RAC database, the START_OPTIONSfor that database must be set to MOUNTin the Oracle Cluster Repository (OCR) using SRVCTL, as follows:SRVCTL ADD DATABASE -d <db_unique_name> -o <$ORACLE_HOME>-s MOUNT

orSRVCTL MODIFY DATABASE -d <db_unique_name> -o <$ORACLE_HOME> -s MOUNT

Page 61: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 61

Copyright © 2006, Oracle. All rights reserved.3 - 61

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 database parameter values.

Data Guard Broker and the SPFILE

To ensure that the broker can update the values of parameters both in the database instance and in the configuration file, you must use the persistent server initialization parameter file (SPFILE) to control static and dynamic initialization parameters. Use of the SPFILE gives the broker a mechanism that enables it to reconcile property values that you have selected when using the broker with any related initialization parameter values that are recorded in the SPFILE. Also, the SPFILE permits persistent Data Guard settings, so that Data Guard continues to work even after the broker is disabled.

When you set definitions or values for database properties in the broker configuration, the broker records the change in the configuration file and also propagates the changes to the related initialization parameters in the server parameter file in the Data Guard configuration.

When the configuration is enabled, the broker keeps the database property values in the Data Guard configuration file consistent with the values of the database initialization parameters in the SPFILE.

Even when the configuration is disabled, you can update database property values through the broker. The broker retains the property settings (without validating the values) and updates the database initialization parameters in the SPFILE and the in-memory settings the next time you enable the broker configuration.

Page 62: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 62

Data Guard Broker and the SPFILE (continued)

For dynamic initialization parameters, the broker keeps the value of the database parameter consistent in the System Global Area (SGA) for the instance, in the Data Guard configuration files, and in the SPFILE.

For static initialization parameters, the value in the SGA may differ from what is in the configuration files and in the SPFILE. Typically, the broker reconciles the differences by updating all parameter and property values the next time the database instance is stopped and restarted.

Note: When using the broker (with Enterprise Manager or the CLI), do not attempt to manually set the parameters that the broker controls. If you set them manually, either you render your configuration inoperable, or the broker simply resets the parameter to the setting it has recorded at the next opportunity. If you want to change a parameter value, you must change it by using one of the broker interfaces.

Page 63: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 63

Copyright © 2006, Oracle. All rights reserved.3 - 63

Data Guard Monitor: DMONProcess

• 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 DMONprocesses in the

configuration• Updates the configuration file

Data Guard Monitor: DMONProcess

The Data Guard monitor comprises two components: the DMONprocess and the configuration file.

The Data Guard Monitor process (DMON) is an Oracle background process that is part of each database instance managed by the broker. When you start the Data Guard broker, a portion of the SGA is allocated and a DMONprocess is created. The amount of memory allocated is typically less than 50 KB per site; the actual amount on your system varies.

When you use Enterprise Manager or the CLI, the DMONprocess is the server-side component that interacts with the local instance and the DMONprocesses running on other sites to perform the requested function.

The DMONprocess is also responsible for monitoring the health of the broker configuration and for ensuring that every database has a consistent copy of the broker configuration files in which the DMONprocess stores its configuration data.

Page 64: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 64

Copyright © 2006, Oracle. All rights reserved.3 - 64

Data Guard Monitor: Configuration File

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

• Override default path name and file name by setting DG_BROKER_CONFIG_FILEn .

• Two files at each managed site• Managed automatically by the DMONprocess• Default names are dr1<db_unique_name>.dat and

dr2<db_unique_name>.dat.

• Default locations are operating system specific:– Default location for UNIX and Linux: ORACLE_HOME/dbs

– Default location for Windows: ORACLE_HOME\database

Data Guard Monitor: Configuration FileThe DMONprocess maintains persistent configuration data about all the databases in the broker configuration in a broker configuration file. Every database that is part of the Data Guard broker configuration has two broker configuration files that are maintained and synchronized for each database in the broker configuration. One of the files is in use and the other acts as a backup. The configuration files are binary files and cannot be edited.

When the broker is started for the first time, the configuration files are created and named automatically by using a default name. You can override this default name by setting the DG_BROKER_CONFIG_FILEn initialization parameters. You can also change the configurationfile names dynamically by issuing the ALTER SYSTEMSQL statement.

The configuration files contain entries that describe the state and properties of the databases in the configuration. For example, the files record the databases that are part of the configuration, the roles and properties of each of the databases, and the state of each of the databases in the configuration. Two files are maintained so that there is always a record of the last known valid state of the configuration. The broker uses the data in the configuration file to configure and start the databases, control each database’s behavior, and provide information to the CLI and Enterprise Manager.

Page 65: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 65

Copyright © 2006, Oracle. All rights reserved.3 - 65

Benefits of Using the Data Guard Broker

• Enhances the high-availability, data protection, an d 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

• Helps you logically define and create a Data Guard configuration consisting of a primary database and a standby database

• Enables easy configuration of additional standby databases

Benefits of Using the Data Guard Broker

By automating the tasks required to configure and monitor a Data Guard configuration, the broker enhances the high-availability, data protection, and disaster protection capabilities that are inherent in Oracle Data Guard.

If the primary database fails, the broker streamlines the process for any one of the standby databases to replace the primary database and take over production processing.

Using the broker, you can logically define and create a Data Guard configuration consisting of a primary database and a (physical or logical, RAC or non-RAC) standby database.

The broker enables easy configuration of additional standby databases. After you create a Data Guard configuration consisting of a primary and a standby database, you can add up to eight standby databases (new or existing, physical or logical) to each Data Guard configuration.

Page 66: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 66

Copyright © 2006, Oracle. All rights reserved.3 - 66

Benefits of Using the Data Guard Broker

• Provides simplified, centralized, and extended management

• Automates switchover and failover to a specified standby database in the broker configuration

• Automatically communicates between the databases in a Data Guard configuration using Oracle Net Service s

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

Benefits of Using the Data Guard Broker (continued)

The broker provides simplified, centralized, and extended management.

The broker automates switchover and failover to a specified standby database in the broker configuration.

The broker automatically communicates between the databases in a Data Guard configuration using Oracle Net Services. The database can be local or remote, connected by a LAN or geographically dispersed over a WAN.

The broker provides built- in validation that monitors the health of all the databases in the configuration.

Page 67: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 67

Copyright © 2006, Oracle. All rights reserved.3 - 67

Data Guard Broker Interfaces

• Oracle Enterprise Manager 10 g Grid Control:– Contains wizards to simplify creating and managing

standby databases

• Command-line interface (CLI):– Started by entering DGMGRLat the command prompt

where the Oracle server is installed– Enables you to control and monitor a Data Guard

configuration from the CLI prompt or in scripts

Data Guard Broker Interfaces

Oracle Enterprise Manager automates and simplifies the management of a Data Guard configuration.

Oracle Enterprise Manager 10g Grid Control includes the following Data Guard features:• Wizard-driven creation of standby databases• Wizard-driven creation of a broker configuration based on an existing primary and standby

database• Complete monitoring and proactive event reporting through e-mail or pagers• Simplified control of the databases through their potential states. For example, with

Enterprise Manager you can take a database offline, put it online, start or stop the redo transport services, start or stop the log apply services, place a standby database in read-only mode, and so on.

• “Pushbutton” switchover and failover: Grid Control enables you to execute a switchover or failover between a primary and a standby database by simply clicking a button.

Page 68: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 68

Data Guard Broker Interfaces (continued)

The DGMGRL command- line interface (CLI) includes:• Configuration and setup tasks• Management and control of the configuration• Commands to check the status and health of the configuration• Commands to execute role changes

For additional information about using these interfaces, see Oracle Data Guard Broker.

Page 69: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 69

Copyright © 2006, Oracle. All rights reserved.3 - 69

Using Oracle Enterprise Manager 10 gGrid Control

Click “Setup and Manage” to access the Data Guard pages.

Using Oracle Enterprise Manager 10 g Grid Control

Access the Data Guard features in Grid Control by performing the following steps:1. Click the Targets tab to go to the Targets page.2. Click Databases to go to the Databases page.3. On the Databases page, you can see a list of all discovered databases, including the primary

database. Click the primary database to go to the primary database home page.4. Click Maintenance.5. Click “Setup and Manage’’ in the Data Guard section.

Page 70: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 70

Copyright © 2006, Oracle. All rights reserved.3 - 70

Data Guard Overview Page

Data Guard Overview Page

On the Data Guard Overview page, you can:• View the protection mode and access the page to edit the protection mode• View a summary showing the amount of data that the standby has not received• View information about the primary database• View or access pages to change information for the standby databases:

- Add a standby database to the broker configuration.- Change the state or properties.- Discontinue Data Guard broker control.- Switch the role from standby to primary.- Transition the standby database to the role of primary database.

• Access pages to view performance information for the configuration and status of online redo log files for each standby database

• Perform a verification process on the Data Guard configuration

You can click Help to access information about using each page.

Note: The Data Guard Overview page is displayed when you click “Setup and Manage” in the Data Guard section of the database Maintenance page.

Page 71: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 71

Copyright © 2006, Oracle. All rights reserved.3 - 71

Enterprise Manager Metrics and Alerts

• Metrics: Units of measurement used to assess the health of your system

• Thresholds: Boundary values against which monitored metric values are compared

• Alert: Generated when a threshold is reached

Enterprise Manager Metrics and Alerts

Metricsare units of measurement that are used to assess the health of your system. Each target comes with a predefined set of metrics. Metrics have thresholds associated with them.

Thresholdsare boundary values against which monitored metric values are compared. Some of the thresholds are predefined by Oracle; others are not.

When a threshold is reached, an alert is generated. An alert is an indicator signifying that a particular condition has been encountered. An alert is triggered when one of the following conditions is true:

• A threshold is reached• An alert has been cleared• The availability of a monitored service changes• A specific condition occurs. For example, an alert is triggered whenever an error message is

written to a database alert log file.

Alerts are detected through a polling-based mechanism by checking for the monitored condition from a separate process at regular, predefined intervals.

You can associate an alert with a notification, with the automatic execution of a job, and so on.

Page 72: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 72

Copyright © 2006, Oracle. All rights reserved.3 - 72

Using Data Guard Metrics

Enterprise Manager includes the following Data Guar d metrics:• Data Guard Fast-Start Failover• Data Guard Fast-Start Failover

Observer• Data Guard Performance• Data Guard Status

Using Data Guard Metrics

You can use Enterprise Manager to monitor the status and log file activity. In addition, Enterprise Manager automatically monitors the status and archived redo log file activity on the primary and standby databases and provides the following metrics:

• Data Guard Fast-Start Failover: When Fast-Start Failover is enabled, this metric generates a critical alert on the new primary database (old standby database) if a fast-start failover occurs.

• Data Guard Fast-Start Failover Observer:This metric shows you the current status of the Fast-Start Failover observer. A down status triggers an alert.

• Data Guard Performance:This metric provides alerts for performance related to redo log activity in the configuration.

• Data Guard Status:This metric checks the status of each database in the broker configuration and triggers a warning or critical alert if necessary.

You can set up Email Services to notify you with an e-mail message if any of the metrics are triggered. Refer to the Oracle Data Guard Broker 10g Release 2 (10.2)reference manual for detailed information.

Note: These metrics are seen on the primary database only.

Page 73: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 73

Copyright © 2006, Oracle. All rights reserved.3 - 73

Managing Data Guard Metrics

1. Configure notification methods.2. View the All Metrics page.3. Set or change Data Guard metric thresholds.4. View triggered metrics.

Managing Data Guard Metrics

You can specify that an e-mail notification be sent to you when a Data Guard metric is triggered. Use the following procedure to configure the notification:

1. Configure notification methods in Enterprise Manager.a. Click Setup at the top of the Database Home page.b. Click Notification Methods on the Setup page.c. Enter the appropriate information in the Mail Server section and click Apply. You can

click Test Mail Servers to verify your configuration.2. View the All Metrics page by clicking All Metrics in the Related Links section on the

Database Home page. Then, view all the Oracle Enterprise Manager metrics, including the metrics for Data Guard.

3. Set or change Data Guard metric thresholds by clicking Metric and Policy Settings in the Related Links section on the All Metrics page to access the Metric and Policy Settings page. You can set and change the Data Guard Status metric on the Metrics Thresholds tab of the Metric and Policy Settings page.

4. View triggered metrics: If a metric condition is triggered or a threshold value is exceeded, an alert is issued. Click Data Guard on the All Metrics page to view triggered metrics. You can click the metric and then click a particular database to see details.

Page 74: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 74

Copyright © 2006, Oracle. All rights reserved.3 - 74

Benefits of Using Enterprise Manager

• Enables you to manage your configuration using a familiar interface and event-management system

• Automates and simplifies the complex operations of creating and managing standby databases through the use of wizards

• Performs all Oracle Net Services configuration chan ges that are necessary to support redo transport servic es and log apply services

• Provides a verify operation to ensure that redo transport services and log apply services are configured and functioning properly

• Enables you to select a new primary database from a set of viable standby databases

Benefits of Using Enterprise Manager

Managing your Data Guard configuration with Oracle Enterprise Manager 10g Grid Control provides the following benefits:

• Enables you to manage your configuration using the familiar Enterprise Manager interface and event-management system

• Provides a wizard that automates the complex tasks involved in creating a broker configuration

• Provides the Add Standby Database Wizard to guide you through the process of adding more databases

• Performs all Oracle Net Services configuration changes that are necessary to support redo transport services and log apply services across the configuration

• Provides a verify operation to ensure that redo transport services and log apply services are configured and functioning properly

• Enables you to select a new primary database from a set of viable standby databases when you need to initiate a role change for a switchover or failover operation

Page 75: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 75

Copyright © 2006, Oracle. All rights reserved.3 - 75

Using the Command-Line Interfaceof the Data Guard Broker

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

ConfigurationName: EDRSR8P1_ORCL.oracle.comEnabled: YESProtection Mode: MaxPerformanceFast-Start Failover: DISABLEDDatabases:

EDRSR8P1_ORCL - Primary databaseEDRSR8P1_SITE1 - Physical standby databaseEDRSR8P1_SITE2 - Logical standby database

Current status for "EDRSR8P1_ORCL.oracle.com":SUCCESS

DGMGRL Commands

The following commands are available in DGMGRL (the Data Guard CLI). Many of these commands have additional arguments that are not described here. This is simply an overview listing.

• ADD: Adds a standby database to the broker configuration• CONNECT: Connects a given username to the specified instance• CREATE: Enables you to create broker configurations• DISABLE: Enables you to disable broker control of a configuration or database so that the

object is no longer managed by the broker• EDIT : Used to edit a configuration, database, or instance• ENABLE: Enables you to enable broker control of a configuration or database• EXIT/QUIT : Exits the Data Guard CLI (DGMGRL)• FAILOVER: Performs a database failover operation in which one of the standby databases

changes to the role of primary database. This is an unplanned transition that may result in the loss of application data.

• HELP: Displays online help for the commands in DGMGRL• REINSTATE: Changes a disabled database into a viable standby database• REMOVE: Removes a broker configuration, including all of its database profiles, a specified

standby database profile, or knowledge of an instance

Page 76: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 76

DGMGRL Commands (continued)• SHOW: Displays either a brief or a detailed summary of information about the broker

configuration, database, or instance. Also, it can display the dependency tree and default online states for the broker configuration, as well as the configuration log or the Oracle database alert log.

• SHUTDOWN: Shuts down a currently running Oracle database instance• START: Starts the Fast-Start Failover Observer• STARTUP: Starts an Oracle instance with several options, including mounting and opening a

database• STOP: Stops the Fast-Start Failover Observer• SWITCHOVER: Performs a switchover operation in which the current primary database

becomes a standby database and the standby database to which the CLI is currently connected becomes the primary database

Note: The ALTERcommand has been deprecated in Oracle Database 10g. The new EDITcommand provides comparable functionality.

Page 77: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 77

Copyright © 2006, Oracle. All rights reserved.3 - 77

Summary

In this lesson, you should have learned how to:• Describe the Data Guard broker management model• Describe the Data Guard broker architecture• Describe Data Guard broker components• Access Enterprise Manager• Invoke DGMGRL (the Data Guard CLI)

Page 78: Data Guard Slides Study Guide_shahul
Page 79: Data Guard Slides Study Guide_shahul

4Copyright © 2006, Oracle. All rights reserved.

Creating a Configuration and Physical Standby Database by Using Enterprise

Manager

Page 80: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 80

Copyright © 2006, Oracle. All rights reserved.4 - 80

Objectives

After completing this lesson, you should be able to do the following:• Enable FORCE LOGGING

• Use Enterprise Manager to create a broker configuration

• Use Enterprise Manager to monitor the broker configuration

Page 81: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 81

Copyright © 2006, Oracle. All rights reserved.4 - 81

Enabling FORCE LOGGINGMode

• Forced logging is recommended to ensure data consistency.

• FORCE LOGGINGforces redo to be generated even when NOLOGGINGoperations are executed.

• Temporary tablespaces and temporary segments are not logged.

• FORCE LOGGINGis recommended for both physical and logical standby databases.

• Issue the following command on the primary database :

SQL> ALTER DATABASE FORCE LOGGING;

Enabling FORCE LOGGINGMode

FORCE LOGGINGmode determines whether or not the Oracle database server logs all changes in the database, except for changes to temporary tablespaces and temporary segments. The [NO]FORCE LOGGINGclause of the ALTER DATABASEcommand contains the following settings:

• FORCE LOGGING: This setting takes precedence over (and is independent of) any NOLOGGINGor FORCE LOGGINGsettings that you specify for individual tablespaces and any NOLOGGINGsetting that you specify for individual database objects. All ongoing, unlogged operations must finish before forced logging can begin.

• NOFORCE LOGGING: Places the database in NOFORCE LOGGINGmode. This is the default.

The FORCE_LOGGINGcolumn in V$DATABASEcontains a value of YES if the database is in FORCE LOGGINGmode.

Page 82: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 82

Enabling FORCE LOGGINGMode (continued)

Although the database can be placed in FORCE LOGGINGmode when the database is OPEN, the mode does not change until any operation that is currently running in NOLOGGINGmode has completed. Therefore, it is recommended that you enable FORCE LOGGINGmode when the database is in the MOUNTstate.

Note: You should enable FORCE LOGGINGbefore performing the backup operation to create the standby database, and then maintain FORCE LOGGINGmode for as long as the standby database is active.

Page 83: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 83

Copyright © 2006, Oracle. All rights reserved.4 - 83

Using Enterprise Manager to Create a Broker Configuration

• Use the Add Standby Database Wizard to:– Create a broker configuration– Add a database to a broker configuration

• Primary database must be started with an SPFILE.

Using Enterprise Manager to Create a Broker Configu ration

Enterprise Manager automates the process of creating a standby database. The Add Standby Database Wizard is used to create a new broker configuration and to add databases to an existing configuration.

Before you invoke the Add Standby Database Wizard, verify that the primary database instance was started with a server parameter file (SPFILE). If the instance was not started with an SPFILE, the wizard notifies you.

Page 84: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 84

Copyright © 2006, Oracle. All rights reserved.4 - 84

Creating a Configuration

Click “Add Standby Database”to start the wizard.

Creating a Configuration

You can access the Data Guard features in Enterprise Manager by clicking Setup and Manage in the Data Guard section of the Maintenance page.

If your primary database is not already in a broker configuration, an information page appears with this indication. Click the Add Standby Database link to invoke the Add Standby Database Wizard.

Using the Add Standby Database Wizard, you perform the following steps:1. Specify the backup type to use for the standby database creation.2. Specify the backup options.3. Select the Oracle home in which to create the standby database.4. Specify the location for standby database files.5. Specify standby database configuration parameters.6. Review the configuration information.

Page 85: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 85

Creating a Configuration (continued)

During the standby creation process, the following operations are performed:• The control file, data files, and archived redo log files are backed up to a temporary location

on the primary host.• The backup pieces from the primary host are transferred to a temporary location on the

standby host.• Additional required files, such as initialization parameter and password, are created on the

standby host.• The control file, data files, and archived redo log files are restored to the specified locations

on the standby host.• Online log files and other files are added to the standby database as needed.• The recovered database is changed into a physical or logical standby.

Page 86: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 86

Copyright © 2006, Oracle. All rights reserved.4 - 86

Using the Add Standby Database Wizard

Using the Add Standby Database Wizard

The Add Standby Database Wizard begins by asking you to select the type of standby database that you want to create. You can create a new physical or logical standby database. Or you can add an existing database, including a RAC database, to the configuration to serve as a standby database.

Note: You must be connected to the primary database with SYSDBAcredentials to invoke the Add Standby Database Wizard.

If you choose to create a new standby database, the following conditions are verified when you click Continue:

• All databases in the configuration are using a server parameter file (SPFILE).• The primary database is in ARCHIVELOGmode.• The COMPATIBLEinitialization parameter for the primary database has a setting

of 9.0 or higher.

If any of these conditions are not met, the wizard returns a message indicating that you must cancel the wizard and perform the appropriate action to meet the condition.

In addition, the wizard verifies that the primary database is inFORCE LOGGINGmode. If it is not in FORCE LOGGINGmode, a warning message appears. You can then cancel the configuration and enable FORCE LOGGING(as described earlier in this lesson).

Page 87: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 87

Copyright © 2006, Oracle. All rights reserved.4 - 87

Step 1: Specify the Backup Type

Step 1: Specify the Backup Type

You can use the Backup Type page of the wizard to select the type of backup for creation of the standby database:

• “Perform a live backup of the primary database”: Creates a new backup using the Recovery Manager utility (RMAN)

• “Use a backup from a previous standby database creation”: Uses an existing backup of the primary database that was created by Data Guard during a previous creation of a standby database

Page 88: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 88

Copyright © 2006, Oracle. All rights reserved.4 - 88

Step 2: Specify the Backup Options

Step 2: Specify the Backup Options

If you selected the “Perform a live backup of the primary database” option on the Backup Type page, you can specify a location on the primary database host to store the backup files. A default location is specified in the Backup Files Directory Location field, or you can provide your own location. A unique subdirectory to store the backup files is created in the specified directory.

If you intend to create additional standby databases, you can save the backup by selecting the “Retain directory for a future standby creation” option. Otherwise, you should select the “Delete directory after standby creation” option. Note

• If you choose to retain the backup, additional space is required (as indicated on the Backup Options page). If you selected the “Use a backup from a previous standby database creation” option on the Backup Type page, specify the location of the backup in the Backup Files Directory Location field.

• This backup must have been taken by Data Guard during a previous standby database creation and must be of the same type that you are creating.Specify the operating system credentials of the user who owns the primary database Oracle server installation in the Primary Host Credentials section.

• The credentials are preset to the host-preferred credentials that are stored with the primary database-preferred credentials by default.

Page 89: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 89

Copyright © 2006, Oracle. All rights reserved.4 - 89

Step 3: Select the Standby Database Location Instance Name

Step 3: Select the Database Location Instance Name

Specify the instance name for your new standby database in the Instance Name field, or use the default instance name that is provided. The instance name must conform to Oracle naming guidelines.

Note: For a physical standby, the database name is the same as the primary. This is because a physical standby is an exact, block-by-block copy of the primary. You can make the instance name the same as the primary. However, you must make the instance name different from the primary if the standby is on the same machine as the primary.

In the Standby Host Credentials section, specify the operating system credentials of the user who owns the Oracle installation in the selected Oracle home on the standby host.

Page 90: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 90

Copyright © 2006, Oracle. All rights reserved.4 - 90

Step 3: Select the Standby Database Location Oracle Home

Step 3: Select the Standby Database Location Oracle Home

The Standby Database Location section lists all the available Oracle homes that match the primary database version and host operating system. From this list, select the host and Oracle home for your new standby database.

Page 91: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 91

Copyright © 2006, Oracle. All rights reserved.4 - 91

Step 4: Specify the Standby Database File Locations Access Method

Step 4: Specify the Standby Database File Locations Access Method

The Standby Host Backup File Access section appears only when you are creating a standby database on a host other than the primary database. You must select a method to be used to make the primary backup files accessible to the standby host.

• Transfer files: If you choose to transfer files from the primary host working directory to a standby host directory, you must specify a temporary location on the standby host to store the backup files copied from the primary host. In addition, you must select the file transfer method: FTP or HTTP server. FTP is the faster of the two file transfer methods. Select the HTTP Server option if you know that the primary or standby host does not support FTP.

• Directly access the files:If you select this method, you must supply the network path name for the standby host. This method is appropriate when the primary host working directory location is directly accessible from the standby host via NFS, a network share, or some other network method. This option saves time and disk space because there is no file transfer to the standby host and because no temporary location is needed.

Page 92: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 92

Copyright © 2006, Oracle. All rights reserved.4 - 92

Step 4: Specify the Standby Database File Locations File Locations

Step 4: Specify the Standby Database File Locations File Locations

By default, all standby database files are placed in an Oracle Optimal Flexible Architecture (OFA) directory structure when your primary and standby databases are on the same host.

When your primary and standby databases are on different hosts, you can specify that you want to convert the standby files to an OFA structure or keep the file names and locations the same as the primary database. You can optionally change the locations of individual standby database files by clicking the Customize button to display the File Locations Customize page of the wizard.

Data Guard automatically adds configuration information for the new standby database to the listener.ora and tnsnames.ora files in the directory that is specified in the Configuration File Location field in the Network Configuration File Location section. The default location is the network administration directory for the standby database’s Oracle home. The default location is correct for most configurations. You can specify a different directory if you want the new standby database to be serviced by a listener running in a different Oracle home on the standby host.

Page 93: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 93

Copyright © 2006, Oracle. All rights reserved.4 - 93

Step 5: Specify Standby Database Configuration Parameters

Step 5: Specify Standby Database Configuration Para meters

On the Standby Configuration page of the wizard, you can specify configuration parameters for the standby database. The parameters that must be specified depend on whether you are adding an existing standby database, creating a new physical standby database, or creating a new logical standby database. The configuration parameters include the instance name, service provider name, target name, and standby archive location. The default values are based on corresponding primary database settings.When you create a new physical database, the following parameters must be configured:

• Database Unique Name:Specify a value for the database DB_UNIQUE_NAMEparameter. This name must be unique within the Data Guard configuration. Note: This field appears only if you are creating a new physical standby database and the primary database is an Oracle10g database.

• Target Name:Specify a name for Enterprise Manager to use for the new standby database. This name will appear in the list of database targets maintained by Enterprise Manager. This name should be the same as the database unique name.

Page 94: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 94

Copyright © 2006, Oracle. All rights reserved.4 - 94

Step 6: Review the Configuration Information

Step 6: Review the Configuration Information

The Review page of the wizard displays a summary of your selections and lists the parameters to be used to create the new standby database.

The new standby database is created in the background by an Oracle Enterprise Manager job. The name of the job that is submitted is provided at the top of the page.

When you click Finish, the Processing page appears. This page tracks each step through the submission of the standby creation job. After the job submission is complete, the Data Guard Overview page appears, where you can monitor the progress of the standby creation job.

Page 95: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 95

Copyright © 2006, Oracle. All rights reserved.4 - 95

Standby Database Creation: Processing

Standby Database Creation: Processing

You can view the progress of the Add Standby Database process on the Processing page. On completion of the process, Oracle Enterprise Manager displays the Data Guard Overview page.

The display on the Processing page differs based on whether you are adding an existing standby database or creating a new standby database. An arrow icon indicates which step is being processed. When it completes, a check icon appears next to the step.

The following steps appear on the Processing page:• Creating Data Guard Configuration or Updating Data Guard Configuration: The Data

Guard configuration is created during this step if it does not exist. If you are adding an existing standby database, it is added to the configuration.

• Preparing standby creation job: This step appears only if you are creating a new standby database. The standby database is actually created by an Enterprise Manager job; preliminary setup steps to prepare for job submission are accomplished in this step. You can cancel the Add Standby Database process at any point up to the completion of this step.

Page 96: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 96

Standby Database Creation: Processing (continued)

• Submitting standby creation job: This step appears only if you are creating a new standby database. The Enterprise Manager job that creates the standby database in the background is submitted in this step. The Add Standby Database process cannot be canceled once this step begins.

• Adding standby database target:In this step, the standby database target in Enterprise Manager is updated with additional information denoting membership in the Data Guard configuration. This enables enhanced summary information to be displayed on the Enterprise Manager home page of the standby database.

Page 97: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 97

Copyright © 2006, Oracle. All rights reserved.4 - 97

Standby Database Creation: Progress

Click “Creation in progress”to view the job.

Standby Database Creation: Progress

After the job is submitted, you return to the Data Guard Overview page. The Data Guard Status column indicates that the standby database creation is in progress. Click the “Creation in progress” link to access the job page and monitor the progress of the creation of the standby database.

Page 98: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 98

Copyright © 2006, Oracle. All rights reserved.4 - 98

Standby Database Creation: Job Details

Standby Database Creation: Job Details

You can monitor creation of the standby database by viewing the details on the job progress page.

Page 99: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 99

Copyright © 2006, Oracle. All rights reserved.4 - 99

Verifying a Configuration

Click “Verify Configuration.”

Verifying a Configuration

After you create your configuration, you should use the Data Guard Verify operation to check the configuration. You can invoke the Verify operation by clicking Verify Configuration in the Additional Administration section of the Data Guard page. When you invoke the Verify operation, a series of validation checks is performed on the Data Guard configuration, including a health check of each database and each agent. The Verify operation does the following:

• Determines the current data protection mode settings, including the current redo transport mode settings for each database and whether or not the standby redo logs are configured properly. If standby redo logs are needed for any database, a message indicates this on the Detailed Results page. You can then add the standby redo logs.

• Validates each database for the current status • Performs a log switch on the primary database (for non-RAC databases) and verifies that the

log was applied on each standby database• Checks the agent status for each database. The verify process executes a SQL*Plus job on the

agent if credentials are available. If credentials are not available to run the job, the agent is pinged instead. If any errors occur during this process, a message appears on the Detailed Results page.

• Displays the results of the Verify operation, including any errors Note: You can cancel the Verify operation at any time by clicking Cancel.

Page 100: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 100

Copyright © 2006, Oracle. All rights reserved.4 - 100

Reviewing Results of the Verify Operation

Reviewing Results of the Verify Operation

You can view the results of the Verify operation on the Detailed Results page. If any errors occur during the operation, detailed information appears on this page.

Page 101: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 101

Copyright © 2006, Oracle. All rights reserved.4 - 101

Creating Standby Redo Logs

Creating Standby Redo Logs

If standby redo log files are needed for any of the databases, a message appears. You can click OK to create the standby redo logs.

As discussed in the lesson titled “Understanding the Oracle Data Guard Architecture,” standby redo logs should be configured on all databases in a configuration, including the primary database.

Page 102: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 102

Copyright © 2006, Oracle. All rights reserved.4 - 102

Viewing the Data Guard Configuration Status

Viewing the Data Guard Configuration Status

On the Data Guard page, you can view the status of the primary database and the standby databases in a configuration.

Page 103: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 103

Copyright © 2006, Oracle. All rights reserved.4 - 103

Viewing Data Guard Performance

Viewing Data Guard Performance

You can click Performance Overview in the Performance section of the Data Guard Overview page to access the Performance Overview page.

The Performance Overview page displays detailed performance-related statistics for the Data Guard configuration. The performance charts provide a graphical summary of all redo log activity in the configuration. You can set the collection interval (which causes the charts to be refreshed) to determine the rate of sampling of the primary database in the View Data field.

The Performance Overview page displays performance information for all the databases in the configuration as follows:

• Redo Generation Rate:Shows the redo generate rate in KB per second• Lag Time: Shows the approximate amount of potential data loss• Apply Rate: Displays the data applied on each standby database in the configuration. Each

point on the chart represents the amount of redo data that has been applied since the last time it was refreshed.

You can click any of the charts to obtain historical information.

Page 104: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 104

Copyright © 2006, Oracle. All rights reserved.4 - 104

Summary

In this lesson, you should have learned how to:• Enable FORCE LOGGING

• Use Enterprise Manager to create a configuration• Use Enterprise Manager to monitor the configuration

Page 105: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 105

Copyright © 2006, Oracle. All rights reserved.4 - 105

Practice 4: Overview

This practice covers the following topics:• Logging in to Oracle Enterprise Manager 10 g

Grid Control• Using the wizard to create a Data Guard broker

configuration with a physical standby database• Verifying the configuration

Page 106: Data Guard Slides Study Guide_shahul
Page 107: Data Guard Slides Study Guide_shahul

5Copyright © 2006, Oracle. All rights reserved.

Creating a Physical Standby Databaseby Using SQL

Page 108: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 108

Copyright © 2006, Oracle. All rights reserved.5 - 108

Objectives

After completing this lesson, you should be ableto use SQL commands to create a physical standby database.

Page 109: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 109

Copyright © 2006, Oracle. All rights reserved.5 - 109

Steps to Create a Physical Standby Database

1. Prepare the primary database.2. Back up the primary database.3. Copy files to the standby system.4. Set parameters on the physical standby database.5. Start the standby database.6. Configure Oracle Net Services.7. Set parameters on the primary database.8. Start the transport of redo.

Steps to Create a Physical Standby Database

Perform the following steps to create a physical standby database by using SQL commands:1. Prepare the primary database.2. Back up the primary database.3. Copy files to the standby system.4. Set parameters on the physical standby database.5. Start the standby database.6. Configure Oracle Net Services.7. Set parameters on the primary database.8. Start the transport of redo.

Page 110: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 110

Copyright © 2006, Oracle. All rights reserved.5 - 110

Preparing the Primary Database

• Enable FORCE LOGGINGat the database level.

• Create a password file.• Set initialization parameters.• Enable archiving.

SQL> ALTER DATABASE FORCE LOGGING;

SQL> SHUTDOWN IMMEDIATE;SQL> STARTUP MOUNT;SQL> ALTER DATABASE ARCHIVELOG;SQL> ALTER DATABASE OPEN;

Preparing the Primary DatabaseThe FORCE LOGGINGmode determines whether or not the Oracle database server logs all changes in the database, except for changes to temporary tablespaces and temporary segments. The FORCE_LOGGINGcolumn in V$DATABASEcontains a value of YES if the database is in FORCE LOGGINGmode.

Every database in a Data Guard configuration must use a password file, and the password for the SYSuser must be identical on every system for redo data transmission to succeed. For details about creating a password file, see Oracle Database Administrator’s Guide.

On the primary database, you define initialization parameters that control redo transport services while the database is in the primary role. There are additional parameters that you need to add that control the receipt of the redo data and log apply services when the primary database is transitioned to the standby role.

If archiving is not enabled, issue the ALTER DATABASE ARCHIVELOGcommand to put the primary database in ARCHIVELOGmode and enable automatic archiving. See Oracle Database Administrator’s Guidefor additional information about archiving.

Page 111: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 111

Copyright © 2006, Oracle. All rights reserved.5 - 111

Setting Initialization Parameters on the Primary Database

Traces redo data transmissionLOG_ARCHIVE_TRACE

Forces a log switch after the specifiednumber of seconds elapses

ARCHIVE_LAG_TARGET

Controls automatic standby file managementSTANDBY_FILE_MANAGEMENT

Converts primary database log file namesLOG_FILE_NAME_CONVERT

Converts primary database file namesDB_FILE_N AME_CONVERT

Specifies the unique database name for each database in the configuration

LOG_ARCHIVE_CONFIG

Specifies destination stateLOG_ARCHIVE_DEST_STATE_n

LOG_ARCHIVE_DEST_n

Parameter Name

Controls redo transport services

Description

Setting Initialization Parameters on the Primary Da tabase

On the primary database, you define initialization parameters that control redo transport services while the database is in the primary role. These parameters are described in more detail on the following pages.

Page 112: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 112

Copyright © 2006, Oracle. All rights reserved.5 - 112

LOG_ARCHIVE_CONFIG

• Specify the DG_CONFIGattribute to list the DB_UNIQUE_NAMEfor the primary database and each standby database in the Data Guard configuration.

• Additional LOG_ARCHIVE_CONFIGparameter values:– SEND: enables a database to send redo data to remote

destinations.– RECEIVE: enables the standby database to receive redo

from another database.– Use the NOSENDand NORECEIVEkeywords to disable

these settings.

DB_NAME=chicagoDB_UNIQUE_NAME=chicagoLOG_ARCHIVE_CONFIG='DG_CONFIG=(chicago,boston)'

LOG_ARCHIVE_CONFIG

Specify the DG_CONFIGattribute on the LOG_ARCHIVE_CONFIGparameter to list the DB_UNIQUE_NAMEof the primary and standby databases in the Data Guard configuration. This setting enables the dynamic addition of a standby database to a Data Guard configuration that has a Real Application Clusters primary database running in either maximum protection or maximum availability mode. By default, the LOG_ARCHIVE_CONFIGparameter enables the database to send and receive redo. After a role transition, you may need to specify these settings again using the SEND, NOSEND, RECEIVE, or NORECEIVEkeywords.

Note: The database must be in MOUNTmode to change the SEND, NOSEND, RECEIVE, or NORECEIVEsettings.

Use the V$DATAGUARD_CONFIGview to see the unique database names defined with the DB_UNIQUE_NAMEand LOG_ARCHIVE_CONFIGinitialization parameters, providing a view of the Data Guard environment from any database in the configuration. The first row of the view lists the unique database name of the current database that was specified with the DB_UNIQUE_NAMEinitialization parameter. Additional rows reflect the unique database names of the other databases in the configuration that were specified with the DG_CONFIGkeyword of the LOG_ARCHIVE_CONFIGinitialization parameter.

Page 113: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 113

LOG_ARCHIVE_CONFIG(continued)

The following example illustrates the use of V$DATAGUARD_CONFIG:

SQL> show parameter log_archive_config

NAME TYPE VALUE------------------- ------- ------------------------- --log_archive_config string dg_config=(EDT3R7P1_SIT E1,EDT3R7P1_SITE2)

SQL> select * from v$dataguard_config;

DB_UNIQUE_NAME------------------------------EDT3R7P1_ORCLEDT3R7P1_SITE1EDT3R7P1_SITE2

Note: The LOG_ARCHIVE_CONFIGinitialization parameter replaces the REMOTE_ARCHIVE_ENABLEinitialization parameter, which will be deprecated in a future release. Do not specify both parameters in the same SPFILE or text initialization parameter file.

Page 114: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 114

Copyright © 2006, Oracle. All rights reserved.5 - 114

LOG_ARCHIVE_DEST_n

• Specify at least two LOG_ARCHIVE_DEST_n parameters.

• Must contain (at a minimum) one of the following:– LOCATION

– SERVICE

• LOG_ARCHIVE_DEST_STATE_n parameter for each defined destination

LOG_ARCHIVE_DEST_2='SERVICE=bostonVALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE)DB_UNIQUE_NAME=boston'LOG_ARCHIVE_DEST_STATE_2=ENABLE

LOG_ARCHIVE_DEST_n

By using the various LOG_ARCHIVE_DEST_n attributes, you define most of the settings for the Data Guard configuration. The redo transport service is directly controlled by these settings. There are 35 different attributes that can be set for each LOG_ARCHIVE_DEST_n parameter. Most have defaults that are adequate for most configurations. See Oracle Data Guard Concepts and Administrationfor a complete list and description of each.

You should specify at least two LOG_ARCHIVE_DEST_n parameters (where n is an integer from 1 to 10): one parameter for the required local archiving destination and another parameter for a standby location. Query the V$ARCHIVE_DESTview to see current settings of the LOG_ARCHIVE_DEST_n initialization parameter.

All LOG_ARCHIVE_DEST_n parameters must contain, at a minimum, either a LOCATION or SERVICE attribute. In addition, you must have a LOG_ARCHIVE_DEST_STATE_n parameter for each defined destination.

Page 115: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 115

Copyright © 2006, Oracle. All rights reserved.5 - 115

LOCATIONand SERVICEAttributes

Each archive log destination includes one of the fo llowing attributes:• LOCATION: specifies a valid path name.• SERVICE: specifies a valid Oracle Net Services name

referencing a standby database.

LOG_ARCHIVE_DEST_1='LOCATION=/arch1/chicago/ VALID_FOR=(ALL_LOGFILES,A LL_ROLES)DB_UNIQUE_NAME=chicago'LOG_ARCHIVE_DEST_2='SERVICE=boston VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ ROLE) DB_UNIQUE_NAME=boston'

LOCATIONand SERVICEAttributes

Each LOG_ARCHIVE_DEST_n destination must specify either the LOCATIONattribute or the SERVICEattribute to identify either a local disk directory or a remote database destination where redo transport services can transmit redo data.LOCATION: Each destination that specifies the LOCATIONattribute must identify a unique directory path name. This is the local destination for archived redo logs.SERVICE: Specifies a valid Oracle Net Services name. This service may be one of the following:

• A standby database (either physical or logical)• An archive log repository, allowing for off-site archiving of redo logs. An archive log

repository is created by using a standby control file, starting the instance, and mounting the database. This destination contains no data files. Note: The Data Guard broker does not support this type of service.

• A cross- instance archival database environment is possible on both the primary and standby databases. In a RAC environment, each instance directs its archived redo logs to a single instance of the cluster. The recovery instance typically has a tape drive available to support RMAN backup and restore operations. Note: The Data Guard broker does not support this type of service.

Note: There are no defaults for these attributes.

Page 116: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 116

Copyright © 2006, Oracle. All rights reserved.5 - 116

LOG_ARCHIVE_DEST_STATE_n

• Defines the current state of an archive log destina tion:– ENABLE (default)– DEFER

– RESET

• Applies to the primary and standby database

log_archive_dest_3='SERVICE=stby1_path1 ALTERNATE=LOG_ARCHIVE_DEST_4'log_archive_dest_4='SERVICE=stby1_path2'log_archive_dest_state_3=ENABLE

LOG_ARCHIVE_DEST_STATE_n

The LOG_ARCHIVE_DEST_STATE_n initialization parameter (where n is an integer from 1 to 10) specifies the state of the corresponding destination that is indicated by the LOG_ARCHIVE_DEST_ninitialization parameter (where n is the same integer). For example, the LOG_ARCHIVE_DEST_STATE_2parameter specifies the state of the LOG_ARCHIVE_DEST_2destination. The following are the valid values:

• ENABLE: specifies that a valid log archive destination can be used for a subsequent archiving operation (automatic or manual). This is the default.

• DEFER: specifies that valid destination information and attributes are preserved but that the destination is excluded from archiving operations until re-enabled.

• RESET: functions similarly to DEFERbut clears any error messages for the destination if it had previously failed.

Page 117: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 117

Copyright © 2006, Oracle. All rights reserved.5 - 117

Specifying Values for DB_FILE_NAME_CONVERT

• Must be defined on standby databases that have different disk or directory structures from the pri mary

• Allows multiple pairs of file names• Applies to a database when in physical standby mode

DB_FILE_NAME_CONVERT =('/oracle1/dba/','/ora1/stby_dba/','/oracle2/dba/','/ora2/stby_dba/')

Specifying Values for DB_FILE_NAME_CONVERT

When the standby database is updated, the DB_FILE_NAME_CONVERTparameter is used to convert the data file name on the primary database to a data file name on the standby database. The file must exist and be writable on the physical standby database; if it is not, then the recovery process halts with an error.

Specify the path name and file name location of the primary database data files followed by the standby location by setting the value of this parameter to two strings. The first string is the pattern found in the data file names on the primary database. The second string is the pattern found in the data file names on the physical standby database. You can use as many pairs of primary and standby replacement strings as required. You can use single or double quotation marks. The parentheses are optional.

In the example in the slide, /oracle1/dba/ and /oracle2/dba/ are used to match for file names coming from the primary database. The strings /ora1/stby_dba/ and /ora2/stby_dba/ are the corresponding ones on the physical standby database.

A file on the primary database named /oracle1/dba/system01.dbf is converted to /ora1/dba/system01.dbf on the standby database.

Note: If the standby database uses Oracle Managed Files (OMF), do not set the DB_FILE_NAME_CONVERTparameter.

Page 118: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 118

Copyright © 2006, Oracle. All rights reserved.5 - 118

Specifying Values for LOG_FILE_NAME_CONVERT

• Similar to DB_FILE_NAME_CONVERT

• Must be defined on standby databases that have different disk or directory structures from the pri mary

• Online redo log files are used only when the standb y becomes a primary.

• Applies to a database when in physical standby mode

LOG_FILE_NAME_CONVERT = ('/oracle1/logs/','/ora1/stby_logs/')

Specifying Values for LOG_FILE_NAME_CONVERT

The LOG_FILE_NAME_CONVERTparameter is used to convert the name of a redo log file on the primary database to the name of a redo log file on the standby database. Adding a redo log file to the primary database requires adding a corresponding file to the standby database. When the standby database is updated, this parameter is used to convert the log file name from the primary database to the log file name on the standby database. This parameter is required if the standby database is on the same system as the primary database or on a separate system that uses different path names.

Specify the location of the primary database online redo log files followed by the standby location. The use of parentheses is optional.

Note: If the standby database uses OMF, do not set the LOG_FILE_NAME_CONVERTparameter.

Page 119: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 119

Copyright © 2006, Oracle. All rights reserved.5 - 119

Specifying a Value for LOG_ARCHIVE_FORMAT

• Indicates the format for redo log file names• Format directives:

– %t: Thread number– %T: Zero-filled thread number– %s: Sequence number– %S: Zero-filled sequence number– %d: Database ID– %D: Zero-filled database ID – %a: Current activation ID– %A: Zero-filled activation ID– %r: Resetlogs ID

• Default value is operating-system dependent.

LOG_ARCHIVE_FORMAT = %d_%t_%s_%r.arc

Specifying a Value for LOG_ARCHIVE_FORMAT

Use a text string and variables to specify the default file name format for archived redo log files. The string that is generated from this format is appended to the string that is specified in the LOG_ARCHIVE_DEST_n and STANDBY_ARCHIVE_DESTparameters.

The thread number refers to the redo thread. With a single instance, this is always 1; with RAC, this corresponds to the order in which the instances were started.

Sequence number is the redo log sequence number. It starts at 0 or 1 and is incremented at each log switch.

The database identifier (database ID) is calculated when the database is created and stored in all file headers. This value is not changed for the life of the database.

The activation number is an internal number that is generated the first time the database is started. Subsequently, it is changed only when the database is opened with the RESETLOGSoption.

The resetlogs ID ensures unique names are constructed for the archived log files across multiple incarnations of the database. If the COMPATIBLEinitialization parameter is set to 10.0 or higher, you must include %r in the LOG_ARCHIVE_FORMATparameter.

The length of the zero-filled versions of these directives is 8 on most platforms.

Page 120: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 120

Copyright © 2006, Oracle. All rights reserved.5 - 120

Specifying a Value for STANDBY_FILE_MANAGEMENT

• Used to maintain consistency when you add or delete a data file on the primary database– MANUAL(default)

— Data files must be manually added to the standby da tabase.

– AUTO— Adds the data file automatically to the standby dat abase— Certain ALTERstatements are no longer allowed on the standby

database.

• Applies to the primary database and physical standb y database

STANDBY_FILE_MANAGEMENT = auto

Specifying a Value for STANDBY_FILE_MANAGEMENT

When STANDBY_FILE_MANAGEMENTis set to AUTO, you cannot execute the following commands on the standby database:

• ALTER DATABASE RENAME• ALTER DATABASE ADD/DROP LOGFILE [MEMBER]• ALTER DATABASE ADD/DROP STANDBY LOGFILE MEMBER• ALTER DATABASE CREATE DATAFILE AS ...

When you add (or drop) a log file to the primary and want to add (or drop) it to the physical standby database as well, you must do the following:

• Set STANDBY_FILE_MANAGEMENTto MANUALon the physical standby database.• Add (or drop) the redo log files on the primary database.• Add (or drop) them to the standby database.• Reset to AUTOafterward on the standby database.

Page 121: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 121

Copyright © 2006, Oracle. All rights reserved.5 - 121

ARCHIVE_LAG_TARGET

• Configure on primary database only• Set to the number of seconds after which a log swit ch

must happen even if the log file is not full• Sets maximum time that a standby database must wait

to process the redo• Default is 0 (disabled)• Range of values: 60 to 7,200• Recommended value: 1,800 (30 minutes)

ARCHIVE_LAG_TARGET = 1800

ARCHIVE_LAG_TARGET

The ARCHIVE_LAG_TARGETparameter defines the mean time to failover in the event your primary database fails and you must fail over to the standby. Although the redo is transmitted to the standby during normal operations, it is not applied to the standby database until the online redo log file on the primary has been completed.

Note: If the real- time apply feature is enabled, log apply services can apply redo data as it is received, without waiting for the current standby redo log file to be archived. Real-time apply is described in detail in the lesson titled “Understanding the Oracle Data Guard Architecture.”

For example, in a configuration where the online redo log file is 100 MB and 80 MB has been written, a failure at this point would mean that the 80 MB of redo must be applied to the standby before the failover can complete. If you need to limit the amount of time it takes to complete the failover, you can define this parameter to force a log switch after a certain amount of time, thereby enabling the redo to be applied.

If you set this parameter to too small a value, the primary database log files switch too often and thus impact performance.

Page 122: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 122

Copyright © 2006, Oracle. All rights reserved.5 - 122

LOG_ARCHIVE_TRACEParameter

• LOG_ARCHIVE_TRACEis optional and is used for diagnostic purposes.

• Set this parameter to an integer value to see the progression of the archiving of redo logs to the standby system.– On the primary database, processes write an audit t rail of

the archived logs sent to the standby system into a trace file.

– On the standby database, processes write an audit t rail of the archived logs received from the primary databas e into a trace file.

• Trace files are located in the directory specified by the USER_DUMP_DESTparameter.

LOG_ARCHIVE_TRACEParameter

You can set this parameter to trace the transmission of redo data to the standby system.

To enable, disable, or modify the LOG_ARCHIVE_TRACEparameter in a primary database, do one of the following:

• Shut down the primary database, modify the initialization parameter file, and restart the database.

• Issue an ALTER SYSTEM SET LOG_ARCHIVE_TRACE=trace_level statement while the database is open or mounted.

If you change the value of this parameter dynamically with an ALTER SYSTEMstatement, the changes take effect at the start of the next archive operation.

Refer to Oracle Data Guard Concepts and Administrationfor additional information.

Page 123: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 123

LOG_ARCHIVE_TRACEParameter (continued)

The integer values for the LOG_ARCHIVE_TRACEparameter represent levels of tracing data. In general, the higher the level, the more detailed the information. You can combine tracing levels by setting the value of the LOG_ARCHIVE_TRACEparameter to the sum of the individual levels. For example, setting the parameter to 6 generates level 2 and level 4 trace output.

The following integer levels are available:

Level Meaning 0 Disables archived redo log tracing (default setting) 1 Tracks archiving of redo log file 2 Tracks archival status per archived redo log destination 4 Tracks archival operational phase 8 Tracks archived redo log destination activity 16 Tracks detailed archived redo log destination activity 32 Tracks archived redo log destination parameter modifications 64 Tracks ARCn process state activity 128 Tracks FAL server process activity 256 Reserved for future use 512 Tracks asynchronous LGWR activity 1024 Tracks RFS physical client 2048 Tracks ARCn or RFS heartbeat 4096 Tracks real-time apply activity 8192 Tracks Redo Apply activity (media recovery or physical

standby)

Page 124: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 124

Copyright © 2006, Oracle. All rights reserved.5 - 124

Example: Setting Initialization Parameters on the Primary Database

DB_NAME=chicagoDB_UNIQUE_NAME=chicagoSERVICE_NAMES=chicagoLOG_ARCHIVE_CONFIG='DG_CONFIG=(chicago,boston)'CONTROL_FILES='/arch1/chicago/control1.ctl', '/arch2/chicago/control2.ctl'LOG_ARCHIVE_DEST_1='LOCATION=/arch1/chicago/VALID_FOR=(ALL_LOGFILES,ALL_ROLES)DB_UNIQUE_NAME=chicago'LOG_ARCHIVE_DEST_2='SERVICE=bostonVALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE)DB_UNIQUE_NAME=boston'LOG_ARCHIVE_DEST_STATE_1=ENABLELOG_ARCHIVE_DEST_STATE_2=ENABLEREMOTE_LOGIN_PASSWORDFILE=EXCLUSIVELOG_ARCHIVE_FORMAT=%t_%s_%r.arc

Setting Initialization Parameters on the Primary Da tabaseIn the example in the slide, assume that the primary database is named chicago and the standby is named boston . For each, there is an Oracle Net Services name defined.

There are additional parameters you need to add that control the receipt of the redo data and log apply services when the primary database is transitioned to the standby role:

FAL_SERVER=bostonFAL_CLIENT=chicagoDB_FILE_NAME_CONVERT='/arch1/boston/','/arch1/chica go/','/arch2/boston/','/arch2/chicago/'LOG_FILE_NAME_CONVERT='/arch1/boston/','/arch1/chic ago/','/arch2/boston/','/arch2/chicago/'STANDBY_FILE_MANAGEMENT=AUTO

Specifying these initialization parameters configures the primary database to resolve gaps, converts new data file and log file path names from a new primary database, and archives the incoming redo data when this database is in the standby role.

Page 125: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 125

Copyright © 2006, Oracle. All rights reserved.5 - 125

Backing Up the Primary Database by Using RMAN

RMAN> BACKUP DATABASE

• Create a backup copy of the primary database.• Use of RMAN is recommended.

Backing Up the Primary Database by Using RMAN

You can use any backup copy of the primary database to create the physical standby database, as long as you have the necessary archived redo log files to completely recover the database. It is recommended that you use Recovery Manager (RMAN).

See Oracle High Availability Architecture and Best Practicesfor backup recommendations and Oracle Database Backup and Recovery Advanced User’s Guidefor additional information about performing the RMAN backup operation.

Page 126: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 126

Copyright © 2006, Oracle. All rights reserved.5 - 126

Creating a Control File for the Standby Database

SQL> ALTER DATABASE CREATE STANDBY CONTROLFILE 2 AS '/tmp/boston.ctl';

Create a control file on the primary database to be used for the standby database:

Creating a Control File for the Standby Database

On the primary database, you create the control file for the standby database. Create the control file by issuing the following command:

ALTER DATABASE CREATE STANDBY CONTROLFILE AS file_name [REUSE];

If the file already exists, you can use the REUSEoption to overwrite it.

Note: You cannot use a single control file for both the primary and standby databases.

Page 127: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 127

Copyright © 2006, Oracle. All rights reserved.5 - 127

Copying Files to the Standby Database System

Copy the following files to the standby database sy stem:• Backup of the data files• Standby control file• Initialization parameter file

Primary Standby

Copying Files to the Standby Database System

After you have successfully backed up the data files and created the standby database control file, copy the files to the standby system by using an operating-system utility. If the physical standby database is on a different system from the primary database, then the directory paths may be the same. If the physical standby database is on the same system as the primary database, you must rename the primary data files in the standby control file after copying them to the standby location.

Page 128: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 128

Copyright © 2006, Oracle. All rights reserved.5 - 128

Oracle Managed Files (OMF) and Automatic Storage Management (ASM)

• OMF: Use same on each database.• ASM: Use the RMAN DUPLICATE … FOR STANDBY

command.

OMF primary

OMF standby

Oracle Managed Files (OMF) and Automatic Storage Ma nagement (ASM)

If the primary database is configured to use OMF, Oracle recommends that the standby database be configured to use OMF as well. To do this, set the DB_CREATE_FILE_DESTand DB_CREATE_ONLINE_LOG_DEST_n initialization parameters to appropriate values. Maintenance and future role transitions are simplified if the same disk group names are used for both the primary and standby databases.

On the standby database, do the following:1. If the standby database is going to use ASM, create an ASM instance if one does not already

exist on the standby database system.2. Use the RMAN BACKUPcommand to create a backup set that contains a copy of the primary

database’s data files, archived log files, and a standby control file.3. Use the RMAN DUPLICATE … FOR STANDBYcommand to copy the data files, archived

redo log files, and standby control file in the backup set to the standby database’s storage area. The DUPLICATE … FOR STANDBYcommand performs the actual data movement at the standby instance.

For more information about OMF and ASM, see the Oracle Database Administrator’s Guide. For more information about the DUPLICATE … FOR STANDBYcommand, see the Oracle Database Recovery Manager Reference.

Page 129: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 129

Copyright © 2006, Oracle. All rights reserved.5 - 129

Setting Initialization Parameters on the Standby Database

DB_NAME=chicagoDB_UNIQUE_NAME=bostonSERVICE_NAMES=bostonLOG_ARCHIVE_CONFIG='DG_CONFIG=(chicago,boston)'CONTROL_FILES='/arch1/boston/control1.ctl', '/arch2/boston/control2.ctl'DB_FILE_NAME_CONVERT= '/arch1/chicago/','/arch1/bos ton/', '/arch2/chicago/','/arch2/boston/'LOG_FILE_NAME_CONVERT='/arch1/chicago/','/arch1/bos ton/', '/arch2/chicago/','/arch2/boston/'LOG_ARCHIVE_FORMAT=log%t_%s_%r.arc

Continued on the next page…

Setting Initialization Parameters on the Standby Da tabase

Create a text initialization parameter file (PFILE) from the server parameter file (SPFILE) that is used by the primary database. A PFILE can be copied to the standby location and modified. Issue the following command to create the PFILE:

SQL> CREATE PFILE='/tmp/initboston.ora' FROM SPFILE ;

Later, you will convert this file back to a SPFILE after it is modified to contain the parameter values that are appropriate for use with the physical standby database.Although most of the initialization parameter settings in the text initialization parameter file that you copied from the primary system are also appropriate for the physical standby database, some modifications need to be made. The lines in italic in the slide indicate the parameters that need to be changed for use with the physical standby. The parameters shown are valid for the bostondatabase when it is running in either the primary or the standby database role.

In addition, ensure that the COMPATIBLE initialization parameter is set to the same value on both the primary and standby databases. If the values differ, redo transport services may be unable to transmit redo data from the primary database to the standby databases. In a Data Guard configuration, COMPATIBLEmust be set to a minimum of 9.2.0.1.0. However, if you want to take advantage of new Oracle Database 10g features, set the COMPATIBLEparameter to 10.1.0.0 or higher.

Page 130: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 130

Copyright © 2006, Oracle. All rights reserved.5 - 130

Setting Initialization Parameters on the Standby Database

LOG_ARCHIVE_DEST_1= 'LOCATION=/arch1/boston/ VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=boston'LOG_ARCHIVE_DEST_2= 'SERVICE=chicago VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=chicago'LOG_ARCHIVE_DEST_STATE_1=ENABLELOG_ARCHIVE_DEST_STATE_2=ENABLEREMOTE_LOGIN_PASSWORDFILE=EXCLUSIVESTANDBY_FILE_MANAGEMENT=AUTOINSTANCE_NAME=bostonFAL_SERVER=chicagoFAL_CLIENT=boston

Page 131: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 131

Copyright © 2006, Oracle. All rights reserved.5 - 131

Specifying a Value for STANDBY_ARCHIVE_DEST

• Defines the standby database directory where the archived redo log files are created

• Overrides the directory location that is specified with the LOG_ARCHIVE_DEST_n parameter

STANDBY_ARCHIVE_DEST = '/standby/arc_dest/'

STANDBY_ARCHIVE_DEST = 'LOCATION=/standby/arc_dest/'

Specifying a Value for STANDBY_ARCHIVE_DEST

You can use the STANDBY_ARCHIVE_DESTinitialization parameter on the standby database to indicate an alternative directory where the archived redo log files are to be stored when received from the primary database.

The STANDBY_ARCHIVE_DESTinitialization parameter overrides the directory location that is specified with the LOG_ARCHIVE_DEST_n parameter if both the parameters are specified.

You should set STANDBY_ARCHIVE_DESTto the same location as the local archive destination for the physical standby database so that all necessary archived redo log files for the standby database are in the same location.

Because logical standbys have at least one local archive destination, STANDBY_ARCHIVE_DESTis not set in most configurations.

STANDBY_ARCHIVE_DESTand LOG_ARCHIVE_FORMATare used to construct a fully qualified file name.

Page 132: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 132

Copyright © 2006, Oracle. All rights reserved.5 - 132

Setting Up the Environment to Support the Standby Database

1. If creating a standby database on a Windows platfor m, create a Windows-based service.

2. Create a password file.3. Configure listeners for the primary and standby

databases.

Setting Up the Environment to Support the Standby D atabase

1. If the standby system is running on a Windows-based system, use the ORADIM tool to create a Windows service and password file. Here is an example:

WINNT> oradim -NEW -SID boston -INTPWD password -ST ARTMODE manual

Refer to Oracle Database Platform Guide for Windowsfor more information about using the ORADIM tool.

2. On platforms other than Windows, create a password file and set the password for the SYSuser to the same password that is used by the SYSuser on the primary database. The password for the SYSuser on every database in a Data Guard configuration must be identical for redo transmission to succeed. Refer to the Oracle Database Administrator’s Guidefor information about creating a password file.

3. On both the primary and standby sites, use Oracle Net Manager to configure a listener for the respective databases. To restart the listeners so that they recognize the new definitions, enter the following Listener Control utility commands on both the primary and standby systems:

% lsnrctl stop% lsnrctl start

Refer to the Oracle Net Services Administrator’s Guide for additional information about the Listener Control utility.

Page 133: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 133

Copyright © 2006, Oracle. All rights reserved.5 - 133

Setting Up the Environment to Support the Standby Database

4. Create Oracle Net Services names.5. Create a server parameter file for the standby

database.

Setting Up the Environment to Support the Standby D atabase (continued)

4. On both the primary and standby systems, use Oracle Net Manager to create a network service name for the primary and standby databases that will be used by redo transport services. The Oracle Net Services name must resolve to a connect descriptor that uses the same protocol, host address, port, and SID that you specified when you configured the listeners for the primary and standby databases. The connect descriptor must also specify that a dedicated server be used. Refer to the Oracle Net Services Administrator’s Guideand the Oracle Database Administrator’s Guide.

5. On an idle standby database, use the CREATE SPFILE SQL statement to create a server parameter file for the standby database from the text initialization parameter file that was edited earlier, as shown in the following example:

SQL> CREATE SPFILE FROM PFILE='initboston.ora';

Page 134: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 134

Copyright © 2006, Oracle. All rights reserved.5 - 134

Starting the Physical Standby Database

To start the physical standby database:1. Bring it to the OPEN READ ONLYstage.2. Start Redo Apply.3. Test archival operations to the physical standby

database:

SQL> STARTUP;

SQL> ALTER DATABASE RECOVER MANAGED STANDBY

2 DATABASE DISCONNECT FROM SESSION;

Starting Up the Physical Standby Database1. On the standby database, issue the STARTUPSQL statement to start the instance and open

the database in read-only mode.2. On the standby database, issue the ALTER DATABASE RECOVER MANAGED STANDBY

DATABASESQL command to start Redo Apply. This statement automatically mounts the database. Also, include the DISCONNECT FROM SESSIONoption so that Redo Apply runs in a background session.

3. The transmission of redo data to the remote standby location does not occur until after a log switch. Issue the following command on the primary to force a log switch:

SQL> ALTER SYSTEM SWITCH LOGFILE;

Page 135: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 135

Copyright © 2006, Oracle. All rights reserved.5 - 135

Additional Configuration Tasks

Perform the following tasks as appropriate for your configuration:• Configure standby redo logs.• Enable real-time apply.• Enable Flashback Database.• Upgrade the data protection mode.

Additional Configuration Tasks

Perform the following tasks if they are appropriate for your physical standby database:• Configure standby redo logs:Standby redo logs are required for standby databases running

in the maximum protection mode and maximum availability mode. However, configuring standby redo logs is recommended on all standby databases because, during a failover, Data Guard can recover and apply more redo data from standby redo log files than from the archived redo log files alone. The standby redo logs should exist on both primary and standby databases and have the same size and names.

• Enable real-time apply: When you enable the real-time apply feature, log apply services apply the redo data from standby redo log files in real time (at the same time the log files are being written to) as opposed to recovering redo from archived redo log files when a log switch occurs. Refer to the lesson titled “Understanding the Oracle Data Guard Architecture”for additional information about configuring real-time apply.

• Enable Flashback Database:Flashback Database removes the need to re-create the primary database after a failover. Flashback Database is similar to conventional point-in-time recovery in its effects, enabling you to return a database to a recent-past state. Flashback Database is faster than point- in-time recovery because it does not require restoring data files from backup or the extensive application of redo data. You can enable Flashback Database on the primary database, on the standby database, or on both.

Page 136: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 136

Additional Configuration Tasks (continued)

• Upgrade the data protection mode:The Data Guard configuration is initially set up in the maximum performance mode (the default). Protection modes are discussed in detail in the lesson titled “Configuring Data Protection Modes and Redo Transport Services.”

Page 137: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 137

Copyright © 2006, Oracle. All rights reserved.5 - 137

Special Note:Standby Database on the Same System

• Standby database data files must be at a different location.

• Each database instance must archive to different locations.

• Service names must be unique.• The standby database does not protect against

disaster.

Primary Standby /oracle/dba /oracle/standby/dba

Special Note: Standby Database on the Same System

If you have a standby database on the same system as the primary database, you must consider the following:

• The data files must be renamed. The actual file names can be the same, but at least the directory path must be different. This means that you must use the DB_FILE_NAME_CONVERTand LOG_FILE_NAME_CONVERT parameters. Note: If the standby database uses Oracle Managed Files (OMF), do not set the DB_FILE_NAME_CONVERTor LOG_FILE_NAME_CONVERTparameter.

• If a standby database is located on the same system as the primary database, the archival directories for the standby database must use a different directory structure than the primary database. Otherwise, the standby database may overwrite the primary database files.

• If you do not explicitly specify unique service names and if the primary and standby databases are located on the same system, the same default global name (consisting of the database name and domain name, from the DB_NAMEand DB_DOMAINparameters) will be in effect for both the databases.

• If the standby database is on the same system as the primary database, it does not protect against disaster. A disaster is defined as a total loss of the primary database system. If the standby database is on the same system, it will be lost as well. This configuration should be used for testing and training purposes only.

Page 138: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 138

Copyright © 2006, Oracle. All rights reserved.5 - 138

Summary

In this lesson, you should have learned how to:• Create a physical standby with SQL commands• Enable FORCE LOGGING

• Back up the primary database• Copy files to the standby system• Set parameters on the physical standby database• Start the standby database• Configure Oracle Net Services• Set parameters on the primary database• Start the transport of redo

Page 139: Data Guard Slides Study Guide_shahul

6Copyright © 2006, Oracle. All rights reserved.

Configuring Data Protection Modesand Redo Transport Services

Page 140: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 140

Copyright © 2006, Oracle. All rights reserved.6 - 140

Objectives

After completing this lesson, you should be able to do the following:• Describe the data protection modes• Change the data protection mode of your configurati on• Modify redo transport services to serve your needs

Page 141: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 141

Copyright © 2006, Oracle. All rights reserved.6 - 141

Data Protection Modes and Redo Transport Modes

• A data protection mode requires a specific redo transport mode.

• A redo transport mode alone does not define a data protection mode.

Data Protection Modes and Redo Transport Modes

When you define a redo transport mode, you are configuring the shipment of log files from the primary database to the standby database (physical or logical). You must set your redo transport mode to support the protection mode that you want for your configuration. However, configuring the redo transport mode alone does not set up the protection mode.

After you set up the redo transport mode, you can put the configuration into the desired data protection mode. The data protection mode setting causes internal rules to be implemented, ensuring that your configuration is protected at the level you desire.

Page 142: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 142

Copyright © 2006, Oracle. All rights reserved.6 - 142

Defining the Redo Transport Mode

Use the attributes of LOG_ARCHIVE_DEST_n:• ARCHand LGWR

– Specify that either the archiver process or the log writer process is responsible for transmitting redo to the standby destination

– ARCHis the default.

• SYNCand ASYNC(LGWR only)– Specify that network I/O operations are to be perfo rmed

synchronously or asynchronously when using LGWR– SYNCis the default.

• AFFIRM and NOAFFIRM

– Ensure that redo has been successfully written to d isk on the standby destination

– NOAFFIRMis the default.

Attributes of LOG_ARCHIVE_DEST_n

The following attributes of the LOG_ARCHIVE_DEST_n initialization parameter define the redo transport mode that is used by the primary database to send redo to the standby database:

• ARCH: Indicates that redo logs are transmitted to the destination during an archival operation. A foreground archival operation or the archiver background processes (ARCn) serve as the redo log transport service. This is the default.

• LGWR: Indicates that redo is transmitted to the destination concurrently while the online redo log is being written. The log writer process (LGWR) submits the redo data to one or more network server (LNSn) processes, which then initiate the network I/O in parallel to multiple remote destinations. If a LGWR destination fails, the destination automatically reverts to using the archiver process until the error is corrected. With the LGWRattribute, you have the following additional options:

- SYNC: Specifies that network I/O is to be performed synchronously for the destination, meaning that once the I/O is initiated, the log writer process waits for the I/O to complete before continuing.

- ASYNC: Specifies that network I/O is to be performed asynchronously for the destination. In ASYNCmode all network I/O is done completely independent of the LGWR process. Use of the ASYNCattribute allows standby environments to be maintained with little or no performance impact on the primary database.

Page 143: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 143

Attributes of LOG_ARCHIVE_DEST_n (continued)

• AFFIRM: ensures that all disk I/O to the archived redo log files or standby redo log files at the standby destination is performed synchronously and completes successfully. This attribute has the potential to affect primary database performance. When you use the LGWR, SYNC, and AFFIRM attributes, the transaction is not committed until the disk I/O is completed.

• NOAFFIRM: indicates that all redo disk I/O operations are to be performed asynchronously, which means that the log writer process does not wait until the disk I/O has completed before continuing. This is the default.

Page 144: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 144

Copyright © 2006, Oracle. All rights reserved.6 - 144

Setting the Redo Transport Mode

Click Edit to access the Edit Standby Database Properties

page.

Setting the Redo Transport Mode

Use the following procedure to set the redo transport mode by using Enterprise Manager:1. Select your standby database, and then click Edit on the Data Guard page.2. Click “Standby Role Properties” on the Edit Standby Database Properties page.3. Click “Show Advanced Properties.”

Page 145: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 145

Copyright © 2006, Oracle. All rights reserved.6 - 145

Setting the Redo Transport Mode

Select the mode from the Log Transport

Mode list.

Setting the Redo Transport Mode (continued)

You can use the drop-down list to select the redo transport mode on the Standby Role Properties page. The values in the Log Transport Mode list are defined as follows:

• ARCH: configures redo transport services for your standby database using the ARCHattribute of the LOG_ARCHIVE_DEST_n initialization parameter. You do not need standby redo log files for this mode. This mode enables the lowest grade of protection to the primary database as well as the lowest performance impact.

• ASYNC: configures redo transport services for your standby database using the LGWR, ASYNC, and NOAFFIRMattributes of the LOG_ARCHIVE_DEST_n initialization parameter. This mode, along with standby redo log files, enables a moderate grade of protection to the primary database and incurs a lower performance impact.

• SYNC: configures redo transport services for your standby database using the LGWR, SYNC, and AFFIRM attributes of the LOG_ARCHIVE_DEST_n initialization parameter. This mode, along with standby redo log files, is required for the maximum protection or maximum availability protection modes. This redo transport mode enables the highest grade of data protection to the primary database, but it also incurs the highest performance impact.

Page 146: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 146

Copyright © 2006, Oracle. All rights reserved.6 - 146

Data Protection Modes

• Three data protection modes:– Maximum protection– Maximum availability– Maximum performance

• Help to balance data availability and system performance

Data Protection Modes

Oracle Data Guard offers maximum protection, maximum availability, and maximum performance modes to help enterprises balance data availability against system performance requirements.

In some situations, a business cannot afford to lose data. In other situations, the availability of the database may be more important than the loss of data. Some applications require maximum database performance and can tolerate a potential loss of data.

Page 147: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 147

Copyright © 2006, Oracle. All rights reserved.6 - 147

Maximum Protection

• Enables zero data loss• Redo data must be written to both the local online redo

log and the standby redo log on at least one standb y database.

• Primary database shuts down if a fault prevents it from writing its redo stream to at least one remote stan dby redo log.

• Configuration requirements:– Standby redo log files on at least one standby data base– SYNC, LGWR, and AFFIRMattributes

for at least one standby database

Maximum Protection

This protection mode ensures that no data loss will occur if the primary database fails. To provide this level of protection, the redo data needed to recover each transaction must be written to both the local online redo log and the standby redo log on at least one standby database before the transaction commits. To ensure that data loss cannot occur, the primary database shuts down if a fault prevents it from writing its redo stream to at least one remote standby redo log. For multiple-instance RAC databases, Data Guard shuts down the primary database if it is unable to write the redo records to at least one properly configured database instance.

To enable maximum protection mode, perform the following configuration tasks:• Configure standby redo log files on at least one standby database. • Set the SYNC, LGWR, and AFFIRM attributes of the LOG_ARCHIVE_DEST_n parameter for

at least one standby database destination.

Page 148: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 148

Copyright © 2006, Oracle. All rights reserved.6 - 148

Maximum Availability

• Enables zero data loss• Provides the highest possible level of data protect ion

without compromising the availability of the primar y database

• Redo data must be written to both the local online redo log and the standby redo log on at least one standb y database.

• Primary database does not shut down if a fault prevents it from writing its redo stream.

• Configuration requirements:– Standby redo log files on at least one standby data base– SYNC, LGWR, and AFFIRMattributes

for at least one standby database

Maximum Availability

This protection mode provides the highest possible level of data protection without compromising the availability of the primary database. Like maximum protection mode, a transaction will not commit until the redo needed to recover that transaction is written to the local online redo log and to at least one remote standby redo log. Unlike maximum protection mode, the primary database does not shut down if a fault prevents it from writing its redo stream to a remote standby redo log. Instead, the primary database operates in maximum performance mode until the fault is corrected and all gaps in redo log files are resolved. When all gaps are resolved, the primary database automatically resumes operating in maximum availability mode.

This mode guarantees that no data loss will occur if the primary database fails, but only if a second fault does not prevent a complete set of redo data from being sent from the primary database to at least one standby database.

To enable maximum availability mode, perform the following configuration tasks:• Configure standby redo log files on at least one standby database. • Set the SYNC, LGWR, and AFFIRM attributes of the LOG_ARCHIVE_DEST_n parameter for

at least one standby database.

Page 149: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 149

Copyright © 2006, Oracle. All rights reserved.6 - 149

Maximum Performance

• Default level of data protection• Provides the highest possible level of data protect ion

without affecting the performance of the primary database

• Transactions can commit as soon as the redo data is written to the local online redo log.

• Redo stream is written asynchronously with respect to the commitment of the transactions that create the redo data.

Maximum Performance

This protection mode (the default) provides the highest possible level of data protection without affecting the performance of the primary database. This is accomplished by allowing a transaction to commit as soon as the redo data needed to recover that transaction is written to the local online redo log. The primary database’s redo data stream is also written to at least one standby database, but that redo stream is written asynchronously with respect to the commitment of the transactions that create the redo data.

When network links with sufficient bandwidth are used, this mode provides a level of data protection that approaches that of maximum availability mode with minimal impact on primary database performance.

The maximum performance mode enables you to either set the LGWRand ASYNCattributes or set the ARCHattribute on the LOG_ARCHIVE_DEST_n parameter for the standby database destination. If the primary database fails, you can reduce the amount of data that is not received on the standby destination by setting the LGWRand ASYNCattributes.

Page 150: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 150

Copyright © 2006, Oracle. All rights reserved.6 - 150

Setting the Data Protection Mode

Click the Protection Mode link.

Setting the Data Protection ModeIf the data protection mode that you need requires a standby database to use the SYNCor ASYNCredo transport mode, Enterprise Manager will automatically set the redo transport mode for the primary database and the selected standby databases.

Enterprise Manager automatically determines the correct number and size of standby redo log files needed for all databases in the configuration and adds those log files using the directory locations you specify.

After you upgrade the protection mode using Enterprise Manager, the primary database will be restarted automatically. The primary database need not be restarted following a downgrade of the protection mode.

You can set the data protection mode by using Enterprise Manager as follows:1. Navigate to the Data Guard page.2. Click the link in the Protection Mode field to access the Change Protection Mode: Select

Mode page.

Page 151: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 151

Copyright © 2006, Oracle. All rights reserved.6 - 151

Setting the Data Protection Mode

Setting the Data Protection Mode (continued)

3. Select Maximum Protection, Maximum Availability, or Maximum Performance, and then click Continue.

4. If prompted, enter the username and password of a user with SYSDBAprivileges, and then click Login.

5. Select one or more standby databases to support the protection mode that you selected. If standby redo log files are needed, verify the names of the log files. Click OK.

6. On the Confirmation page, click Yes.

Page 152: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 152

Copyright © 2006, Oracle. All rights reserved.6 - 152

Setting the Data Protection Mode by Using the CLI

1. Configure standby redo logs.2. Set the LogXptMode property (if necessary).

3. Set the data protection mode.

DGMGRL> EDIT DATABASE 'site1_edrsr8p1' SET PROPERTY 'LogXptMode'='SYNC';DGMGRL> EDIT CONFIGURATION SET PROTECTION MODE AS MAXAVAILABILITY;

Setting the Data Protection Mode by Using the CLI

1. If you are setting the protection mode to maximum protection or maximum availability, ensure that standby redo log files are configured on the standby database. You must also configure standby redo log files for the primary database or another standby database in the configuration to ensure that it can support the chosen protection mode after a switchover.

2. Use the EDIT DATABASE SET PROPERTYcommand to set the redo transport mode for the standby database. For example, if you are changing the data protection mode to maximum availability, use the EDIT DATABASEcommand to specify SYNCfor redo transport services as follows:

DGMGRL> EDIT DATABASE 'DR_Sales' SET PROPERTY 'LogXp tMode'='SYNC';

You must also set the redo transport services for the primary database or another standby database in the configuration to ensure that it can support the chosen protection mode after a switchover.

3. Use the EDIT CONFIGURATION SET PROTECTION MODE AScommand to set the overall configuration protection mode. To set the protection mode to maximum availability, issue the following command:

DGMGRL> EDIT CONFIGURATION SET PROTECTION MODE AS MAXAVAILABILITY;

Page 153: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 153

Copyright © 2006, Oracle. All rights reserved.6 - 153

Setting the Protection Mode by Using SQL

• You must set attributes to support the type of protection desired.

• Issue the ALTER DATABASEstatement on the primary database:

ALTER DATABASE SET STANDBY TO MAXIMIZE PROTECTION;

Setting the Protection Mode by Using SQLYou must set attributes of the LOG_ARCHIVE_DEST_n initialization parameter for each level of protection. For each level of protection, you must have at least one standby database with the following:

• Maximum protection: LGWR, SYNC, AFFIRM, and standby redo logs files• Maximum availability: LGWR, SYNC, AFFIRM, and standby redo logs files for physical

standby databases• Maximum performance: Any combination of LGWRor ARCH

Using the following SQL statement on the primary database, you can configure the Data Guard environment to maximize data protection, availability, or performance:

ALTER DATABASE SET STANDBY DATABASE TO MAXIMIZE {PR OTECTION | AVAILABILITY | PERFORMANCE};

Page 154: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 154

Copyright © 2006, Oracle. All rights reserved.6 - 154

Delaying the Application of Redo

Delaying the application of redo helps safeguard ag ainst:• Data corruption• User errors

Productiondatabase

Standbydatabase

Ora

cle

Net Delayed

application

Delaying the Application of Redo

You can delay the application of changes to standby databases, thereby providing protection from user errors or corruptions. You can protect against the application of corrupted or erroneous data to the standby database. The apply process also revalidates the log records to prevent application of log corruptions.

For example, if a critical table is accidentally dropped from the primary database, you can prevent this action from affecting the standby database by delaying the application of this change in the standby database.

If operating in maximum protection or maximum availability mode, Data Guard will ensure zero data loss even with the delayed apply in effect.

If you define a delay for a destination that has real- time apply enabled, the delay is ignored.

Note: You can use Flashback Database as an alternative to the Apply Delay configuration option as described later in this lesson.

Page 155: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 155

Copyright © 2006, Oracle. All rights reserved.6 - 155

Using Enterprise Manager to Delay the Application of Redo

Specify the delay in minutes.

Using Enterprise Manager to Delay the Application o f Redo

You can configure delayed apply by using Enterprise Manager as follows:1. On the Data Guard page, select your standby database. Then click Edit.2. On the Edit Standby Database Properties page, click Standby Role Properties.3. In the Apply Delay field, enter the delay value (in minutes). 4. Click Apply.

Page 156: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 156

Copyright © 2006, Oracle. All rights reserved.6 - 156

Setting LOG_ARCHIVE_DEST_nto Delay the Application of Redo

Use the attributes of LOG_ARCHIVE_DEST_n to control the application of redo:• DELAY: number of minutes to delay application of redo

(default: 30 minutes)

Setting LOG_ARCHIVE_DEST_nto Delay the Application of Redo

You can use the DELAY=<minutes> attribute of the LOG_ARCHIVE_DEST_n initialization parameter to delay the application of archived redo log files to the standby database on the primary database and physical standby databases.

Note: If you do not specify a value for minutes , the default is 30 minutes.

Page 157: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 157

Copyright © 2006, Oracle. All rights reserved.6 - 157

Using Flashback Database Instead of Apply Delay

No delay

4-hour delay

Standby1

Standby2

Standby3

8-hour delay

Standby

Primary database

Primary database

Using Flashback Database Instead of Apply Delay

As an alternative to the Apply Delay configuration option, you can use Flashback Database to protect against the application of corrupted or erroneous data to the standby database. Flashback Database can quickly and easily flash back a standby database to an arbitrary time in the past. You can configure one standby database with Flashback Database to achieve the same benefit as multiple standby databases with different delays.

Refer to the Oracle Database Backup and Recovery Advanced User’s Guidefor additional information about Flashback Database.

Page 158: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 158

Copyright © 2006, Oracle. All rights reserved.6 - 158

Additional Attributes That Affect Redo Transport Services

• ALTERNATE

• DEPENDENCY

• MAX_FAILURE

• NET_TIMEOUT

• REOPEN

Additional Attributes That Affect Redo Transport Se rvicesThe following pages present additional attributes of the LOG_ARCHIVE_DEST_n initialization parameter that affect redo transport services. The use of each attribute depends entirely on your individual business requirements.

Page 159: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 159

Copyright © 2006, Oracle. All rights reserved.6 - 159

Using the ALTERNATEAttribute

• Can specify one alternate destination for the LOG_ARCHIVE_DEST_n parameter

• Allow a failed destination to change destinations– Disk full: switch to new disk– Oracle Net link fails: switch to new network link

• Require REOPEN=0or MAX_FAILURE

• Enabled with LOG_ARCHIVE_DEST_STATE_n

log_archive_dest_3='SERVICE=stby1_path1 REOPEN=0 ALTERNATE=LOG_ARCHIVE_DEST_4'log_archive_dest_4='SERVICE=stby1_path2 REOPEN=0 OPTIONAL'log_archive_dest_state_3=ENABLElog_archive_dest_state_4=ALTERNATE

Using the ALTERNATEAttribute

You can use the ALTERNATEattribute to specify another LOG_ARCHIVE_DEST_n destination to be used if archival operations to the original destination fail. A destination can have a maximum of one alternate destination specified. An alternate destination is used when the transmission of redo fails. If the archiving to the destination fails and the REOPENattribute is specified with a value of zero (0), the Oracle Database server attempts to transmit the redo to the alternate destination on the next log switch.

An alternate destination cannot be self-referencing.

An alternate destination must be in the ALTERNATEstate; this state is specified using the LOG_ARCHIVE_DEST_STATE_n initialization parameter. The ALTERNATEstate defers the processing of the destination until another destination failure automatically enables this destination (provided the alternate destination attributes are valid).

Page 160: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 160

Copyright © 2006, Oracle. All rights reserved.6 - 160

Using the MAX_FAILUREAttribute

MAX_FAILURE[=count]

• Number of times redo transport services attempts to reestablish communication

• Requires REOPEN

• No default count

log_archive_dest_3='SERVICE=o10g1 LGWR MAX_FAILURE= 30 REOPEN'

Using the MAX_FAILUREAttribute

The MAX_FAILUREattribute of the LOG_ARCHIVE_DEST_n initialization parameter specifies the maximum number of consecutive times that redo transport services attempt archival operations to a failed destination. Using this attribute, you can provide failure resolution for archiving destinations to which you want to retry archival operations after a failure, but not retry indefinitely. When you specify the MAX_FAILUREattribute, you must also set the REOPENattribute to specify how often archival operations are retried to the particular destination.

If you set both the MAX_FAILUREand REOPENattributes to nonzero values, redo transport services limit the number of archival attempts to the number of times specified by the MAX_FAILUREattribute. Each destination contains an internal failure counter that tracks the number of consecutive archival failures that have occurred. You can view the failure count in the FAILURE_COUNTcolumn of the V$ARCHIVE_DESTfixed view. The related column REOPEN_SECSidentifies the REOPENattribute value.

Page 161: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 161

Copyright © 2006, Oracle. All rights reserved.6 - 161

Using the NET_TIMEOUTAttribute

• Enables the LGWR process to avoid a network timeout issue

• Valid with SYNC or ASYNCdestinations• Value supplied is the number of seconds to wait.• Range of values for NET_TIMEOUT: 15 to 1200• Default: 180

• Use caution in maximum protection mode.

log_archive_dest_2='SERVICE=o10g2 LGWR SYNC NET_TIMEOUT=30'

Using the NET_TIMEOUTAttribute

The NET_TIMEOUTattribute enables you to bypass the default network timeout interval established for the system on which the primary database resides. Without the NET_TIMEOUTattribute, the primary database can potentially stall for the default network timeout period. By specifying a smaller, nonzero value for NET_TIMEOUT, you can enable the primary database to mark a destination as “failed” after the user-specified timeout interval expires.

Note: Remember to specify a reasonable value when running in maximum protection mode. False network failure detection may cause the primary instance to shut down.

Page 162: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 162

Copyright © 2006, Oracle. All rights reserved.6 - 162

Using the REOPENAttribute

• REOPEN[=seconds]

– Minimum number of seconds to wait before retrying a failed destination at log switch

– Failures can be network failures, quota exceptions, disk full, and so on.

– Default: 300 seconds (5 minutes)• REOPEN=0

– Failed destinations remain disabled until:— Manually reenabled— ALTER SYSTEM SET LOG_ARCHIVE_DEST_STATE_n=ENABLE

issued

— Instance restart

– Required when using ALTERNATEdestinations with MAX_FAILURE=0attributes

Using the REOPENAttribute

The REOPENattribute of the LOG_ARCHIVE_DEST_n parameter specifies the minimum number of seconds before the process shipping the redo should try again to access a previously failed destination.

REOPENapplies to all errors, not just connection failures. These errors include (but are not limited to) network failures, disk errors, and quota exceptions.

Page 163: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 163

Copyright © 2006, Oracle. All rights reserved.6 - 163

Optimized Asynchronous Redo Transmission

LGWR

Primary database

transactions

Onlineredologs

ARC0

FAL

RFS

MRP or LSP

Archived redo logs

(MRP only)

Archived redo logs

ARC1ARC2

LNSn

Ora

cle

Net

Reports

Backup

Standbydatabase

Optimized Asynchronous Redo Transmission

In Oracle Database 10g Release 2, the redo transport mechanism is enhanced to more effectively utilize all of the available bandwidth. A single, large redo log file may be transferred in parallel by multiple ARCn processes.

This architecture increases the redo transfer rate and enables faster redo transmission to standby databases for bulk batch updates on the primary database. As a result of the improvement in transfer rates, there is an increased availability of data at the standby database site.

Page 164: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 164

Copyright © 2006, Oracle. All rights reserved.6 - 164

Enabling Multiple Connectionsfor Remote Archival of Redo

LOG_ARCHIVE_DEST_3='SERVICE=detroit MAX_CONNECTIONS=5'

The following conditions must be met to enable this feature:• Remote archiving is performed to disk.• LOG_ARCHIVE_LOCAL_FIRSTmust be set to TRUE

(default).

Enabling Multiple Connections for Remote Archival o f RedoThe MAX_CONNECTIONSattribute of LOG_ARCHIVE_DEST_nis used to set the number of parallel connections that are used for transmitting archived redo log files to a remote destination. The MAX_CONNECTIONSattribute defaults to 1, indicating that a single connection isestablished for the communication and transfer of data. The maximum value for MAX_CONNECTIONSis 5.

Note: You must set the LOG_ARCHIVE_MAX_PROCESSESinitialization parameter to be greater than or equal to the value of MAX_CONNECTIONSto achieve the desired number of parallel connections. If the value of the MAX_CONNECTIONSattribute exceeds the value of LOG_ARCHIVE_MAX_PROCESSES, Data Guard will use the available ARCn processes.

Page 165: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 165

Copyright © 2006, Oracle. All rights reserved.6 - 165

Summary

In this lesson, you should have learned how to:• Describe the data protection modes• Change the data protection mode of your configurati on• Modify redo transport services to suit your needs• Delay the application of redo• Use additional transport services attributes

Page 166: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 166

Copyright © 2006, Oracle. All rights reserved.6 - 166

Practice 6: Overview

This practice covers the following topics:• Changing the data protection mode• Delaying the application of redo

Page 167: Data Guard Slides Study Guide_shahul

7Copyright © 2006, Oracle. All rights reserved.

Creating a Logical Standby Database by Using Enterprise Manager

Page 168: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 168

Copyright © 2006, Oracle. All rights reserved.7 - 168

Objectives

After completing this lesson, you should be able to do the following:• Explain the advantages of SQL Apply • Explain when to use a logical standby database• Create a logical standby database by using Enterpri se

Manager

Page 169: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 169

Copyright © 2006, Oracle. All rights reserved.7 - 169

Benefits of Implementing aLogical Standby Database

• Provides an efficient use of system resources:– Open, independent, and active production database– Additional indexes and materialized views can be cr eated

for improved query performance.

• Reduces workload on the primary database by offloading the following workloads to a logical sta ndby database– Reporting– Summations– Queries

Benefits of Implementing a Logical Standby Database

A logical standby database provides disaster recovery, high availability, and data protection benefits that are similar to those of a physical standby database. It also provides the following specialized benefits:

• Efficient utilization of system resources: A logical standby database is an open, independent, and active production database. It can host multiple database schemas, and users can perform normal data manipulation operations on tables in schemas that are not updated from the primary database. It remains open while the tables are updated from the primary database, and those tables are simultaneously available for read-access. Because the data can be presented with a different physical layout, additional indexes and materialized views can be created to improve your reporting and query requirements and to suit your specific business requirements.

• Reduction in primary database workload: The logical standby tables that are updated from the primary database can be used for other tasks (such as reporting, summations, and queries), thereby reducing the primary database workload.

Page 170: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 170

Copyright © 2006, Oracle. All rights reserved.7 - 170

Benefits of Implementing aLogical Standby Database

• Provides data protection: – Primary database corruptions not propagated

• Provides disaster recovery capabilities:– Switchover and failover– Minimizes downtime for planned and unplanned outage s

Benefits of Implementing a Logical Standby Database (continued)

• Data protection: A logical standby database provides a safeguard against data corruptions and user errors. Primary-side physical corruptions do not propagate through the redo data that are transported to the logical standby database. Similarly, user errors that may cause the primary database to be permanently damaged can be resolved before application on the logical standby through delay features.

• Disaster recovery: A logical standby database provides a robust and efficient disaster-recovery solution. Easy-to-manage switchover and failover capabilities allow easy role reversals between primary and logical standby databases, minimizing the downtime of the primary database for planned and unplanned outages.

Page 171: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 171

Copyright © 2006, Oracle. All rights reserved.7 - 171

Securing Your Logical Standby Database

• Configure the database guard to control user access to tables.

• ALTER DATABASE GUARDcommand keywords:– ALL: prevents users from making changes to any data in

the database.– STANDBY: prevents users from making changes to any

data maintained by Data Guard SQL Apply.– NONE: normal security

• Query GUARD_STATUScolumn in V$DATABASE.• Database guard level is set to ALL by broker

automatically on the logical standby database.• Database guard level applies to all users except SYS.

Securing Your Logical Standby DatabaseYou can control user access to tables in a logical standby database by using the ALTERDATABASE GUARDcommand to configure the database guard.

By default, it is not possible for a nonprivileged user to modify data on a Data Guard SQL Apply database. This is because the database guard is automatically set to ALL. With this level of security, only the SYSuser can modify data.

When you set the security level to STANDBY, users are able to modify data that is not maintained by the logical apply engine. A security level of NONEpermits any user to access the standby database as long as they have the correct privileges.

When creating a logical standby database manually with SQL commands, you must issue the ALTER DATABASE GUARD ALLcommand before opening the database. Failure to do so will allow jobs that are submitted through DBMS_JOB.SUBMITto be scheduled and to potentially modify tables in the logical standby database.

Page 172: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 172

Copyright © 2006, Oracle. All rights reserved.7 - 172

Preparing to Create aLogical Standby Database

Perform the following steps on the primary database before creating a logical standby database:

1. Check for unsupported data types. 2. Be aware of unsupported DDL commands.3. Ensure row uniqueness. 4. Verify that the primary database is configured for

ARCHIVELOGmode.

5. Enable supplemental logging.

Preparing to Create a Logical Standby Database

When creating a logical standby database, you must take several actions before you begin. The following pages discuss these steps in detail.

Page 173: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 173

Copyright © 2006, Oracle. All rights reserved.7 - 173

Unsupported Objects

• Log apply services automatically exclude unsupporte d objects when applying redo data to the logical stan dby database.

• Unsupported objects:– Tables and sequences in the SYSschema

– Tables using table compression– Tables used to support materialized views– Global temporary tables– Tables with unsupported data types (see list on nex t

page)

Unsupported Objects

If the primary database contains unsupported tables, log apply services automatically exclude these tables when applying redo data to the logical standby database.

Page 174: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 174

Copyright © 2006, Oracle. All rights reserved.7 - 174

Unsupported Data Types

• Log apply services automatically exclude tables wit h unsupported data types when applying redo data to t he logical standby database.

• Unsupported data types:– BFILE , ROWID, and UROWID

– User-defined types– Object types REFs

– Varrays– Nested tables– XMLtype

Unsupported Data Types

Ensure that your logical standby database can support the data types of the database objects that are defined in your primary database.

Refer to Oracle Data Guard Concepts and Administrationfor additional information about unsupported data types and objects.

Page 175: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 175

Copyright © 2006, Oracle. All rights reserved.7 - 175

Checking for Tables with Unsupported Data Types

Query DBA_LOGSTDBY_UNSUPPORTEDon the primary database for tables with unsupported data types:

SQL> desc DBA_LOGSTDBY_UNSUPPORTED

Name Null? Type-------------- -------- -------------OWNER NOT NULL VARCHAR2(30)TABLE_NAME NOT NULL VARCHAR2(30)COLUMN_NAME NOT NULL VARCHAR2(30)DATA_TYPE VARCHAR2(106)

Checking for Tables with Unsupported Data TypesYou can query the DBA_LOGSTDBY_UNSUPPORTEDdata dictionary view to see all of the tables that contain data types that are not supported by logical standby databases. These tables are not maintained (do not have DML applied) in the logical standby database. Any changes made to unsupported data types, tables, sequences, or views on the primary database are neither propagated to the logical standby database, nor is an error message returned.

It is a good idea to query this view on the primary database to ensure that those tables necessary for critical applications are not in this list before you create the logical standby database.

If the primary database includes unsupported tables that are critical, consider using a physical standby database instead.

Note: This view does not show any tables from the SYSschema because changes to the SYSschema object are not applied to the logical standby database. In addition, this view does not show tables with table compression.

Page 176: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 176

Copyright © 2006, Oracle. All rights reserved.7 - 176

Unsupported DDL Commands

• EXPLAIN

• LOCK TABLE

• SET CONSTRAINTS

• SET ROLE

• SET TRANSACTION

• ALTER DATABASE

• ALTER SESSION

• ALTER MATERIALIZED VIEW

• ALTER MATERIALIZED VIEW LOG

• ALTER SYSTEM

• CREATE CONTROL FILE

• CREATE DATABASE

• CREATE DATABASE LINK

• CREATE PFILE FROM SPFILE

• CREATE SCHEMA AUTHORIZATION

• CREATE MATERIALIZED VIEW

• CREATE MATERIALIZED VIEW LOG

• CREATE SPFILE FROM PFILE

• DROP DATABASE LINK

• DROP MATERIALIZED VIEW

• DROP MATERIALIZED VIEW LOG

Unsupported DDL Commands

Not all data definition language (DDL) commands that are executed on the primary database are applied to the logical standby database. If you execute any of these commands (shown in the slide) on the primary database, they are not executed on any logical standby database in your configuration. You must execute them on the logical standby database to maintain consistency between the primary database and the logical standby database.

Page 177: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 177

Copyright © 2006, Oracle. All rights reserved.7 - 177

Ensuring Unique Row Identifiers

• Query DBA_LOGSTDBY_NOT_UNIQUEon the primary database to find tables without a unique identifier :

• BAD_COLUMNvalues:– Y: Data type is unbounded.– N: Table contains enough column information.

• Add a primary key or unique index to ensure that SQ L Apply can efficiently apply data updates

SQL> desc DBA_LOGSTDBY_NOT_UNIQUEName Null? Type-------------- -------- ------------OWNER NOT NULL VARCHAR2(30)TABLE_NAME NOT NULL VARCHAR2(30)BAD_COLUMN VARCHAR2(1)

Ensuring Unique Row Identifiers

Because the row IDs on a logical standby database might not be the same as the row IDs on the primary database, a different mechanism must be used to match the updated row on the primary database to its corresponding row on the logical standby database. Primary keys and unique indexes can be used to match the corresponding rows. It is recommended that you add a primary key or a unique index to tables on the primary database (whenever appropriate and possible) to ensure that SQL Apply can efficiently apply data updates to the logical standby database.

You can query the DBA_LOGSTDBY_NOT_UNIQUEview to identify tables in the primary database that do not have a primary key or unique index with NOT NULLcolumns. Issue the following query to display a list of tables that SQL Apply might not be able to uniquely identify:

SQL> SELECT OWNER, TABLE_NAME,BAD_COLUMN 2 FROM DBA_LOGSTDBY_NOT_UNIQUE3 WHERE TABLE_NAME NOT IN 4 (SELECT TABLE_NAME FROM DBA_LOGSTDBY_UNSUPPORTED);

Page 178: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 178

Ensuring Unique Row Identifiers (continued)The key column in this view is BAD_COLUMN. If this view returns a row for a given table, you may want to consider adding a primary or unique key constraint on the table.

A value of Y indicates that the table does not have a primary or unique constraint and that the column is defined using an unbounded data type, such as CLOB. If two rows in the table match except for values in theirLOBcolumn, then the table cannot be maintained properly and SQL Apply stops.

A value of N indicates that the table does not have a primary or unique constraint but that it contains enough column information to maintain the table in the logical standby database. However, the redo transport services and log apply services run more efficiently if you add a primary key. You should consider adding a disabled RELYconstraint to these tables (as described on the next page).

Page 179: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 179

Copyright © 2006, Oracle. All rights reserved.7 - 179

Adding a Disabled Primary Key RELYConstraint

You can add a disabled RELYconstraint to uniquely identify rows:

SQL> ALTER TABLE hr.employees2 ADD PRIMARY KEY (employee_id, last_name)3 RELY DISABLE;

Adding a Disabled Primary Key RELYConstraint

If your application ensures that the rows in a table are unique, you can create a disabled primary key RELYconstraint on the table without incurring the overhead of maintaining a primary key on the primary database.

The RELYconstraint tells the system to log the named columns (in this example, employee_idand last_name ) to identify rows in this table. Be careful to select columns for the disabled RELYconstraint that uniquely identify the row. If the columns selected for the RELYconstraint do not uniquely identify the row, SQL Apply does not apply redo information to the logical standby database. Supplemental logging must be set to MINIMAL or FULL as described on the next page.

Note: For this example, assume that the HR.EMPLOYEEStable does not have a primary key.

Page 180: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 180

Copyright © 2006, Oracle. All rights reserved.7 - 180

Supplemental Logging

• Adds supplemental data to the log stream• Three levels of database supplemental logging:

– Full: enables database-wide, before-image logging o f primary keys or unique indexes for all updates.

– Minimal: Minimal amount of information needed for LogMiner to identify, group, and merge the redo operations that are associated with DML changes.

– None: No additional redo information added to the r edo stream.

• SQL Apply requires full supplemental logging.

Supplemental Logging

Supplemental logging must be enabled on the primary database to support a logical standby database. Because an Oracle Database logs only the columns that were modified, this is not always sufficient to uniquely identify the row that changed, and additional information must be put into the stream of redo data. The supplemental information that is added to the redo data helps SQL Apply correctly identify and maintain tables in the logical standby database.

The supplemental_db_logging clauses of the ALTER DATABASEcommand instructs the Oracle Database server to add or stop adding supplemental data to the log stream.

Full supplemental logging (or identification key logging) enables database-wide, before- image logging of primary keys or unique indexes (in the absence of primary keys) for all updates. With this type of logging, an application can identify updated rows logically rather than resorting to row IDs. This type of logging is required by SQL Apply.

On the primary database, issue the following statement to add primary key and unique index information to the archived redo log file:

SQL> ALTER DATABASE ADD SUPPLEMENTAL LOG DATA 2 (PRIMARY KEY, UNIQUE INDEX) COLUMNS;

Note: The default for supplemental logging is None.

Page 181: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 181

Copyright © 2006, Oracle. All rights reserved.7 - 181

Enabling Supplemental Logging

• Data Guard broker automatically enables supplementa l logging.

• Manually enable full supplemental logging before yo u create your logical standby:

• Verify that the following columns in V$DATABASEcontain a YESvalue:– SUPPLEMENTAL_LOG_DATA_MIN

– SUPPLEMENTAL_LOG_DATA_PK

– SUPPLEMENTAL_LOG_DATA_UI

SQL> ALTER DATABASE ADD SUPPLEMENTAL LOG DATA2 (PRIMARY KEY, UNIQUE INDEX) COLUMNS;

SQL> ALTER SYSTEM ARCHIVE LOG CURRENT;

Enabling Supplemental Logging

You must enable full supplemental logging before you create the logical standby database. The reason is that the logical standby database cannot use archived redo logs that contain both supplemental log data and nonsupplemental log data.

Note: Enterprise Manager automatically enables supplemental logging when you create the logical standby database.

The following columns in the V$DATABASEview have a YESvalue after supplemental logging has been enabled. YESrepresents the following for the respective columns:

• SUPPLEMENTAL_LOG_DATA_MIN: LogMiner has sufficient information to support chained rows and various storage arrangements.

• SUPPLEMENTAL_LOG_DATA_PK: All columns of the primary key are placed in the redo log whenever there is an update.

• SUPPLEMENTAL_LOG_DATA_UI: If any unique key columns are modified, all other columns belonging to the unique key are also logged.

Note: If you enable full supplemental logging on your primary database and you have already created physical standby databases, then you must enable supplemental logging on each physical standby database to ensure that future switchovers work correctly.

Page 182: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 182

Copyright © 2006, Oracle. All rights reserved.7 - 182

Verifying Values ofInitialization Parameters

Verify the values for the following initialization parameters on the primary database :• PARALLEL_MAX_SERVERS:

– Set to 5 or greater.– Recommended value is 9.

• LOG_PARALLELISM: Set to 1 (default).• SHARED_POOL_SIZE: Set to 160 MB or greater.

Verifying Values of Initialization Parameters

Verify the values of the following initialization parameters on the primary database before creating the logical standby database (where the parameters will also be applicable):

• PARALLEL_MAX_SERVERS: Value must be set to 5 or greater. The recommended value is 9. The SQL Apply Service on the logical standby site uses several parallel processes when applying the SQL to the logical database.

• LOG_PARALLELISM: Value must be set to 1. This is the default value. If this value is changed, LogMiner on the logical standby site cannot read the redo logs.

• SHARED_POOL_SIZE: Value should be 160 MB or greater. This is a recommendation. Your configuration may operate with a lower value, but in a production environment a lower value may cause performance degradation.

Page 183: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 183

Copyright © 2006, Oracle. All rights reserved.7 - 183

Creating a Logical Standby Database with Enterprise Manager

Click “Add Standby Database.”

Creating a Logical Standby Database with Enterprise Manager

The following series of slides shows you how to add a logical standby database to an existing configuration.

First, click Add Standby Database to invoke the Add Standby Database Wizard.

Page 184: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 184

Copyright © 2006, Oracle. All rights reserved.7 - 184

Using the Add Standby Database Wizard

Select “Create a new logical standby database.”

Using the Add Standby Database Wizard

Select “Create a new logical standby database” on the Add Standby Database page, and then click Continue.

Page 185: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 185

Copyright © 2006, Oracle. All rights reserved.7 - 185

Step 1: Specifying the Backup Type

Step 1: Specifying the Backup Type

On the Backup Type page of the wizard, select one of the two backup operations to use to create the standby database (as you did when creating a physical standby database).

When you create a logical standby database, the wizard also identifies tables that cannot be supported in your logical standby database and displays a list on the Backup Type page.

Click Next to continue.

Page 186: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 186

Copyright © 2006, Oracle. All rights reserved.7 - 186

Step 2: Specifying the Backup Options

Step 2: Specifying the Backup Options

On the Backup Options page, specify the parameters that are required to perform a new backup of the primary database or to access an existing backup.

See the lesson titled “Creating a Configuration with Enterprise Manager” for additional information about the parameters on the Backup Options page.

Click Next to continue.

Page 187: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 187

Copyright © 2006, Oracle. All rights reserved.7 - 187

Step 3: Selecting the Database Location Instance Name

Step 3: Selecting the Database Location Instance Na me

On the Database Location page, specify the parameters that are required to create the standby database and select the Oracle home in which to create the standby database. The standby database can be created in any Oracle home that has been discovered by Oracle Enterprise Manager. Only Oracle homes on hosts that match the architecture and version of the primary host are shown.

Click Next to continue.

Page 188: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 188

Copyright © 2006, Oracle. All rights reserved.7 - 188

Step 4: Specifying the Standby Database File Locations Access Method

Step 4: Specifying the Standby Database File Locati ons Access Method

On the File Locations page, specify the location for the standby database files and customize other selections based on whether the standby database is being created on a different host than the primary database.

Note: The Standby Host Backup File Access section appears only when the standby database is being created on a host other than the primary database. In this case, you must choose a method to make the primary backup files accessible to the standby host.

Page 189: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 189

Copyright © 2006, Oracle. All rights reserved.7 - 189

Step 4: Specifying the Standby Database File Locations File Locations

Step 4: Specifying the Standby Database File Locati on File Locations

When the primary and standby databases are on the same host, all standby database files are put in an Optimal Flexible Architecture (OFA) directory structure by default.

When the primary and standby databases are on different hosts, you can use the Standby Database File Locations section to put all the standby database files in an OFA directory structure, or to keep file names and locations the same as the primary database.

You can optionally change the locations of individual standby database files by clicking Customize, which displays the File Locations Customize page.

Data Guard automatically adds configuration information for the new standby database to the listener.ora and tnsnames.ora files in the directory that is specified in the Network Configuration File Location section. The default location is the network administration directory of the standby database Oracle home.

Page 190: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 190

Copyright © 2006, Oracle. All rights reserved.7 - 190

Step 5: Specifying Standby Database Configuration Parameters

Step 5: Specifying Standby Database Configuration P arameters

On the Standby Configuration page, you can specify configuration parameters for the standby database. The configuration parameters include the instance name, service provider name, target name, and standby archive location. The default values are based on corresponding primary database settings.When you create a new logical standby database, the following parameters must be configured:

• Database Name:This field appears only when you are creating a new logical standby database. (Physical standby databases use the same database name as the primary.) A default database name is provided; you can specify any name that conforms to Oracle naming conventions.

• Database Unique Name:Specify a value for the DB_UNIQUE_NAMEparameter. This name must be unique in the Data Guard configuration.

• Target Name:Specify a name for Enterprise Manager to use for the new standby database. This name appears in the list of database targets maintained by Enterprise Manager. It is recommended that this name be the same as the database unique name.

Page 191: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 191

Copyright © 2006, Oracle. All rights reserved.7 - 191

Step 6: Reviewing the Configuration Information

Step 6: Reviewing the Configuration Information

The Review page of the wizard displays a summary of your selections and lists the parameters to be used to create the new standby database.

The new standby database is created in the background by an Oracle Enterprise Manager job. The name of the job that is submitted is provided at the top of the page.

When you click Finish, the Processing page appears. This page tracks each step through the submission of the standby creation job. After the job submission is complete, you see the Data Guard Overview page, where you can monitor the progress of the standby creation job.

Page 192: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 192

Copyright © 2006, Oracle. All rights reserved.7 - 192

Standby Database Creation Processing

Standby Database Creation Processing

You can view the progress of the Add Standby Database process on the Processing page. When the process completes, Enterprise Manager displays the Data Guard Overview page.

Page 193: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 193

Copyright © 2006, Oracle. All rights reserved.7 - 193

Automatic Deletion of Redo LogFiles by SQL Apply

Logical standbydatabase

Redo logs from primary

database

Transform redo information into

SQL

Delete redo log files

SQL Apply

Automatic Deletion of Redo Log Files by SQL Apply

In Oracle Database 10g Release 2, archived redo logs on the logical standby database are automatically deleted by SQL Apply after they have been applied. This feature reduces the amount of space consumed on the logical standby database and eliminates the manual step of deleting the archived redo log files.

Page 194: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 194

Copyright © 2006, Oracle. All rights reserved.7 - 194

Enabling and Disabling the Auto-Delete Feature

• Enabling the auto-delete feature:

• Disabling the auto-delete feature:

EXECUTE dbms_logstdby.apply_set('LOG_AUTO_DELETE','TRUE');

EXECUTE dbms_logstdby.apply_set('LOG_AUTO_DELETE','FALSE');

Enabling and Disabling the Auto-Delete Feature

You can enable the auto-delete feature for archived redo logs with the DBMS_LOGSTDBY.APPLY_SETprocedure as shown. By default, the auto-delete feature is enabled in Oracle Database 10g Release 2.

Page 195: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 195

Copyright © 2006, Oracle. All rights reserved.7 - 195

Summary

In this lesson, you should have learned how to:• Explain the advantages of a logical standby databas e• Decide when to use a logical standby database• Create a logical standby by using Enterprise Manage r

Page 196: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 196

Copyright © 2006, Oracle. All rights reserved.7 - 196

Practice 7: Overview

This practice covers the following topics:• Creating a logical standby database using the

Add Standby Database Wizard• Verifying the configuration

Page 197: Data Guard Slides Study Guide_shahul

8Copyright © 2006, Oracle. All rights reserved.

Creating a Logical Standby Databaseby Using SQL

Page 198: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 198

Copyright © 2006, Oracle. All rights reserved.8 - 198

Objectives

After completing this lesson, you should be able to use SQL commands to create a logical standby database.

Page 199: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 199

Copyright © 2006, Oracle. All rights reserved.8 - 199

Preparing to Create aLogical Standby Database

As preparation for creating a logical standby datab ase, perform the following steps on the primary database :• Check for unsupported data types. • Be aware of unsupported DDL commands.• Ensure row uniqueness. • Verify that the primary database is configured for

ARCHIVELOGmode.

• Enable supplemental logging.• Check the values of the initialization parameters.

Preparing to Create a Logical Standby Database

These tasks were covered in the “Creating a Logical Standby Database by Using Enterprise Manager” lesson. They are presented again as a reminder that they must be performed whether you are using Enterprise Manager or SQL commands to create a logical standby database.

Be sure to check that the initialization parameters have the following values:• PARALLEL_MAX_SERVERS > 5• LOG_PARALLELISM= 1• SHARED_POOL_SIZE: 160 MB or higher (recommended)

Page 200: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 200

Copyright © 2006, Oracle. All rights reserved.8 - 200

Creating a Logical Standby Database

To create a logical standby database by using SQL commands:1. Create a physical standby database.2. Stop Redo Apply on the physical standby database.3. Prepare the primary database to support a logical

standby database.4. Build a LogMiner Dictionary in the redo data.5. Convert to a logical standby database.6. Open the logical standby database.7. Verify that the logical standby database is perform ing

properly.

Creating a Logical Standby Database

Each of these steps is outlined in detail in the remainder of this lesson.

Page 201: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 201

Copyright © 2006, Oracle. All rights reserved.8 - 201

Step 1: Create a Physical Standby Database

a. Create a physical standby database.b. Ensure that the physical standby database is caug ht up

to the primary database.

Step 1: Create a Physical Standby Database

You create a logical standby database by first creating a physical standby database. Then you convert the physical standby database into a logical standby database.

To create the physical standby database:a. Create a physical standby database as described in the lesson titled “Creating a Physical

Standby Database by Using SQL.”b. Ensure that the physical standby database is caught up to the primary database by allowing

recovery to continue until the physical standby database is consistent with the primary database, including all database structural changes (such as adding or dropping data files).

Page 202: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 202

Copyright © 2006, Oracle. All rights reserved.8 - 202

Step 2: Stop Redo Apply on the Physical Standby Database

• Before converting the physical standby database to a logical standby database, stop Redo Apply.

• Required to avoid applying changes past the redo th at contains the LogMiner dictionary.

SQL> ALTER DATABASE RECOVER MANAGED STANDBY 2 DATABASE CANCEL;

Step 2: Stop Redo Apply on the Physical Standby Dat abase

Before converting the physical standby database to a logical standby database, you must stop Redo Apply by issuing the ALTER DATABASE RECOVER MANAGED STANDBY DATABASECANCELcommand.

Page 203: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 203

Copyright © 2006, Oracle. All rights reserved.8 - 203

Step 3: Prepare the Primary Database to Support a Logical Standby Database

a. Prepare the primary database for role transitions by setting LOG_ARCHIVE_DEST_n parameters appropriately.

b. Set the LOG_ARCHIVE_DEST_3initialization parameter for transitioning to a logical standby role.

c. Set the value of UNDO_RETENTIONto 3600 .

LOG_ARCHIVE_DEST_3='LOCATION=/arch/chicago/VALID_FOR=(STANDBY_LOGFILES, STANDBY_ROLE)DB_UNIQUE_NAME=chicago'

LOG_ARCHIVE_DEST_STATE_3=enable

Step 3: Prepare the Primary Database to Support a L ogical Standby Database

Perform the following steps to prepare the primary database to support a logical standby database:

a. To transition the primary database to the logical standby role, you must modify the initialization parameters on the primary database so that no parameters need to change after a role transition.Use the ALTER SYSTEM SET SCOPE=BOTHcommand to dynamically set the LOG_ARCHIVE_DEST_n initialization parameters.Modify the LOG_ARCHIVE_DEST_1parameter to be valid for (ONLINE_LOGFILES,ALL_ROLES) of the primary database.

b. To transition the primary database to a logical standby database role, include the LOG_ARCHIVE_DEST_3destination on the primary database. This parameter takes effect only when the primary database is transitioned to the standby database role.

c. Set the UNDO_RETENTIONinitialization parameter to 3600 . The UNDO_RETENTIONparameter specifies (in seconds) the amount of committed undo information to retain in the database. The value of 3600 is recommended for best results when building a LogMiner dictionary for the logical standby database.

Page 204: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 204

Copyright © 2006, Oracle. All rights reserved.8 - 204

Step 4: Build a LogMiner Dictionary in the Redo Data

• Build a LogMiner dictionary in the redo data so tha t SQL Apply can properly interpret changes in the red o.

• Supplemental logging is automatically enabled.

SQL> EXECUTE DBMS_LOGSTDBY.BUILD;

Step 4: Build a LogMiner Dictionary in the Redo Dat a

SQL Apply requires a LogMiner dictionary in the redo data so that it can properly interpret changes in the redo. When you execute the DBMS_LOGSTDBY.BUILDprocedure, the LogMiner dictionary is built and supplemental logging is automatically enabled for logging primary key and unique-constraint/index columns.

Note: The DBMS_LOGSTDBY.BUILDprocedure waits for all existing transactions to complete so long-running transactions executing on the primary database will affect its operation.

Page 205: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 205

Copyright © 2006, Oracle. All rights reserved.8 - 205

Step 5: Transition to a Logical Standby Database

a. Convert to a logical standby database.

b. Create a new password file.c. Shut down the instance and restart it in MOUNT mo de.d. Adjust initialization parameters: LOG_ARCHIVE_DEST_n

SQL> ALTER DATABASE RECOVER TO 2 LOGICAL STANDBY db_name;

Step 5: Convert to a Logical Standby Database

Perform the following steps to prepare the physical standby database to transition to a logical standby database:

a. Issue the ALTER DATABASE RECOVER TO LOGICAL STANDBY db_namecommand to continue applying redo data to the physical standby database until it is ready to convert to a logical standby database. Specify a database name (db_name) to identify the new logical standby database. The redo log files contain the information needed to convert your physical standby database to a logical standby database. The statement applies redo data until the LogMiner dictionary is found in the redo log files.

b. Create a new password file using the orapwd utility. You must create a new password file because the conversion process changes the database name for the logical standby database.

c. Shut down the logical standby database instance and restart it in MOUNTmode.d. Modify the LOG_ARCHIVE_DEST_n parameters to specify separate local destinations for:

- Archived redo log files that store redo data generated by the logical standby database- Archived redo log files that store redo data received the the primary database

Modify the LOG_ARCHIVE_DEST_1parameter to be valid for (ONLINE_LOGFILES,ALL_ROLES).

Page 206: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 206

Copyright © 2006, Oracle. All rights reserved.8 - 206

Step 6: Open the Logical Standby Database

a. Open the new logical standby database with the RESETLOGSoption:

b. Start the application of redo data to the logical standby database:

SQL> ALTER DATABASE OPEN RESETLOGS;

SQL> ALTER DATABASE START LOGICAL STANDBY 2 APPLY IMMEDIATE;

Step 6: Open the Logical Standby Database

Perform the following steps to open the logical standby database and start SQL Apply:a. On the logical standby database, issue the ALTER DATABASE OPEN RESETLOGScommand

to open the database.b. On the logical standby database, issue the following command to start SQL Apply:

ALTER DATABASE START LOGICAL STANDBY APPLY IMMEDIATE

Page 207: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 207

Copyright © 2006, Oracle. All rights reserved.8 - 207

Step 7: Verify That the Logical Standby Database Is Performing Properly

a. Verify that the archived redo log files were regi stered:

b. Begin sending redo data to the standby database:

c. Query the DBA_LOGSTDBY_LOGview to verify that the archived redo log files were registered.

SQL> SELECT SEQUENCE#, FIRST_TIME, NEXT_TIME, 2 DICT_BEGIN, DICT_END3 FROM DBA_LOGSTDBY_LOG ORDER BY SEQUENCE#;

SQL> ALTER SYSTEM ARCHIVE LOG CURRENT;

Step 7: Verify That the Logical Standby Database Is Performing Properly

After you create your logical standby database, set up redo transport services, and log apply services, you should verify that redo data is being transmitted from the primary database and applied to the standby database. Perform the following steps to verify that the logical standby database is functioning properly:

a. Connect to the logical standby database and query the DBA_LOGSTDBY_LOGview to verify that the archived redo log files were registered on the logical standby system:

SQL> SELECT SEQUENCE#, FIRST_TIME, NEXT_TIME, 2 DICT_BEGIN,DICT_END3 FROM DBA_LOGSTDBY_LOG ORDER BY SEQUENCE#;

b. Connect to the primary database and issue the following command to begin sending redo data to the standby database:

SQL> ALTER SYSTEM ARCHIVE LOG CURRENT;c. Connect to the logical standby database and re-query the DBA_LOGSTDBY_LOGview as

shown in step a. This enables you to verify that the new archived redo log files were registered.

Page 208: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 208

Copyright © 2006, Oracle. All rights reserved.8 - 208

Step 7: Verify That the Logical Standby Database Is Performing Properly

d. Verify that redo data is being applied correctly:

e. View the V$LOGSTDBYview to see current SQL Apply activity:

f. Check the overall progress of SQL Apply:

SQL> SELECT NAME, VALUE FROM V$LOGSTDBY_STATS 2 WHERE NAME = 'coordinator state';

SQL> SELECT TYPE, HIGH_SCN, STATUS 2 FROM V$LOGSTDBY;

SQL> SELECT APPLIED_SCN, LATEST_SCN 2 FROM V$LOGSTDBY_PROGRESS;

Step 7: Verify That the Logical Standby Database Is Performing Properly (continued)d. On the logical standby database, query the V$LOGSTDBY_STATSview to verify that redo

data is being applied correctly:SQL> SELECT NAME, VALUE FROM V$LOGSTDBY_STATS

2 WHERE NAME = 'coordinator state';A value of INITIALIZING in the VALUEcolumn indicates that log apply services are preparing to begin SQL Apply, but data from the archived redo log files is not being applied to the logical standby database.

e. Query the V$LOGSTDBYview on the logical standby database to see a current snapshot of SQL Apply activity. A text message describing the current activity of each process that is involved in reading and applying changes is displayed.

f. Query the V$LOGSTDBY_PROGRESSview on the logical standby database to check the overall progress of SQL Apply:

SQL> SELECT APPLIED_SCN, LATEST_SCN 2 FROM V$LOGSTDBY_PROGRESS;

Page 209: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 209

Copyright © 2006, Oracle. All rights reserved.8 - 209

Additional Configuration Tasks

Perform the following tasks as appropriate for your configuration:• Configure standby redo logs.• Enable Flashback Database.• Upgrade the data protection mode.

Additional Configuration Tasks

Perform the following tasks as appropriate for your logical standby database:• Configure standby redo logs:Standby redo logs are required for standby databases running

in maximum protection mode and maximum availability mode. However, configuring standby redo logs is recommended on all standby databases because, during a failover, Data Guard can recover and apply more redo data from standby redo log files than from the archived redo log files alone. The standby redo logs should exist on both primary and standby databases and have the same size and names.

• Enable Flashback Database:Flashback Database eliminates the need to re-create the primary database after a failover. Flashback Database is similar to conventional point- in-time recovery in its effects, enabling you to return a database to its state at a time in the recent past. Flashback Database is faster than point-in-time recovery because it does not require restoring data files from backup or the extensive application of redo data. You can enable Flashback Database on the primary database, the standby database, or both.

• Upgrade the data protection mode:The Data Guard configuration is initially set up in maximum performance mode (the default).

Page 210: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 210

Copyright © 2006, Oracle. All rights reserved.8 - 210

Summary

In this lesson, you should have learned how to use SQL commands to create a logical standby database.

Page 211: Data Guard Slides Study Guide_shahul

8Copyright © 2006, Oracle. All rights reserved.

Creating a Logical Standby Databaseby Using SQL

Page 212: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 212

Copyright © 2006, Oracle. All rights reserved.8 - 212

Objectives

After completing this lesson, you should be able to use SQL commands to create a logical standby database.

Page 213: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 213

Copyright © 2006, Oracle. All rights reserved.8 - 213

Preparing to Create aLogical Standby Database

As preparation for creating a logical standby datab ase, perform the following steps on the primary database :• Check for unsupported data types. • Be aware of unsupported DDL commands.• Ensure row uniqueness. • Verify that the primary database is configured for

ARCHIVELOGmode.

• Enable supplemental logging.• Check the values of the initialization parameters.

Preparing to Create a Logical Standby Database

These tasks were covered in the “Creating a Logical Standby Database by Using Enterprise Manager” lesson. They are presented again as a reminder that they must be performed whether you are using Enterprise Manager or SQL commands to create a logical standby database.

Be sure to check that the initialization parameters have the following values:• PARALLEL_MAX_SERVERS > 5• LOG_PARALLELISM= 1• SHARED_POOL_SIZE: 160 MB or higher (recommended)

Page 214: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 214

Copyright © 2006, Oracle. All rights reserved.8 - 214

Creating a Logical Standby Database

To create a logical standby database by using SQL commands:1. Create a physical standby database.2. Stop Redo Apply on the physical standby database.3. Prepare the primary database to support a logical

standby database.4. Build a LogMiner Dictionary in the redo data.5. Convert to a logical standby database.6. Open the logical standby database.7. Verify that the logical standby database is perform ing

properly.

Creating a Logical Standby Database

Each of these steps is outlined in detail in the remainder of this lesson.

Page 215: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 215

Copyright © 2006, Oracle. All rights reserved.8 - 215

Step 1: Create a Physical Standby Database

a. Create a physical standby database.b. Ensure that the physical standby database is caug ht up

to the primary database.

Step 1: Create a Physical Standby Database

You create a logical standby database by first creating a physical standby database. Then you convert the physical standby database into a logical standby database.

To create the physical standby database:a. Create a physical standby database as described in the lesson titled “Creating a Physical

Standby Database by Using SQL.”b. Ensure that the physical standby database is caught up to the primary database by allowing

recovery to continue until the physical standby database is consistent with the primary database, including all database structural changes (such as adding or dropping data files).

Page 216: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 216

Copyright © 2006, Oracle. All rights reserved.8 - 216

Step 2: Stop Redo Apply on the Physical Standby Database

• Before converting the physical standby database to a logical standby database, stop Redo Apply.

• Required to avoid applying changes past the redo th at contains the LogMiner dictionary.

SQL> ALTER DATABASE RECOVER MANAGED STANDBY 2 DATABASE CANCEL;

Step 2: Stop Redo Apply on the Physical Standby Dat abase

Before converting the physical standby database to a logical standby database, you must stop Redo Apply by issuing the ALTER DATABASE RECOVER MANAGED STANDBY DATABASECANCELcommand.

Page 217: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 217

Copyright © 2006, Oracle. All rights reserved.8 - 217

Step 3: Prepare the Primary Database to Support a Logical Standby Database

a. Prepare the primary database for role transitions by setting LOG_ARCHIVE_DEST_n parameters appropriately.

b. Set the LOG_ARCHIVE_DEST_3initialization parameter for transitioning to a logical standby role.

c. Set the value of UNDO_RETENTIONto 3600 .

LOG_ARCHIVE_DEST_3='LOCATION=/arch/chicago/VALID_FOR=(STANDBY_LOGFILES, STANDBY_ROLE)DB_UNIQUE_NAME=chicago'

LOG_ARCHIVE_DEST_STATE_3=enable

Step 3: Prepare the Primary Database to Support a L ogical Standby Database

Perform the following steps to prepare the primary database to support a logical standby database:

a. To transition the primary database to the logical standby role, you must modify the initialization parameters on the primary database so that no parameters need to change after a role transition.Use the ALTER SYSTEM SET SCOPE=BOTHcommand to dynamically set the LOG_ARCHIVE_DEST_n initialization parameters.Modify the LOG_ARCHIVE_DEST_1parameter to be valid for (ONLINE_LOGFILES,ALL_ROLES) of the primary database.

b. To transition the primary database to a logical standby database role, include the LOG_ARCHIVE_DEST_3destination on the primary database. This parameter takes effect only when the primary database is transitioned to the standby database role.

c. Set the UNDO_RETENTIONinitialization parameter to 3600 . The UNDO_RETENTIONparameter specifies (in seconds) the amount of committed undo information to retain in the database. The value of 3600 is recommended for best results when building a LogMiner dictionary for the logical standby database.

Page 218: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 218

Copyright © 2006, Oracle. All rights reserved.8 - 218

Step 4: Build a LogMiner Dictionary in the Redo Data

• Build a LogMiner dictionary in the redo data so tha t SQL Apply can properly interpret changes in the red o.

• Supplemental logging is automatically enabled.

SQL> EXECUTE DBMS_LOGSTDBY.BUILD;

Step 4: Build a LogMiner Dictionary in the Redo Dat a

SQL Apply requires a LogMiner dictionary in the redo data so that it can properly interpret changes in the redo. When you execute the DBMS_LOGSTDBY.BUILDprocedure, the LogMiner dictionary is built and supplemental logging is automatically enabled for logging primary key and unique-constraint/index columns.

Note: The DBMS_LOGSTDBY.BUILDprocedure waits for all existing transactions to complete so long-running transactions executing on the primary database will affect its operation.

Page 219: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 219

Copyright © 2006, Oracle. All rights reserved.8 - 219

Step 5: Transition to a Logical Standby Database

a. Convert to a logical standby database.

b. Create a new password file.c. Shut down the instance and restart it in MOUNT mo de.d. Adjust initialization parameters: LOG_ARCHIVE_DEST_n

SQL> ALTER DATABASE RECOVER TO 2 LOGICAL STANDBY db_name;

Step 5: Convert to a Logical Standby Database

Perform the following steps to prepare the physical standby database to transition to a logical standby database:

a. Issue the ALTER DATABASE RECOVER TO LOGICAL STANDBY db_namecommand to continue applying redo data to the physical standby database until it is ready to convert to a logical standby database. Specify a database name (db_name) to identify the new logical standby database. The redo log files contain the information needed to convert your physical standby database to a logical standby database. The statement applies redo data until the LogMiner dictionary is found in the redo log files.

b. Create a new password file using the orapwd utility. You must create a new password file because the conversion process changes the database name for the logical standby database.

c. Shut down the logical standby database instance and restart it in MOUNTmode.d. Modify the LOG_ARCHIVE_DEST_n parameters to specify separate local destinations for:

- Archived redo log files that store redo data generated by the logical standby database- Archived redo log files that store redo data received the the primary database

Modify the LOG_ARCHIVE_DEST_1parameter to be valid for (ONLINE_LOGFILES,ALL_ROLES).

Page 220: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 220

Copyright © 2006, Oracle. All rights reserved.8 - 220

Step 6: Open the Logical Standby Database

a. Open the new logical standby database with the RESETLOGSoption:

b. Start the application of redo data to the logical standby database:

SQL> ALTER DATABASE OPEN RESETLOGS;

SQL> ALTER DATABASE START LOGICAL STANDBY 2 APPLY IMMEDIATE;

Step 6: Open the Logical Standby Database

Perform the following steps to open the logical standby database and start SQL Apply:a. On the logical standby database, issue the ALTER DATABASE OPEN RESETLOGScommand

to open the database.b. On the logical standby database, issue the following command to start SQL Apply:

ALTER DATABASE START LOGICAL STANDBY APPLY IMMEDIATE

Page 221: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 221

Copyright © 2006, Oracle. All rights reserved.8 - 221

Step 7: Verify That the Logical Standby Database Is Performing Properly

a. Verify that the archived redo log files were regi stered:

b. Begin sending redo data to the standby database:

c. Query the DBA_LOGSTDBY_LOGview to verify that the archived redo log files were registered.

SQL> SELECT SEQUENCE#, FIRST_TIME, NEXT_TIME, 2 DICT_BEGIN, DICT_END3 FROM DBA_LOGSTDBY_LOG ORDER BY SEQUENCE#;

SQL> ALTER SYSTEM ARCHIVE LOG CURRENT;

Step 7: Verify That the Logical Standby Database Is Performing Properly

After you create your logical standby database, set up redo transport services, and log apply services, you should verify that redo data is being transmitted from the primary database and applied to the standby database. Perform the following steps to verify that the logical standby database is functioning properly:

a. Connect to the logical standby database and query the DBA_LOGSTDBY_LOGview to verify that the archived redo log files were registered on the logical standby system:

SQL> SELECT SEQUENCE#, FIRST_TIME, NEXT_TIME, 2 DICT_BEGIN,DICT_END3 FROM DBA_LOGSTDBY_LOG ORDER BY SEQUENCE#;

b. Connect to the primary database and issue the following command to begin sending redo data to the standby database:

SQL> ALTER SYSTEM ARCHIVE LOG CURRENT;c. Connect to the logical standby database and re-query the DBA_LOGSTDBY_LOGview as

shown in step a. This enables you to verify that the new archived redo log files were registered.

Page 222: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 222

Copyright © 2006, Oracle. All rights reserved.8 - 222

Step 7: Verify That the Logical Standby Database Is Performing Properly

d. Verify that redo data is being applied correctly:

e. View the V$LOGSTDBYview to see current SQL Apply activity:

f. Check the overall progress of SQL Apply:

SQL> SELECT NAME, VALUE FROM V$LOGSTDBY_STATS 2 WHERE NAME = 'coordinator state';

SQL> SELECT TYPE, HIGH_SCN, STATUS 2 FROM V$LOGSTDBY;

SQL> SELECT APPLIED_SCN, LATEST_SCN 2 FROM V$LOGSTDBY_PROGRESS;

Step 7: Verify That the Logical Standby Database Is Performing Properly (continued)d. On the logical standby database, query the V$LOGSTDBY_STATSview to verify that redo

data is being applied correctly:SQL> SELECT NAME, VALUE FROM V$LOGSTDBY_STATS

2 WHERE NAME = 'coordinator state';A value of INITIALIZING in the VALUEcolumn indicates that log apply services are preparing to begin SQL Apply, but data from the archived redo log files is not being applied to the logical standby database.

e. Query the V$LOGSTDBYview on the logical standby database to see a current snapshot of SQL Apply activity. A text message describing the current activity of each process that is involved in reading and applying changes is displayed.

f. Query the V$LOGSTDBY_PROGRESSview on the logical standby database to check the overall progress of SQL Apply:

SQL> SELECT APPLIED_SCN, LATEST_SCN 2 FROM V$LOGSTDBY_PROGRESS;

Page 223: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 223

Copyright © 2006, Oracle. All rights reserved.8 - 223

Additional Configuration Tasks

Perform the following tasks as appropriate for your configuration:• Configure standby redo logs.• Enable Flashback Database.• Upgrade the data protection mode.

Additional Configuration Tasks

Perform the following tasks as appropriate for your logical standby database:• Configure standby redo logs:Standby redo logs are required for standby databases running

in maximum protection mode and maximum availability mode. However, configuring standby redo logs is recommended on all standby databases because, during a failover, Data Guard can recover and apply more redo data from standby redo log files than from the archived redo log files alone. The standby redo logs should exist on both primary and standby databases and have the same size and names.

• Enable Flashback Database:Flashback Database eliminates the need to re-create the primary database after a failover. Flashback Database is similar to conventional point- in-time recovery in its effects, enabling you to return a database to its state at a time in the recent past. Flashback Database is faster than point-in-time recovery because it does not require restoring data files from backup or the extensive application of redo data. You can enable Flashback Database on the primary database, the standby database, or both.

• Upgrade the data protection mode:The Data Guard configuration is initially set up in maximum performance mode (the default).

Page 224: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 224

Copyright © 2006, Oracle. All rights reserved.8 - 224

Summary

In this lesson, you should have learned how to use SQL commands to create a logical standby database.

Page 225: Data Guard Slides Study Guide_shahul

9Copyright © 2006, Oracle. All rights reserved.

Performing Switchover and Failover

Page 226: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 226

Copyright © 2006, Oracle. All rights reserved.9 - 226

Objectives

After completing this lesson, you should be able to do the following:• Explain the database roles• Perform a switchover• Perform a failover• Use Flashback Database after a failover

Page 227: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 227

Copyright © 2006, Oracle. All rights reserved.9 - 227

Types of Roles in an Oracle Data Guard Configuration

There are two types of roles in an Oracle Data Guar d configuration:• User role: identifies the group and determines the

privileges assigned to a user.• Database role: identifies what role (primary or sta ndby)

the database plays in a Data Guard configuration.

SQL> SELECT database_role FROM v$database; DATABASE_ROLE----------------LOGICAL STANDBY

Types of Roles in an Oracle Data Guard Configuratio n

User roles are named groups of related privileges that you grant to users or other user roles. User roles are designed to ease the administration of the end-user system and schema object privileges.

Database roles identify what “part” the database is “playing” in the Data Guard configuration. A database can be in one of two roles:

• Primary• Standby

A database that is in the standby role is one of the following types:• Physical standby• Logical standby

Page 228: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 228

Copyright © 2006, Oracle. All rights reserved.9 - 228

Role Management Services

• A database operates in one of two mutually exclusiv e roles in a Data Guard configuration:– Primary role: The database is operating in the prim ary

role, and redo transport services are shipping redo to the standby databases.

– Standby role: The database is operating in the stan dby role, and log apply services are applying the archi ved redo logs to the standby database.

• With role management services, you can change these roles dynamically.

Role Management Services

You can use role management services to change the primary and standby roles dynamically as a planned transition called a switchoveroperation, or as a result of a database failure through a failoveroperation.

For example, you might perform a switchover operation to transition the primary database to the standby role and transition a standby database to the primary role to perform routine maintenance tasks.

Page 229: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 229

Copyright © 2006, Oracle. All rights reserved.9 - 229

Role Transitions: Switchover and Failover

• Not automatically invoked• Switchover

– Planned role reversal– Used for OS or hardware maintenance

• Failover– Unplanned role reversal– Used in an emergency– Minimal or no data loss depending on the

data-protection mode– Fast-start failover can be enabled for automatic fa ilover

Role Transitions: Switchover and Failover

Switchover and failover operations are not invoked automatically. You must initiate switchover or failover operations by using a SQL statement or by using the Data Guard GUI or Data Guard broker command- line interface (CLI).

Switchover

You can use the switchover feature to switch the role of the primary database to one of the available standby databases. The chosen standby database becomes the primary database, and the original primary database then becomes a standby database. There is no need to re-create any of the databases in the switchover operation. There is no data divergence between the original and the new primary database after the successful completion of the database switchover.

Page 230: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 230

Role Transitions: Switchover and Failover (continue d)

Failover

You invoke a failover operation when a catastrophic failure occurs on the primary database, and there is no possibility of recovering the primary database in a timely manner. During a failover operation, the incapacitated primary database is removed from the Data Guard environment and a standby database assumes the primary database role. You invoke the failover operation on the standby database that you want to fail over to the primary role.

Note: You can enable fast-start failover to fail over automatically when the primary database becomes unavailable. When fast-start failover is enabled, the broker determines if a failover is necessary and initiates the failover to the specified target standby database automatically, with no need for DBA intervention and with no loss of data. Fast-start failover is discussed in detail in the lesson titled “Enabling Fast-Start Failover.”

Page 231: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 231

Copyright © 2006, Oracle. All rights reserved.9 - 231

Choosing the Best Role Transition Operation

Are you performing a planned role transition so that you can perform hardware or software maintenance on the system that currently hosts the primary database?

Switch over to best available standby database.

Yes

Can you run crash recovery to repair the primary database in a timely manner?

Yes Repair primary database.

No

No

Fail over to best available standby database.

Choosing the Best Role Transition Operation

The goal of a role transition (switchover or failover) is to bring the new primary database online as quickly as possible with no data loss or with the least possible data loss. The decision tree shown in the slide can help you choose the role transition operation that best minimizes downtime and the risk of data loss. In general, you should always consider performing crash recovery to repair the primary database or performing a switchover before you consider performing a failover.

Repairing the primary database may be faster than transitioning a standby database to the primary role, even when you are using a no-data-loss environment. If you can repair the primary database, you also do not have to reconfigure client applications to connect to a new database. However, if the repair operation results in any data loss, you may need to re-create all other standby databases in the configuration from a backup of the repaired primary database.

In general, the best standby database to transition to is a physical standby database that has the most redo applied to it.

Page 232: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 232

Copyright © 2006, Oracle. All rights reserved.9 - 232

Switchover

• Transitions the roles of the primary and standby databases

• No resetting of the online redo logs of the new pri mary database

• No data loss

Switchover

A switchover operation transitions the primary database to the standby role and transitions the standby database to the primary role, without resetting the online redo logs of the new primary database.

If the switchover operation involves a physical standby database, both the primary database and the physical standby database switching over to the primary role will be shut down and restarted. However, there is no need to shut down and restart any other standby databases that are not participants in the switchover operation. If the switchover operation involves a logical standby database, there is no need to shut down and restart either the primary database or any of the standby databases. Logical standby databases do not need to be shut down and restarted.

Note: All extra RAC instances will be shut down and restarted.

Page 233: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 233

Copyright © 2006, Oracle. All rights reserved.9 - 233

Switchover: Before

Standbydatabase

Read/writetransactions

Primarydatabase

San FranciscoBoston

Oracle Net

Application

Application

Read-only reports

Switchover: Before

For example, assume that the primary database is located in San Francisco and the physical standby database is located in Boston. Switchovers are initiated only on the primary database. They cannot be initiated from the standby database.

Page 234: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 234

Copyright © 2006, Oracle. All rights reserved.9 - 234

Switchover: After

Standbydatabase

Read/writetransactions

Primarydatabase

Application

Application

Read-only reports

San FranciscoBoston

Oracle Net

Switchover: After

After the switchover completes, each database has the role opposite to the one that it had before the switchover. In our example, Boston is now the primary database and San Francisco is the standby database.

Data Guard does not automatically switch over sessions from one database to the other, so active sessions for each system need to reconnect.

Page 235: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 235

Copyright © 2006, Oracle. All rights reserved.9 - 235

Standby Redo Logs and Switchovers

Standby redo logs should be configured on the prima ry database to ease switchovers.

Redo shipment

RFS

Standbyredo logs

Online redo logs

Primarydatabase

Standbydatabase

Standbyredo logs

Standby Redo Logs and Switchovers

Standby redo log configuration should be identical on the primary database and on any physical standby databases. Even though the standby redo logs are not used when the database is in the primary role, configuring the standby redo logs on the primary database is recommended in preparation for an eventual switchover operation.

Page 236: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 236

Copyright © 2006, Oracle. All rights reserved.9 - 236

Preparing for a Switchover

Verify the following in preparation for the switcho ver operation: network connectivity between the primary and standby locations.

Preparing for a Switchover

Each location in the Data Guard configuration should have connectivity through Oracle Net to the primary database and to all associated standby databases.

Page 237: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 237

Copyright © 2006, Oracle. All rights reserved.9 - 237

Performing a Switchover by UsingEnterprise Manager

Select the database and click Switchover.

Performing a Switchover with Enterprise Manager

The following tasks are performed when Enterprise Manager is used for the switchover:a. A check is made to ensure that the primary database and standby database are not currently in

an error status condition and that broker management of the primary database is enabled and online.

b. Any active sessions connected to the primary database are automatically closed during the switchover.

c. The primary database is first changed to the standby role, and then the standby database is changed to the primary role.

d. If the switchover target is a physical standby database, the target and primary databases are each restarted.

To initiate a switchover by using Enterprise Manager:1. On the Data Guard page, select the standby database that you want to become the primary

database.2. Click Switchover.

Page 238: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 238

Copyright © 2006, Oracle. All rights reserved.9 - 238

Performing a Switchover by UsingEnterprise Manager

Click Yes to confirm.

Performing a Switchover with Enterprise Manager (co ntinued)

3. The Data Guard Switchover Confirmation page appears.4. You can view active sessions by clicking the Browse Primary Database Sessions link.5. Click Yes to continue with the switchover, or click No to cancel.

You cannot cancel the switchover operation after it has begun.

Page 239: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 239

Copyright © 2006, Oracle. All rights reserved.9 - 239

Performing a Switchover by UsingEnterprise Manager

Performing a Switchover with Enterprise Manager (co ntinued)

The Data Guard Switchover processing page displays the progress of the switchover operation as it performs the following steps:

• Switch roles between the primary and standby databases. If the switchover target is a physical standby database, it is restarted along with the primary database.

• Wait for the Data Guard broker to complete the initialization tasks required to switch the database roles.

You can view the database alert log of the primary and standby databases by clicking the respective “View alert log” links. A new browser window opens with the content of the alert log.

After the switchover operation is complete, you are returned to the Data Guard page.

Page 240: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 240

Copyright © 2006, Oracle. All rights reserved.9 - 240

Performing a Switchover to a Physical Standby by Using SQL

Perform these steps only if you are not using the D ata Guard broker.On the original primary database:1. Verify that it is possible to perform a switchover

operation.2. Initiate the switchover operation on the primary

database:

3. Shut down and restart the instance.

SQL> ALTER DATABASE COMMIT TO SWITCHOVER TO 2 PHYSICAL STANDBY;

Performing a Switchover to a Physical Standby by Us ing SQL

You can perform a switchover using SQL, as described in the following steps. You should not execute these steps when managing your configuration with the Data Guard broker. Consider using the Data Guard broker to automate and simplify the switchover procedure.

Execute steps 1 through 3 on the original primary database: 1. Query the SWITCHOVER_STATUScolumn of the V$DATABASEview on the primary

database to verify that it is possible to perform a switchover operation. A TO STANDBYvalue in the SWITCHOVER_STATUScolumn indicates that it is possible to switch the primary database to the standby role.

2. To transition the primary database to a physical standby database role, execute the following SQL statement:

SQL> ALTER DATABASE COMMIT TO SWITCHOVER TO2 PHYSICAL STANDBY WITH SESSION SHUTDOWN WAIT;

The WAIT option specifies that control is not returned to you until the statement completes.3. Shut down the instance and restart the database in MOUNTmode:

SQL> SHUTDOWN IMMEDIATE;SQL> STARTUP MOUNT;

Page 241: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 241

Copyright © 2006, Oracle. All rights reserved.9 - 241

Performing a Switchover to a Physical Standby by Using SQL

On the original physical standby database:1. Verify the switchover status in the V$DATABASEview.

2. Switch the physical standby database role to the primary role.

3. If the standby database was opened read-only, shut down and restart the new primary database. If it wa s not opened read-only, open the database.

4. Begin archiving logs to the physical standby databa se.

Performing a Switchover to a Physical Standby by Us ing SQL (continued)

Execute steps 4 through 7 on the original standby database:4. After you switch the primary database to the standby role and the switchover notification has

been received by the standby database, you should verify that the switchover notification has been processed by the standby database by querying the SWITCHOVER_STATUScolumn of the V$DATABASEfixed view on the standby database. You should see a value of TO_PRIMARY.

5. Execute the following SQL statement on the physical standby database that you want to switch to the primary role: ALTER DATABASE COMMIT TO SWITCHOVER TO PRIMARY

6. If the standby database was opened read-only, shut down and restart the new primary database.

SQL> SHUTDOWN IMMEDIATE;SQL> STARTUP;

If it was not opened read-only, open the database with the ALTER DATABASE OPENcommand.The selected physical standby database is now transitioned to the primary database role. There is no need to shut down and restart any other standby databases that were online at the time of the switchover operation.

7. Issue the following statement on the new primary database to start redo transport:SQL> ALTER SYSTEM SWITCH LOGFILE;

Page 242: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 242

Copyright © 2006, Oracle. All rights reserved.9 - 242

Performing a Switchover to a Logical Standby by Using SQL

On the original primary database:1. Verify that it is possible to perform a switchover.2. Prepare the primary database for the switchover:

SQL> ALTER DATABASE PREPARE TO SWITCHOVER 2 TO LOGICAL STANDBY;

Performing a Switchover to a Logical Standby by Usi ng SQL

When you perform a switchover that changes roles between a primary database and a logical standby database, you must always initiate the switchover on the primary database and complete it on the logical standby database.

Perform steps 1 and 2 on the original primary database:1. Query the SWITCHOVER_STATUScolumn of the V$DATABASEview on the primary

database to verify that it is possible to perform a switchover operation. A TO STANDBYor SESSIONS ACTIVEvalue in the SWITCHOVER_STATUScolumn indicates that it is possible to switch the primary database to the standby role.

2. Issue the following SQL statement to prepare the current primary database for a logical standby database role:

SQL> ALTER DATABASE PREPARE TO SWITCHOVER 2 TO LOGICAL STANDBY;

This statement notifies the current primary database that it will soon switch to the logical standby role and begin receiving redo data from a new primary database.

Page 243: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 243

Copyright © 2006, Oracle. All rights reserved.9 - 243

Performing a Switchover to a Logical Standby by Using SQL

On the original logical standby database:3. Prepare the logical standby database for switchover :

SQL> ALTER DATABASE PREPARE TO SWITCHOVER 2 TO PRIMARY;

Performing a Switchover to a Logical Standby by Usi ng SQL (continued)

Perform step 3 on the logical standby database:3. Issue the following statement to build a LogMiner dictionary on the logical standby database

that is the target of the switchover:SQL> ALTER DATABASE PREPARE TO SWITCHOVER TO PRIMARY;

This statement also starts redo transport services on the logical standby database to begin transmitting its redo data to the current primary database and to other standby databases in the Data Guard configuration. The sites receiving redo data from this logical standby database accept the redo data, but they do not apply it.

Page 244: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 244

Copyright © 2006, Oracle. All rights reserved.9 - 244

Performing a Switchover to a Logical Standby by Using SQL

On the original primary database:4. Verify the switchover status in V$DATABASE.

5. Switch the primary database to the logical standby database role:

SQL> ALTER DATABASE COMMIT TO SWITCHOVER 2 TO LOGICAL STANDBY;

Performing a Switchover to a Logical Standby by Usi ng SQL (continued)

Perform steps 4 and 5 on the original primary database:4. Verify that the LogMiner dictionary was received by the primary database by querying the

SWITCHOVER_STATUScolumn of V$DATABASEon the primary database. When the query returns TO LOGICAL STANDBY in the SWITCHOVER_STATUScolumn, proceed with step 5.

5. Issue the following SQL statement to transition the primary database to a logical standby database role:

SQL> ALTER DATABASE COMMIT TO SWITCHOVER 2 TO LOGICAL STANDBY;

This statement waits for all current transactions on the primary database to end and prevents any new users from starting new transactions. It also puts a marker in the redo data to provide a synchronization point for logical standby database operations.Executing this statement also prevents users from making any changes to the data being maintained in the logical standby database. To ensure faster execution, ensure that the primary database is in a quiet state with no update activity before issuing the switchover statement. You can query V$TRANSACTIONSfor the status of any current in-progress transactions that could delay execution of this statement.

Page 245: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 245

Copyright © 2006, Oracle. All rights reserved.9 - 245

Performing a Switchover to a Logical Standby by Using SQL

SQL> ALTER DATABASE COMMIT TO SWITCHOVER 2 TO PRIMARY;

SQL> ALTER SYSTEM ARCHIVE LOG CURRENT;

On the new primary database (original logical stand by database):6. Verify the switchover status in V$DATABASE.7. Switch the logical standby database to the primary

database role.

8. Ensure that all standby databases begin receiving r edo data.

Performing a Switchover to a Logical Standby by Usi ng SQL (continued)

Perform steps 6, 7, and 8 on the new primary database (original logical standby database):6. Verify that the switchover notification was processed by the target standby database by

querying the SWITCHOVER_STATUScolumn of the V$DATABASEfixed view on the target standby database. The SWITCHOVER_STATUSvalue is updated to show progress during the switchover. When the status is TO PRIMARY, proceed with step 7.

7. Issue the following SQL statement to switch the logical standby database to the primary role:SQL> ALTER DATABASE COMMIT TO SWITCHOVER TO PRIMARY;

8. Issue the following statement to perform a log switch and to ensure that all logical standby databases begin receiving redo data from the new primary database:

SQL> ALTER SYSTEM ARCHIVE LOG CURRENT;

Page 246: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 246

Copyright © 2006, Oracle. All rights reserved.9 - 246

Performing a Switchover to a Logical Standby by Using SQL

On the new logical standby database:9. Start SQL Apply.

SQL> ALTER DATABASE 2 START LOGICAL STANDBY APPLY;

Performing a Switchover to a Logical Standby by Usi ng SQL (continued)

Perform step 9 on the new logical standby database:9. Issue the following statement to start SQL Apply:

SQL> ALTER DATABASE START LOGICAL STANDBY APPLY;

Page 247: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 247

Copyright © 2006, Oracle. All rights reserved.9 - 247

Considerations When Performing a Switchover to a Logical Standby Database

• Switchover operation does not cause a shutdown of the primary.

• There is no need to terminate user sessions, but termination is recommended.

• Logical standby database may not have all data.

Considerations When Performing a Switchover to a Lo gical Standby Database

Consider the following when performing a switchover to a logical standby database:• Unlike a switchover to a physical standby database, a switchover to a logical standby

database does not require a shutdown of the primary database.• If you are switching over to a logical standby database, you do not need to terminate

applications that are connected to the current primary database or to the logical standby database, because neither database is shut down during the switchover operation. However, because sessions on the old primary database may fail after the switchover operation completes and the database guard is turned on, you should terminate such open sessions now. The database guard prevents users from making changes in the logical standby database.

• If you switch over to a logical standby database, there may be a loss of data if the logical standby database contains only a subset of the data that is present in the primary database.

Page 248: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 248

Copyright © 2006, Oracle. All rights reserved.9 - 248

Situations That Prevent a Switchover

You cannot perform a switchover in the following situations:• Archived redo log files are unavailable.• Point-in-time recovery is required.• Production database is not open and cannot be

opened.

Situations That Prevent a Switchover

The following situations prevent the execution of a switchover operation:• Archived redo log files are unavailable:If there is a gap in the archived redo log files on

the standby database, you are not able to switch over to that standby database. • Point-in-time recovery is required:When you perform a switchover to a standby database,

you always switch over to the current state of the primary database. You cannot switch over to a time in the past.

• Production database is not open and cannot be opened: A switchover is initiated on the primary database while it is in the open state. If you cannot open the primary database, a switchover is not possible.

Page 249: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 249

Copyright © 2006, Oracle. All rights reserved.9 - 249

Failover

Standbydatabase becomes primary database.

Read/writetransactions

Online redologs

Local archiving

San FranciscoBoston

Archived redologs

Application

Online RedoLogs

Local Archiving

Archived redologs

Primary database

Failover

You invoke a failover operation when a catastrophic failure occurs on the primary database and there is no possibility of recovering the primary database in a timely manner. During a failover operation, the primary database is removed from the Data Guard environment and a standby database assumes the primary database role. Failing over to a standby database is a permanent operation. You cannot undo the failover and return the database to its former role as a standby database. Because of this, you should invoke a failover operation only in an emergency.

It is not always necessary to fail over to the standby database. In some cases, recovery of the primary database may be faster. Most failures can be resolved at a primary database within a reasonable amount of time.

In a failover operation:• The original primary database is presumed to be lost. You must re-create (or flash back) the

original primary database as a new standby database, if desired.• Standby databases that are online at the time of the failover operation, but are not involved in

the role transition, do not need to be shut down and restarted.

Page 250: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 250

Copyright © 2006, Oracle. All rights reserved.9 - 250

Failover Considerations

• Old primary database is no longer part of the configuration.

• Data loss is possible.• Failover should be used only in an emergency.• Special-case failover: activation of a standby

Failover Considerations

During a failover operation, a standby database transitions to the primary role and the old primary database is rendered unable to participate in the configuration. Depending on the protection mode under which the old primary database was operating before the failover, there may be some or no data loss during a failover. A failover is typically used only when a primary database becomes incapacitated and there is no possibility of performing a switchover or successfully repairing the primary database within a reasonable amount of time. The specific actions that are performed during a failover vary depending on whether a logical or physical standby database is involved in the failover operation, the state of the configuration at the time of the failover, and the specific SQL commands that are used to initiate the failover.

There is also a special-case failover in which the standby database is activated. This should be avoided unless absolutely necessary because it causes all other databases in the configuration to become permanently disabled.

Page 251: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 251

Copyright © 2006, Oracle. All rights reserved.9 - 251

Performing a Failover by UsingEnterprise Manager

Select the database and click Failover.

Performing a Failover with Enterprise Manager

You should perform a failover only in the event of a software or system failure that results in the loss of the primary database. The failed primary database is disabled by the broker and must be re-created. The standby database then assumes the primary database role.

To initiate a failover by using Enterprise Manager:1. On the Data Guard page, select the standby database that you want to become the primary

database.2. Click Failover.

Page 252: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 252

Copyright © 2006, Oracle. All rights reserved.9 - 252

Performing a Failover by UsingEnterprise Manager

Performing a Failover with Enterprise Manager (cont inued)

3. Confirm that you want to proceed with the failover operation by clicking Yes.

Page 253: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 253

Copyright © 2006, Oracle. All rights reserved.9 - 253

Performing a Failover by UsingEnterprise Manager

Select the failover type and click Yes.

Performing a Failover with Enterprise Manager (cont inued)

4. On the Data Guard Failover Confirmation page, you must specify the type of failover that you want to perform:

- Complete: All available redo is applied on the standby database. Oracle Corporation recommends that you specify this type of failover.

- Immediate: No additional data is applied on the standby database resulting in a data loss failover and should be used only when a Complete failover is not possible.

5. Select the failover option, and then click Yes to confirm the failover operation.

Page 254: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 254

Copyright © 2006, Oracle. All rights reserved.9 - 254

Performing a Failover by UsingEnterprise Manager

Performing a Failover with Enterprise Manager (cont inued)

After you click Yes, the Failover Processing page shows you the progress of the failover operation.

You cannot cancel this operation after it begins.

Page 255: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 255

Copyright © 2006, Oracle. All rights reserved.9 - 255

Performing a Failover to a Physical Standby Database

The physical standby database needs to be

reinstated.

Performing a Failover to a Physical Standby Databas e

During the failover operation, the selected standby database transitions into the primary role. If the failover target is a physical standby database, it is restarted. If you are failing over to a logical standby database, it is not restarted. When the operation is completed, the Data Guard Overview page reflects the updated configuration.

After a complete or immediate failover, the primary database and some standby databases may need to be reinstated or re-created.

To reinstate the database, click the “Database must be reinstated” link. Click Reinstate on the General Properties page. Enterprise Manager reinstates the database as a standby database to the new primary database.

Note: Flashback Database must have been enabled on the database prior to the failover and there must be sufficient flashback logs on that database for the reinstatement to succeed. In addition, the database to be reinstated and the new primary database must have network connectivity.

Page 256: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 256

Copyright © 2006, Oracle. All rights reserved.9 - 256

Performing a Failover to a Logical Standby Database

The logical standby database is now the primary database.

The physical standby database is disabled.

Performing a Failover to a Logical Standby Database

When you perform a failover to a logical standby database, any physical standby databases in the configuration are permanently disabled after the failover and are no longer usable. These databases must be re-created from the new primary database.

Page 257: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 257

Copyright © 2006, Oracle. All rights reserved.9 - 257

Performing a Failover to a Physical Standby Database by Using SQL

1. Identify and resolve any gaps in the archived redo log files.

2. Repeat step 1 until all gaps are resolved.3. Copy any other missing archived redo log files.4. Initiate the failover operation on the target stand by

database.5. Convert the physical standby database to the primar y

role.6. Complete the transition of the standby database to the

primary database role.7. (Optional) Back up the new primary database. 8. (Optional) Restore the failed primary database.

Performing a Failover to a Physical Standby Databas e by Using SQL

Perform the following steps to fail over to a physical standby database by using SQL.

Note: If the target standby database was operating in maximum protection mode, no gaps in the archived redo log files should exist, and you can proceed directly to step 4. Otherwise, begin with step 1 to determine if any manual gap resolution steps must be performed.

1. To determine if there are gaps in the archived redo log files on the target standby database, query the V$ARCHIVE_GAPview. This view contains the sequence numbers of the archived redo log files that are known to be missing for each thread. The data returned reflects the highest gap only.

SQL> SELECT thread#, low_sequence#, high_sequence# 2 FROM v$archive_gap;

If possible, copy all of the identified missing archived redo log files to the target standby database from the primary database and register them. Execute the following command to register the redo log files:

SQL> ALTER DATABASE REGISTER PHYSICAL LOGFILE 'file spec1';Perform this step for each thread.

2. Repeat step 1 until all gaps are resolved. The query that is executed in step 1 displays information for the highest gap only. Repeat step 1 until the query returns no rows.

Page 258: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 258

Performing a Failover to a Physical Standby Databas e by Using SQL (continued)

3. To determine if there are any other missing archived redo log files, query the V$ARCHIVED_LOGview on the target standby database to obtain the highest sequence number for each thread.

SQL> SELECT UNIQUE THREAD# AS THREAD, MAX(SEQUENCE#)2 OVER (PARTITION BY thread#) AS LAST 3 FROM V$ARCHIVED_LOG;

Copy to the target standby database any available primary database archived redo log files that contain sequence numbers higher than the highest sequence number that is available on the target standby database. Then register those redo log files by issuing the following SQL statement:

SQL> ALTER DATABASE REGISTER PHYSICAL LOGFILE 'file spec1';

Perform this step for each thread.After registering all available archived redo log files, query the V$ARCHIVE_GAPview (as described in step 1) to verify that no additional gaps were introduced in step 3.

4. Execute the following SQL statement to initiate the failover:SQL> ALTER DATABASE RECOVER

2 MANAGED STANDBY DATABASE FINISH FORCE;

5. Transition the physical standby database to the primary database role by issuing the following SQL statement:

SQL> ALTER DATABASE COMMIT TO SWITCHOVER TO PRIMARY;

After issuing this SQL statement, you can no longer use this database as a standby database. Any subsequent redo that is received from the original primary database cannot be applied. During the failover process, the standby redo log files are automatically archived and recovered on all other standby databases that are derived from the original primary database if the standby destinations are correctly defined on the new primary database.

Perform step 6 on the new primary database.6. If the physical standby database has not been opened in read-only mode since the last time it

was started, open the new primary database as follows and proceed to step 7:SQL> ALTER DATABASE OPEN;

If the physical database has been opened in read-only mode since the last time it was started, shut down the target standby database (new primary database) and restart it as follows:

SQL> SHUTDOWN IMMEDIATE;SQL> STARTUP;

7. Perform an open backup of the database after opening the database. Although performing a backup immediately is not required, it is recommended because you cannot recover changes that are made after the failover without a complete backup copy of the database.

Page 259: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 259

Performing a Failover to a Physical Standby Databas e by Using SQL (continued)

8. After a failover, the original primary database no longer participates in the configuration. After performing a failover, you may be able to optionally restore the failed primary database as a new standby database using either of the following methods:

- Use Flashback Database to restore the failed primary database to a point in time before the failover occurred, and then convert it into a standby database.

- Re-create the failed database and add it to the configuration as a new standby database. To reuse the old primary database in the new configuration, you must re-create it as a standby database using a backup copy of the new primary database.

After the failed primary database is restored and is operating in the standby role, you can optionally perform a switchover to transition the databases to their original (pre-failure) roles.

Page 260: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 260

Copyright © 2006, Oracle. All rights reserved.9 - 260

Performing a Failover to aLogical Standby Database by Using SQL

1. Copy missing redo logs to the logical standby database.

2. Register the missing redo logs:

3. If it exists, register the partially filled archive log file.4. Ensure that all redo log files have been applied to the

new primary database.

SQL> ALTER DATABASE REGISTER LOGICAL 2 LOGFILE ' filespec ';

SQL> SELECT APPLIED_SCN, LATEST_SCN 2 FROM V$LOGSTDBY_PROGRESS;

Performing a Failover to a Logical Standby Database by Using SQL

To perform failover for logical standby databases using SQL: 1. If redo logs exist on the primary database that have not yet been applied on the logical

standby database, manually copy the redo logs to that standby database. 2. You must register the redo log files that you manually copied from the original primary

database. Issue the following SQL statement for each missing redo log file on the logical standby:

SQL> ALTER DATABASE REGISTER LOGICAL LOGFILE 'files pec';

3. On the logical standby database, check if there is a partially written archived log file. If it exists, this file has a sequence number that is one greater than the last registered archived log file. If it exists, register the partially filled archived log file.

4. On the new primary database, ensure that the remaining redo logs have been applied by checking the V$LOGSTDBY_PROGRESSview. When the values in the APPLIED_SCNand LATEST_SCNcolumns are equal, all available redo has been applied. The logical standby database now contains as much data as possible from the primary database. Issue the following query:

SQL> SELECT APPLIED_SCN, LATEST_SCN 2 FROM V$LOGSTDBY_PROGRESS;

Page 261: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 261

Copyright © 2006, Oracle. All rights reserved.9 - 261

Performing a Failover to aLogical Standby Database by Using SQL

5. Activate the new primary database:

6. Enable archiving of redo logs.7. Begin SQL Apply operations on all logical standby

databases:

SQL> ALTER DATABASE ACTIVATE 2 LOGICAL STANDBY DATABASE3 FINISH APPLY;

SQL> ALTER DATABASE START LOGICAL STANDBY 2 APPLY NEW PRIMARY dblin k;

Performing a Failover to a Logical Standby Database by Using SQL (continued)

5. To stop the RFS process, apply remaining redo, stop SQL Apply, and activate the database in the primary database role, issue the following statements on the logical standby database that you are transitioning to the new primary role:

SQL> ALTER DATABASE ACTIVATE LOGICAL STANDBY DATABASE2 FINISH APPLY;

6. Enable archiving of redo logs to all remote logical standby destinations, as in the following example:

SQL> ALTER SYSTEM SET LOG_ARCHIVE_DEST_STATE_2=ENABLE

In general, when the database operates in the primary role, you must enable archiving of redo logs to remote destinations. When the database operates in the standby role, you must disable archiving of redo logs to remote destinations.

7. Issue the following command to begin SQL Apply operations on all logical standby databases in the configuration:

SQL> ALTER DATABASE START LOGICAL STANDBY 2 APPLY NEW PRIMARY dblink;

Note: Any logical standby databases that are more current (have applied more redo operations) than the standby database to which the primary database has failed over to must be re-created from a backup of the new primary database and added back to the configuration.

Page 262: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 262

Copyright © 2006, Oracle. All rights reserved.9 - 262

Activating a Standby Database

When you are unable to fail over, you can activate a standby database by issuing one of the following commands (depending on the role of the database):

SQL> ALTER DATABASE ACTIVATE 2 LOGICAL STANDBY DATABASE;

SQL> ALTER DATABASE ACTIVATE 2 PHYSICAL STANDBY DATABASE;

Activating a Standby DatabaseYou can use the ALTER DATABASE ACTIVATE STANDBY DATABASEcommand to force the standby database into the primary role. Specify the appropriate option, PHYSICALor LOGICAL, for the type of database that you are activating. You can issue this command in a situation in which you cannot perform a failover operation.

Page 263: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 263

Copyright © 2006, Oracle. All rights reserved.9 - 263

Restoring Databases After a Role Transition

Additional steps may be needed to restore your disa ster-recovery solution after a role transition:• Databases may be disabled, but are not removed from

the broker configuration.• Reenable broker management of the databases:

– Reinstate databases using the REINSTATE DATABASE

command or through Enterprise Manager.– Re-create databases from a copy of the primary data base

and reenable the database.

Restoring Databases After a Role Transition

If a database can be reinstated, it has the following status after a complete failover: ORA-16661: the standby database needs to be reinstated. The “Database must be reinstated” message is displayed in the Status column in Enterprise Manager. Reinstate the database using the DGMGRL REINSTATE DATABASEcommand or the reinstate option in Enterprise Manager.

A database that must be re-created from a copy of the new primary database, has the following status: ORA-16795: the broker detects that database re-creation is required. Re-create the standby database from a copy of the primary database and then reenable it.

Page 264: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 264

Copyright © 2006, Oracle. All rights reserved.9 - 264

Flashback Through Standby DatabaseRole Transitions

• Use Flashback Database to flash back a database to a point in time before a switchover or failover.

• Primary and standby databases retain their current roles when you flash back through physical standby switchovers or failovers.

• Database roles will be flashed back when you flash back through logical standby switchovers or failove rs.

• Flashback database can be used to undo a physical database activation.

Flashback Through Standby Database Role Transitions

You can use Flashback Database to revert a database to a point in time before a physical standby database switchover or failover. The database role does not change when flashing back through a physical standby switchover, failover, or activation.

In a logical standby database, the FLASHBACK DATABASEcommand reverts the database to a system change number (SCN) or timestamp before a switchover or failover. For a logical standby database, the database reverts to its original role at the time of the flashback SCN or flashback time.

You can also use Flashback Database to undo a physical standby activation, making a physical standby database more useful. Previously, you could open standby databases as read-only only. Read-only mode is usually not adequate for running report tools because these tools typically also change the database. In Oracle Database 10g Release 2, a physical standby database can be temporarily activated to run reports and tests. After noting or saving the results, you can flash back your database to revert to a standby database.

Page 265: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 265

Copyright © 2006, Oracle. All rights reserved.9 - 265

Using Flashback Database After Failover

Failover

New standby database

Redo

Redo

New primary database

Flashback

Primary database

Standby database

Using Flashback Database After Failover

You invoke a failover operation when a catastrophic failure occurs on the primary database and there is no possibility of recovering the primary database in a timely manner. After a failover operation, the old standby database becomes the new primary database, and the old primary database is placed in the “needs reinstatement” state.

You can use the Flashback Database feature to convert the old primary database into a new standby database without re-creating the database. You can flash back the old primary database so that it contains only those changes that are already applied to the old standby database. This enables you to convert the old primary database into a new standby database without restoring the old primary database.

Note: You must have the Flashback Database feature enabled on the old primary database.

Page 266: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 266

Using Flashback Database After Failover (continued)

Physical Standby Configuration

In a physical standby configuration, use the following procedure to avoid reinstantiating the old primary database after a failover:

1. On the new primary database, issue the following query to determine the system change number (SCN) at which the old standby database became the new primary database:

SELECT standby_became_primary_scn FROM v$database;

2. After the old primary database site is available, mount the old primary database.STARTUP MOUNT;

3. Flash back the old primary database to the “standby became primary” SCN that you determined in step 1:

FLASHBACK DATABASE TO SCN <SCN>;

4. On the old primary database, issue the following command to convert the control file to a standby control file:

ALTER DATABASE CONVERT TO PHYSICAL STANDBY;

5. Shut down the old primary instance.SHUTDOWN IMMEDIATE;

6. Mount the old primary database. The old primary database is now your new standby database.

STARTUP MOUNT;

7. On the new primary database, enable redo transport to the old primary database (new standby database). Check the status of the archive destinations and enable any that are not enabled.

SELECT DEST_ID, DEST_NAME, STATUS, PROTECTION_MODE, DESTINATION, ERROR, SRL FROM V$ARCHIVE_DEST_STATUS;ALTER SYSTEM SET LOG_ARCHIVE_DEST_STATE_n=ENABLE;

Then, archive a new log to the new standby by issuing the following command:ALTER SYSTEM ARCHIVE LOG CURRENT;

8. On the new standby database, start managed standby recovery. The role reversal is now complete:

ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT;

If you are using real-time apply:ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE DISCONNECT;

Page 267: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 267

Using Flashback Database After Failover (continued)

Logical Standby Configuration

In a logical standby configuration, use the following procedure to avoid reinstantiating the old primary database after a failover:

1. On the new primary database, issue the following query to determine the SCN to which you want to flash back the failed primary database:

SELECT applied_scn AS flashback_scn FROM v$logstdby_progress;

2. On the new primary database, issue the following query to determine if you need to copy any redo log files to the failed primary database so that Flashback Database reaches a consistent state:

SELECT NAME FROM DBA_LOGSDTBY_LOGWHERE NEXT_CHANGE# >

(SELECT VALUE FROM DBA_LOGSTDBY_PARAMETERSWHERE NAME = 'STANDBY_BECAME_PRIMARY_SCN')

AND FIRST_CHANGE <= (FLASHBACK_SCN from step 1);

3. Shutdown (if required) and mount the failed primary database.SHUTDOWN IMMEDIATE;STARTUP MOUNT;

4. Flash back the old primary database to the “standby became primary” SCN that you determined in step 1:

FLASHBACK DATABASE TO SCN <SCN>;

5. Enable the Data Guard guard to prevent the job queue from executing:ALTER DATABASE GUARD ALL;

6. Open the database with the RESETLOGSoption: ALTER DATABASE OPEN RESETLOGS;

7. Create a database link to the new primary database:CREATE PUBLIC DATABASE LINK mylinkCONNECT TO system IDENTIFIED BY passwordUSING ' service_name_of_new_primary_database';

8. Start SQL Apply:ALTER DATABASE START LOGICAL STANDBY APPLY NEW PRIMARYmylink;

Page 268: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 268

Copyright © 2006, Oracle. All rights reserved.9 - 268

Summary

In this lesson, you should have learned how to:• Use the Data Guard GUI to perform switchover and

failover operations• Use SQL commands to perform switchover and failover

operations• Use Flashback Database after a failover

Page 269: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 269

Copyright © 2006, Oracle. All rights reserved.9 - 269

Practice 9: Overview

This practice covers the following topics:• Performing a switchover• Performing a failover

Page 270: Data Guard Slides Study Guide_shahul
Page 271: Data Guard Slides Study Guide_shahul

10Copyright © 2006, Oracle. All rights reserved.

Enabling Fast-Start Failover

Page 272: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 272

Copyright © 2006, Oracle. All rights reserved.10 - 272

Objectives

After completing this lesson, you should be able to :• Configure fast-start failover• View information about the fast-start failover

configuration• Manage the observer• Perform role changes in a fast-start failover

configuration• Manually reinstate the primary database

Page 273: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 273

Copyright © 2006, Oracle. All rights reserved.10 - 273

Fast-Start Failover: Overview

Primary database

Fast-start failover standby database

Observer

Fast-Start Failover: Overview

Fast-start failover enables Data Guard to rapidly and automatically fail over to a previously chosen standby database without requiring manual intervention. This feature increases the availability of your database in the event of a disaster by reducing the need for you to perform a failover operation manually.

The observer is an OCI client-side component that runs on a separate computer and monitors theavailability of the primary database.

Note: Fast-start failover is an Oracle Data Guard 10g Release 2 feature.

Page 274: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 274

Copyright © 2006, Oracle. All rights reserved.10 - 274

When Will Fast-Start Failover Occur?

Primary database

Fast-start failover standby database

Observer

Loss of connectivity >fast-start failover threshold

When Will Fast-Start Failover Occur?

Fast-start failover occurs when any of the following conditions occurs:• Loss of connectivity between both the primary database and the observer, and between the

primary database and the fast-start failover target standby database, exceeds the fast-start failover threshold

• Database health-check mechanism determines that the primary database data files are offline• An instance crash occurs for a single- instance database• All instances of a Real Application Clusters (RAC) primary database crash• Shutdown abort of the primary database occurs

Page 275: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 275

Copyright © 2006, Oracle. All rights reserved.10 - 275

Installing the Observer

Observer

• The observer is a separate OCI client-side componen t that monitors the availability of the primary datab ase.

• Install it on a different computer from the primary and standby databases.

• Manage the observer through Oracle Enterprise Manager or by using DGMGRL commands.

Installing the Observer

To use fast-start failover, you must install DGMGRL and run the observer software on a computer system that is separate from the primary and standby systems.

To install DGMGRL on the observer computer, use one of the methods described as follows:• Install the complete Oracle Client Administrator by choosing the Administrator option in the

Oracle Universal Installer. This installation includes DGMGRL but it does not include the Oracle Enterprise Manager agent. This type of installation enables you to manage the observer using DGMGRL commands but not Oracle Enterprise Manager.

• Install the full Oracle Database 10g software kit. This installation includes DGMGRL and the Oracle Enterprise Manager agent, allowing you to manage the observer using Oracle Enterprise Manager or DGMGRL commands.

Page 276: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 276

Copyright © 2006, Oracle. All rights reserved.10 - 276

Configuring Fast-Start Failover

1. Specify the target standby database.2. Set the FastStartFailoverThreshold property.

3. Enable fast-start failover.4. Start the observer.5. Verify the configuration.

Configuring Fast-Start Failover

The manual steps to configure fast-start failover are described in detail on the next few pages. Configuring Fast-Start Failover by using Enterprise Manager Grid Control is described later in the lesson.

Page 277: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 277

Copyright © 2006, Oracle. All rights reserved.10 - 277

Step 1: Specifying the Target Standby Database

Fast-start failover standby database

Primary database

EDRSR10P1_ORCL EDRSR10P1_SITE1

EDIT DATABASE edrsr10p1_orclSET PROPERTY FastStartFailoverTarget = edrsr10p1_site1;

Step 1: Specifying the Target Standby Database

In a Data Guard configuration with multiple standby databases, you must set theFastStartFailoverTarget database property before enabling fast-start failover.

Before enabling fast-start failover, set theFastStartFailoverTarget property for the primary database to the fast-start failover target standby database. When you enable fast-start failover, the Data Guard broker automatically sets theFastStartFailoverTarget property for the fast-start failover target standby database to the database name of the primary database.

Execute the command when connected to the primary database or to any standby database with connectivity to the primary database within the configuration.

The command syntax is as follows:EDIT DATABASE database-nameSET PROPERTY FastStartFailoverTarget = FSFO-database-name;

Note: Database-nameand FSFO-database-nameare the values of the DB_UNIQUE_NAMEinitialization parameter for the respective databases.

You do not need to set theFastStartFailoverTarget property in a configuration with only one standby database because the Data Guard broker will automatically set it appropriately for the primary database and the standby database when fast-start failover is enabled.

Page 278: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 278

Copyright © 2006, Oracle. All rights reserved.10 - 278

Step 2: Setting the Fast-Start Failover Threshold

EDIT CONFIGURATION SET PROPERTY FastStartFailoverThreshold = threshold-val ;

Primary database

EDRSR10P1_ORCL

Step 2: Setting the Fast-Start Failover Threshold

The fast-start failover threshold (FSFT) specifies how long the observer and target standby database should simultaneously wait to hear from the primary database before initiating a fast-start failover. The threshold value is specified as a positive, non-zero number of seconds. The default value for FSFT is 30 seconds. When choosing a value for this parameter, you must balance the increased risk of an unnecessary failover (for example, if the network connection was temporarily broken for a few seconds) against the benefits of faster failover and less downtime during a critical outage.

Recommended settings for the Fast-Start Failover Threshold are:• Single instance primary, low latency, reliable network = 10-15 seconds• Single instance primary, high latency network over WAN = 30-45 seconds• RAC primary = (CSS misscount + reconfiguration time) + 24-40 seconds

Execute the EDIT CONFIGURATION SET PROPERTY FastStartFailoverThresh old =threshold-val command when connected to the primary database or to any standby database within the Data Guard broker configuration with connectivity to the primary database.

Note: You can modify this property regardless of whether fast-start failover is enabled or disabled.

Page 279: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 279

Copyright © 2006, Oracle. All rights reserved.10 - 279

Step 3: Enabling Fast-Start Failover

ENABLE FAST_START FAILOVER;

Primary database

Fast-start failover standby database

EDRSR10P1_ORCL EDRSR10P1_SITE1

Step 3: Enabling Fast-Start Failover

You can use the Data Guard Manager command- line interface (CLI)—DGMGRL—to enable fast-start failover. When you issue the ENABLE FAST_START FAILOVERcommand, the observer is able to observe the primary database and the standby database, and initiate a fast-start failover when necessary. In addition to enabling fast-start failover, you must start the observer as described later in this lesson.

The following prerequisites must be met to enable fast-start failover:• At least one enabled standby database with standby redo log files must exit. The log files

being shipped to it must have the LGWR, SYNC, and AFFIRM attributes. The redo transport mode property—LogXptMode —must be set to SYNC.

• The primary database must be configured with standby redo log files. ItsLogXptModeproperty must be set to SYNC. This setting enables automatic reinstatement of the original primary database as a standby database in the event of a failover.

• The Data Guard broker configuration must be enabled and operating in maximum availability mode.

• Flashback Database must be enabled on the primary database and target standby database.• The primary database and target standby database must have connectivity.

Page 280: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 280

Copyright © 2006, Oracle. All rights reserved.10 - 280

Step 4: Starting the Observer

START OBSERVER [FILE=filename];

Observer

Primary database

Fast-start failover standby database

Step 4: Starting the ObserverExecute the START OBSERVERcommand to start the observer. The START OBSERVERcommand directs DGMGRL to begin “observing” the Data Guard configuration to which DGMGRL is connected. You must execute this command on the computer where the observer is to reside.

When you execute the START OBSERVERcommand, the observer retrieves the primary database and the fast-start failover target standby database connect descriptors and begins observation. It provides the name of its host computer to the Data Guard broker. This information is recorded in theObserverInfo configuration- level property and is displayed when you execute the SHOWCONFIGURATION VERBOSEcommand.

The primary database must be available for the START OBSERVERcommand to succeed. The observer must be connected either to the primary database in the Data Guard configuration or to a standby database that has connectivity to the primary database.

There can be only one observer for a Data Guard configuration at any one time. If you attempt to start a second observer for the configuration, you will receive an error message.

If you disable fast-start failover while the observer is observing the configuration, then the observer idles waiting for fast-start failover to become enabled.

Page 281: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 281

Step 4: Starting the Observer (continued)

The observer maintains a small configuration file for persistently recording key information about the Data Guard configuration that it is observing. The file contains a description of the primary and target standby databases, including connect descriptors. Use the FILE qualifier with the START OBSERVERcommand to specify an explicit directory path and name for the configuration file on the observer computer as follows:

DGMGRL> START OBSERVER FILE=$ORACLE_HOME/dbs/Boston.dat;

If you do not specify the FILE qualifier, the current working directory is searched for a filenamed FSFO.dat . If the file does not exist, a new file is created. If the configuration file exists, the observer checks whether the file describes a valid fast-start failover environment for the Data Guard configuration to which the observer is connected.

Note: You can execute the START OBSERVERcommand regardless of whether fast-start failover is enabled.

Control is not returned to you when the observer is successfully started. The observer is a continuous, foreground process; thus, the command-line prompt on the observer computer does not return until you issue the STOP OBSERVERcommand from another DGMGRL session. To issue commands and interact with the broker configuration, you must connect through another DGMGRL client session. If you stop the observer with the STOP OBSERVERcommand, then the observer’s DGMGRLprocess will terminate.

Page 282: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 282

Copyright © 2006, Oracle. All rights reserved.10 - 282

Step 5: Verifying the Configuration

DGMGRL> SHOW CONFIGURATION VERBOSE;Configuration

Name: EDRSR8P1_ORCL.oracle.comEnabled: YESProtection Mode: MaxAvailabilityFast-Start Failover: ENABLEDDatabases:

EDRSR8P1_ORCL - Primary databaseEDRSR8P1_SITE1 - Physical standby database

- Fast-Start Failover targetEDRSR8P1_SITE2 - Logical standby database

Fast-Start FailoverThreshold: 30 secondsObserver: EDRSR10P1

Current status for "EDRSR8P1_ORCL.oracle.com":SUCCESS

Step 5: Verifying the ConfigurationUse the SHOW CONFIGURATION VERBOSEcommand to review information about the fast-start failover configuration.

Page 283: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 283

Copyright © 2006, Oracle. All rights reserved.10 - 283

Viewing Information

SELECT fs_failover_status as STATUS,fs_failover_current_target as CURR_TGET,fs_failover_threshold as THRESHOLD,fs_failover_observer_present as OBS_PRES,fs_failover_observer_host as OBS_HOST

FROM v$database;

STATUS CURR_TGET THRESHOLD OBS_PRES------------ -------------- --------- --------SYNCHRONIZED EDRSR8P1_SITE1 30 YES

OBS_HOST---------EDRSR10P1

Viewing InformationV$DATABASEcontains the following columns providing detailed information about fast-start failover:

• FS_FAILOVER_STATUS: - BYSTANDER: Fast-start failover is enabled, but this standby database is not the target of

the fast-start failover.- DISABLED: Fast-start failover is disabled.- LOADING DICTIONARY: This status appears only on a logical standby database that

has not completed loading a copy of the primary database data dictionary.- PRIMARY UNOBSERVED: This status occurs only on the target standby database when

it is synchronized with the primary database and has connectivity with the observer, but the primary database does not have a connection to the observer.

- REINSTATE FAILED: Reinstatement of the failed primary database as a new standby database failed. Refer to the Data Guard brokerdrc* log files for additional information.

- REINSTATE IN PROGRESS: Reinstatement of the failed primary database as a new standby database is in progress.

- REINSTATE REQUIRED: The failed primary database requires reinstatement as a new standby database to the new primary database. The observer automatically starts the reinstatement process.

Page 284: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 284

Viewing Information (continued)- STALLED: This status appears on the primary database if it simultaneously loses

connection to both the target standby database and the observer while synchronized.- SUSPENDED: This status appears on the target standby database when either the

primary database or the target standby database was shut down in a controlled fashion.- SYNCHRONIZED: The primary database and the fast-start failover target standby

database are synchronized with respect to redo.- UNSYNCHRONIZED: The target standby database does not have all the redo from the

primary database. Fast-start failover is not possible.• FS_FAILOVER_CURRENT_TARGET: DB_UNIQUE_NAMEof the standby database that is

the current fast-start failover target standby database for the Data Guard configuration• FS_FAILOVER_THRESHOLD: Time in seconds that the observer will attempt to reconnect

with a disconnected primary database before attempting fast-start failover with the target standby database

• FS_FAILOVER_OBSERVER_PRESENT:- YES : Observer is connected to the local database.- NO: Observer is not connected to the local database.

• FS_FAILOVER_OBSERVER_HOST: Name of the machine that is hosting the observer process

Page 285: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 285

Copyright © 2006, Oracle. All rights reserved.10 - 285

Prohibited Operations After EnablingFast-Start Failover

Maximumprotection

Maximumperformance

Disable or deletethe fast-start failover

standby database

EDIT DATABASE SET PROPERTY LogXptModeEDIT DATABASE SET PROPERTY FastStartFailoverTarget

Prohibited Operations After Enabling Fast-Start Fai lover

After you have enabled fast-start failover, you cannot perform any of the following operations that would undermine the fast-start failover environment:

• Change the configuration protection mode to either maximum protection or maximum performance.

• Change theLogXptMode property for the primary or target standby databases.• Perform a failover or switchover to a standby database that is not the fast-start failover target.• Disable the Data Guard broker configuration.• Delete the Data Guard broker configuration.• Disable the standby database that is the target of fast-start failover.• Remove the standby database that is the target of fast-start failover.• Alter theFastStartFailoverTarget database-level property of either the primary

database or the standby database.• Fail over to an unsynchronized fast-start failover target.

Page 286: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 286

Copyright © 2006, Oracle. All rights reserved.10 - 286

Disabling Fast-Start Failover

Primary database

Fast-start failover standby database

Observer

DISABLE FAST_START FAILOVER [FORCE];

Disabling Fast-Start Failover

You can use the Data Guard CLI to disable fast-start failover. The primary database and the fast-start failover target standby database must have connectivity unless you use the FORCEoption.

When you issue the DISABLE FAST_START FAILOVERcommand, the Data Guard broker disables fast-start failover on the target standby database and then disables fast-start failover on the primary database. The Data Guard broker records this change persistently in the Data Guard broker metadata and propagates the change to all standby databases in the Data Guard broker configuration.

If the primary database and the fast-start failover target standby database do not have connectivity with each other, then you can use the FORCEoption to disable fast-start failover. If this command is executed on the primary database or on a bystander (non-fast-start failover target) standby database that has connectivity with the primary database, then the Data Guard broker will disable fast-start failover locally. The Data Guard broker then records this change persistently in the Data Guard broker metadata and propagates this change to all databases in the Data Guard broker configuration to which the primary database has connectivity.

Page 287: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 287

Disabling Fast-Start Failover (continued)

If the standby database does not have connectivity with the primary database when you execute the DISABLE FAST_START FAILOVERcommand with the FORCEoption on the fast-start failover target standby database, then fast-start failover will be disabled only on that target standby database. If the target standby database regains connectivity with the primary database, then the primary database will disable fast-start failover as previously described.

If the standby database does not have connectivity with the primary database when you execute the DISABLE FAST_START FAILOVERcommand with the FORCEoption on a bystander standby database, then it is ignored by the primary database. Fast-start failover will be reenabledon the bystander standby database automatically when connectivity with the primary database is restored. You must issue the DISABLE FAST_START FAILOVERcommand on the primary database or a bystander standby database that has connectivity with the primary database, or to the fast-start failover target standby database itself, if fast-start failover is to be persistently disabled.

Note: Disabling fast-start failover does not stop the observer. Stopping the observer is discussed later in the lesson.

Page 288: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 288

Copyright © 2006, Oracle. All rights reserved.10 - 288

Using the FORCEOption

Use the FORCEoption in the following situations:

• When the fast-start failover environment is synchronized and the primary has lost connectivity to the observer and the target standby database

• To prevent a fast-start failover from occurring on the target standby database

• To conduct a manual failover when the fast-start failover environment is unsynchronized

Using the FORCEOption

You should use the FORCEoption in the following situations:• You want to disable fast-start failover when the environment is synchronized and the primary

database has lost connectivity with the observer and the target standby database. The FORCEoption enables you to disable fast-start failover without requiring connectivity with the target standby database or the observer.

• You want to prevent a fast-start failover from occurring on the target standby database because you know that the primary database will resume service before the fast-start failover threshold expires.

• You want to conduct a manual failover to either the target standby database or a bystander standby database when the fast-start failover environment is unsynchronized. In this case, you must be willing to accept a data- loss failover.

Page 289: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 289

Copyright © 2006, Oracle. All rights reserved.10 - 289

Stopping the Observer

Primary database

Fast-start failover standby database

Observer

STOP OBSERVER;

Stopping the Observer

If you no longer want to use fast-start failover or you want to move the observer to a different host computer, use the STOP OBSERVERcommand to stop the observer.

Note: The STOP OBSERVERcommand does not disable fast-start failover. You can issue this command regardless of whether fast-start failover is enabled.

You must issue this command on the primary database or on a standby database in the configuration that has connectivity to the primary database. If you execute this command when fast-start failover is enabled, then the fast-start failover target standby database must have connectivity to the primary database.

The observer does not immediately stop when you execute the STOP OBSERVERcommand. The broker informs the observer the next time it is contacted by the observer. After you execute the STOP OBSERVERcommand, the Data Guard broker can accept a new observer regardless of whether the stopped observer is terminated.

Page 290: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 290

Copyright © 2006, Oracle. All rights reserved.10 - 290

Performing Role Changes

Primary database

Fast-start failover standby database

FailoverSwitchover

Performing Role ChangesYou can perform role changes in a fast-start failover configuration as long as the role change is directed to the fast-start failover target standby database and the configuration is synchronized. The following are some of the restrictions that apply:

• Switchover to the fast-start failover target standby database: This is allowed as long as the configuration is synchronized. No switchovers are permitted to the fast-start failover target standby database if the configuration is unsynchronized. Switchovers to non-fast-start failover targets are not permitted.

• A manual failover to the fast-start failover target standby database: This is permitted as long as the target standby database is synchronized. You can perform manual failover if the fast-start failover configuration is suspended. If the manual failover fails, the Data Guard broker will ensure that fast-start failover is suspended to prevent the observer from performing a fast-start failover operation. You can correct the problem and retry the manual failover operation.

• Fast-Start Failover: Fast-start failover to a synchronized target standby database can occur at any time after the observer and the target standby database lose connectivity with the primary database. If the failover fails, the Data Guard broker disables fast-start failover. In addition, the observer, upon receiving an error status from the attempted fast-start failover, will delete its metadata state and terminate. The observer is prevented from retrying a fast-start failover and repeatedly failing. You can correct the problem and attempt a manual failover.

Page 291: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 291

Copyright © 2006, Oracle. All rights reserved.10 - 291

Performing a Manual Failover

Primary database

Fast-start failover standby database

Failover EDRSR10P1_SITE1EDRSR10P1_ORCL

FAILOVER TO edrsr10p1_site1;

Performing a Manual Failover

You can perform a manual failover to the fast-start failover target standby database when fast-start failover is suspended because the primary database has been shut down. The FAILOVERcommand succeeds if the fast-start failover configuration is synchronized. The manual failover preserves the fast-start failover environment and the Data Guard configuration remains in maximum availability mode. The observer automatically reinstates the original primary database when it is restarted.

Note: You cannot perform a manual failover if the fast-start failover target standby database is not synchronized with the primary database.

If you must fail over to an unsynchronized fast-start failover target standby database or a bystander standby database, and then you must first disable fast-start failover for that standby database by executing the DISABLE FAST_START FAILOVER FORCEcommand. After you disable fast-start failover and perform the failover, fast-start failover is disabled for the entire configuration and the protection mode is changed to maximum performance.

Page 292: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 292

Copyright © 2006, Oracle. All rights reserved.10 - 292

Automatic Reinstatement AfterFast-Start Failover

Fast-start failover standby database

Primary database

EDRSR10P1_SITE1EDRSR10P1_ORCL

Automatic Reinstatement After Fast-Start Failover

Reinstatement of the original primary database is critical for reestablishing high availability after a fast-start failover. The original primary database can act as the fast-start failover target standby database for the new primary database after being reinstated as a standby database. You cannot perform a subsequent fast-start failover until the original primary database is reinstated without reconfiguring the fast-start failover environment.

Automatic reinstatement of the original primary database is triggered when all the following conditions are met:

• The original primary database and the new primary database comprise the same fast-start failover configuration before the failover occurs and after the original primary database restarts.

• In a multi–standby database configuration, you have not performed a subsequent failover or switchover before the original primary database restarting.

• The observer in the fast-start failover configuration can connect to the original primarydatabase.

• The original primary database must be able to connect to the new primary database to complete the reinstatement operation.

Page 293: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 293

Automatic Reinstatement After Fast-Start Failover ( continued)

If these conditions are not met, automatic reinstatement of the original primary database will not take place and appropriate errors will be logged. You can then request manual reinstatement of the original primary database using the CLI or Enterprise Manager.

Page 294: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 294

Copyright © 2006, Oracle. All rights reserved.10 - 294

Manually Reinstating the Database

Fast-start failover standby database

Primary database

EDRSR10P1_SITE1EDRSR10P1_ORCL

REINSTATE DATABASE edrsr10p1_orcl;

Manually Reinstating the DatabaseUse the REINSTATE DATABASEdatabase-name command to reinstate the database. If the conditions for reinstatement are not satisfied, then the request fails and the specified database remains disabled.

If the database name specified is the original primary database and fast-start failover is enabled, then the original primary database is reinstated as a standby database to the new primary database. The fast-start failover configuration is updated to reflect the availability of the new standby database. It accepts archived redo log files from the new primary database and serves as the fast-start failover target should the new primary database fail.

Issue this command while connected to either the primary database or to a standby database in the configuration that has connectivity to the primary database other than the original primary database to be reinstated.

Note: The REINSTATE DATABASEdatabase-name command does not require fast-start failover to be enabled. It can be used to reinstate an original primary database after a conventional no-data- loss failover.

This command is not needed when fast-start failover is enabled and the database to be reinstated is the original primary database. In that case, the observer will automatically reinstate the database.

Page 295: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 295

Copyright © 2006, Oracle. All rights reserved.10 - 295

Using Enterprise Manager toEnable Fast-Start Failover

Click Disabled to invoke the fast-start failover wizard.

Using Enterprise Manager to Enable Fast-Start Failo ver

On the Data Guard page, click the Disabled link next to Fast-Start Failover to invoke the fast-start failover wizard to enable fast-start failover.

Page 296: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 296

Copyright © 2006, Oracle. All rights reserved.10 - 296

Using Enterprise Manager toEnable Fast-Start Failover

Select the database.

Click Set Observer.

Using Enterprise Manager to Enable Fast-Start Failo ver (continued)

Select the fast-start failover target database and, optionally, the observer host. If the observer has not been started, click the Set Observer button.

Page 297: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 297

Copyright © 2006, Oracle. All rights reserved.10 - 297

Using Enterprise Manager toEnable Fast-Start Failover

Using Enterprise Manager to Enable Fast-Start Failo ver (continued)

Specify the Observer host and Observer Oracle Home to indicate where the observer will be started.

Page 298: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 298

Copyright © 2006, Oracle. All rights reserved.10 - 298

Using Enterprise Manager toEnable Fast-Start Failover

Using Enterprise Manager to Enable Fast-Start Failo ver (continued)

Flashback logging must be enabled on the primary database and the standby database to enable fast-start failover. If the primary database or the standby database does not have flashback logging enabled, the Enable Flashback Logging page displays. Specify the flash recovery area location, flash recovery area size, and flashback retention time for each database.

Page 299: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 299

Copyright © 2006, Oracle. All rights reserved.10 - 299

Using Enterprise Manager toEnable Fast-Start Failover

Using Enterprise Manager to Enable Fast-Start Failo ver (continued)

On the Confirmation: Enable Fast-Start Failover page, confirm that you want to enable fast-start failover to the named database.

Page 300: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 300

Copyright © 2006, Oracle. All rights reserved.10 - 300

Using Enterprise Manager toEnable Fast-Start Failover

Using Enterprise Manager to Enable Fast-Start Failo ver (continued)

After you confirm that you want to enable fast-start failover to a specific database, the fast-start enabling process begins. After the processing steps are complete, you are returned to the Data Guard page.

On the Data Guard Fast-start Failover Processing page you can observe the progress of the fast-start failover enabling operation as the following steps are performed:

• Standby redo log files are created on the primary and standby databases. • The protection mode is upgraded to Maximum Availability, if required.• The primary database and standby database is restarted, if required. • Fast-start failover is enabled.• The observer process is started.

Page 301: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 301

Copyright © 2006, Oracle. All rights reserved.10 - 301

Changing the Protection Modeand Disabling Fast-Start Failover

Changing the Protection Mode and Disabling Fast-Sta rt Failover

If you change the protection mode to a mode that does not support fast-start failover, then you implicitly disable fast-start failover.

Page 302: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 302

Copyright © 2006, Oracle. All rights reserved.10 - 302

Using Enterprise Manager toDisable Fast-Start Failover

Click the Enabled link to access the Change Mode

page.

Using Enterprise Manager to Disable Fast-Start Fail over

Access the Fast-Start Failover: Change Mode page by clicking the Fast-Start Failover link. Selecting Disable and the Stop observer option on the Fast-Start Failover: Change Mode page to disable fast-start failover.

Page 303: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 303

Copyright © 2006, Oracle. All rights reserved.10 - 303

Using Enterprise Manager toSuspend Fast-Start Failover

Using Enterprise Manager to Suspend Fast-Start Fail over

Suspend fast-start failover by selecting Disable on the Fast-Start Failover: Change Mode page. Do not select the “Stop observer” option.

Page 304: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 304

Copyright © 2006, Oracle. All rights reserved.10 - 304

Summary

In this lesson, you should have learned how to:• Configure fast-start failover• View information about the fast-start failover

configuration• Manage the observer• Perform role changes in a fast-start failover

configuration• Manually reinstate the primary database

Page 305: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 305

Copyright © 2006, Oracle. All rights reserved.10 - 305

Practice 10: Overview

This practice covers the following topics:• Enabling fast-start failover• Simulating a failure of the primary database and

observing the fast-start failover operation• Observing the automatic reinstatement of the new

physical standby into the Data Guard configuration

Page 306: Data Guard Slides Study Guide_shahul
Page 307: Data Guard Slides Study Guide_shahul

10Copyright © 2006, Oracle. All rights reserved.

Enabling Fast-Start Failover

Page 308: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 308

Copyright © 2006, Oracle. All rights reserved.10 - 308

Objectives

After completing this lesson, you should be able to :• Configure fast-start failover• View information about the fast-start failover

configuration• Manage the observer• Perform role changes in a fast-start failover

configuration• Manually reinstate the primary database

Page 309: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 309

Copyright © 2006, Oracle. All rights reserved.10 - 309

Fast-Start Failover: Overview

Primary database

Fast-start failover standby database

Observer

Fast-Start Failover: Overview

Fast-start failover enables Data Guard to rapidly and automatically fail over to a previously chosen standby database without requiring manual intervention. This feature increases the availability of your database in the event of a disaster by reducing the need for you to perform a failover operation manually.

The observer is an OCI client-side component that runs on a separate computer and monitors theavailability of the primary database.

Note: Fast-start failover is an Oracle Data Guard 10g Release 2 feature.

Page 310: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 310

Copyright © 2006, Oracle. All rights reserved.10 - 310

When Will Fast-Start Failover Occur?

Primary database

Fast-start failover standby database

Observer

Loss of connectivity >fast-start failover threshold

When Will Fast-Start Failover Occur?

Fast-start failover occurs when any of the following conditions occurs:• Loss of connectivity between both the primary database and the observer, and between the

primary database and the fast-start failover target standby database, exceeds the fast-start failover threshold

• Database health-check mechanism determines that the primary database data files are offline• An instance crash occurs for a single- instance database• All instances of a Real Application Clusters (RAC) primary database crash• Shutdown abort of the primary database occurs

Page 311: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 311

Copyright © 2006, Oracle. All rights reserved.10 - 311

Installing the Observer

Observer

• The observer is a separate OCI client-side componen t that monitors the availability of the primary datab ase.

• Install it on a different computer from the primary and standby databases.

• Manage the observer through Oracle Enterprise Manager or by using DGMGRL commands.

Installing the Observer

To use fast-start failover, you must install DGMGRL and run the observer software on a computer system that is separate from the primary and standby systems.

To install DGMGRL on the observer computer, use one of the methods described as follows:• Install the complete Oracle Client Administrator by choosing the Administrator option in the

Oracle Universal Installer. This installation includes DGMGRL but it does not include the Oracle Enterprise Manager agent. This type of installation enables you to manage the observer using DGMGRL commands but not Oracle Enterprise Manager.

• Install the full Oracle Database 10g software kit. This installation includes DGMGRL and the Oracle Enterprise Manager agent, allowing you to manage the observer using Oracle Enterprise Manager or DGMGRL commands.

Page 312: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 312

Copyright © 2006, Oracle. All rights reserved.10 - 312

Configuring Fast-Start Failover

1. Specify the target standby database.2. Set the FastStartFailoverThreshold property.

3. Enable fast-start failover.4. Start the observer.5. Verify the configuration.

Configuring Fast-Start Failover

The manual steps to configure fast-start failover are described in detail on the next few pages. Configuring Fast-Start Failover by using Enterprise Manager Grid Control is described later in the lesson.

Page 313: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 313

Copyright © 2006, Oracle. All rights reserved.10 - 313

Step 1: Specifying the Target Standby Database

Fast-start failover standby database

Primary database

EDRSR10P1_ORCL EDRSR10P1_SITE1

EDIT DATABASE edrsr10p1_orclSET PROPERTY FastStartFailoverTarget = edrsr10p1_site1;

Step 1: Specifying the Target Standby Database

In a Data Guard configuration with multiple standby databases, you must set theFastStartFailoverTarget database property before enabling fast-start failover.

Before enabling fast-start failover, set theFastStartFailoverTarget property for the primary database to the fast-start failover target standby database. When you enable fast-start failover, the Data Guard broker automatically sets theFastStartFailoverTarget property for the fast-start failover target standby database to the database name of the primary database.

Execute the command when connected to the primary database or to any standby database with connectivity to the primary database within the configuration.

The command syntax is as follows:EDIT DATABASE database-nameSET PROPERTY FastStartFailoverTarget = FSFO-database-name;

Note: Database-nameand FSFO-database-nameare the values of the DB_UNIQUE_NAMEinitialization parameter for the respective databases.

You do not need to set theFastStartFailoverTarget property in a configuration with only one standby database because the Data Guard broker will automatically set it appropriately for the primary database and the standby database when fast-start failover is enabled.

Page 314: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 314

Copyright © 2006, Oracle. All rights reserved.10 - 314

Step 2: Setting the Fast-Start Failover Threshold

EDIT CONFIGURATION SET PROPERTY FastStartFailoverThreshold = threshold-val ;

Primary database

EDRSR10P1_ORCL

Step 2: Setting the Fast-Start Failover Threshold

The fast-start failover threshold (FSFT) specifies how long the observer and target standby database should simultaneously wait to hear from the primary database before initiating a fast-start failover. The threshold value is specified as a positive, non-zero number of seconds. The default value for FSFT is 30 seconds. When choosing a value for this parameter, you must balance the increased risk of an unnecessary failover (for example, if the network connection was temporarily broken for a few seconds) against the benefits of faster failover and less downtime during a critical outage.

Recommended settings for the Fast-Start Failover Threshold are:• Single instance primary, low latency, reliable network = 10-15 seconds• Single instance primary, high latency network over WAN = 30-45 seconds• RAC primary = (CSS misscount + reconfiguration time) + 24-40 seconds

Execute the EDIT CONFIGURATION SET PROPERTY FastStartFailoverThresh old =threshold-val command when connected to the primary database or to any standby database within the Data Guard broker configuration with connectivity to the primary database.

Note: You can modify this property regardless of whether fast-start failover is enabled or disabled.

Page 315: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 315

Copyright © 2006, Oracle. All rights reserved.10 - 315

Step 3: Enabling Fast-Start Failover

ENABLE FAST_START FAILOVER;

Primary database

Fast-start failover standby database

EDRSR10P1_ORCL EDRSR10P1_SITE1

Step 3: Enabling Fast-Start Failover

You can use the Data Guard Manager command- line interface (CLI)—DGMGRL—to enable fast-start failover. When you issue the ENABLE FAST_START FAILOVERcommand, the observer is able to observe the primary database and the standby database, and initiate a fast-start failover when necessary. In addition to enabling fast-start failover, you must start the observer as described later in this lesson.

The following prerequisites must be met to enable fast-start failover:• At least one enabled standby database with standby redo log files must exit. The log files

being shipped to it must have the LGWR, SYNC, and AFFIRM attributes. The redo transport mode property—LogXptMode —must be set to SYNC.

• The primary database must be configured with standby redo log files. ItsLogXptModeproperty must be set to SYNC. This setting enables automatic reinstatement of the original primary database as a standby database in the event of a failover.

• The Data Guard broker configuration must be enabled and operating in maximum availability mode.

• Flashback Database must be enabled on the primary database and target standby database.• The primary database and target standby database must have connectivity.

Page 316: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 316

Copyright © 2006, Oracle. All rights reserved.10 - 316

Step 4: Starting the Observer

START OBSERVER [FILE=filename];

Observer

Primary database

Fast-start failover standby database

Step 4: Starting the ObserverExecute the START OBSERVERcommand to start the observer. The START OBSERVERcommand directs DGMGRL to begin “observing” the Data Guard configuration to which DGMGRL is connected. You must execute this command on the computer where the observer is to reside.

When you execute the START OBSERVERcommand, the observer retrieves the primary database and the fast-start failover target standby database connect descriptors and begins observation. It provides the name of its host computer to the Data Guard broker. This information is recorded in theObserverInfo configuration- level property and is displayed when you execute the SHOWCONFIGURATION VERBOSEcommand.

The primary database must be available for the START OBSERVERcommand to succeed. The observer must be connected either to the primary database in the Data Guard configuration or to a standby database that has connectivity to the primary database.

There can be only one observer for a Data Guard configuration at any one time. If you attempt to start a second observer for the configuration, you will receive an error message.

If you disable fast-start failover while the observer is observing the configuration, then the observer idles waiting for fast-start failover to become enabled.

Page 317: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 317

Step 4: Starting the Observer (continued)

The observer maintains a small configuration file for persistently recording key information about the Data Guard configuration that it is observing. The file contains a description of the primary and target standby databases, including connect descriptors. Use the FILE qualifier with the START OBSERVERcommand to specify an explicit directory path and name for the configuration file on the observer computer as follows:

DGMGRL> START OBSERVER FILE=$ORACLE_HOME/dbs/Boston.dat;

If you do not specify the FILE qualifier, the current working directory is searched for a filenamed FSFO.dat . If the file does not exist, a new file is created. If the configuration file exists, the observer checks whether the file describes a valid fast-start failover environment for the Data Guard configuration to which the observer is connected.

Note: You can execute the START OBSERVERcommand regardless of whether fast-start failover is enabled.

Control is not returned to you when the observer is successfully started. The observer is a continuous, foreground process; thus, the command-line prompt on the observer computer does not return until you issue the STOP OBSERVERcommand from another DGMGRL session. To issue commands and interact with the broker configuration, you must connect through another DGMGRL client session. If you stop the observer with the STOP OBSERVERcommand, then the observer’s DGMGRLprocess will terminate.

Page 318: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 318

Copyright © 2006, Oracle. All rights reserved.10 - 318

Step 5: Verifying the Configuration

DGMGRL> SHOW CONFIGURATION VERBOSE;Configuration

Name: EDRSR8P1_ORCL.oracle.comEnabled: YESProtection Mode: MaxAvailabilityFast-Start Failover: ENABLEDDatabases:

EDRSR8P1_ORCL - Primary databaseEDRSR8P1_SITE1 - Physical standby database

- Fast-Start Failover targetEDRSR8P1_SITE2 - Logical standby database

Fast-Start FailoverThreshold: 30 secondsObserver: EDRSR10P1

Current status for "EDRSR8P1_ORCL.oracle.com":SUCCESS

Step 5: Verifying the ConfigurationUse the SHOW CONFIGURATION VERBOSEcommand to review information about the fast-start failover configuration.

Page 319: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 319

Copyright © 2006, Oracle. All rights reserved.10 - 319

Viewing Information

SELECT fs_failover_status as STATUS,fs_failover_current_target as CURR_TGET,fs_failover_threshold as THRESHOLD,fs_failover_observer_present as OBS_PRES,fs_failover_observer_host as OBS_HOST

FROM v$database;

STATUS CURR_TGET THRESHOLD OBS_PRES------------ -------------- --------- --------SYNCHRONIZED EDRSR8P1_SITE1 30 YES

OBS_HOST---------EDRSR10P1

Viewing InformationV$DATABASEcontains the following columns providing detailed information about fast-start failover:

• FS_FAILOVER_STATUS: - BYSTANDER: Fast-start failover is enabled, but this standby database is not the target of

the fast-start failover.- DISABLED: Fast-start failover is disabled.- LOADING DICTIONARY: This status appears only on a logical standby database that

has not completed loading a copy of the primary database data dictionary.- PRIMARY UNOBSERVED: This status occurs only on the target standby database when

it is synchronized with the primary database and has connectivity with the observer, but the primary database does not have a connection to the observer.

- REINSTATE FAILED: Reinstatement of the failed primary database as a new standby database failed. Refer to the Data Guard brokerdrc* log files for additional information.

- REINSTATE IN PROGRESS: Reinstatement of the failed primary database as a new standby database is in progress.

- REINSTATE REQUIRED: The failed primary database requires reinstatement as a new standby database to the new primary database. The observer automatically starts the reinstatement process.

Page 320: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 320

Viewing Information (continued)- STALLED: This status appears on the primary database if it simultaneously loses

connection to both the target standby database and the observer while synchronized.- SUSPENDED: This status appears on the target standby database when either the

primary database or the target standby database was shut down in a controlled fashion.- SYNCHRONIZED: The primary database and the fast-start failover target standby

database are synchronized with respect to redo.- UNSYNCHRONIZED: The target standby database does not have all the redo from the

primary database. Fast-start failover is not possible.• FS_FAILOVER_CURRENT_TARGET: DB_UNIQUE_NAMEof the standby database that is

the current fast-start failover target standby database for the Data Guard configuration• FS_FAILOVER_THRESHOLD: Time in seconds that the observer will attempt to reconnect

with a disconnected primary database before attempting fast-start failover with the target standby database

• FS_FAILOVER_OBSERVER_PRESENT:- YES : Observer is connected to the local database.- NO: Observer is not connected to the local database.

• FS_FAILOVER_OBSERVER_HOST: Name of the machine that is hosting the observer process

Page 321: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 321

Copyright © 2006, Oracle. All rights reserved.10 - 321

Prohibited Operations After EnablingFast-Start Failover

Maximumprotection

Maximumperformance

Disable or deletethe fast-start failover

standby database

EDIT DATABASE SET PROPERTY LogXptModeEDIT DATABASE SET PROPERTY FastStartFailoverTarget

Prohibited Operations After Enabling Fast-Start Fai lover

After you have enabled fast-start failover, you cannot perform any of the following operations that would undermine the fast-start failover environment:

• Change the configuration protection mode to either maximum protection or maximum performance.

• Change theLogXptMode property for the primary or target standby databases.• Perform a failover or switchover to a standby database that is not the fast-start failover target.• Disable the Data Guard broker configuration.• Delete the Data Guard broker configuration.• Disable the standby database that is the target of fast-start failover.• Remove the standby database that is the target of fast-start failover.• Alter theFastStartFailoverTarget database-level property of either the primary

database or the standby database.• Fail over to an unsynchronized fast-start failover target.

Page 322: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 322

Copyright © 2006, Oracle. All rights reserved.10 - 322

Disabling Fast-Start Failover

Primary database

Fast-start failover standby database

Observer

DISABLE FAST_START FAILOVER [FORCE];

Disabling Fast-Start Failover

You can use the Data Guard CLI to disable fast-start failover. The primary database and the fast-start failover target standby database must have connectivity unless you use the FORCEoption.

When you issue the DISABLE FAST_START FAILOVERcommand, the Data Guard broker disables fast-start failover on the target standby database and then disables fast-start failover on the primary database. The Data Guard broker records this change persistently in the Data Guard broker metadata and propagates the change to all standby databases in the Data Guard broker configuration.

If the primary database and the fast-start failover target standby database do not have connectivity with each other, then you can use the FORCEoption to disable fast-start failover. If this command is executed on the primary database or on a bystander (non-fast-start failover target) standby database that has connectivity with the primary database, then the Data Guard broker will disable fast-start failover locally. The Data Guard broker then records this change persistently in the Data Guard broker metadata and propagates this change to all databases in the Data Guard broker configuration to which the primary database has connectivity.

Page 323: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 323

Disabling Fast-Start Failover (continued)

If the standby database does not have connectivity with the primary database when you execute the DISABLE FAST_START FAILOVERcommand with the FORCEoption on the fast-start failover target standby database, then fast-start failover will be disabled only on that target standby database. If the target standby database regains connectivity with the primary database, then the primary database will disable fast-start failover as previously described.

If the standby database does not have connectivity with the primary database when you execute the DISABLE FAST_START FAILOVERcommand with the FORCEoption on a bystander standby database, then it is ignored by the primary database. Fast-start failover will be reenabledon the bystander standby database automatically when connectivity with the primary database is restored. You must issue the DISABLE FAST_START FAILOVERcommand on the primary database or a bystander standby database that has connectivity with the primary database, or to the fast-start failover target standby database itself, if fast-start failover is to be persistently disabled.

Note: Disabling fast-start failover does not stop the observer. Stopping the observer is discussed later in the lesson.

Page 324: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 324

Copyright © 2006, Oracle. All rights reserved.10 - 324

Using the FORCEOption

Use the FORCEoption in the following situations:

• When the fast-start failover environment is synchronized and the primary has lost connectivity to the observer and the target standby database

• To prevent a fast-start failover from occurring on the target standby database

• To conduct a manual failover when the fast-start failover environment is unsynchronized

Using the FORCEOption

You should use the FORCEoption in the following situations:• You want to disable fast-start failover when the environment is synchronized and the primary

database has lost connectivity with the observer and the target standby database. The FORCEoption enables you to disable fast-start failover without requiring connectivity with the target standby database or the observer.

• You want to prevent a fast-start failover from occurring on the target standby database because you know that the primary database will resume service before the fast-start failover threshold expires.

• You want to conduct a manual failover to either the target standby database or a bystander standby database when the fast-start failover environment is unsynchronized. In this case, you must be willing to accept a data- loss failover.

Page 325: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 325

Copyright © 2006, Oracle. All rights reserved.10 - 325

Stopping the Observer

Primary database

Fast-start failover standby database

Observer

STOP OBSERVER;

Stopping the Observer

If you no longer want to use fast-start failover or you want to move the observer to a different host computer, use the STOP OBSERVERcommand to stop the observer.

Note: The STOP OBSERVERcommand does not disable fast-start failover. You can issue this command regardless of whether fast-start failover is enabled.

You must issue this command on the primary database or on a standby database in the configuration that has connectivity to the primary database. If you execute this command when fast-start failover is enabled, then the fast-start failover target standby database must have connectivity to the primary database.

The observer does not immediately stop when you execute the STOP OBSERVERcommand. The broker informs the observer the next time it is contacted by the observer. After you execute the STOP OBSERVERcommand, the Data Guard broker can accept a new observer regardless of whether the stopped observer is terminated.

Page 326: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 326

Copyright © 2006, Oracle. All rights reserved.10 - 326

Performing Role Changes

Primary database

Fast-start failover standby database

FailoverSwitchover

Performing Role ChangesYou can perform role changes in a fast-start failover configuration as long as the role change is directed to the fast-start failover target standby database and the configuration is synchronized. The following are some of the restrictions that apply:

• Switchover to the fast-start failover target standby database: This is allowed as long as the configuration is synchronized. No switchovers are permitted to the fast-start failover target standby database if the configuration is unsynchronized. Switchovers to non-fast-start failover targets are not permitted.

• A manual failover to the fast-start failover target standby database: This is permitted as long as the target standby database is synchronized. You can perform manual failover if the fast-start failover configuration is suspended. If the manual failover fails, the Data Guard broker will ensure that fast-start failover is suspended to prevent the observer from performing a fast-start failover operation. You can correct the problem and retry the manual failover operation.

• Fast-Start Failover: Fast-start failover to a synchronized target standby database can occur at any time after the observer and the target standby database lose connectivity with the primary database. If the failover fails, the Data Guard broker disables fast-start failover. In addition, the observer, upon receiving an error status from the attempted fast-start failover, will delete its metadata state and terminate. The observer is prevented from retrying a fast-start failover and repeatedly failing. You can correct the problem and attempt a manual failover.

Page 327: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 327

Copyright © 2006, Oracle. All rights reserved.10 - 327

Performing a Manual Failover

Primary database

Fast-start failover standby database

Failover EDRSR10P1_SITE1EDRSR10P1_ORCL

FAILOVER TO edrsr10p1_site1;

Performing a Manual Failover

You can perform a manual failover to the fast-start failover target standby database when fast-start failover is suspended because the primary database has been shut down. The FAILOVERcommand succeeds if the fast-start failover configuration is synchronized. The manual failover preserves the fast-start failover environment and the Data Guard configuration remains in maximum availability mode. The observer automatically reinstates the original primary database when it is restarted.

Note: You cannot perform a manual failover if the fast-start failover target standby database is not synchronized with the primary database.

If you must fail over to an unsynchronized fast-start failover target standby database or a bystander standby database, and then you must first disable fast-start failover for that standby database by executing the DISABLE FAST_START FAILOVER FORCEcommand. After you disable fast-start failover and perform the failover, fast-start failover is disabled for the entire configuration and the protection mode is changed to maximum performance.

Page 328: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 328

Copyright © 2006, Oracle. All rights reserved.10 - 328

Automatic Reinstatement AfterFast-Start Failover

Fast-start failover standby database

Primary database

EDRSR10P1_SITE1EDRSR10P1_ORCL

Automatic Reinstatement After Fast-Start Failover

Reinstatement of the original primary database is critical for reestablishing high availability after a fast-start failover. The original primary database can act as the fast-start failover target standby database for the new primary database after being reinstated as a standby database. You cannot perform a subsequent fast-start failover until the original primary database is reinstated without reconfiguring the fast-start failover environment.

Automatic reinstatement of the original primary database is triggered when all the following conditions are met:

• The original primary database and the new primary database comprise the same fast-start failover configuration before the failover occurs and after the original primary database restarts.

• In a multi–standby database configuration, you have not performed a subsequent failover or switchover before the original primary database restarting.

• The observer in the fast-start failover configuration can connect to the original primarydatabase.

• The original primary database must be able to connect to the new primary database to complete the reinstatement operation.

Page 329: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 329

Automatic Reinstatement After Fast-Start Failover ( continued)

If these conditions are not met, automatic reinstatement of the original primary database will not take place and appropriate errors will be logged. You can then request manual reinstatement of the original primary database using the CLI or Enterprise Manager.

Page 330: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 330

Copyright © 2006, Oracle. All rights reserved.10 - 330

Manually Reinstating the Database

Fast-start failover standby database

Primary database

EDRSR10P1_SITE1EDRSR10P1_ORCL

REINSTATE DATABASE edrsr10p1_orcl;

Manually Reinstating the DatabaseUse the REINSTATE DATABASEdatabase-name command to reinstate the database. If the conditions for reinstatement are not satisfied, then the request fails and the specified database remains disabled.

If the database name specified is the original primary database and fast-start failover is enabled, then the original primary database is reinstated as a standby database to the new primary database. The fast-start failover configuration is updated to reflect the availability of the new standby database. It accepts archived redo log files from the new primary database and serves as the fast-start failover target should the new primary database fail.

Issue this command while connected to either the primary database or to a standby database in the configuration that has connectivity to the primary database other than the original primary database to be reinstated.

Note: The REINSTATE DATABASEdatabase-name command does not require fast-start failover to be enabled. It can be used to reinstate an original primary database after a conventional no-data- loss failover.

This command is not needed when fast-start failover is enabled and the database to be reinstated is the original primary database. In that case, the observer will automatically reinstate the database.

Page 331: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 331

Copyright © 2006, Oracle. All rights reserved.10 - 331

Using Enterprise Manager toEnable Fast-Start Failover

Click Disabled to invoke the fast-start failover wizard.

Using Enterprise Manager to Enable Fast-Start Failo ver

On the Data Guard page, click the Disabled link next to Fast-Start Failover to invoke the fast-start failover wizard to enable fast-start failover.

Page 332: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 332

Copyright © 2006, Oracle. All rights reserved.10 - 332

Using Enterprise Manager toEnable Fast-Start Failover

Select the database.

Click Set Observer.

Using Enterprise Manager to Enable Fast-Start Failo ver (continued)

Select the fast-start failover target database and, optionally, the observer host. If the observer has not been started, click the Set Observer button.

Page 333: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 333

Copyright © 2006, Oracle. All rights reserved.10 - 333

Using Enterprise Manager toEnable Fast-Start Failover

Using Enterprise Manager to Enable Fast-Start Failo ver (continued)

Specify the Observer host and Observer Oracle Home to indicate where the observer will be started.

Page 334: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 334

Copyright © 2006, Oracle. All rights reserved.10 - 334

Using Enterprise Manager toEnable Fast-Start Failover

Using Enterprise Manager to Enable Fast-Start Failo ver (continued)

Flashback logging must be enabled on the primary database and the standby database to enable fast-start failover. If the primary database or the standby database does not have flashback logging enabled, the Enable Flashback Logging page displays. Specify the flash recovery area location, flash recovery area size, and flashback retention time for each database.

Page 335: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 335

Copyright © 2006, Oracle. All rights reserved.10 - 335

Using Enterprise Manager toEnable Fast-Start Failover

Using Enterprise Manager to Enable Fast-Start Failo ver (continued)

On the Confirmation: Enable Fast-Start Failover page, confirm that you want to enable fast-start failover to the named database.

Page 336: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 336

Copyright © 2006, Oracle. All rights reserved.10 - 336

Using Enterprise Manager toEnable Fast-Start Failover

Using Enterprise Manager to Enable Fast-Start Failo ver (continued)

After you confirm that you want to enable fast-start failover to a specific database, the fast-start enabling process begins. After the processing steps are complete, you are returned to the Data Guard page.

On the Data Guard Fast-start Failover Processing page you can observe the progress of the fast-start failover enabling operation as the following steps are performed:

• Standby redo log files are created on the primary and standby databases. • The protection mode is upgraded to Maximum Availability, if required.• The primary database and standby database is restarted, if required. • Fast-start failover is enabled.• The observer process is started.

Page 337: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 337

Copyright © 2006, Oracle. All rights reserved.10 - 337

Changing the Protection Modeand Disabling Fast-Start Failover

Changing the Protection Mode and Disabling Fast-Sta rt Failover

If you change the protection mode to a mode that does not support fast-start failover, then you implicitly disable fast-start failover.

Page 338: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 338

Copyright © 2006, Oracle. All rights reserved.10 - 338

Using Enterprise Manager toDisable Fast-Start Failover

Click the Enabled link to access the Change Mode

page.

Using Enterprise Manager to Disable Fast-Start Fail over

Access the Fast-Start Failover: Change Mode page by clicking the Fast-Start Failover link. Selecting Disable and the Stop observer option on the Fast-Start Failover: Change Mode page to disable fast-start failover.

Page 339: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 339

Copyright © 2006, Oracle. All rights reserved.10 - 339

Using Enterprise Manager toSuspend Fast-Start Failover

Using Enterprise Manager to Suspend Fast-Start Fail over

Suspend fast-start failover by selecting Disable on the Fast-Start Failover: Change Mode page. Do not select the “Stop observer” option.

Page 340: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 340

Copyright © 2006, Oracle. All rights reserved.10 - 340

Summary

In this lesson, you should have learned how to:• Configure fast-start failover• View information about the fast-start failover

configuration• Manage the observer• Perform role changes in a fast-start failover

configuration• Manually reinstate the primary database

Page 341: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 341

Copyright © 2006, Oracle. All rights reserved.10 - 341

Practice 10: Overview

This practice covers the following topics:• Enabling fast-start failover• Simulating a failure of the primary database and

observing the fast-start failover operation• Observing the automatic reinstatement of the new

physical standby into the Data Guard configuration

Page 342: Data Guard Slides Study Guide_shahul
Page 343: Data Guard Slides Study Guide_shahul

11Copyright © 2006, Oracle. All rights reserved.

Using Data Guard in a Real Application Clusters Configuration

Page 344: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 344

Copyright © 2006, Oracle. All rights reserved.11 - 344

Objectives

After completing this lesson, you should be able to deploy Data Guard in a Real Application Clusters environme nt.

Page 345: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 345

Copyright © 2006, Oracle. All rights reserved.11 - 345

Real Application Clusters and Data Guard

Possible combinations of instances in the primary a nd standby databases:

YesYesMulti-Instance

YesYesSingle-Instance

Multi-Instance

Standby Database

Single-Instance

Standby Database

Primary

Instance

Real Application Clusters and Data Guard

You can configure your Real Application Clusters (RAC) environment to switch over to another RAC environment or a single- instance environment.

If you configure switchover to another RAC environment, the broker ships all redo from all primary database RAC instances to the single standby instance where apply services is running. After switchover or failover, your application is in a RAC, which should give the same performance as the previous configuration.

Switchover and failover to a smaller system do not allow your application to perform as in the original configuration. If you are sending redo to a single- instance standby database, be sure to configure the number of standby redo logs on the standby database to be equal to the total number of online redo logs in all the instances of the RAC system.

Page 346: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 346

Copyright © 2006, Oracle. All rights reserved.11 - 346

Configuration Considerations with RAC

• Format for archived redo log file names: Thread variable ( %t or %T) of LOG_ARCHIVE_FORMATis mandatory.

• Data protection modes: Maximum protection or maximum availability mode; all instances could stop shipping redo.

Configuration Considerations with RACFormat for archived redo log file names:The thread variable (%t or %T) in the LOG_ARCHIVE_FORMATparameter is mandatory for Real Application Clusters to uniquely identify the archived redo log files.

Data protection modes:In a RAC configuration that is configured for maximum protection or maximum availability mode, any instance that loses connectivity with a standby destination causes all other instances to create a sync point for that destination. This action maintains the data integrity of the data that has been transmitted to that destination and can be recovered.

When the failed standby destination comes back up, Data Guard runs the site in resynchronization mode until no gaps remain. Then, the standby destination can participate in the Data Guard configuration again.

Page 347: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 347

Configuration Considerations with RAC (continued)

Data protection modes: In a RAC configuration that is configured for maximum protection or maximum availability mode, any instance that loses connectivity with a standby destination causes all other instances to create a sync point for that destination. This action maintains the data integrity of the data that has been transmitted to that destination and can be recovered.

When the failed standby destination comes back up, Data Guard runs the site in resynchronization mode until no gaps remain. Then, the standby destination can participate in the Data Guard configuration again.

Page 348: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 348

Copyright © 2006, Oracle. All rights reserved.11 - 348

Multi-Instance Primary Database with a Single-Instance Standby Database

Primary database Standby database

Multi-Instance Primary with a Single-Instance Stand by

You can create a single- instance standby database by using either SQL commands or Enterprise Manager.

Each instance of the primary database sends redo to the one instance of the standby. The standby database automatically determines the correct order in which to apply the archived redo log files.

Page 349: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 349

Copyright © 2006, Oracle. All rights reserved.11 - 349

Multi-Instance Primary Database with a Multi-Instance Standby Database

Primary database Standby database

Multi-Instance Primary with a Multi-Instance Standb y

Although the Add Standby Database Wizard does not create a RAC standby database, you can use it to add an existing RAC standby database to a Data Guard configuration. Click Add Standby Database to invoke the Add Standby Database Wizard, and then select “Add an existing standby database.”

The Data Guard broker also has the ability to dynamically discover instances of a database and add them to a database profile without user intervention. After they are added, the broker can manage these instances when it comes to conducting state changes, role changes, and so on. If a new primary instance is added, the broker automatically enables the redo transport service on that instance and gets that instance to ship its redo to the configured set of standby databases. During role changes and protection mode upgrades, the broker also manages the instance restarts because it is integrated with the RAC Cluster Ready Services (CRS).

Page 350: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 350

Copyright © 2006, Oracle. All rights reserved.11 - 350

Redo Transport with RAC to RAC

Primary instance A

Primary instance B

Standby instance C

Standby recovery instance D

Archived logs

Archived logs

Onlineredofiles

Standbyredofiles

Archivedlogs

LGWR RFS ARCn

LGWR

Primary database

Physical standby

database

MRP

Redo Transport with RAC to RAC

The best practice is to send all redo to the recovery instance on the standby RAC.

When both the primary and standby databases are in a Real Application Clusters configuration, then a single instance of the standby database applies all sets of log files that are transmitted by the primary instances. In this case, the standby instances that are not applying redo data cannot be in read-only mode while Redo Apply is in progress.

Page 351: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 351

Copyright © 2006, Oracle. All rights reserved.11 - 351

Setting Up a Primary Database with RAC

Primary instance A

Primary instance B

Archived logs

Archived logs

Onlineredofiles

LGWR

LGWR

Primary database

Setting Up a Primary Database with RAC

To configure redo transport services on the primary database:1. On all instances, define the LGWRattribute for the LOG_ARCHIVE_DEST_n parameter to

specify that the LGWR process performs the archival operation.2. Configure each primary instance to send its redo to the standby recovery instance by setting

the LOG_ARCHIVE_DEST_n parameter to an appropriate value.

Page 352: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 352

Copyright © 2006, Oracle. All rights reserved.11 - 352

Setting Up a Standby Database with RAC

Standby instance C

Standby recovery instance D

Standbyredofiles

Archivedlogs

RFS ARCn

Physical standby

database

MRP

Setting Up a Standby Database with RAC

To configure redo transport services on the standby database:1. Create the standby redo log files.

In a Real Application Clusters environment, the standby redo log files must reside on disk devices that are shared by all instances.

2. On the recovery instance, define the LOCATIONattribute of the LOG_ARCHIVE_DEST_1initialization parameter to archive locally.

3. Start log apply services on the recovery instance.

Page 353: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 353

Copyright © 2006, Oracle. All rights reserved.11 - 353

Assigning Threads to Standby Redo Log Groups

SQL> ALTER DATABASE ADD STANDBY LOGFILE2 THREAD 1 'STBY_LOGFILE_1.SRL' SIZE 50M;

Primarydatabase

Standbydatabase

Standby redo logs

Assigning Threads to Standby Redo Log GroupsUse the THREADn clause in the ALTER DATABASE ADD STANDBY LOGFILEstatement to assign a standby redo log group to a specific thread. With this clause, you can balance the use of standby redo log groups across all threads. The THREADn syntax is optional. If the syntax is omitted, Data Guard automatically assigns the standby redo log to a thread at run time. This is applicable only if you are using the RAC.

Because standby redo log groups are now assigned to a given thread, you may need more standby redo log groups. This is because there is no longer a pool of files available for any thread. If you have threads that generate more redo than others, assign more standby redo log groups to that thread. It is usually sufficient to assign one or two more than there are online log files.

Page 354: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 354

Copyright © 2006, Oracle. All rights reserved.11 - 354

Apply Instance Failover

• If the apply instance fails, transport of redo is a lso halted by default.

• Broker configuration:– Set ApplyInstanceTimeout to avoid downtime.

— Default is 120 seconds.— Set to 0 (zero) to disable.

– Optionally set PreferredApplyInstance .

• Non-broker configuration: Set up a list of destinat ion connect identifiers.

Apply Instance Failover

When the apply instance fails, not only does log apply services stop applying log files to the standby database, but redo transport services stop transmitting redo data to the standby database. To tolerate a failure of the apply instance, the broker leverages the availability of the RAC standby database by automatically failing over log apply services to a different standby instance. To set up apply instance failover in a Data Guard broker–controlled configuration, set the ApplyInstanceTimeout property to specify the time period that the broker should wait after detecting an apply instance failure and before initiating an apply instance failover. To select an appropriate timeout value, you must consider:

• If there is another mechanism in the cluster that will try to recover the failed apply instance• How long the primary database can tolerate not transmitting redo data to the standby

database• The overhead that is associated with moving the log apply services to a different instance.

The overhead may include retransmitting (from the primary database) all unapplied log files that have accumulated on the failed apply instance if those log files are not saved in a shared file system that can be accessed from other standby instances.

Page 355: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 355

Apply Instance Failover (continued)You can also set the PreferredApplyInstance property of Data Guard broker to indicate which instance should take over this task if the current apply instance fails. If PreferredApplyInstance is not set, the broker picks a random instance that is currently running to be the new apply instance.

If the Data Guard broker is not enabled for your configuration, Oracle’s high-availability best practices recommend setting up a list of destination connect identifiers in the tnsnames.orafile on the primary database, as in the following example:

CHICAGO=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=tcp)(HOST=chicago_n1-server)(POR T=1521))(ADDRESS=(PROTOCOL=tcp)(HOST=chicago_n2-server)(POR T=1521)))(CONNECT_DATA=(SERVICE_NAME=CHICAGO)))

In this case, LGWR chooses the next entry in the list to send redo data to, after a timeout period that is specified in the NET_TIMEOUTattribute of the log_archive_dest_n parameter (if NET_TIMEOUTis not specified, it waits until the system’s TCP/IP timeout). However, the apply process (Redo Apply or SQL Apply) would need to be manually started in the new instance with SQL*Plus.

The primary instance of the standby cluster will be brought down to ensure no data loss if all of the following are true:

• A connection list is not specified• The Data Guard broker is not enabled for the configuration• The apply instance for the last standby database fails• The LGWR process times out

Page 356: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 356

Copyright © 2006, Oracle. All rights reserved.11 - 356

Role Transitions with RAC

• Switchovers: Only one primary instance and one standby instance can be active during a switchover.

• Failovers: Before performing a failover to a RAC standby database, shut down all but one standby instance.

Role Transitions with RAC

Switchovers:For a RAC database, only one primary instance and one standby instance can be active during a switchover. Before a switchover, shut down all but one primary instance and one standby instance. After the switchover completes, restart the primary and standby instances that you shut down during the switchover.

Failovers: Before performing a failover to a RAC standby database, shut down all but one standby instance. After the failover completes, restart the instances that were shut down.

Page 357: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 357

Copyright © 2006, Oracle. All rights reserved.11 - 357

Troubleshooting

• Switchover failure • Avoiding downtime during a network outage

Troubleshooting

Switchover failure: When your database is using RAC, active instances prevent a switchover from being performed. When other instances are active, an attempt to switch over fails and the following error message appears:

SQL> ALTER DATABASE COMMIT TO SWITCHOVER TO STANDBY;ALTER DATABASE COMMIT TO SWITCHOVER TO STANDBY *ORA-01105: mount is incompatible with mounts by oth er instances

Query the V$ACTIVE_INSTANCESview to determine which instances are causing the problem:SQL> SELECT * FROM v$active_instances;

INST_NUMBER INST_NAME----------- ------------------------------

1 nleduc1.nl.oracle.com:orcl1

Connect to this instance and shut it down.

Page 358: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 358

Troubleshooting (continued)

Avoiding downtime: If you configured Data Guard to support a primary database in a RAC environment and the primary database is running in maximum protection mode, a network outage between the primary database and all of its standby databases will disable the primary database until the network connection is restored. The maximum protection mode dictates that if the last participating standby database becomes unavailable, processing halts on the primary database.

If you expect the network to be down for an extended period of time, consider changing the primary database to operate in either maximum availability or maximum performance mode until network connectivity is restored. If you change the primary database to maximum availability mode, it is possible for there to be a lag between the primary and standby databases, but you gain the ability to use the primary database until the network problem is resolved.

If you choose to change the primary database to maximum availability mode, it is important to use the following procedures to prevent damage to your data.

The following steps describe what to do if the network goes down and you want to change the protection mode for the RAC configuration. The example assumes that you are using a server parameter file (SPFILE) rather than a text initialization parameter file (PFILE).

1. At this point, all RAC primary instances are shut down. Issue the STARTUP MOUNTcommand to start one instance:STARTUP MOUNT;

2. Change the mode from maximum protection to either maximum availability or maximum performance. For example, the following statement sets the maximum availability protection mode:

ALTER DATABASE SET STANDBY DATABASE TO MAXIMIZE AVAILABILITY;

3. Open the RAC primary database for general access.

When the network comes back up later, perform the following steps to revert to maximum protection mode:

1. Shut down all instances of the RAC primary database.2. Mount a single instance of the RAC primary database without opening it for general access.3. Change the mode on the RAC primary database from its current mode (maximum availability

or maximum performance) to maximum protection mode.4. Open the RAC primary database for general access.

Page 359: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 359

Copyright © 2006, Oracle. All rights reserved.11 - 359

Summary

In this lesson, you should have learned how to depl oy Data Guard in a Real Application Clusters environment.

Page 360: Data Guard Slides Study Guide_shahul
Page 361: Data Guard Slides Study Guide_shahul

12Copyright © 2006, Oracle. All rights reserved.

Other Considerations for Oracle Data Guard

Page 362: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 362

Copyright © 2006, Oracle. All rights reserved.12 - 362

Objectives

After completing this lesson, you should be able to do the following:• Back up the primary database with a physical standb y

database • Back up a logical standby database • Use Flashback Database features in a Data Guard

configuration • Encrypt redo information • Configure cascaded redo log destinations

Page 363: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 363

Copyright © 2006, Oracle. All rights reserved.12 - 363

Offloading Backups to a Physical Standby

• Backups of data files and archived redo logs are fu lly interchangeable.

• Control file backups are not interchangeable.• Primary and standby databases must use the same

recovery catalog.• It is not necessary to register the standby databas e.

Offloading Backups to a Physical Standby

Recovery Manager (RMAN) can back up the standby database and its associated archived redo logs. Standby backups of data files and archived redo logs are fully interchangeable with primary database backups. In other words, you can execute the RESTOREcommand to restore a backup of a standby data file to the primary database, and you can restore a backup of a primary data file to the standby database. The standby control file and primary control file, however, are not interchangeable.

Both the primary database and standby database must use the same recovery catalog. Note that you do not need to register the standby database in the catalog if the primary is already registered; simply connect to the standby database and execute the BACKUPcommand.

Page 364: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 364

Copyright © 2006, Oracle. All rights reserved.12 - 364

Using RMAN to Back Up a Physical Standby Database

1. Invoke RMAN.2. Allocate channels if needed.3. Issue the BACKUPcommand.4. Use the LIST command to verify the backup.

Using RMAN to Back Up a Physical Standby DatabaseUse the RMAN BACKUPcommand to back up the standby database. Performing a backup on the standby database is exactly the same as a backup of the primary database, except that the backup takes place on the standby site.

Page 365: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 365

Copyright © 2006, Oracle. All rights reserved.12 - 365

Restrictions and Usage Notes

• The database you are backing up must be a physical standby database.

• You must be connected to the recovery catalog when backing up.

• You cannot back up the standby control file.• You must connect to the physical standby database

with the TARGETkeyword.

Restrictions and Usage Notes

If physical standby database backups are to be usable for restore jobs at the primary site, you must be connected to the recovery catalog when backing up the standby database or must resynchronize the physical standby database shortly after the backup. This step is necessary because there is no way for the primary database to know about the standby backups unless the backup records are stored in the recovery catalog.

You cannot back up the standby control file. Also, you cannot make an image copy or non-RMAN backup of the standby control file and then use it to restore the primary database.

When you back up the standby database, you must connect to the standby database with the TARGETkeyword (not the AUXILIARY keyword). Essentially, the standby database is “substituting” for the primary database during the backup.

Page 366: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 366

Copyright © 2006, Oracle. All rights reserved.12 - 366

Backup and Recovery of aLogical Standby Database

• Backup considerations: – Use the same backup method that you use for your

primary database.– Files are not interchangeable with the primary data base.

• Recovery considerations:– Can recover like any other database for loss of ind ividual

files– Need to re-create if you lose entire database– Must use a binary copy of control file for control- file

recovery

Backup and Recovery of a Logical Standby Database

You can back up your logical standby database by using the same method that you use for your primary database. The backup files are not interchangeable with the primary database. Remember that this is a different database.

You can use the same recovery techniques as with any other database for loss of data files or online log files. You must use the backups of the logical (not the primary) database. If the entire logical standby database is lost, you must re-create the logical standby.

If you lose all copies of your control file, you must use a binary copy of the control file when performing the recovery. Using a trace file or the CREATE CONTROLFILEcommand for control file recovery does not create a logical standby control file. You can make a binary copy of the control file by doing either of the following:

• Shut down the logical standby and copy the control file to a backup. • Issue the following command while the logical standby database is open:

ALTER DATABASE BACKUP CONTROLFILE TO '<filename>';

This command creates a binary copy of the control file with the name that you supply.

Page 367: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 367

Copyright © 2006, Oracle. All rights reserved.12 - 367

Flashback Across Database Changes

Flashback Database restores the database to a point -in-time before the following global database changes:• Database RESETLOGSoperation• Database switchover or failover to a physical or lo gical

standby database• Physical standby database activation

Flashback Across Database Changes

In Oracle Database 10g Release 2, you can use flashback database functionality to flash back through the global database changes described above. To flash back through any of these database state changes, Flashback Database must be previously enabled. Enabling Flashback Database for your database remains unchanged from the previous release.

Previously, when any of these global database changes were made, the flashback logs were discarded. Oracle Database 10g Release 2 maintains the flashback logs through the above globaldatabase changes, thereby extending the functionality of the Flashback Database command.

Page 368: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 368

Copyright © 2006, Oracle. All rights reserved.12 - 368

Using Flashback Database and Real-Time Apply

RFS

Standbyredo log

MRP

ARC0

Archivedredo logs

Primary database

Standby database

Using Flashback Database and Real-Time Apply

You can reduce failover time by using the Oracle Data Guard real- time apply feature. You can protect a physical standby database from logical data corruption or user error by using Flashback Database.

Page 369: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 369

Copyright © 2006, Oracle. All rights reserved.12 - 369

Using Flashback Database After RESETLOGS

Redo

Redo

Flashback

Primary database

Standby database

RESETLOGSafter

point-in-timerecovery

Primary database Standby database

Using Flashback Database After RESETLOGS

Physical Standby Configuration

For a physical standby database, it is possible that the Redo Apply service might not halt when it encounters the OPEN RESETLOGScommand in the redo information. If the physical standby database’s SCN is far enough behind the primary database’s SCN, then the Redo Apply service will be able to interpret the OPEN RESETLOGScommand without stopping.

Use the following procedure to avoid re-creating a standby database after you have performed an OPEN RESETLOGSon the primary database and the managed recovery process has halted on the physical standby database:

1. On the primary database, determine an SCN that is at least two SCNs prior to the SCN when the OPEN RESETLOGScommand was issued. This is necessary to enable the standby to recover properly through the OPEN RESETLOGS. Use the following query to find the “before RESETLOGS” SCN:

SELECT TO_CHAR(resetlogs_change# - 2) FROM v$databas e;

2. On the standby database, obtain the current SCN by using the following query: SELECT TO_CHAR(current_scn) FROM v$database;

Page 370: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 370

Using Flashback Database After RESETLOGS(continued)

3. Flash back the standby database to the “before RESETLOGS” SCN that you queried instep 1:

FLASHBACK STANDBY DATABASE TO SCN <before RESETLOGS SCN>;

4. Restart managed recovery on the standby database.The standby database should now be ready to receive and apply logs from the primary database:

ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT;

Logical Standby Configuration

For a logical standby database, it is possible that the SQL Apply service might not halt when it encounters the OPEN RESETLOGScommand in the redo information. If the logical standby database’s SCN is far enough behind the primary database’s SCN, then the SQL Apply service will be able to interpret the OPEN RESETLOGScommand without stopping.

Use the following procedure to avoid re-creating a standby database after you have performed an OPEN RESETLOGSon the primary database and the SQL Apply process has halted on the logical standby database:

1. On the primary database, determine an SCN that is at least two SCNs prior to the SCN when the OPEN RESETLOGScommand was issued. This is necessary to enable the standby to recover properly through the OPEN RESETLOGS. Use the following query to find the “before RESETLOGS” SCN:

SELECT TO_CHAR(resetlogs_change# - 2) FROM v$databas e;

2. On the standby database, obtain the current SCN with the following query: SELECT TO_CHAR(current_scn) FROM v$database;

3. Flash back the standby database to the “before RESETLOGS” SCN that you queried instep 1:

FLASHBACK STANDBY DATABASE TO SCN <before RESETLOGS SCN>;

4. Restart SQL Apply on the standby database. The standby database should now be ready to receive and apply logs from the primary database:

ALTER DATABASE START LOGICAL STANDBY APPLY IMMEDIATE;

Page 371: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 371

Copyright © 2006, Oracle. All rights reserved.12 - 371

Enabling Redo Encryption

Primarydatabase

Standbydatabase

Redo information encrypted

Enabling Redo Encryption

You can optionally enable encryption of the redo data by using the following procedure:1. Install the Oracle Advanced Security option at both the primary and standby databases.2. Configure the appropriate SQLNET.ORAparameters to enable Oracle Net to encrypt the redo

traffic shipped to the standby. An outline of the tasks to configure encryption on the client and on the server using Oracle Net Manager is as follows:

a. Navigate to the Oracle Advanced Security profile.b. Choose the Encryption tab.c. Select CLIENT or SERVER from the list.d. From the Encryption Type list, select one of the following: REQUESTED, REQUIRED,

ACCEPTED, or REJECTED. e. (Optional) In the Encryption Seed field, enter between 10 and 70 random characters; the

encryption seed for the client should not be the same as that for the server.f. Choose File > Save Network Configuration. The SQLNET.ORAfile is updated.g. Repeat this procedure to configure encryption on the other system.

Refer to the Oracle Database Advanced Security Administrator’s Guide for detailed information.

Page 372: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 372

Copyright © 2006, Oracle. All rights reserved.12 - 372

Activating a Physical Standby Database for Reporting

Physical standby database

Flashback

Redoapply

Redo stream

Redotransport

Guaranteedrestorepoint

Primary database

Activate for

reporting

Activating a Physical Standby Database for Reportin g

In Oracle Database 10g Release 2, using a combination of the capabilities of Data Guard, guaranteed restore points, and the Flashback Database features, a physical standby database can be temporarily activated in read/write mode for running reports and flashed back to revert it to a physical standby database. When the physical standby database is flashed back, Data Guard automatically synchronizes it with the primary database. You do not need to re-create the physical standby database from a backup copy of the primary database.

Page 373: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 373

Copyright © 2006, Oracle. All rights reserved.12 - 373

Activating a Physical Standby Database for Reporting

1. On the physical standby database, perform the following steps:a. Specify initialization parameters to define the fla sh

recovery area if not already configured.b. Cancel Redo Apply.c. Create a guaranteed restore point.

2. On the primary database, perform the following step s to ensure that the physical standby database can be reverted to the restore point:a. Archive the current log.b. Defer the log archive destination for the physical standby

database.

Activating a Physical Standby Database for Reportin g (continued)

The steps to activate a physical standby database for reporting are outlined on this page and the next.

Page 374: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 374

Copyright © 2006, Oracle. All rights reserved.12 - 374

Activating a Physical Standby Database for Reporting

3. Activate the physical standby database and set protection mode to maximum performance.

4. Perform reporting or testing on the activated datab ase.5. Revert the activated database to a physical standby

database:a. Flash back to the restore point.b. Convert it back into a physical standby database.

6. On the primary database, reenable archiving to the physical standby database destination.

7. Allow Data Guard to automatically resynchronize the physical standby database or use RMAN incremental backups from the primary database to resynchronize the physical standby database.

Activating a Physical Standby Database for Reportin g (continued)

When you activate a physical standby database temporarily as read/write, it does not receive logs from the primary database to provide disaster protection. In this case, you should use multiple standby databases to ensure full disaster protection while a standby is activated temporarily. Also, you should note that any results stored in the database by a reporting tool are lost when the standby database is flashed back. Any results that should be saved must be copied from the database before flashing it back.

Page 375: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 375

Copyright © 2006, Oracle. All rights reserved.12 - 375

Cascaded Redo Log Destinations

Primarydatabase

Standbydatabase

Standbydatabase

Redo

Redo

Cascading Redo Log Destinations

To reduce the load on your primary system, you can implement cascaded redo log destinations, whereby a standby database receives its redo data from another standby database instead of directly from the primary database. You can configure a physical standby database to retransmit the incoming redo data that it receives from the primary database to other remote destinations in the same manner as the primary database.

Note: You must use SQL commands when managing a cascaded redo log destination configuration because Data Guard broker does not support this feature.

Page 376: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 376

Copyright © 2006, Oracle. All rights reserved.12 - 376

Configuring Cascaded Redo Log Destinations: Physical Standby

• On the primary database, use the LGWR transport.• On the receiving standby database:

– Configure standby redo logs.– Configure LOG_ARCHIVE_DEST_n to send redo to the next

standby.

Physicalstandby

Primarydatabase

Physical orlogical standby

Configuring Cascaded Redo Log Destinations: Physica l Standby

To enable a physical standby database to send the incoming redo data to another set of destinations, you must do the following:

• Define the LOG_ARCHIVE_DEST_n initialization parameter on the primary database to set up a physical standby database as the starting point for a cascade to use the LGWRtransport method. Use either the SYNCor the ASYNCnetwork protocol, depending on your requirements.

• On the receiving physical standby database, define sufficient standby redo log files and ensure that archiving is enabled.

• Define the LOG_ARCHIVE_DEST_n initialization parameter on the physical standby database that will define the end points of the cascade.

Remember that, as part of the original setup of the physical standby database, you should have defined a local archive destination to be used for local archiving when the physical standby database transitions to the primary role.

For example, you might define the LOG_ARCHIVE_DEST_1initialization parameter to be the 'LOCATION=/physical1/arch' location. When the physical standby database switches roles, any archived redo log files are put into that directory with the same format that you defined with the LOG_ARCHIVE_FORMATinitialization parameter.

Page 377: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 377

Configuring Cascaded Redo Log Destinations: Physica l Standby (continued)

This local archiving destination can be the same as the one that is defined in the parameter STANDBY_ARCHIVE_DEST, but this is not required.

A side effect of this configuration is that the archiver process on the standby database now tries to send the redo data not only to the cascading end points, but also to the other standby databases and the primary database if they are defined and enabled. The shipping of redo back to the primary or another standby is not a problem, because the receiving database will reject it. If the destination is another standby database and it has not received the log file successfully, then the shipping of redo acts as an active gap resolution. You can avoid the shipping of redo to the primary and other standbys by setting the state to DEFERfor any destinations not involved in the cascade. However, you must remember to enable them again if you do a switchover or failover operation.

If you want to have one initialization parameter file handle both the cascaded redo log destinations and the original primary and standby destinations, define the destinations for the primary database and other standby databases as well as for the cascading standby databases. However, the total remote destinations still cannot exceed 10, including the local archiving destination.

Page 378: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 378

Copyright © 2006, Oracle. All rights reserved.12 - 378

Role Transitions withCascaded Redo Log Destinations

• Standby databases that receive redo data from a physical standby database:– No change: Switchover and failover are exactly the same.– May take longer

• Standby databases that receive redo data from a log ical standby database cannot participate in a switchover involving the primary database.

Role Transitions with Cascaded Redo Log Destination s

The process to perform a switchover or failover is exactly the same in a cascaded redo log destinations configuration, because all physical standby databases that receive retransmitted primary database redo data are identical and valid for role transitions. The only difference is that additional time may be required for the end-of-redo data to cascade to the standby database.

Any standby database that receives redo data that is cascaded from a logical standby database cannot participate in a switchover involving the primary database. (Only logical standby databases that receive redo data directly from the primary database can participate in switchovers.) If you fail over to a database that receives redo data generated by a logical standby database, then the only other logical standby databases that receive redo data cascaded from the same logical standby database are able to continue to participate in the Data Guard configuration after the failover.

Page 379: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 379

Copyright © 2006, Oracle. All rights reserved.12 - 379

Summary

In this lesson, you should have learned how to:• Back up the primary database with a physical standb y

database • Back up a logical standby database • Use Flashback Database features in a Data Guard

configuration • Encrypt redo information • Configure cascaded redo log destinations

Page 380: Data Guard Slides Study Guide_shahul
Page 381: Data Guard Slides Study Guide_shahul

13Copyright © 2006, Oracle. All rights reserved.

Workshop

Page 382: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 382

Copyright © 2006, Oracle. All rights reserved.13 - 382

Objectives

After completing this lesson, you should be able to do the following:• Explain the workshop methodology• Explain the workshop setup

Page 383: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 383

Copyright © 2006, Oracle. All rights reserved.13 - 383

Workshop Premise

• You are the DBA of a growing company that has decided to implement Oracle Data Guard to protect i ts Oracle database.

• You use Enterprise Manager and SQL commands to manage your Data Guard configuration.

Page 384: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 384

Copyright © 2006, Oracle. All rights reserved.13 - 384

Workshop Flow

In this workshop, you perform the following tasks:• Create one or more standby databases.• Verify the configurations.• Change the protection mode.• Retrieve information from the standby database.• Perform failovers.

Page 385: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 385

Copyright © 2006, Oracle. All rights reserved.13 - 385

Workshop Scenarios

The workshop comprises the following scenarios:1. Creating a Data Guard configuration to ensure high

availability, data protection, and disaster recover y2. Verifying the configuration and the operation of lo g

transport and apply services3. Verifying that the automatic gap detection and

resolution feature is working properly4. Changing the protection mode to meet stated

requirements

General Notes for the Workshop

The scenarios should be performed in order.

Page 386: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 386

Copyright © 2006, Oracle. All rights reserved.13 - 386

Workshop Scenarios

5. Configuring the feature that will ensure you will n ot need to re-create the primary database after failov er

6. Adding a data file to your primary database7. Configuring the standby database so that users can

use it for reporting 8. Adding a standby database that will support reporti ng9. Verifying that the automatic gap detection and

resolution feature is working properly

Page 387: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 387

Copyright © 2006, Oracle. All rights reserved.13 - 387

Workshop Scenarios

10.Configuring SQL Apply so that specified DML statements are not executed on the logical standby database

11.Creating a new view on the logical standby database12.Performing a failover operation13.Adding your original primary database back into the

configuration14.Returning to your original Data Guard configuration

Page 388: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 388

Copyright © 2006, Oracle. All rights reserved.13 - 388

Summary

In this lesson, you should have learned:• The flow of the workshop• The setup that is used for the workshop• Some hints that will help you through the workshop

Page 389: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 389

Workshop Preparation

To prepare for the workshop, you need to drop your Data Guard configuration and your standby databases. Perform the following steps:

1. Access the Data Guard page and disable fast-start failover.2. Change the protection mode from Maximum Availability to Maximum Performance.3. Drop your Data Guard configuration by selecting Remove Data Guard Configuration in the

Additional Administration section. Click Yes on the Confirmation: Remove Data Guard Configuration page to confirm.

4. Invoke DBCA on the server machine your standby databases are on and delete your standby databases.

5. Remove your <HOSTNAME>_SITE1and <HOSTNAME>_SITE2databases from Grid Control.

Page 390: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 390

Workshop Scenarios

In the workshop you will create standby databases and modify your configuration to meet the business requirements outlined in the workshop scenarios.

1. You need to create a Data Guard configuration to ensure high availability, data protection, and disaster recovery for your enterprise data. You want to be able to open your standby database in read-only mode so that queries can be executed. Create your standby database to meet these requirements with the following specifications:Standby database unique and target name:<YOUR_HOSTNAME>_SITE1Location: Create your standby database on the next-highest student PC in your classroom. For example, if your host name is EDRSR8P1, create your physical standby database named EDRSR8P1_SITE1on EDRSR8P2. If you are on EDRSR8P12, create your standby database on EDRSR8P1.

2. You want to ensure that you have created your standby database successfully and that the log transport and apply services are working. Use Enterprise Manager to confirm that your Data Guard configuration is functioning properly.

3. You understand that Data Guard can automatically detect archive gaps and resolve those gaps by copying the missing sequence of log files to the standby destination. As an example, if connectivity is lost between the primary and one or more standby databases (for example, due to network problems), redo data being generated on the primary database cannot be sent to those standby databases. Once a connection is reestablished, the missing archived redo log files (referred to as a gap) are automatically detected by Data Guard, which then automatically transmits the missing archived redo log files to the standby databases. Verify that this feature is working properly in your configuration by simulating a loss of connectivity. Disable log transport services to your standby database, switch the log on your primary database, and reenable log transport services to your standby database.

4. Maximum performance is the default protection mode and provides the highest level of data protection that is possible without affecting the performance of the primary database. This is accomplished by allowing a transaction to commit as soon as the redo data needed to recover that transaction is written to the local online redo log. You have determined that you need to change the data protection mode to ensure the redo data needed to recover each transaction is written to both the local online redo log and to the standby redo log on at least one standby database before the transaction commits. You also want to configure the protection mode so that the primary database does not shut down if a fault prevents it from writing its redo stream to a remote standby redo log. Change the protection mode so that your configuration meets these requirements.

Page 391: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 391

Workshop Scenarios (continued)

5. You want to ensure that you will not need to re-create the primary database after you have performed a failover operation. Configure the feature that will enable you to flash back the failed primary database to a point in time before the failover and convert it into a standby database for the new primary database.

6. You have been asked to add a data file to the EXAMPLEtablespace in your primary database. Add the data file with the following specifications:Data file name:/u01/app/oracle/oradata/orcl/example02.dbfData file size:2 MBVerify that the new data file has been added to your standby database.

7. The application users need to run some additional reports and do not want to impact the production system. Perform the steps required to make the standby database available for this reporting task. Verify that you can query tables in the standby database and then restart real-time apply so that the standby database will be resynchronized with the primary database.

8. You have determined that the users will need to run reports on a regular basis and do not want to impact the production database. In addition, you would like to add a standby database to your configuration for additional data protection. Configure a second standby database that will be available for users to perform queries, summations, and reporting activities against at all times with the following specifications:Standby database unique and target name: <HOSTNAME>_SITE2Location: Create your standby database on the next-highest student PC in your classroom. For example, if your host name is EDRSR8P1, create your standby database on EDRSR8P2. If you are on EDRSR8P12, create your standby database on EDRSR8P1.

9. Verify that the automatic gap detection and resolution feature is working properly in your configuration by simulating a loss of connectivity to your new standby database. Disable log transport services to your standby database, switch the log on your primary database, and reenable log transport services to your standby database.

Page 392: Data Guard Slides Study Guide_shahul

Oracle Database 10 g: Data Guard Administration 1 - 392

Workshop Scenarios (continued)

10. Because the users want to use some tables in the new standby database to report against for historical purposes, you need to configure SQL Apply so that certain DML statements are not executed against those tables on the logical standby database. You decide to test this feature first by creating a new table on the primary database as follows:

CREATE TABLE hr.emp_name AS SELECT first_name, last_name

FROM hr.employees WHERE 1=2;

Define a filter that prevents SQL Apply from issuing DML statements against the HR.EMP_NAMEtable on the logical standby database. Insert a few rows into the HR.EMP_NAMEtable on the primary database and commit your changes. Force a log switch on the primary database and then verify that the new rows are not applied to your logical standby database.

11. You have been asked to create a view for the users to query on the logical standby database. Create the view as follows:

CREATE VIEW hr.emp_90_vw AS SELECT *

FROM hr.employees WHERE department_id=90;

12. You have experienced a failure on your primary database server. Fail over to your physical standby database.

13. You have been able to restore the server which your primary database was on. Add your original primary database back into your Data Guard configuration as a physical standby database.

14. Return to your original Data Guard configuration with your HOSTNAME_ORCL.oracle.com database as your primary database.