Oracle Data Guard: Overview

1

Copyright © 2006, Oracle. All rights reserved.

Objectives

After completing this lesson, you should be able to do the following: • Describe the factors that affect planned and unplanned downtime • Describe the basic components of Oracle Data Guard • Explain the differences between physical and logical standby databases • Explain the benefits of creating a Data Guard environment • Explain the use of Data Guard in high-availability architectures

1-2

Copyright © 2006, Oracle. All rights reserved.

Oracle Database 10g: Data Guard Administration 1 - 2

Causes of Data Loss

Hardware & system errors Human errors Computer viruses Software corruption Natural disasters 7% 4% 3% 36%

49%

Source: Disaster Recovery Journal

1-3

Copyright © 2006, Oracle. All rights reserved.

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.

Oracle Database 10g: Data Guard Administration 1 - 3

Understanding the Causes of Downtime
Storage failure Computer failures Unplanned downtime Data failures Corruption Human error

Planned downtime

Data changes System changes

Site failure

1-4

Copyright © 2006, Oracle. All rights reserved.

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 e rror: 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.

Oracle Database 10g: Data Guard Administration 1 - 4

What Is Oracle Data Guard?
Primary database Standby database

Redo transport

Database

Oracle Net

Database copy

1-5

Copyright © 2006, Oracle. All rights reserved.

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 database is 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.

Oracle Database 10g: Data Guard Administration 1 - 5

Types of Standby Databases

There are two types of standby databases: • Physical standby database
– Identical to the primary database on a block-for-block 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 transforming the data in the redo received from the primary database into SQL statements and then executing the SQL statements
1-6 Copyright © 2006, Oracle. All rights reserved.

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 readonly reporting. Logical Standby Database A logical standby database contains the same logical information (unless configured to skip certain 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.

Oracle Database 10g: Data Guard Administration 1 - 6

Oracle Data Guard Broker Framework

Oracle Management Server Repository Agent Primary database Data Guard broker Enterprise Manager Data Guard broker Agent Standby database

CLI management client

1-7

Copyright © 2006, Oracle. All rights reserved.

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.

Oracle Database 10g: Data Guard Administration 1 - 7

The received redo data is first transformed into SQL statements. . 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 . Role. Oracle.SQL Apply: Technology used for logical standby databases.Types of Services There are three types of services provided with Data Guard: • Redo transport services • Log apply services – Redo Apply – SQL Apply • Role-management services 1-8 Copyright © 2006. Redo data is applied on the standby database by using the standard recovery techniques of an Oracle database.Redo Apply: Technology used for physical standby databases. Oracle Database 10g: Data Guard Administration 1 . All rights reserved.8 .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. 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.

and a standby database assumes the primary database role. All rights reserved. synchronized standby database. In Oracle Database 10g Release 2. 1-9 Copyright © 2006. and the original primary database then becomes a standby database. Oracle Data Guard supports two roletransition 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.” Oracle Database 10g: Data Guard Administration 1 .9 . The chosen standby database becomes the primary database.Role Transitions: Switchover and Failover • Oracle Data Guard supports two role-transition operations: – Switchover — — Planned role reversal Used for OS or hardware maintenance 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 failover is enabled – Failover — — — — • Role-transition operations are not automatically invoked. Fast-start failover is discussed in detail in the lesson titled “Enabling Fast-Start Failover. Oracle. During a failover operation. you can enable fast-start failover that allows Data Guard to automatically and quickly fail over to a previously chosen. the failed primary database is removed from the Data Guard environment. 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. • 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. You invoke the failover operation on the standby database that you want to fail over to the primary role.

To reenable broker management of these databases.Role Transitions: Switchover and Failover (continued) Databases that have been disabled after a role transition are not removed from the broker configuration.10 . Refer to the lesson titled “Performing Switchover and Failover” for detailed information. Oracle Database 10g: Data Guard Administration 1 . but they are disabled in the sense that the databases are no longer managed by the broker. you must reinstate or re-create the databases.

performance. Data Guard shuts down the primary database if it is unable to write the redo records to at least one properly configured database instance. 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. availability.instance Real Application Clusters (RAC) databases.level modes of data protection that you can configure to balance cost. the primary database shuts down if a fault prevents it from writing its redo stream to at least one remote standby redo log. To ensure that data loss does not occur. You can configure the Data Guard environment to maximize data protection. Maximum Protection This protection mode guarantees that no data loss occurs if the primary database fails. availability. Oracle Database 10g: Data Guard Administration 1 .Data Protection Modes • Maximum protection • Maximum availability • Maximum performance 1 .11 Copyright © 2006. and transaction protection. Data Protection Modes Data Guard provides three high. To provide this level of protection.11 . All rights reserved. For multiple. or performance. Oracle.

but that redo stream is written asynchronously with respect to the commitment of the transactions that create the redo data. 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. 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. the primary database operates in maximum performance mode until the fault is corrected and all the gaps in the redo log files are resolved. 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.12 . When all the gaps are resolved. Oracle Database 10g: Data Guard Administration 1 . the primary database automatically resumes operating in maximum availability mode. Instead. this mode provides a level of data protection that approaches that of maximum availability mode with minimal impact on primary database performance. As with maximum protection mode. The primary database’s redo data stream is also written to at least one standby database. the primary database does not shut down if a fault prevents it from writing its redo stream to a remote standby redo log. Maximum Performance (Default) This default protection mode provides the highest possible level of data protection without affecting the performance of the primary database. This mode guarantees that no data loss occurs if the primary database fails.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. Unlike maximum protection mode. When network links with sufficient bandwidth are used.

You can also use the physical standby database for backups of the primary database. With the use of protection modes and several tunable parameters. All rights reserved. • Complete data protection: Data Guard guarantees no data loss and provides a safeguard against data corruption and user errors. • Efficient use of system resources: Standby databases can be used for reporting in addition to providing a safeguard for disaster recovery. Benefits of Implementing Oracle Data Guard Oracle Data Guard provides the following benefits: • Continuous service: With the use of switchover and failover between systems. • Centralized manage ment: You can use Enterprise Manager Grid Control to manage all configurations in your enterprise. Oracle Database 10g: Data Guard Administration 1 .13 Copyright © 2006. You can use a logical standby for real. • Elimination of idle standby systems: A standby database does not have to be idle when you implement a logical standby database.in-time reporting. 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. Oracle.time reporting and the physical standby database for point.13 . Redo data is validated when applied to the standby database.Benefits of Implementing Oracle Data Guard Oracle Data Guard provides the following benefits: • Continuous service through disasters or crippling data failures • Complete data protection against corruptions and data loss • Efficient use of system resources • Elimination of idle standby systems • Flexible configuration of your system to meet business protection and recovery requirements • Centralized management 1 . you can tailor the configuration to your needs. your business need not halt because of a disaster at one location.

This course focuses on the use of Data Guard. including Flashback Query. Flashback Transaction Query. For additional information about ASM. Flashback Table. Data Guard addresses data failure and disaster recovery in high-availability architectures.Role of Data Guard in a High-Availability Architecture Computer failures RAC Storage failure Human error ASM Flashback technology Oracle HARD RMAN Data failures Corruption Site failure Data Guard 1 . All rights reserved. Real Application Clusters (RAC) enables you to build highly available and scalable database servers across multiple systems. Role of Data Guard in a High-Availability Architecture Oracle Database offers many features to protect your system from common types of downtime. see Oracle Database Concepts and the Oracle Database Administrator’s Guide.14 . Oracle Database 10g introduces the Automatic Storage Management (ASM) feature. Refer to Oracle High Availability Architecture and Best Practices for additional information about the HARD initiative. Oracle’s Hardware Assisted Resilient Data (HARD) is a comprehensive program designed to prevent data corruptions before they happen. which provides a vertically integrated file system and volume manager in the Oracle kernel. see the Oracle Database Administrator’s Guide. For additional information about these features. Oracle Database 10g: Data Guard Administration 1 . Flashback Versions Query. Oracle Database 10g includes flashback technologies to address human errors. For more information about Real Application Clusters.14 Copyright © 2006. you can attend the Oracle Database 10g: Real Application Clusters course or review the Oracle Real Application Clusters Administrator’s Guide. Oracle. and Flashback Drop. Flashback Database.

15 . See the Oracle Database Administrator’s Guide for additional information about these features. rebuilt. All rights reserved. Indexes can be added.15 Copyright © 2006. Oracle Database dynamically accommodates a number of hardware configuration changes. Tables can be redefined without interruption to users who are viewing or updating the data. Patches can be applied to a RAC system in a rolling fashion. Role of Data Guard in a High-Availability Architecture (continued) There are a number of features in Oracle Database to support planned downtime that encompasses data changes. Oracle Database 10g: Data Guard Administration 1 . or defragmented while the tables that they index are being queried or updated. 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. Oracle.Role of Data Guard in a High-Availability Architecture • Online schema and data reorganization • Partitioned tables and indexes • Dynamic resource provisioning Data changes Planned downtime • Rolling patch updates • Rolling release upgrade using Data Guard SQL Apply System changes 1 .

16 Copyright © 2006. All rights reserved.16 .Oracle Data Guard and Real Application Clusters Oracle Data Guard and Real Application Clusters are complementary and can be used together. 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.” Oracle Database 10g: Data Guard Administration 1 . 1 . Oracle. • Oracle Data Guard provides disaster protection and prevents data loss. • Real Application Clusters provides high availability.

MAA provides a comprehensive architecture for reducing downtime for scheduled outages and preventing. Maximum Availability Architecture RAC and Data Guard provide the basis for the database maximum availability architecture (MAA) solution. detecting. Oracle. Identical site configuration is recommended to ensure that performance is not sacrificed after a failover or switchover.17 . Symmetric sites also enable processes and procedures to be kept the same between sites. This course focuses on the Data Guard component of MAA. For more information about MAA. and the secondary site contains both a physical standby database and a logical standby database on RAC. Oracle Database 10g: Data Guard Administration 1 . All rights reserved. The recommended MAA has two identical sites.Maximum Availability Architecture Clients Oracle Application Server WAN traffic manager Oracle Application Server RAC production database Data Guard RAC physical standby database RAC logical standby database 1 . refer to the Oracle Database High Availability Overview manual. making operational tasks easier to maintain and execute. and recovering from unscheduled outages. The primary site contains the RAC database.17 Copyright © 2006.

you should have learned how to: • Describe the basic components of Oracle Data Guard • Describe the differences between physical and logical 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 1 . Oracle Database 10g: Data Guard Administration 1 .18 Copyright © 2006.18 . All rights reserved. Oracle.Summary In this lesson.

Oracle.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 logical standby databases • Reviewing the components of Oracle Data Guard 1 .19 Copyright © 2006. Oracle Database 10g: Data Guard Administration 1 . All rights reserved.

.

All rights reserved. Oracle. .Understanding the Oracle Data Guard Architecture 2 Copyright © 2006.

22 Copyright © 2006. 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.Objectives After completing this lesson. Oracle. transports. and applies redo logs • Describe standby database modes 2 . All rights reserved.22 . Oracle Database 10g: Data Guard Administration 1 .

Data Guard Operational Requirements: Hardware and Operating System • The hardware can be different for the primary and standby databases. 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. Note: Standby databases can use a different directory structure from the primary database. • The operating system on both databases must be the same.23 Copyright © 2006. as discussed in the lesson titled “Creating a Physical Standby Database by Using SQL. There are certain parameters that must be specified to support this configuration. and the storage configuration can differ. • If both the primary and the standby databases are on the same server. • If all databases are on the same system. • The operating system releases for the primary and standby databases can be different. • The operating system and platform architecture for the primary and standby databases must be the same. Oracle. All rights reserved. the number of CPUs. 2 .23 . you must ensure that the operating system allows you to mount two databases with the same name on the same system simultaneously. • The operating system and platform architecture for the primary and standby databases must be the same. but the operating system release does not need to be the same. verify that the OS allows you to mount more than one database with the same name. the memory size.” Oracle Database 10g: Data Guard Administration 1 .

• If any databases use ASM and/or OMF. • Enable FORCE LOGGING on the primary database before taking data file backups for standby creation. Oracle Database 10g: Data Guard Administration 1 . all should use the same combination.24 . All rights reserved. • SYSDBA privileges are required for the accounts used to manage the database instances. • Each database must have its own control file. Furthermore. the SYS user must have the same password on all databases in the configuration. • The primary database and each standby database must have their own control files. • You must have SYSDBA system privileges for the user accounts that you use to manage the primary and standby database instances. Oracle. 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.Data Guard Operational Requirements: Oracle Database Software • Same release of Oracle Database Enterprise Edition must be installed for all databases. 2 . • Primary database must operate in ARCHIVELOG mode.24 Copyright © 2006. • The primary database must be configured in ARCHIVELOG mode.

25 . The NOLOGGING setting can speed up operations that can be easily recovered outside of the database recovery mechanisms. or both. You can enable FORCE LOGGING to force the writing of redo records even when NOLOGGING has been specified in DDL statements. respectively. To protect against unlogged direct writes in the primary database that cannot be propagated to the standby database. OMF. If any database in your Data Guard configuration uses ASM. Oracle Database 10g: Data Guard Administration 1 . or both. you should use ASM and OMF symmetrically on the primary and standby database. which causes some database operations not to generate redo records in the database redo log. OMF. • If you use Oracle Automatic Storage Management (ASM) and Oracle Managed Files (OMF) in a Data Guard configuration. but it can negatively affect media recovery and standby databases. enable FORCE LOGGING on the primary database before taking data file backups for standby creation.Oracle Database Software Requirements (continued) • Some data definition language (DDL) statements permit the NOLOGGING clause. You should maintain FORCE LOGGING mode as long as the standby database is active. then every database in the configuration should use ASM.

Oracle.Oracle Data Guard: Architecture Primary database transactions LGWR LNSn MRP or LSP (MRP only) RFS Standby database Online redo logs FAL Oracle net (Real-time apply) Standby redo logs Reports ARC0 Backup ARC0 Archived redo logs 2 . Some of these processes existed before the introduction of Data Guard.26 Copyright © 2006. others were created specifically to support Oracle Data Guard.26 . These processes are discussed in more detail on the next few pages. Oracle Data Guard uses several processes to achieve the automation that is necessary for disaster recovery and high availability. All rights reserved. By using the existing architecture. Oracle Database 10g: Data Guard Administration 1 . Archived redo logs 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. Oracle Data Guard minimizes its impact on the primary database.

The ARCn process may also ship the redo stream to the RFS process while simultaneously archiving the online log. it ships redo information directly to the remote file server (RFS) process on the standby database and waits for a confirmation before proceeding. Oracle. Note: You can configure a primary database to ship redo information to a single standby database by using either LGWR or ARCn.27 . Archived redo logs Primary Database Flow On the primary database. but not both. This process is started only when needed and shuts down as soon as it is finished. In synchronous mode. creates a copy of the online redo logs locally for use in a primary database recovery. It is very likely you will not see this process running. it ships the redo information directly but does not wait before proceeding.Primary Database Flow Primary database transactions LGWR LNSn MRP or LSP (MRP only) RFS Standby database Online redo logs FAL Oracle net (Real-time apply) Standby redo logs Reports ARC0 Backup ARC0 Archived redo logs 2 . • Archiver (ARCn) process: ARCn. ARCn is also responsible for proactively detecting and resolving gaps on all standby databases. Data Guard redo transport services use the following processes: • Log writer (LGWR) process: LGWR collects transaction redo information and updates the online redo logs. All rights reserved. LGWR submits the network I/O request to the network server (LNSn) process for that destination.27 Copyright © 2006. • 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. In asynchronous mode. Oracle Database 10g: Data Guard Administration 1 . In asynchronous mode. or a SQL session performing an archival operation.

• Archiver (ARCn) process: The ARCn process archives the standby redo logs. the broker always starts the MRP background process for a physical standby database. • Managed recovery process (MRP): For physical standby databases only.Standby Database Flow Primary database transactions LGWR LNSn MRP or LSP (MRP only) RFS Standby database Online redo logs FAL Oracle net (Real-time apply) Standby redo logs Reports ARC0 Backup ARC0 Archived redo logs 2 . Oracle Database 10g: Data Guard Administration 1 . RFS can write the redo into standby redo logs or directly to archived redo logs. Note: The use of standby redo logs is discussed in more detail later in the lesson.28 Copyright © 2006. MRP applies archived redo log information to the physical standby database. Each LNSn and ARCn process from the primary database has its own RFS process. If you use Data Guard broker to manage your standby databases. the MRP background process starts. this foreground session performs the recovery. LSP controls the applying of archived redo log information to the logical standby database. If you start the managed recovery with the ALTER DATABASE RECOVER MANAGED STANDBY DATABASE SQL statement. If you use the optional DISCONNECT [FROM SESSION] clause. Archived redo logs 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. • Logical standby process (LSP): For logical standby databases only. All rights reserved.28 . Oracle.

Oracle.29 Copyright © 2006. Oracle Database 10g: Data Guard Administration 1 . 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.Standby Redo Logs Redo from primary database Standby redo logs Archived redo logs RFS MRP/LSP ARC0 Standby database 2 . Note: The real-time apply feature is discussed in more detail later in this lesson. standby redo logs must be archived before the data can be applied to the 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. All rights reserved. Unless you are using the real-time apply feature. The standby archival operation occurs automatically. Configuring standby redo log files is highly recommended on all standby databases in a Data Guard configuration. Standby redo logs form a separate pool of log file groups. including the primary database to aid in role reversal.29 .

30 Physical standby database Copyright © 2006. Refer to the lesson titled “Other Considerations for Oracle Data Guard” for additional information about this feature. In Oracle Database 10g. . the maximum number of destinations is 10. leaving the other nine for uses such as the standby database. Oracle.Physical Standby Database: Redo Apply Architecture Production database Redo transport Physical standby database Redo apply Redo stream Backup Primary database 2 . The standby databases are either in recovery mode or open in read-only mode. which is linked to one or more standby databases (up to nine) that are identical copies of the production database . but not both.30 . Oracle Database 10g: Data Guard Administration 1 .The limit of nine standby databases is imposed by the LOG_ARCHIVE_DEST_n parameter.The primary database is open and active. All rights reserved. Note: You can use the Cascaded Redo Log Destinations feature to incorporate more than nine standby databases in your configuration. One is used as the local archive destination. Data Guard Redo Apply: Architecture The Data Guard physical standby Redo Apply architecture consists of: • A production (primary) database.

When a failure occurs.During planned downtime. . you can perform a switchover to a standby database. which is updated by redo that is automatically shipped from the primary database. you may perform a failover to one of the standby databases. .31 . . .The physical standby database can also be used to back up the primary database. Oracle Database 10g: Data Guard Administration 1 .Data Guard Redo Apply: Architecture (continued) • The standby 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.

However. Oracle Database 10g: Data Guard Administration 1 . Oracle. The logical standby database is open in read/write mode and is available for reporting capabilities.32 . Data Guard SQL Apply: Architecture In a logical standby database configuration.32 Logical standby database Copyright © 2006. All rights reserved. archived redo log information is transformed into equivalent SQL statements by using LogMiner technology.Logical Standby Database: SQL Apply Architecture Production database Redo transport SQL Apply Logical standby database Transform redo information into SQL Reports Primary database 2 . Data Guard SQL Apply uses redo information shipped from the primary system. These SQL statements are then applied to the logical standby database. instead of using media recovery to apply changes (as in the physical standby database configuration).

• The builder process assembles completed transactions from the individual LCRs. All rights reserved. • The analyzer process examines the records. Oracle. • The preparer processes convert the block changes into table changes or logical change records (LCRs).Monitors dependencies between transactions and coordinates scheduling .Assigns transactions . 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.Asks the coordinator process to approve transactions with unresolved dependencies (the transactions are scheduled appropriately so that the dependencies are resolved) .33 Copyright © 2006. possibly eliminating transactions and identifying dependencies between the different transactions.Commits the transactions Oracle Database 10g: Data Guard Administration 1 .Applies the LCRs to the database .33 . • The coordinator process (LSP): . the LCRs do not represent any specific transactions.SQL Apply Process: Architecture LCR LCR : Shared pool Logical change records not grouped into transactions Reader Redo records Preparer Builder Redo data from primary database Log Mining Apply processing Applier Transaction groups Coordinator Analyzer Data files Transactions to be applied Transactions sorte d in dependency order 2 . At this point.Authorizes the commitment of changes to the logical standby database • The applier process: .

34 Copyright © 2006. 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. Oracle. up-to-date reporting from a logical standby database. if you have a physical standby in READ ONLY mode for a period of time).time apply mode. All rights reserved. Real-time application of redo information provides a number of benefits.Real-Time Apply RFS Primary database MRP or LSP Standby redo log files ARC0 Archived redo log files Standby database 2 . The apply service also tries to catch up and go back to reading the standby redo log files as soon as possible. Real-Time Apply When you enable the optional real. and the ability to leverage larger logs files. Oracle Database 10g: Data Guard Administration 1 . 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. including quicker switchover and failover operations.time apply feature. The RECOVERY_MODE column of the V$ARCHIVE_DEST_STATUS view contains the value MANAGED REAL TIME APPLY when log apply services are running in real. If for some reason the apply service is unable to keep up (for example. instantly up-to-date results after you change a physical standby database to read-only.34 . then the apply service automatically goes to the archived redo log files as needed.

Note: Standby redo log files are required for real-time apply. the managed recovery process (MRP) applies the redo from the standby redo log files after the remote file server (RFS) process finishes writing. the delay is ignored. Real-time apply is supported by the broker. For physical standby databases. To start real.time apply for a logical standby database. issue the following command: ALTER DATABASE START LOGICAL STANDBY APPLY IMMEDIATE. issue the following command: ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE. It is highly recommended that you have one more standby redo log group than the number of online log groups on the primary database.35 . 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 physical standby database. Oracle Database 10g: Data Guard Administration 1 .time apply.Real-Time Apply (continued) If you define a delay on a destination (with the DELAY attribute) and use real.

Setting the DB_UNIQUE_NAME Parameter

San Francisco

SF1_DB

DB_UNIQUE_NAME = SF1_DB

2 - 36

Copyright © 2006, Oracle. All rights reserved.

Setting the DB_UNIQUE_NAME Parameter Data Guard identifies all the databases in its configuration by using the DB_UNIQUE_NAME initialization parameter. Choose a unique name for each database and assign it with this parameter. The DB_UNIQUE_NAME value 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_NAME value 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.

Oracle Database 10g: Data Guard Administration 1 - 36

Specifying Role-Based Destinations
Primary database Standby database

Not used

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

2 - 37

Copyright © 2006, Oracle. All rights reserved.

Specifying Role-Based Destinations The VALID_FOR attribute 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_FOR setting 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_FOR attribute: 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.

Oracle Database 10g: Data Guard Administration 1 - 37

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_role values can be specified in any order. For example, VALID_FOR=(PRIMARY_ROLE,ONLINE_LOGFILE) is functionally equivalent to VALID_FOR=(ONLINE_LOGFILE,PRIMARY_ROLE).

Oracle Database 10g: Data Guard Administration 1 - 38

Combinations for VALID_FOR
Combination
ONLINE_LOGFILE, PRIMARY_ROLE ONLINE_LOGFILE, STANDBY_ROLE ONLINE_LOGFILE, ALL_ROLES STANDBY_LOGFILE ,STANDBY_ROLE STANDBY_LOGFILE , ALL_ROLES ALL_LOGFILES , PRIMARY_ROLE ALL_LOGFILES , STANDBY_ROLE ALL_LOGFILES , ALL_ROLES

Primary
Valid Ignored Valid Ignored Ignored Valid Ignored Valid

Physical Logical
Ignored Ignored Ignored Valid Valid Ignored Valid Valid Ignored Valid Valid Valid Valid Ignored Valid Valid

2 - 39

Copyright © 2006, Oracle. All rights reserved.

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 Ignored value 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 contains an invalid attribute value

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

Oracle Database 10g: Data Guard Administration 1 - 39

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.
2 - 40 Copyright © 2006, Oracle. All rights reserved.

Identifying Destination Settings The VALID_NOW column in V$ARCHIVE_DEST indicates 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_2 is set to (STANDBY_LOGFILES,STANDBY_ROLE), but WRONG VALID_TYPE is 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_3 is set to (ONLINE_LOGFILES,STANDBY_ROLE), but WRONG VALID_ROLE is 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_ROLE columns are the respective values from the VALID_FOR attribute that is specified for each archive log destination.

Oracle Database 10g: Data Guard Administration 1 - 40

Standby Redo Log Configuration

Online redo logs

Redo shipment

Standby redo logs

RFS Primary database Standby database

2 - 41

Copyright © 2006, Oracle. All rights reserved.

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.

Oracle Database 10g: Data Guard Administration 1 - 41

Using SQL to Add Standby Redo Logs

• Use the ALTER DATABASE statement to create the standby redo log files:
SQL> ALTER DATABASE ADD STANDBY LOGFILE 2 ('/oracle/oradata/orcl/log1c.rdo', 3 '/oracle/oradata/orcl/log2c.rdo') SIZE 500K;

• Add members to a group with the following statement:
SQL> ALTER DATABASE ADD STANDBY LOGFILE MEMBER 2 '/oracle/oradata/orcl/log2b.rdo' TO GROUP 2;

• View information about the groups as follows:
SQL> SELECT * FROM v$standby_log; SQL> SELECT * FROM v$logfile 2 WHERE type = 'STANDBY';
2 - 42 Copyright © 2006, Oracle. All rights reserved.

Using SQL to Add Standby Redo Logs You can create standby redo logs by using the ADD STANDBY LOGFILE clause of the ALTER DATABASE statement. 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_LOG or V$LOGFILE with 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 144545 4 UNASSIGNED 0 5 UNASSIGNED 0

Oracle Database 10g: Data Guard Administration 1 - 42

All rights reserved. Using Enterprise Manager to Add Standby Redo Logs When you create a standby configuration with Enterprise Manager.43 .43 Copyright © 2006. Oracle. Configuring standby redo logs is covered in more detail in the lesson titled “Creating a Configuration and Physical Standby Database by Using Enterprise Manager. it recommends a configuration of standby redo logs.Using Enterprise Manager to Add Standby Redo Logs 2 . This recommendation includes creating the standby redo logs on the primary database as well as on any standby databases in the configuration.” Oracle Database 10g: Data Guard Administration 1 .

In most implementations of a Data Guard environment. Log apply services cannot apply archived redo logs to the standby database when it is in this mode. then open it in read-only mode in a Data Guard environment. and log apply services automatically apply these logs. but the primary database continues to ship redo to the standby database. no reads of the data are possible.Standby Database Modes You can maintain the standby data in one of the following modes: • For physical standby databases – Redo Apply – Open read-only mode • For logical standby databases – Open read/write mode 2 . 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 Oracle Database 10g: Data Guard Administration 1 . All rights reserved. redo transport services archive the logs to the standby database. 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.44 . You can easily change between managed recovery mode and read-only mode. Oracle. • Open read-only mode: If you want to use the standby database for reporting purposes.44 Copyright © 2006. The database is in the MOUNT state.

the database is open for reporting. In addition. Oracle Database 10g: Data Guard Administration 1 . users can modify database objects in other schemas that are not being maintained 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.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. However. 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.

transports.46 Copyright © 2006. All rights reserved. and applies redo logs • Modes of standby databases and when to use each mode 2 .Summary In this lesson. you should have learned how to describe the following: • Data Guard architecture processes • Operational requirements of a Data Guard environment • How Data Guard processes. Oracle Database 10g: Data Guard Administration 1 . Oracle.46 .

Oracle. Oracle Database 10g: Data Guard Administration 1 .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 2 . All rights reserved.47 Copyright © 2006.47 .

All rights reserved.Practice 2-2: Installing the Oracle Management Agent This practice covers the following topics: • Installing the Oracle Management Agent • Configuring monitoring credentials for your database 2 .48 .48 Copyright © 2006. Oracle Database 10g: Data Guard Administration 1 . Oracle.

Oracle.Practice 2-3: Configuring Your Primary Database This practice covers the following topics: • Reviewing your primary database configuration • Configuring your primary database in preparation for creating a Data Guard configuration 2 . All rights reserved. Oracle Database 10g: Data Guard Administration 1 .49 .49 Copyright © 2006.

.

. Oracle. All rights reserved.Using Data Guard Broker and Enterprise Manager 3 Copyright © 2006.

All rights reserved.52 . Oracle. Oracle Database 10g: Data Guard Administration 1 . 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 3 .Objectives After completing this lesson.52 Copyright © 2006.

redo transport services. RAC or non-RAC) standby databases to each existing Data Guard configuration. and monitoring of Data Guard configurations. and log apply services Note: Any of the databases in the configuration can be a RAC database. and detecting problems quickly with centralized monitoring.Features of Data Guard Broker • The Data Guard broker is a distributed management framework. • Adding up to eight new or existing (physical or logical. maintenance.53 . you can perform all management operations locally or remotely through easy-to-use interfaces: – Oracle Enterprise Manager 10g Grid Control – A command-line interface: DGMGRL 3 . and performance tools Oracle Database 10g: Data Guard Administration 1 . a new or existing (physical or logical) standby database. • The broker automates and centralizes the creation. Oracle. The following are some of the operations that the broker automates and simplifies: • Automated creation of Data Guard configurations incorporating a primary database. for a total of one primary database. reporting statistics such as the log apply rate and the redo generation rate. Features of Data Guard Broker The Oracle Data Guard broker is a distributed management framework that automates and centralizes the creation.53 Copyright © 2006. redo transport services. maintenance. • With the broker. 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. testing. All rights reserved. and monitoring of Data Guard configurations. and from one to nine standby databases in the same configuration • Managing an entire Data Guard configuration (including all databases. capturing diagnostic information.

54 . monitor the overall health of the configuration. All rights reserved. with which you can control the databases of that configuration. The properties are recorded in the configuration file as a part of the database’s object profile that is stored there. On the client. Data Guard monitor is a broker component that is integrated with the Oracle database. modify their behavior at run time.Data Guard Broker: Components • Client-side: – Oracle Enterprise Manager 10g Grid Control – DGMGRL (command-line interface) • Server-side: Data Guard monitor – DMON process – Configuration files 3 . Data Guard Broker: Components The Oracle Data Guard broker consists of components that reside on the client and the server in the configuration. Many database properties are used to control database initialization parameters related to the Data Guard environment. Oracle. and provide notification of other operational characteristics. Oracle Database 10g: Data Guard Administration 1 . Data Guard monitor comprises the Data Guard monitor process (DMON) and broker configuration files.line interface (CLI) On the server. Associated with each database are various properties that the DMON process uses to control the database’s behavior. The configuration file contains profiles that describe the states and properties of the databases in the configuration. you can use the following Data Guard components to define and manage a configuration: • Oracle Enterprise Manager • DGMGRL. which is the Data Guard command.54 Copyright © 2006.

Chicago Boston Oracle Net Primary site Standby site 3 . Data Guard Broker: Configurations A Data Guard configuration consists of one primary database and up to nine standby databases. A Data Guard broker configuration is a logical grouping of the primary and standby databases in a Data Guard configuration.55 .55 Copyright © 2006. Oracle. All rights reserved. The databases in a Data Guard configuration are typically dispersed geographically and are connected by Oracle Net. Oracle Database 10g: Data Guard Administration 1 .Data Guard Broker: Configurations The most common configuration is a primary database at one location and a standby database at another location. The broker’s DMON process configures and maintains the broker configuration components as a unified group of resource objects that you can manage and monitor as a single unit.

56 Copyright © 2006. RAC or non-RAC standby databases. current status.Data Guard Broker: Management Model Data Guard Broker Configuration Broker-controlled databases Primary database Instance s Standby database Standby database Standby database Standby database Standby database Standby database Standby database Standby database Standby database Instance s 3 . A database profile is a description of a database object. each of which includes a profile for one primary database as well as profiles for up to nine physical. logical. 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. Oracle Database 10g: Data Guard Administration 1 . Oracle.56 . All rights reserved. The broker supports one or more Data Guard configurations. • 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. and properties. including its current state.

When you use Enterprise Manager or the Data Guard command. When you start the Data Guard broker. The DMON process 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 DMON process stores its configuration data. This configuration consists of a primary database that is protected by one or more standby databases.Data Guard Broker: Architecture Graphical user interface or command-line interface Data Guard Configuration Standby site 9 Standby site 2 Primary site Configuration files Archived redo logs Primary database Online redo logs Log transport services DMON DMON Standby redo logs Standby site 1 Configuration files Standby database Log apply services Archived redo logs Oracle Net 3 . a DMON process is created. Data Guard Broker: Architecture The Data Guard broker helps you create. The Data Guard monitor process (DMON) is an Oracle background process that runs on every site that is managed by the broker. and availability of all systems in the Data Guard configuration.57 . There are two multiplexed versions of the configuration file on each site. After the broker has created the Data Guard configuration. control. the broker monitors the activity. All rights reserved. and monitor a Data Guard configuration.57 Copyright © 2006. Oracle Database 10g: Data Guard Administration 1 . Oracle. health. the DMON process is the server-side component that interacts with the local instance and the DMON processes that are running on other sites to perform the requested function.line interface (CLI).

Oracle. the primary database and standby database must already exist. All rights reserved. Oracle Database 10g: Data Guard Administration 1 . it must be a non-RAC database. Note: If you are creating a new database.58 Copyright © 2006. and then prepare it for recovery.58 . If you are using the CLI. The standby database can be either a physical or a logical database. You must construct the standby database from backups of the primary database control files and data files. 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.Life Cycle of a Broker Configuration Create configuration Enable configuration Make state or role changes Update database properties Monitor and tune configuration 3 .

If you configure an existing standby database in the broker configuration. The value of the GLOBAL_DBNAME attribute must be set to a concatenation of db_unique_name_DGMGRL.0. Note: Oracle Enterprise Manager 10g can manage a 9.2.instance environment. • You can use a single.db_domain 3 . Oracle. • LOCAL_LISTENER on each instance must resolve to an address that is reachable by all members.Data Guard Broker: Requirements • Enterprise Edition of Oracle Database 10g • Single-instance or multi-instance environment • COMPATIBLE must be set to 9.0.1. Oracle Database 10g: Data Guard Administration 1 . you must comply with the following requirements: • You must use the Enterprise Edition of Oracle Database 10g. • To enable the Data Guard broker CLI to restart instances during the course of broker operations.0 or higher for primary and standby databases. All rights reserved.59 Copyright © 2006. • You must set the COMPATIBLE initialization parameter to 9.0. • The value of the LOCAL_LISTENER initialization 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.59 . Data Guard Broker: Requirements To use the Data Guard broker.instance or multi.2 Data Guard configuration.0. • Enterprise Manager automatically configures the Oracle Net network files when it creates a standby database.2. • GLOBAL_DBNAME attribute must be set to a concatenation of: db_unique_name_DGMGRL.1. you must configure the network files.2.db_domain. To take advantage of new Oracle Database 10g features. You must use TCP/IP. • Oracle Net network files must be configured for databases that you add to the configuration. set the COMPATIBLE parameter to 10.0 or higher for the primary and standby databases. a service with a specific name must be statically registered with the local listener of each instance.

Data Guard Broker: Requirements • DG_BROKER_START = TRUE • The primary database must be in ARCHIVELOG mode. as follows: SRVCTL ADD DATABASE -d <db_unique_name> -o <$ORACLE_HOME> -s MOUNT or SRVCTL MODIFY DATABASE -d <db_unique_name> -o <$ORACLE_HOME> -s MOUNT Oracle Database 10g: Data Guard Administration 1 . You cannot use the default values for these parameters. the START_OPTIONS for that database must be set to MOUNT in the Oracle Cluster Repository (OCR) using SRVCTL. Data Guard Broker: Requirements (continued) • You must set the DG_BROKER_START initialization parameter to TRUE. Note: The shared files could be files on a cluster file system. All rights reserved. Note: When you use Enterprise Manager to create your configuration. • If any database in your configuration is a RAC database. • Any database that is managed by the broker (including. for a RAC database. 3 . Oracle.60 . The broker cannot start an instance. 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. • If any database in your configuration is a RAC database. • Configure DG_BROKER_CONFIG_FILEn for any RAC databases. this parameter is automatically set to TRUE. or on raw devices. all instances of the database) must be mounted or open.60 Copyright © 2006. This enables the DMON process. • All databases must be in MOUNT or OPEN mode. • START_OPTIONS for any RAC databases must be set to MOUNT in the Oracle Cluster Repository (OCR). • The primary database must be in ARCHIVELOG mode. if available.

Oracle Database 10g: Data Guard Administration 1 . you must use the persistent server initialization parameter file (SPFILE) to control static and dynamic initialization parameters. • If you use the broker. 3 . so that Data Guard continues to work even after the broker is disabled. you can update database property values through the broker.61 . Also.61 Copyright © 2006. All rights reserved. Oracle. • Using the SPFILE enables the Data Guard broker to keep its configuration file and the database SPFILE consistent. When you set definitions or values for database properties in the broker configuration. 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. use Enterprise Manager or DGMGRL to update database parameter values.Data Guard Broker and the SPFILE • You must use a server parameter file (SPFILE) for initialization parameters. 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. 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. 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. 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. the SPFILE permits persistent Data Guard settings. Even when the configuration is disabled.

Note: When using the broker (with Enterprise Manager or the CLI). the broker reconciles the differences by updating all parameter and property values the next time the database instance is stopped and restarted. in the Data Guard configuration files. If you want to change a parameter value. and in the SPFILE. do not attempt to manually set the parameters that the broker controls. either you render your configuration inoperable. or the broker simply resets the parameter to the setting it has recorded at the next opportunity. Oracle Database 10g: Data Guard Administration 1 . the broker keeps the value of the database parameter consistent in the System Global Area (SGA) for the instance. For static initialization parameters.62 . If you set them manually. Typically. the value in the SGA may differ from what is in the configuration files and in the SPFILE. you must change it by using one of the broker interfaces.Data Guard Broker and the SPFILE (continued) For dynamic initialization parameters.

The amount of memory allocated is typically less than 50 KB per site. the actual amount on your system varies. a portion of the SGA is allocated and a DMON process is created. When you use Enterprise Manager or the CLI. Oracle Database 10g: Data Guard Administration 1 .Data Guard Monitor: DMON Process • • • • Server-side background process Part of each database instance in the configuration Created when you start the broker Performs requested functions and monitors the resource • Communicates with other DMON processes in the configuration • Updates the configuration file 3 . When you start the Data Guard broker.63 Copyright © 2006. the DMON process is the server-side component that interacts with the local instance and the DMON processes running on other sites to perform the requested function. All rights reserved. The DMON process 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 DMON process stores its configuration data.63 . Oracle. The Data Guard Monitor process (DMON) is an Oracle background process that is part of each database instance managed by the broker. Data Guard Monitor: DMON Process The Data Guard monitor comprises two components: the DMON process and the configuration file.

dat and dr2<db_unique_name>. You can also change the configuration file names dynamically by issuing the ALTER SYSTEM SQL statement. Oracle.64 . the configuration files are created and named automatically by using a default name. and the state of each of the databases in the configuration. The configuration files are binary files and cannot be edited. When the broker is started for the first time. the roles and properties of each of the databases. The configuration files contain entries that describe the state and properties of the databases in the configuration. Data Guard Monitor: Configuration File The DMON process 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. the files record the databases that are part of the configuration. For example. Oracle Database 10g: Data Guard Administration 1 . Two files are maintained so that there is always a record of the last known valid state of the configuration. • Two files at each managed site • Managed automatically by the DMON process • Default names are dr1<db_unique_name>.dat. One of the files is in use and the other acts as a backup. The broker uses the data in the configuration file to configure and start the databases. control each database’s behavior. • Default locations are operating system specific: – Default location for UNIX and Linux: ORACLE_HOME/dbs – Default location for Windows: ORACLE_HOME\database 3 .64 Copyright © 2006. and provide information to the CLI and Enterprise Manager. All rights reserved. You can override this default name by setting the DG_BROKER_CONFIG_FILEn initialization parameters.Data Guard Monitor: Configuration File • Automatically created and named using a default path name and file name when the broker is started • Override default path name and file name by setting DG_BROKER_CONFIG_FILEn .

and disaster protection capabilities that are inherent in Oracle Data Guard.Benefits of Using the Data Guard Broker • Enhances the high-availability. RAC or non-RAC) standby database. and disaster protection capabilities inherent in Oracle Data Guard by automating both configuration and monitoring tasks • Streamlines the process for any one of the standby databases to replace the primary database and take over production processing • 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 3 . you can logically define and create a Data Guard configuration consisting of a primary database and a (physical or logical. Oracle Database 10g: Data Guard Administration 1 . physical or logical) to each Data Guard configuration. the broker enhances the high-availability. data protection. The broker enables easy configuration of additional standby databases.65 . After you create a Data Guard configuration consisting of a primary and a standby database. All rights reserved. If the primary database fails.65 Copyright © 2006. 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 add up to eight standby databases (new or existing. Benefits of Using the Data Guard Broker By automating the tasks required to configure and monitor a Data Guard configuration. Oracle. data protection.

66 Copyright © 2006. and extended management. All rights reserved.in validation that monitors the health of all the databases in the configuration. connected by a LAN or geographically dispersed over a WAN. centralized.66 . Oracle. The broker provides built. 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 Services • Provides built-in validation that monitors the health of all the databases in the configuration 3 . The broker automates switchover and failover to a specified standby database in the broker configuration. The database can be local or remote. The broker automatically communicates between the databases in a Data Guard configuration using Oracle Net Services. Oracle Database 10g: Data Guard Administration 1 . Benefits of Using the Data Guard Broker (continued) The broker provides simplified.Benefits of Using the Data Guard Broker • Provides simplified.

All rights reserved. Oracle. 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. put it online.Data Guard Broker Interfaces • Oracle Enterprise Manager 10g Grid Control: – Contains wizards to simplify creating and managing standby databases • Command-line interface (CLI): – Started by entering DGMGRL at 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 3 . start or stop the redo transport services. with Enterprise Manager you can take a database offline. place a standby database in read-only mode. and so on.67 . Oracle Database 10g: Data Guard Administration 1 . Data Guard Broker Interfaces Oracle Enterprise Manager automates and simplifies the management of a Data Guard configuration.67 Copyright © 2006. • “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. For example. start or stop the log apply services.mail or pagers • Simplified control of the databases through their potential states.

Oracle Database 10g: Data Guard Administration 1 .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.68 .Data Guard Broker Interfaces (continued) The DGMGRL command.

Click Databases to go to the Databases page. 3. 5. Using Oracle Enterprise Manager 10g Grid Control Access the Data Guard features in Grid Control by performing the following steps: 1. Oracle. All rights reserved. Oracle Database 10g: Data Guard Administration 1 . you can see a list of all discovered databases. 4.Using Oracle Enterprise Manager 10g Grid Control Click “Setup and Manage” to access the Data Guard pages. Click the primary database to go to the primary database home page. Click the Targets tab to go to the Targets page. Click Maintenance. On the Databases page. including the primary database. 2.69 . 3 . Click “Setup and Manage’’ in the Data Guard section.69 Copyright © 2006.

70 Copyright © 2006. • 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. 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: . .Discontinue Data Guard broker control.70 . Data Guard Overview Page On the Data Guard Overview page.Add a standby database to the broker configuration. Oracle. All rights reserved.Change the state or properties. Note: The Data Guard Overview page is displayed when you click “Setup and Manage” in the Data Guard section of the database Maintenance page.Switch the role from standby to primary. .Transition the standby database to the role of primary database. .Data Guard Overview Page 3 . Oracle Database 10g: Data Guard Administration 1 . .

and so on. Alerts are detected through a polling-based mechanism by checking for the monitored condition from a separate process at regular. predefined intervals. Oracle. Enterprise Manager Metrics and Alerts Metrics are units of measurement that are used to assess the health of your system. You can associate an alert with a notification. Metrics have thresholds associated with them.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 3 . Each target comes with a predefined set of metrics. Some of the thresholds are predefined by Oracle. others are not.71 Copyright © 2006.71 . with the automatic execution of a job. All rights reserved. an alert is triggered whenever an error message is written to a database alert log file. An alert is an indicator signifying that a particular condition has been encountered. For example. 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. Thresholds are boundary values against which monitored metric values are compared. Oracle Database 10g: Data Guard Administration 1 . When a threshold is reached. an alert is generated.

72 . A down status triggers an alert.mail message if any of the metrics are triggered. Oracle Database 10g: Data Guard Administration 1 . this metric generates a critical alert on the new primary database (old standby database) if a fast-start failover occurs. In addition. You can set up Email Services to notify you with an e. Refer to the Oracle Data Guard Broker 10g Release 2 (10.Using Data Guard Metrics Enterprise Manager includes the following Data Guard metrics: • Data Guard Fast-Start Failover • Data Guard Fast-Start Failover Observer • Data Guard Performance • Data Guard Status 3 . • Data Guard Status: This metric checks the status of each database in the broker configuration and triggers a warning or critical alert if necessary.72 Copyright © 2006. 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 Failove r: When Fast-Start Failover is enabled. All rights reserved.2) reference manual for detailed information. Using Data Guard Metrics You can use Enterprise Manager to monitor the status and log file activity. Note: These metrics are seen on the primary database only. • Data Guard Performance: This metric provides alerts for performance related to redo log activity in the configuration. Oracle. • Data Guard Fast-Start Failove r Observer: This metric shows you the current status of the Fast-Start Failover observer.

View the All Metrics page by clicking All Metrics in the Related Links section on the Database Home page.Managing Data Guard Metrics 1. You can click Test Mail Servers to verify your configuration. View the All Metrics page. You can set and change the Data Guard Status metric on the Metrics Thresholds tab of the Metric and Policy Settings page. including the metrics for Data Guard. All rights reserved. Configure notification methods. 4. 3. Oracle. Configure notification methods in Enterprise Manager. 3 . 2.73 Copyright © 2006. c. Click Data Guard on the All Metrics page to view triggered metrics. Then. 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. 3. Use the following procedure to configure the notification: 1.73 . 4. Oracle Database 10g: Data Guard Administration 1 . Managing Data Guard Metrics You can specify that an e-mail notification be sent to you when a Data Guard metric is triggered. an alert is issued. View triggered metrics. a. 2. View triggered metrics: If a metric condition is triggered or a threshold value is exceeded. b. Set or change Data Guard metric thresholds. You can click the metric and then click a particular database to see details. view all the Oracle Enterprise Manager metrics. Click Notification Methods on the Setup page. Enter the appropriate information in the Mail Server section and click Apply. Click Setup at the top of the Database Home page.

74 Copyright © 2006.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 Oracle Database 10g: Data Guard Administration 1 . Oracle.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 changes that are necessary to support redo transport services 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 3 . All rights reserved. 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.74 .

com Enabled: YES Protection Mode: MaxPerformance Fast-Start Failover: DISABLED Databases: EDRSR8P1_ORCL .Using the Command-Line Interface of the Data Guard Broker DGMGRL> connect sys/oracle Connected. a specified standby database profile. This is an unplanned transition that may result in the loss of application data.oracle. • 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.Logical standby database Current status for "EDRSR8P1_ORCL. including all of its database profiles.Primary database EDRSR8P1_SITE1 .com": SUCCESS 3 .75 Copyright © 2006. This is simply an overview listing. Oracle. 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. Many of these commands have additional arguments that are not described here.75 .oracle. All rights reserved. database. • HELP: Displays online help for the commands in DGMGRL • REINSTATE: Changes a disabled database into a viable standby database • REMOVE: Removes a broker configuration. DGMGRL> show configuration verbose Configuration Name: EDRSR8P1_ORCL.Physical standby database EDRSR8P1_SITE2 . or knowledge of an instance Oracle Database 10g: Data Guard Administration 1 . DGMGRL Commands The following commands are available in DGMGRL (the Data Guard CLI).

The new EDIT command provides comparable functionality. it can display the dependency tree and default online states for the broker configuration. Also. Oracle Database 10g: Data Guard Administration 1 . or instance. database.DGMGRL Commands (continued) • SHOW: Displays either a brief or a detailed summary of information about 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.76 . 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 ALTER command has been deprecated in Oracle Database 10g.

77 Copyright © 2006. All rights reserved. Oracle. Oracle Database 10g: Data Guard Administration 1 .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) 3 .

.

Creating a Configuration and Physical Standby Database by Using Enterprise Manager 4 Copyright © 2006. All rights reserved. . Oracle.

80 Copyright © 2006.80 . All rights reserved. Oracle. 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 4 . Oracle Database 10g: Data Guard Administration 1 .Objectives After completing this lesson.

except for changes to temporary tablespaces and temporary segments. All rights reserved. All ongoing. • FORCE LOGGING forces redo to be generated even when NOLOGGING operations are executed. The [NO]FORCE LOGGING clause of the ALTER DATABASE command contains the following settings: • FORCE LOGGING: This setting takes precedence over (and is independent of) any NOLOGGING or FORCE LOGGING settings that you specify for individual tablespaces and any NOLOGGING setting that you specify for individual database objects. • NOFORCE LOGGING: Places the database in NOFORCE LOGGING mode. Oracle. • Issue the following command on the primary database: SQL> ALTER DATABASE FORCE LOGGING. 4 . The FORCE_LOGGING column in V$DATABASE contains a value of YES if the database is in FORCE LOGGING mode. Oracle Database 10g: Data Guard Administration 1 . Enabling FORCE LOGGING Mode FORCE LOGGING mode determines whether or not the Oracle database server logs all changes in the database.81 .Enabling FORCE LOGGING Mode • Forced logging is recommended to ensure data consistency. • Temporary tablespaces and temporary segments are not logged.81 Copyright © 2006. • FORCE LOGGING is recommended for both physical and logical standby databases. unlogged operations must finish before forced logging can begin. This is the default.

Oracle Database 10g: Data Guard Administration 1 . Note: You should enable FORCE LOGGING before performing the backup operation to create the standby database.82 .Enabling FORCE LOGGING Mode (continued) Although the database can be placed in FORCE LOGGING mode when the database is OPEN. Therefore. and then maintain FORCE LOGGING mode for as long as the standby database is active. the mode does not change until any operation that is currently running in NOLOGGING mode has completed. it is recommended that you enable FORCE LOGGING mode when the database is in the MOUNT state.

4 .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. 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. Oracle. Oracle Database 10g: Data Guard Administration 1 . If the instance was not started with an SPFILE.83 .83 Copyright © 2006. the wizard notifies you. verify that the primary database instance was started with a server parameter file (SPFILE). Using Enterprise Manager to Create a Broker Configuration Enterprise Manager automates the process of creating a standby database. All rights reserved.

Creating a Configuration Click “Add Standby Database” to start the wizard. Oracle Database 10g: Data Guard Administration 1 . All rights reserved. 4 . 5. you perform the following steps: 1. Specify the backup type to use for the standby database creation.84 . Click the Add Standby Database link to invoke the Add Standby Database Wizard.84 Copyright © 2006. Using the Add Standby Database Wizard. Specify standby database configuration parameters. an information page appears with this indication. 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. Specify the location for standby database files. Review the configuration information. Select the Oracle home in which to create the standby database. 2. If your primary database is not already in a broker configuration. 3. Specify the backup options. 6. 4. Oracle.

• The recovered database is changed into a physical or logical standby.85 . • Online log files and other files are added to the standby database as needed. • The control file. and archived redo log files are backed up to a temporary location on the primary host. such as initialization parameter and password.Creating a Configuration (continued) During the standby creation process. data files. • The backup pieces from the primary host are transferred to a temporary location on the standby host. Oracle Database 10g: Data Guard Administration 1 . are created on the standby host. data files. and archived redo log files are restored to the specified locations on the standby host. • Additional required files. the following operations are performed: • The control file.

Using the Add Standby Database Wizard 4 . the wizard verifies that the primary database is in FORCE LOGGING mode. 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. • The primary database is in ARCHIVELOG mode. including a RAC database. You can then cancel the configuration and enable FORCE LOGGING (as described earlier in this lesson). to the configuration to serve as a standby database. • The COMPATIBLE initialization parameter for the primary database has a setting of 9.0 or higher. If it is not in FORCE LOGGING mode. Or you can add an existing database. All rights reserved. a warning message appears. Oracle Database 10g: Data Guard Administration 1 .86 Copyright © 2006. You can create a new physical or logical standby database. Note: You must be connected to the primary database with SYSDBA credentials to invoke the Add Standby Database Wizard.86 . In addition. If you choose to create a new standby database. the wizard returns a message indicating that you must cancel the wizard and perform the appropriate action to meet the condition. Oracle. If any of these conditions are not met. the following conditions are verified when you click Continue: • All databases in the configuration are using a server parameter file (SPFILE).

Step 1: Specify the Backup Type 4 . Oracle.87 . 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 Oracle Database 10g: Data Guard Administration 1 . All rights reserved.87 Copyright © 2006.

• The credentials are preset to the host-preferred credentials that are stored with the primary database-preferred credentials by default. Oracle Database 10g: Data Guard Administration 1 . you can specify a location on the primary database host to store the backup files. If you selected the “Use a backup from a previous standby database creation” option on the Backup Type page. Step 2: Specify the Backup Options If you selected the “Perform a live backup of the primary database” option on the Backup Type page. A default location is specified in the Backup Files Directory Location field.88 Copyright © 2006. If you intend to create additional standby databases.Step 2: Specify the Backup Options 4 . or you can provide your own location. specify the location of the backup in the Backup Files Directory Location field. All rights reserved. you should select the “Delete directory after standby creation” option.88 . Specify the operating system credentials of the user who owns the primary database Oracle server installation in the Primary Host Credentials section. Note • If you choose to retain the backup. you can save the backup by selecting the “Retain directory for a future standby creation” option. A unique subdirectory to store the backup files is created in the specified directory. Otherwise. Oracle. additional space is required (as indicated on the Backup Options page). • 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.

Oracle. All rights reserved. specify the operating system credentials of the user who owns the Oracle installation in the selected Oracle home on the standby host. block-by-block copy of the primary.Step 3: Select the Standby Database Location Instance Name 4 . you must make the instance name different from the primary if the standby is on the same machine as the primary.89 Copyright © 2006. Step 3: Select the Database Location Instance Name Specify the instance name for your new standby database in the Instance Name field. This is because a physical standby is an exact. Oracle Database 10g: Data Guard Administration 1 . The instance name must conform to Oracle naming guidelines. You can make the instance name the same as the primary. or use the default instance name that is provided. the database name is the same as the primary. In the Standby Host Credentials section.89 . However. Note: For a physical standby.

Oracle Database 10g: Data Guard Administration 1 . 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. All rights reserved.90 Copyright © 2006.90 .Step 3: Select the Standby Database Location Oracle Home 4 . select the host and Oracle home for your new standby database. From this list. Oracle.

Select the HTTP Server option if you know that the primary or standby host does not support FTP. you must supply the network path name for the standby host. All rights reserved.91 . Oracle. or some other network method. you must specify a temporary location on the standby host to store the backup files copied from the primary host. a network share. FTP is the faster of the two file transfer methods. This method is appropriate when the primary host working directory location is directly accessible from the standby host via NFS. This option saves time and disk space because there is no file transfer to the standby host and because no temporary location is needed.91 Copyright © 2006. you must select the file transfer method: FTP or HTTP server. You must select a method to be used to make the primary backup files accessible to the standby host. • Directly access the files: If you select this method. Oracle Database 10g: Data Guard Administration 1 . In addition. • Transfer files: If you choose to transfer files from the primary host working directory to a standby host directory.Step 4: Specify the Standby Database File Locations Access Method 4 . 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.

Oracle Database 10g: Data Guard Administration 1 . 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. The default location is correct for most configurations.ora files in the directory that is specified in the Configuration File Location field in the Network Configuration File Location section.92 . Step 4: Specify the Standby Database File Locations File Locations By default. 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. The default location is the network administration directory for the standby database’s Oracle home.Step 4: Specify the Standby Database File Locations File Locations 4 . Data Guard automatically adds configuration information for the new standby database to the listener. When your primary and standby databases are on different hosts.92 Copyright © 2006.ora and tnsnames. 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. All rights reserved. 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. Oracle.

All rights reserved. service provider name. This name will appear in the list of database targets maintained by Enterprise Manager. Note: This field appears only if you are creating a new physical standby database and the primary database is an Oracle10g database. and standby archive location. The configuration parameters include the instance name. creating a new physical standby database. The parameters that must be specified depend on whether you are adding an existing standby database.93 . The default values are based on corresponding primary database settings. the following parameters must be configured: • Database Unique Name: Specify a value for the database DB_UNIQUE_NAME parameter. When you create a new physical database. target name. or creating a new logical standby database. • Target Name: Specify a name for Enterprise Manager to use for the new standby database. Oracle Database 10g: Data Guard Administration 1 . This name must be unique within the Data Guard configuration. This name should be the same as the database unique name. you can specify configuration parameters for the standby database. Oracle.93 Copyright © 2006.Step 5: Specify Standby Database Configuration Parameters 4 . Step 5: Specify Standby Database Configuration Parameters On the Standby Configuration page of the wizard.

where you can monitor the progress of the standby creation job. Oracle Database 10g: Data Guard Administration 1 . 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.94 . the Processing page appears. All rights reserved. The name of the job that is submitted is provided at the top of the page.Step 6: Review the Configuration Information 4 . Oracle. When you click Finish. the Data Guard Overview page appears.94 Copyright © 2006. This page tracks each step through the submission of the standby creation job. The new standby database is created in the background by an Oracle Enterprise Manager job. After the job submission is complete.

All rights reserved. a check icon appears next to the step. When it completes. An arrow icon indicates which step is being processed. Oracle. Oracle Enterprise Manager displays the Data Guard Overview page. If you are adding an existing standby database. 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.Standby Database Creation: Processing 4 . On completion of the process. The standby database is actually created by an Enterprise Manager job.95 Copyright © 2006. it is added to the configuration.95 . Oracle Database 10g: Data Guard Administration 1 . You can cancel the Add Standby Database process at any point up to the completion of this step. Standby Database Creation: Processing You can view the progress of the Add Standby Database process on the Processing page. preliminary setup steps to prepare for job submission are accomplished in this step. • Preparing standby creation job: This step appears only if you are creating a new standby database. The display on the Processing page differs based on whether you are adding an existing standby database or creating a new standby database.

the standby database target in Enterprise Manager is updated with additional information denoting membership in the Data Guard configuration.Standby Database Creation: Processing (continued) • Submitting standby creation job: This step appears only if you are creating a new standby database. • Adding standby database target: In this step. 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.96 . Oracle Database 10g: Data Guard Administration 1 . This enables enhanced summary information to be displayed on the Enterprise Manager home page of the standby database.

All rights reserved. Oracle Database 10g: Data Guard Administration 1 .97 . Click the “Creation in progress” link to access the job page and monitor the progress of the creation of the standby database.97 Copyright © 2006.Standby Database Creation: Progress Click “Creation in progress” to view the job. Standby Database Creation: Progress After the job is submitted. The Data Guard Status column indicates that the standby database creation is in progress. 4 . Oracle. you return to the Data Guard Overview page.

98 .Standby Database Creation: Job Details 4 . All rights reserved. Standby Database Creation: Job Details You can monitor creation of the standby database by viewing the details on the job progress page. Oracle.98 Copyright © 2006. Oracle Database 10g: Data Guard Administration 1 .

Verifying a Configuration After you create your configuration.99 Copyright © 2006. If credentials are not available to run the job. If standby redo logs are needed for any database. All rights reserved. The Verify operation does the following: • Determines the current data protection mode settings. You can then add the standby redo logs. If any errors occur during this process. a series of validation checks is performed on the Data Guard configuration.99 . The verify process executes a SQL*Plus job on the agent if credentials are available. you should use the Data Guard Verify operation to check the configuration. a message indicates this on the Detailed Results page. Oracle Database 10g: Data Guard Administration 1 .Verifying a Configuration Click “Verify Configuration.” 4 . You can invoke the Verify operation by clicking Verify Configuration in the Additional Administration section of the Data Guard page. • 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. 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. including the current redo transport mode settings for each database and whether or not the standby redo logs are configured properly. including a health check of each database and each agent. the agent is pinged instead. When you invoke the Verify operation. Oracle.

All rights reserved. Oracle Database 10g: Data Guard Administration 1 . Oracle.Reviewing Results of the Verify Operation 4 .100 Copyright © 2006. detailed information appears on this page. If any errors occur during the operation. Reviewing Results of the Verify Operation You can view the results of the Verify operation on the Detailed Results page.100 .

101 Copyright © 2006.” standby redo logs should be configured on all databases in a configuration. Oracle. As discussed in the lesson titled “Understanding the Oracle Data Guard Architecture. Creating Standby Redo Logs If standby redo log files are needed for any of the databases. Oracle Database 10g: Data Guard Administration 1 .Creating Standby Redo Logs 4 . You can click OK to create the standby redo logs. including the primary database. a message appears. All rights reserved.101 .

Viewing the Data Guard Configuration Status

4 - 102

Copyright © 2006, Oracle. All rights reserved.

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.

Oracle Database 10g: Data Guard Administration 1 - 102

Viewing Data Guard Performance

4 - 103

Copyright © 2006, Oracle. All rights reserved.

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.

Oracle Database 10g: Data Guard Administration 1 - 103

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

4 - 104

Copyright © 2006, Oracle. All rights reserved.

Oracle Database 10g: Data Guard Administration 1 - 104

Practice 4: Overview

This practice covers the following topics: • Logging in to Oracle Enterprise Manager 10g Grid Control • Using the wizard to create a Data Guard broker configuration with a physical standby database • Verifying the configuration

4 - 105

Copyright © 2006, Oracle. All rights reserved.

Oracle Database 10g: Data Guard Administration 1 - 105

Creating a Physical Standby Database by Using SQL

5

Copyright © 2006, Oracle. All rights reserved.

Objectives

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

5 - 108

Copyright © 2006, Oracle. All rights reserved.

Oracle Database 10g: Data Guard Administration 1 - 108

3. Back up the primary database. 6. 5. Configure Oracle Net Services. 8. Copy files to the standby system. 3. Oracle Database 10g: Data Guard Administration 1 . Start the transport of redo. 7. Start the transport of redo. Start the standby database. 6. All rights reserved. 5. Set parameters on the primary database.109 Copyright © 2006. Configure Oracle Net Services.109 . Set parameters on the physical standby database. Prepare the primary database.Steps to Create a Physical Standby Database 1. Oracle. Steps to Create a Physical Standby Database Perform the following steps to create a physical standby database by using SQL commands: 1. 2. 4. Set parameters on the physical standby database. Set parameters on the primary database. Copy files to the standby system. 5 . 8. Back up the primary database. 2. 4. Start the standby database. Prepare the primary database. 7.

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. • Enable archiving. ALTER DATABASE ARCHIVELOG. Preparing the Primary Database The FORCE LOGGING mode determines whether or not the Oracle database server logs all changes in the database.110 Copyright © 2006. SQL> ALTER DATABASE FORCE LOGGING. The FORCE_LOGGING column in V$DATABASE contains a value of YES if the database is in FORCE LOGGING mode. Every database in a Data Guard configuration must use a password file. On the primary database. If archiving is not enabled. • Create a password file. Oracle. issue the ALTER DATABASE ARCHIVELOG command to put the primary database in ARCHIVELOG mode and enable automatic archiving.Preparing the Primary Database • Enable FORCE LOGGING at the database level. • Set initialization parameters. ALTER DATABASE OPEN. you define initialization parameters that control redo transport services while the database is in the primary role. SQL> SQL> SQL> SQL> SHUTDOWN IMMEDIATE. see Oracle Database Administrator’s Guide. STARTUP MOUNT. For details about creating a password file. See Oracle Database Administrator’s Guide for additional information about archiving. and the password for the SYS user must be identical on every system for redo data transmission to succeed. except for changes to temporary tablespaces and temporary segments.110 . Oracle Database 10g: Data Guard Administration 1 . All rights reserved. 5 .

Setting Initialization Parameters on the Primary Database On the primary database. Oracle Database 10g: Data Guard Administration 1 .Setting Initialization Parameters on the Primary Database Parameter Name LOG_ ARCHIVE_CONFIG LOG_ ARCHIVE_DEST_n Description Specifies the unique database name for e ach database in the configuration Controls redo transport services LOG_ ARCHIVE_DEST_ST AT E_n Specifies destination state DB_FILE_N AME_CONVERT LOG_FILE_NAME_CONVERT ST ANDBY_FILE_M ANAGEMENT ARCHIVE_LAG_T ARGET Converts primary database file name s Converts primary database log file name s Controls automatic standby file manage me nt Forces a log switch after the specified number of seconds elapses Traces redo data transmission LOG_ ARCHIVE_TRACE 5 .111 .111 Copyright © 2006. you define initialization parameters that control redo transport services while the database is in the primary role. Oracle. These parameters are described in more detail on the following pages. All rights reserved.

or NORECEIVE keywords. 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. – RECEIVE: enables the standby database to receive redo from another database. Oracle Database 10g: Data Guard Administration 1 . RECEIVE. the LOG_ARCHIVE_CONFIG parameter enables the database to send and receive redo. LOG_ARCHIVE_CONFIG Specify the DG_CONFIG attribute on the LOG_ARCHIVE_CONFIG parameter to list the DB_UNIQUE_NAME of the primary and standby databases in the Data Guard configuration. Oracle.LOG_ARCHIVE_CONFIG • Specify the DG_CONFIG attribute to list the DB_UNIQUE_NAME for the primary database and each standby database in the Data Guard configuration. you may need to specify these settings again using the SEND. All rights reserved. – Use the NOSEND and NORECEIVE keywords to disable these settings. The first row of the view lists the unique database name of the current database that was specified with the DB_UNIQUE_NAME initialization parameter. After a role transition. DB_NAME=chicago DB_UNIQUE_NAME=chicago LOG_ARCHIVE_CONFIG='DG_CONFIG=(chicago. NOSEND. • Additional LOG_ARCHIVE_CONFIG parameter values: – SEND: enables a database to send redo data to remote destinations. or NORECEIVE settings.boston)' 5 . providing a view of the Data Guard environment from any database in the configuration. Additional rows reflect the unique database names of the other databases in the configuration that were specified with the DG_CONFIG keyword of the LOG_ARCHIVE_CONFIG initialization parameter. RECEIVE. Note: The database must be in MOUNT mode to change the SEND. NOSEND.112 .112 Copyright © 2006. Use the V$DATAGUARD_CONFIG view to see the unique database names defined with the DB_UNIQUE_NAME and LOG_ARCHIVE_CONFIG initialization parameters.

which will be deprecated in a future release. Oracle Database 10g: Data Guard Administration 1 .EDT3R7P1_SITE2) SQL> select * from v$dataguard_config. Do not specify both parameters in the same SPFILE or text initialization parameter file.LOG_ARCHIVE_CONFIG (continued) The following example illustrates the use of V$DATAGUARD_CONFIG: SQL> show parameter log_archive_config NAME TYPE VALUE ------------------.------.113 . DB_UNIQUE_NAME -----------------------------EDT3R7P1_ORCL EDT3R7P1_SITE1 EDT3R7P1_SITE2 Note: The LOG_ARCHIVE_CONFIG initialization parameter replaces the REMOTE_ARCHIVE_ENABLE initialization parameter.--------------------------log_archive_config string dg_config=(EDT3R7P1_SITE1.

All LOG_ARCHIVE_DEST_n parameters must contain. Most have defaults that are adequate for most configurations.114 Copyright © 2006. All rights reserved.LOG_ARCHIVE_DEST_n • Specify at least two LOG_ARCHIVE_DEST_n parameters. LOG_ARCHIVE_DEST_n By using the various LOG_ARCHIVE_DEST_n attributes. Oracle Database 10g: Data Guard Administration 1 . There are 35 different attributes that can be set for each LOG_ARCHIVE_DEST_n parameter. you define most of the settings for the Data Guard configuration. Oracle. you must have a LOG_ARCHIVE_DEST_STATE_n parameter for each defined destination.114 . either a LOCATION or SERVICE attribute. The redo transport service is directly controlled by these settings. 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. at a minimum. In addition. Query the V$ARCHIVE_DEST view to see current settings of the LOG_ARCHIVE_DEST_n initialization parameter. • 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=boston VALID_FOR=(ONLINE_LOGFILES. See Oracle Data Guard Concepts and Administration for a complete list and description of each.PRIMARY_ROLE) DB_UNIQUE_NAME=boston' LOG_ARCHIVE_DEST_STATE_2=ENABLE 5 .

LOCATION and SERVICE Attributes Each archive log destination includes one of the following attributes: • LOCATION: specifies a valid path name. This service may be one of the following: • A standby database (either physical or logical) • An archive log repository. Note: The Data Guard broker does not support this type of service. An archive log repository is created by using a standby control file.instance archival database environment is possible on both the primary and standby databases.ALL_ROLES) DB_UNIQUE_NAME=chicago' LOG_ARCHIVE_DEST_2= 'SERVICE=boston VALID_FOR=(ONLINE_LOGFILES. • A cross. LOG_ARCHIVE_DEST_1= 'LOCATION=/arch1/chicago/ VALID_FOR=(ALL_LOGFILES. All rights reserved. SERVICE: Specifies a valid Oracle Net Services name. each instance directs its archived redo logs to a single instance of the cluster. LOCATION and SERVICE Attributes Each LOG_ARCHIVE_DEST_n destination must specify either the LOCATION attribute or the SERVICE attribute to identify either a local disk directory or a remote database destination where redo transport services can transmit redo data. • SERVICE: specifies a valid Oracle Net Services name referencing a standby database.115 . allowing for off-site archiving of redo logs.115 Copyright © 2006. LOCATION: Each destination that specifies the LOCATION attribute must identify a unique directory path name. This is the local destination for archived redo logs. Oracle. In a RAC environment. starting the instance. The recovery instance typically has a tape drive available to support RMAN backup and restore operations.PRIMARY_ROLE) DB_UNIQUE_NAME=boston' 5 . This destination contains no data files. and mounting the database. Note: The Data Guard broker does not support this type of service. Oracle Database 10g: Data Guard Administration 1 . Note: There are no defaults for these attributes.

For example. the LOG_ARCHIVE_DEST_STATE_2 parameter specifies the state of the LOG_ARCHIVE_DEST_2 destination.116 Copyright © 2006.LOG_ARCHIVE_DEST_STATE_n • Defines the current state of an archive log destination: – 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 5 . 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). All rights reserved. • RESET: functions similarly to DEFER but clears any error messages for the destination if it had previously failed.116 . This is the default. 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_n initialization parameter (where n is the same integer). • DEFER: specifies that valid destination information and attributes are preserved but that the destination is excluded from archiving operations until re-enabled. Oracle Database 10g: Data Guard Administration 1 . Oracle.

do not set the DB_FILE_NAME_CONVERT parameter.117 Copyright © 2006. In the example in the slide.dbf is converted to /ora1/dba/system01. The strings /ora1/stby_dba/ and /ora2/stby_dba/ are the corresponding ones on the physical standby database.Specifying Values for DB_FILE_NAME_CONVERT • Must be defined on standby databases that have different disk or directory structures from the primary • Allows multiple pairs of file names • Applies to a database when in physical standby mode DB_FILE_NAME_CONVERT =('/oracle1/dba/'. Oracle Database 10g: Data Guard Administration 1 . '/ora1/stby_dba/'. 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. '/ora2/stby_dba/') 5 . /oracle1/dba/ and /oracle2/dba/ are used to match for file names coming from the primary database. The first string is the pattern found in the data file names on the primary database. then the recovery process halts with an error.dbf on the standby database.117 . the DB_FILE_NAME_CONVERT parameter is used to convert the data file name on the primary database to a data file name on the standby database. The second string is the pattern found in the data file names on the physical standby database. '/oracle2/dba/'. The parentheses are optional. You can use single or double quotation marks. Oracle. Note: If the standby database uses Oracle Managed Files (OMF). Specifying Values for DB_FILE_NAME_CONVERT When the standby database is updated. if it is not. You can use as many pairs of primary and standby replacement strings as required. All rights reserved. A file on the primary database named /oracle1/dba/system01. The file must exist and be writable on the physical standby database.

118 Copyright © 2006. Adding a redo log file to the primary database requires adding a corresponding file to the standby database. The use of parentheses is optional. Specify the location of the primary database online redo log files followed by the standby location. Oracle Database 10g: Data Guard Administration 1 . this parameter is used to convert the log file name from the primary database to the log file name on the standby database. '/ora1/stby_logs/') 5 . 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. • Applies to a database when in physical standby mode LOG_FILE_NAME_CONVERT = ('/oracle1/logs/'.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 primary • Online redo log files are used only when the standby becomes a primary. Note: If the standby database uses OMF. Oracle. When the standby database is updated.118 . do not set the LOG_FILE_NAME_CONVERT parameter. Specifying Values for LOG_FILE_NAME_CONVERT The LOG_FILE_NAME_CONVERT parameter 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. All rights reserved.

with RAC. Oracle Database 10g: Data Guard Administration 1 . this is always 1. All rights reserved.arc 5 . This value is not changed for the life of the database. you must include %r in the LOG_ARCHIVE_FORMAT parameter. The length of the zero-filled versions of these directives is 8 on most platforms. 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_DEST parameters. The resetlogs ID ensures unique names are constructed for the archived log files across multiple incarnations of the database. 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 activation number is an internal number that is generated the first time the database is started.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. The database identifier (database ID) is calculated when the database is created and stored in all file headers.119 Copyright © 2006. If the COMPATIBLE initialization parameter is set to 10. Subsequently. The thread number refers to the redo thread. Oracle. it is changed only when the database is opened with the RESETLOGS option. It starts at 0 or 1 and is incremented at each log switch.119 . this corresponds to the order in which the instances were started. With a single instance. LOG_ARCHIVE_FORMAT = %d_%t_%s_%r.0 or higher. Sequence number is the redo log sequence number.

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 database.. Oracle. – AUTO — — • Applies to the primary database and physical standby database STANDBY_FILE_MANAGEMENT = auto 5 . • Add (or drop) them to the standby database. • Reset to AUTO afterward on the standby database. Adds the data file automatically to the standby database Certain ALTER state ments are no longer allowe d on the standby database. Oracle Database 10g: Data Guard Administration 1 .120 . • Add (or drop) the redo log files on the primary database. you must do the following: • Set STANDBY_FILE_MANAGEMENT to MANUAL on the physical standby database. Specifying a Value for STANDBY_FILE_MANAGEMENT When STANDBY_FILE_MANAGEMENT is set to AUTO. All rights reserved. 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..120 Copyright © 2006. 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 .

If you need to limit the amount of time it takes to complete the failover. it is not applied to the standby database until the online redo log file on the primary has been completed. Oracle. Real-time apply is described in detail in the lesson titled “Understanding the Oracle Data Guard Architecture. All rights reserved. without waiting for the current standby redo log file to be archived.” For example.time apply feature is enabled. log apply services can apply redo data as it is received. Although the redo is transmitted to the standby during normal operations. in a configuration where the online redo log file is 100 MB and 80 MB has been written. If you set this parameter to too small a value. ARCHIVE_LAG_TARGET The ARCHIVE_LAG_TARGET parameter defines the mean time to failover in the event your primary database fails and you must fail over to the standby. the primary database log files switch too often and thus impact performance.121 Copyright © 2006. you can define this parameter to force a log switch after a certain amount of time.800 (30 minutes) ARCHIVE_LAG_TARGET = 1800 5 . Oracle Database 10g: Data Guard Administration 1 . a failure at this point would mean that the 80 MB of redo must be applied to the standby before the failover can complete. Note: If the real.121 . thereby enabling the redo to be applied.200 • Recommended value: 1.ARCHIVE_LAG_TARGET • Configure on primary database only • Set to the number of seconds after which a log switch 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.

the changes take effect at the start of the next archive operation. If you change the value of this parameter dynamically with an ALTER SYSTEM statement. – On the primary database. disable. • Trace files are located in the directory specified by the USER_DUMP_DEST parameter. All rights reserved. 5 . Oracle Database 10g: Data Guard Administration 1 . To enable. and restart the database. • Issue an ALTER SYSTEM SET LOG_ARCHIVE_TRACE=trace_level statement while the database is open or mounted. processes write an audit trail of the archived logs sent to the standby system into a trace file. modify the initialization parameter file. Refer to Oracle Data Guard Concepts and Administration for additional information. • Set this parameter to an integer value to see the progression of the archiving of redo logs to the standby system. LOG_ARCHIVE_TRACE Parameter You can set this parameter to trace the transmission of redo data to the standby system. or modify the LOG_ARCHIVE_TRACE parameter in a primary database.122 . do one of the following: • Shut down the primary database. – On the standby database.122 Copyright © 2006.LOG_ARCHIVE_TRACE Parameter • LOG_ARCHIVE_TRACE is optional and is used for diagnostic purposes. Oracle. processes write an audit trail of the archived logs received from the primary database into a trace file.

You can combine tracing levels by setting the value of the LOG_ARCHIVE_TRACE parameter to the sum of the individual levels. the more detailed the information. For example. In general. The following integer levels are available: Level 0 1 2 4 8 16 32 64 128 256 512 1024 2048 4096 8192 Meaning Disables archived redo log tracing (default setting) Tracks archiving of redo log file Tracks archival status per archived redo log destination Tracks archival operational phase Tracks archived redo log destination activity Tracks detailed archived redo log destination activity Tracks archived redo log destination parameter modifications Tracks ARCn process state activity Tracks FAL server process activity Reserved for future use Tracks asynchronous LGWR activity Tracks RFS physical client Tracks ARCn or RFS heartbeat Tracks real-time apply activity Tracks Redo Apply activity (media recovery or physical standby) Oracle Database 10g: Data Guard Administration 1 . setting the parameter to 6 generates level 2 and level 4 trace output.123 .LOG_ARCHIVE_TRACE Parameter (continued) The integer values for the LOG_ARCHIVE_TRACE parameter represent levels of tracing data. the higher the level.

boston)' CONTROL_FILES='/arch1/chicago/control1.'/arch2/chicago/' STANDBY_FILE_MANAGEMENT=AUTO Specifying these initialization parameters configures the primary database to resolve gaps.ALL_ROLES) DB_UNIQUE_NAME=chicago' LOG_ARCHIVE_DEST_2= 'SERVICE=boston VALID_FOR=(ONLINE_LOGFILES. converts new data file and log file path names from a new primary database. Oracle Database 10g: Data Guard Administration 1 . 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=boston FAL_CLIENT=chicago DB_FILE_NAME_CONVERT='/arch1/boston/'.'/arch1/chicago/'.Example: Setting Initialization Parameters on the Primary Database DB_NAME=chicago DB_UNIQUE_NAME=chicago SERVICE_NAMES=chicago LOG_ARCHIVE_CONFIG='DG_CONFIG=(chicago. there is an Oracle Net Services name defined. '/arch2/boston/'.PRIMARY_ROLE) DB_UNIQUE_NAME=boston' LOG_ARCHIVE_DEST_STATE_1=ENABLE LOG_ARCHIVE_DEST_STATE_2=ENABLE REMOTE_LOGIN_PASSWORDFILE=EXCLUSIVE LOG_ARCHIVE_FORMAT=%t_%s_%r. For each. and archives the incoming redo data when this database is in the standby role. Setting Initialization Parameters on the Primary Database In the example in the slide.ctl' LOG_ARCHIVE_DEST_1= 'LOCATION=/arch1/chicago/ VALID_FOR=(ALL_LOGFILES.124 Copyright © 2006.124 . All rights reserved.arc 5 .'/arch2/chicago/' LOG_FILE_NAME_CONVERT='/arch1/boston/'. '/arch2/chicago/control2.'/arch1/chicago/'. Oracle.ctl'. '/arch2/boston/'. assume that the primary database is named chicago and the standby is named boston.

Backing Up the Primary Database by Using RMAN You can use any backup copy of the primary database to create the physical standby database.Backing Up the Primary Database by Using RMAN • Create a backup copy of the primary database.125 Copyright © 2006. Oracle. Oracle Database 10g: Data Guard Administration 1 . • Use of RMAN is recommended. It is recommended that you use Recovery Manager (RMAN). as long as you have the necessary archived redo log files to completely recover the database. See Oracle High Availability Architecture and Best Practices for backup recommendations and Oracle Database Backup and Recovery Advanced User’s Guide for additional information about performing the RMAN backup operation. All rights reserved.125 . RMAN> BACKUP DATABASE 5 .

126 . If the file already exists. you can use the REUSE option to overwrite it.126 Copyright © 2006. Create the control file by issuing the following command: ALTER DATABASE CREATE STANDBY CONTROLFILE AS file_name [REUSE].Creating a Control File for the Standby Database Create a control file on the primary database to be used for the standby database: SQL> ALTER DATABASE CREATE STANDBY CONTROLFILE 2 AS '/tmp/boston. Note: You cannot use a single control file for both the primary and standby databases. Oracle. Oracle Database 10g: Data Guard Administration 1 . you create the control file for the standby database.ctl'. Creating a Control File for the Standby Database On the primary database. All rights reserved. 5 .

If the physical standby database is on the same system as the primary database.127 Copyright © 2006.127 . If the physical standby database is on a different system from the primary database.Copying Files to the Standby Database System Copy the following files to the standby database system: • Backup of the data files • Standby control file • Initialization parameter file Primary Standby 5 . Copying Files to the Standby Database System After you have successfully backed up the data files and created the standby database control file. Oracle Database 10g: Data Guard Administration 1 . copy the files to the standby system by using an operating-system utility. then the directory paths may be the same. All rights reserved. Oracle. you must rename the primary data files in the standby control file after copying them to the standby location.

128 . set the DB_CREATE_FILE_DEST and DB_CREATE_ONLINE_LOG_DEST_n initialization parameters to appropriate values. Use the RMAN DUPLICATE … FOR STANDBY command to copy the data files. For more information about the DUPLICATE … FOR STANDBY command. Oracle Managed Files (OMF) and Automatic Storage Management (ASM) If the primary database is configured to use OMF. see the Oracle Database Administrator’s Guide. 2. On the standby database. Oracle recommends that the standby database be configured to use OMF as well. archived redo log files.Oracle Managed Files (OMF) and Automatic Storage Management (ASM) • OMF: Use same on each database. Oracle Database 10g: Data Guard Administration 1 . The DUPLICATE … FOR STANDBY command performs the actual data movement at the standby instance. and a standby control file. and standby control file in the backup set to the standby database’s storage area. Oracle. archived log files. 3. Maintenance and future role transitions are simplified if the same disk group names are used for both the primary and standby databases. OMF primary OMF standby 5 . If the standby database is going to use ASM. All rights reserved. Use the RMAN BACKUP command to create a backup set that contains a copy of the primary database’s data files. see the Oracle Database Recovery Manager Reference. To do this.128 Copyright © 2006. do the following: 1. • ASM: Use the RMAN DUPLICATE … FOR STANDBY command. For more information about OMF and ASM. create an ASM instance if one does not already exist on the standby database system.

Setting Initialization Parameters on the Standby Database
DB_NAME=chicago DB_UNIQUE_NAME=boston SERVICE_NAMES=boston LOG_ARCHIVE_CONFIG='DG_CONFIG=(chicago,boston)' CONTROL_FILES='/arch1/boston/control1.ctl', '/arch2/boston/control2.ctl' DB_FILE_NAME_CONVERT= '/arch1/chicago/','/arch1/boston/', '/arch2/chicago/','/arch2/boston/' LOG_FILE_NAME_CONVERT='/arch1/chicago/','/arch1/boston/', '/arch2/chicago/','/arch2/boston/' LOG_ARCHIVE_FORMAT=log%t_%s_%r.arc

Continued on the next page…

5 - 129

Copyright © 2006, Oracle. All rights reserved.

Setting Initialization Parameters on the Standby Database 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 boston database 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, COMPATIBLE must 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 COMPATIBLE parameter to 10.1.0.0 or higher.

Oracle Database 10g: Data Guard Administration 1 - 129

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=ENABLE LOG_ARCHIVE_DEST_STATE_2=ENABLE REMOTE_LOGIN_PASSWORDFILE=EXCLUSIVE STANDBY_FILE_MANAGEMENT=AUTO INSTANCE_NAME=boston FAL_SERVER=chicago FAL_CLIENT=boston

5 - 130

Copyright © 2006, Oracle. All rights reserved.

Oracle Database 10g: Data Guard Administration 1 - 130

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/'

5 - 131

Copyright © 2006, Oracle. All rights reserved.

Specifying a Value for STANDBY_ARCHIVE_DEST You can use the STANDBY_ARCHIVE_DEST initialization 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_DEST initialization 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_DEST to 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_DEST is not set in most configurations. STANDBY_ARCHIVE_DEST and LOG_ARCHIVE_FORMAT are used to construct a fully qualified file name.

Oracle Database 10g: Data Guard Administration 1 - 131

Setting Up the Environment to Support the Standby Database
1. If creating a standby database on a Windows platform, create a Windows-based service. 2. Create a password file. 3. Configure listeners for the primary and standby databases.

5 - 132

Copyright © 2006, Oracle. All rights reserved.

Setting Up the Environment to Support the Standby Database 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 -STARTMODE manual

Refer to Oracle Database Platform Guide for Windows for more information about using the ORADIM tool. 2. On platforms other than Windows, create a password file and set the password for the SYS user to the same password that is used by the SYS user on the primary database. The password for the SYS user on every database in a Data Guard configuration must be identical for redo transmission to succeed. Refer to the Oracle Database Administrator’s Guide for 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.

Oracle Database 10g: Data Guard Administration 1 - 132

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.

5 - 133

Copyright © 2006, Oracle. All rights reserved.

Setting Up the Environment to Support the Standby Database (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 Guide and 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';

Oracle Database 10g: Data Guard Administration 1 - 133

Starting the Physical Standby Database
To start the physical standby database: 1. Bring it to the OPEN READ ONLY stage. 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;

5 - 134

Copyright © 2006, Oracle. All rights reserved.

Starting Up the Physical Standby Database 1. On the standby database, issue the STARTUP SQL 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 DATABASE SQL command to start Redo Apply. This statement automatically mounts the database. Also, include the DISCONNECT FROM SESSION option 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;

Oracle Database 10g: Data Guard Administration 1 - 134

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.

5 - 135

Copyright © 2006, Oracle. All rights reserved.

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.

Oracle Database 10g: Data Guard Administration 1 - 135

Protection modes are discussed in detail in the lesson titled “Configuring Data Protection Modes and Redo Transport Services.” Oracle Database 10g: Data Guard Administration 1 .Additional Configuration Tasks (continued) • Upgrade the data protection mode: The Data Guard configuration is initially set up in the maximum performance mode (the default).136 .

Oracle Database 10g: Data Guard Administration 1 . • Each database instance must archive to different locations. but at least the directory path must be different. the archival directories for the standby database must use a different directory structure than the primary database.137 Copyright © 2006. from the DB_NAME and DB_DOMAIN parameters) will be in effect for both the databases.137 . All rights reserved. the standby database may overwrite the primary database files. • Service names must be unique. If the standby database is on the same system. 5 . Oracle. • The standby database does not protect against disaster. • If the standby database is on the same system as the primary database. This means that you must use the DB_FILE_NAME_CONVERT and LOG_FILE_NAME_CONVERT parameters. the same default global name (consisting of the database name and domain name. it does not protect against disaster. A disaster is defined as a total loss of the primary database system. it will be lost as well. Special Note: Standby Database on the Same System If you have a standby database on the same system as the primary database.Special Note: Standby Database on the Same System Primary /oracle/dba Standby /oracle/standby/dba • Standby database data files must be at a different location. you must consider the following: • The data files must be renamed. Otherwise. The actual file names can be the same. do not set the DB_FILE_NAME_CONVERT or LOG_FILE_NAME_CONVERT parameter. Note: If the standby database uses Oracle Managed Files (OMF). This configuration should be used for testing and training purposes only. • If you do not explicitly specify unique service names and if the primary and standby databases are located on the same system. • If a standby database is located on the same system as the primary database.

Oracle Database 10g: Data Guard Administration 1 .138 .Summary In this lesson. All rights reserved. Oracle.138 Copyright © 2006. 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 5 .

Oracle.Configuring Data Protection Modes and Redo Transport Services 6 Copyright © 2006. All rights reserved. .

Oracle. All rights reserved. you should be able to do the following: • Describe the data protection modes • Change the data protection mode of your configuration • Modify redo transport services to serve your needs 6 .140 . Oracle Database 10g: Data Guard Administration 1 .Objectives After completing this lesson.140 Copyright © 2006.

you are configuring the shipment of log files from the primary database to the standby database (physical or logical). you can put the configuration into the desired data protection mode. All rights reserved. The data protection mode setting causes internal rules to be implemented. However. 6 .141 Copyright © 2006. After you set up the redo transport mode.141 . You must set your redo transport mode to support the protection mode that you want for your configuration. ensuring that your configuration is protected at the level you desire. Oracle Database 10g: Data Guard Administration 1 . Oracle. configuring the redo transport mode alone does not set up the protection mode. Data Protection Modes and Redo Transport Modes When you define a redo transport mode. • A redo transport mode alone does not define a data protection mode.Data Protection Modes and Redo Transport Modes • A data protection mode requires a specific redo transport mode.

• SYNC and ASYNC (LGWR only) – Specify that network I/O operations are to be performed synchronously or asynchronously when using LGWR – SYNC is the default.ASYNC: Specifies that network I/O is to be performed asynchronously for the destination. you have the following additional options: . The log writer process (LGWR) submits the redo data to one or more network server (LNSn) processes. This is the default. the log writer process waits for the I/O to complete before continuing.SYNC: Specifies that network I/O is to be performed synchronously for the destination. All rights reserved. the destination automatically reverts to using the archiver process until the error is corrected. With the LGWR attribute. A foreground archival operation or the archiver background processes (ARCn) serve as the redo log transport service.142 Copyright © 2006. If a LGWR destination fails. • AFFIRM and NOAFFIRM – Ensure that redo has been successfully written to disk on the standby destination – NOAFFIRM is the default.142 . In ASYNC mode all network I/O is done completely independent of the LGWR process. meaning that once the I/O is initiated.Defining the Redo Transport Mode Use the attributes of LOG_ARCHIVE_DEST_n: • ARCH and LGWR – Specify that either the archiver process or the log writer process is responsible for transmitting redo to the standby destination – ARCH is the default. Oracle Database 10g: Data Guard Administration 1 . 6 . which then initiate the network I/O in parallel to multiple remote destinations. 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. • LGWR: Indicates that redo is transmitted to the destination concurrently while the online redo log is being written. Use of the ASYNC attribute allows standby environments to be maintained with little or no performance impact on the primary database. . Oracle.

143 . This is the default. When you use the LGWR. the transaction is not committed until the disk I/O is completed. which means that the log writer process does not wait until the disk I/O has completed before continuing. SYNC. Oracle Database 10g: Data Guard Administration 1 .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. and AFFIRM attributes. NOAFFIRM: indicates that all redo disk I/O operations are to be performed asynchronously.

Click “Show Advanced Properties. Select your standby database. Click “Standby Role Properties” on the Edit Standby Database Properties page. and then click Edit on the Data Guard page.” Oracle Database 10g: Data Guard Administration 1 . 6 . 2. 3.144 Copyright © 2006.Setting the Redo Transport Mode Click Edit to access the Edit Standby Database Properties page.144 . Setting the Redo Transport Mode Use the following procedure to set the redo transport mode by using Enterprise Manager: 1. Oracle. All rights reserved.

and NOAFFIRM attributes of the LOG_ARCHIVE_DEST_n initialization parameter. • ASYNC: configures redo transport services for your standby database using the LGWR. Oracle Database 10g: Data Guard Administration 1 . • SYNC: configures redo transport services for your standby database using the LGWR. 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. SYNC. This redo transport mode enables the highest grade of data protection to the primary database. ASYNC.145 Copyright © 2006. 6 . is required for the maximum protection or maximum availability protection modes. and AFFIRM attributes of the LOG_ARCHIVE_DEST_n initialization parameter. along with standby redo log files. along with standby redo log files. You do not need standby redo log files for this mode.Setting the Redo Transport Mode Select the mode from the Log Transport Mode list.145 . Oracle. enables a moderate grade of protection to the primary database and incurs a lower performance impact. The values in the Log Transport Mode list are defined as follows: • ARCH: configures redo transport services for your standby database using the ARCH attribute of the LOG_ARCHIVE_DEST_n initialization parameter. All rights reserved. This mode. This mode enables the lowest grade of protection to the primary database as well as the lowest performance impact. This mode. but it also incurs the highest performance impact.

Oracle. a business cannot afford to lose data.146 Copyright © 2006. 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. Oracle Database 10g: Data Guard Administration 1 . and maximum performance modes to help enterprises balance data availability against system performance requirements. maximum availability.146 . All rights reserved. In other situations. In some situations. Data Protection Modes Oracle Data Guard offers maximum protection.Data Protection Modes • Three data protection modes: – Maximum protection – Maximum availability – Maximum performance • Help to balance data availability and system performance 6 .

For multipleinstance RAC databases. LGWR. Data Guard shuts down the primary database if it is unable to write the redo records to at least one properly configured database instance. LGWR. 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. Maximum Protection This protection mode ensures that no data loss will occur if the primary database fails. Oracle. perform the following configuration tasks: • Configure standby redo log files on at least one standby database. Oracle Database 10g: Data Guard Administration 1 . All rights reserved. and AFFIRM attributes of the LOG_ARCHIVE_DEST_n parameter for at least one standby database destination. To enable maximum protection mode. • Set the SYNC. and AFFIRM attributes for at least one standby database 6 . the primary database shuts down if a fault prevents it from writing its redo stream to at least one remote standby redo log. To ensure that data loss cannot occur.147 Copyright © 2006.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 standby database.147 . • Primary database shuts down if a fault prevents it from writing its redo stream to at least one remote standby redo log. • Configuration requirements: – Standby redo log files on at least one standby database – SYNC.

148 . Unlike maximum protection mode.Maximum Availability • Enables zero data loss • Provides the highest possible level of data protection without compromising the availability of the primary database • Redo data must be written to both the local online redo log and the standby redo log on at least one standby database. • Set the SYNC. 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. the primary database operates in maximum performance mode until the fault is corrected and all gaps in redo log files are resolved. Oracle Database 10g: Data Guard Administration 1 . 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. the primary database automatically resumes operating in maximum availability mode. and AFFIRM attributes for at least one standby database 6 . LGWR. the primary database does not shut down if a fault prevents it from writing its redo stream to a remote standby redo log. Oracle.148 Copyright © 2006. To enable maximum availability mode. When all gaps are resolved. • Configuration requirements: – Standby redo log files on at least one standby database – SYNC. Instead. All rights reserved. • Primary database does not shut down if a fault prevents it from writing its redo stream. This mode guarantees that no data loss will occur if the primary database fails. LGWR. perform the following configuration tasks: • Configure standby redo log files on at least one standby database. and AFFIRM attributes of the LOG_ARCHIVE_DEST_n parameter 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.

Maximum Performance This protection mode (the default) provides the highest possible level of data protection without affecting the performance of the primary database.149 .Maximum Performance • Default level of data protection • Provides the highest possible level of data protection 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. Oracle. If the primary database fails. Oracle Database 10g: Data Guard Administration 1 . When network links with sufficient bandwidth are used. but that redo stream is written asynchronously with respect to the commitment of the transactions that create the redo data. The maximum performance mode enables you to either set the LGWR and ASYNC attributes or set the ARCH attribute on the LOG_ARCHIVE_DEST_n parameter for the standby database destination. 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. • Redo stream is written asynchronously with respect to the commitment of the transactions that create the redo data. The primary database’s redo data stream is also written to at least one standby database. you can reduce the amount of data that is not received on the standby destination by setting the LGWR and ASYNC attributes.149 Copyright © 2006. All rights reserved. 6 . this mode provides a level of data protection that approaches that of maximum availability mode with minimal impact on primary database performance.

the primary database will be restarted automatically. Enterprise Manager will automatically set the redo transport mode for the primary database and the selected standby databases. The primary database need not be restarted following a downgrade of the protection mode. 2.150 .Setting the Data Protection Mode Click the Protection Mode link. Setting the Data Protection Mode If the data protection mode that you need requires a standby database to use the SYNC or ASYNC redo transport mode.150 Copyright © 2006. Click the link in the Protection Mode field to access the Change Protection Mode: Select Mode page. 6 . Navigate to the Data Guard page. You can set the data protection mode by using Enterprise Manager as follows: 1. Oracle. After you upgrade the protection mode using Enterprise Manager. 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. Oracle Database 10g: Data Guard Administration 1 . All rights reserved.

6. On the Confirmation page.Setting the Data Protection Mode 6 . and then click Continue. Maximum Availability. Click OK. Setting the Data Protection Mode (continued) 3. enter the username and password of a user with SYSDBA privileges. 4. Select Maximum Protection. If standby redo log files are needed. or Maximum Performance.151 Copyright © 2006. click Yes. Oracle Database 10g: Data Guard Administration 1 .151 . verify the names of the log files. and then click Login. If prompted. 5. All rights reserved. Oracle. Select one or more standby databases to support the protection mode that you selected.

ensure that standby redo log files are configured on the standby database. For example. Configure standby redo logs.152 . 2. 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. All rights reserved. Set the LogXptMode property (if necessary). if you are changing the data protection mode to maximum availability. 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. issue the following command: DGMGRL> EDIT CONFIGURATION SET PROTECTION MODE AS MAXAVAILABILITY. DGMGRL> EDIT CONFIGURATION SET PROTECTION MODE AS MAXAVAILABILITY. Use the EDIT CONFIGURATION SET PROTECTION MODE AS command to set the overall configuration protection mode. 3. 3.Setting the Data Protection Mode by Using the CLI 1. use the EDIT DATABASE command to specify SYNC for redo transport services as follows: DGMGRL> EDIT DATABASE 'DR_Sales' SET PROPERTY 'LogXptMode'='SYNC'. Set the data protection mode. Oracle. If you are setting the protection mode to maximum protection or maximum availability.152 Copyright © 2006. Use the EDIT DATABASE SET PROPERTY command to set the redo transport mode for the standby database. DGMGRL> EDIT DATABASE 'site1_edrsr8p1' SET PROPERTY 'LogXptMode'='SYNC'. To set the protection mode to maximum availability. 6 . Setting the Data Protection Mode by Using the CLI 1. Oracle Database 10g: Data Guard Administration 1 . 2.

or performance: ALTER DATABASE SET STANDBY DATABASE TO MAXIMIZE {PROTECTION | AVAILABILITY | PERFORMANCE}. AFFIRM. All rights reserved. you must have at least one standby database with the following: • Maximum protection: LGWR. For each level of protection. SYNC. • Issue the ALTER DATABASE statement on the primary database: ALTER DATABASE SET STANDBY TO MAXIMIZE PROTECTION. SYNC. Oracle. you can configure the Data Guard environment to maximize data protection. 6 .153 Copyright © 2006. Oracle Database 10g: Data Guard Administration 1 . AFFIRM. and standby redo logs files for physical standby databases • Maximum performance: Any combination of LGWR or ARCH Using the following SQL statement on the primary database.153 . Setting the Protection Mode by Using SQL You must set attributes of the LOG_ARCHIVE_DEST_n initialization parameter for each level of protection. availability. and standby redo logs files • Maximum availability: LGWR.Setting the Protection Mode by Using SQL • You must set attributes to support the type of protection desired.

154 . thereby providing protection from user errors or corruptions.time apply enabled. Data Guard will ensure zero data loss even with the delayed apply in effect. the delay is ignored.154 Delayed application Standby database Copyright © 2006. If you define a delay for a destination that has real. if a critical table is accidentally dropped from the primary database. You can protect against the application of corrupted or erroneous data to the standby database. For example. All rights reserved. Note: You can use Flashback Database as an alternative to the Apply Delay configuration option as described later in this lesson. Oracle Database 10g: Data Guard Administration 1 . The apply process also revalidates the log records to prevent application of log corruptions.Delaying the Application of Redo Delaying the application of redo helps safeguard against: • Data corruption • User errors Oracle Net Production database 6 . If operating in maximum protection or maximum availability mode. you can prevent this action from affecting the standby database by delaying the application of this change in the standby database. Oracle. Delaying the Application of Redo You can delay the application of changes to standby databases.

click Standby Role Properties. In the Apply Delay field. select your standby database. All rights reserved. 3. 6 . Using Enterprise Manager to Delay the Application of Redo You can configure delayed apply by using Enterprise Manager as follows: 1. Oracle Database 10g: Data Guard Administration 1 . On the Edit Standby Database Properties page. 4. On the Data Guard page. Oracle. Click Apply.155 .155 Copyright © 2006. enter the delay value (in minutes).Using Enterprise Manager to Delay the Application of Redo Specify the delay in minutes. Then click Edit. 2.

Note: If you do not specify a value for minutes. Oracle. Oracle Database 10g: Data Guard Administration 1 . the default is 30 minutes.Setting LOG_ARCHIVE_DEST_n to 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) 6 .156 Copyright © 2006. Setting LOG_ARCHIVE_DEST_n to 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.156 . All rights reserved.

Oracle Database 10g: Data Guard Administration 1 .Using Flashback Database Instead of Apply Delay Standby1 No delay Primary database Standby2 4-hour delay Standby3 8-hour delay Primary database Standby 6 . 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. Oracle. All rights reserved.157 . Refer to the Oracle Database Backup and Recovery Advanced User’s Guide for additional information about Flashback Database. You can configure one standby database with Flashback Database to achieve the same benefit as multiple standby databases with different delays. Flashback Database can quickly and easily flash back a standby database to an arbitrary time in the past.157 Copyright © 2006.

Oracle. Oracle Database 10g: Data Guard Administration 1 . Additional Attributes That Affect Redo Transport Services The following pages present additional attributes of the LOG_ARCHIVE_DEST_n initialization parameter that affect redo transport services.158 Copyright © 2006.Additional Attributes That Affect Redo Transport Services • • • • ALTERNATE DEPENDENCY MAX_FAILURE NET_TIMEOUT • REOPEN 6 .158 . All rights reserved. The use of each attribute depends entirely on your individual business requirements.

An alternate destination cannot be self-referencing. Using the ALTERNATE Attribute You can use the ALTERNATE attribute to specify another LOG_ARCHIVE_DEST_n destination to be used if archival operations to the original destination fail. An alternate destination is used when the transmission of redo fails. the Oracle Database server attempts to transmit the redo to the alternate destination on the next log switch. Oracle Database 10g: Data Guard Administration 1 . A destination can have a maximum of one alternate destination specified.Using the ALTERNATE Attribute • 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=0 or 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=ENABLE log_archive_dest_state_4=ALTERNATE 6 . Oracle. All rights reserved. If the archiving to the destination fails and the REOPEN attribute is specified with a value of zero (0). this state is specified using the LOG_ARCHIVE_DEST_STATE_n initialization parameter.159 .159 Copyright © 2006. An alternate destination must be in the ALTERNATE state. The ALTERNATE state defers the processing of the destination until another destination failure automatically enables this destination (provided the alternate destination attributes are valid).

If you set both the MAX_FAILURE and REOPEN attributes to nonzero values. you can provide failure resolution for archiving destinations to which you want to retry archival operations after a failure. You can view the failure count in the FAILURE_COUNT column of the V$ARCHIVE_DEST fixed view. Oracle. Oracle Database 10g: Data Guard Administration 1 .Using the MAX_FAILURE Attribute 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' 6 . but not retry indefinitely. Each destination contains an internal failure counter that tracks the number of consecutive archival failures that have occurred.160 Copyright © 2006. All rights reserved. The related column REOPEN_SECS identifies the REOPEN attribute value. Using the MAX_FAILURE Attribute The MAX_FAILURE attribute 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. When you specify the MAX_FAILURE attribute.160 . redo transport services limit the number of archival attempts to the number of times specified by the MAX_FAILURE attribute. you must also set the REOPEN attribute to specify how often archival operations are retried to the particular destination.

the primary database can potentially stall for the default network timeout period. Oracle. you can enable the primary database to mark a destination as “failed” after the user-specified timeout interval expires. Without the NET_TIMEOUT attribute. • Range of values for NET_TIMEOUT: 15 to 1200 • Default: 180 • Use caution in maximum protection mode. By specifying a smaller. False network failure detection may cause the primary instance to shut down. log_archive_dest_2='SERVICE=o10g2 LGWR SYNC NET_TIMEOUT=30' 6 .161 . All rights reserved. Note: Remember to specify a reasonable value when running in maximum protection mode. nonzero value for NET_TIMEOUT. Using the NET_TIMEOUT Attribute The NET_TIMEOUT attribute enables you to bypass the default network timeout interval established for the system on which the primary database resides.161 Copyright © 2006. Oracle Database 10g: Data Guard Administration 1 .Using the NET_TIMEOUT Attribute • Enables the LGWR process to avoid a network timeout issue • Valid with SYNC or ASYNC destinations • Value supplied is the number of seconds to wait.

All rights reserved. and so on. disk full.162 Copyright © 2006. disk errors. Using the REOPEN Attribute The REOPEN attribute 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. quota exceptions. – 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 ALTERNATE destinations with MAX_FAILURE=0 attributes 6 . Oracle Database 10g: Data Guard Administration 1 . REOPEN applies to all errors. These errors include (but are not limited to) network failures. Oracle.162 . and quota exceptions.Using the REOPEN Attribute • REOPEN[=seconds] – Minimum number of seconds to wait before retrying a failed destination at log switch – Failures can be network failures. not just connection failures.

the redo transport mechanism is enhanced to more effectively utilize all of the available bandwidth. large redo log file may be transferred in parallel by multiple ARCn processes.163 . This architecture increases the redo transfer rate and enables faster redo transmission to standby databases for bulk batch updates on the primary database. A single. All rights reserved. As a result of the improvement in transfer rates. Optimized Asynchronous Redo Transmission In Oracle Database 10g Release 2.Optimized Asynchronous Redo Transmission Primary database transactions LGWR LNSn MRP or LSP (MRP only) RFS Standby database Online redo logs FAL ARC0 ARC1 ARC2 Archived redo logs 6 . there is an increased availability of data at the standby database site. Oracle Database 10g: Data Guard Administration 1 .163 Oracle Net Backup Reports Archived redo logs Copyright © 2006. Oracle.

164 . All rights reserved.Enabling Multiple Connections for Remote Archival of Redo The following conditions must be met to enable this feature: • Remote archiving is performed to disk. • LOG_ARCHIVE_LOCAL_FIRST must be set to TRUE (default). Oracle Database 10g: Data Guard Administration 1 . The MAX_CONNECTIONS attribute defaults to 1. Enabling Multiple Connections for Remote Archival of Redo The MAX_CONNECTIONS attribute of LOG_ARCHIVE_DEST_n is used to set the number of parallel connections that are used for transmitting archived redo log files to a remote destination. Data Guard will use the available ARCn processes. indicating that a single connection is established for the communication and transfer of data. Oracle. If the value of the MAX_CONNECTIONS attribute exceeds the value of LOG_ARCHIVE_MAX_PROCESSES. The maximum value for MAX_CONNECTIONS is 5. LOG_ARCHIVE_DEST_3= 'SERVICE=detroit MAX_CONNECTIONS=5' 6 . Note: You must set the LOG_ARCHIVE_MAX_PROCESSES initialization parameter to be greater than or equal to the value of MAX_CONNECTIONS to achieve the desired number of parallel connections.164 Copyright © 2006.

Oracle.165 . All rights reserved.Summary In this lesson. you should have learned how to: • Describe the data protection modes • Change the data protection mode of your configuration • Modify redo transport services to suit your needs • Delay the application of redo • Use additional transport services attributes 6 .165 Copyright © 2006. Oracle Database 10g: Data Guard Administration 1 .

166 Copyright © 2006. Oracle. Oracle Database 10g: Data Guard Administration 1 . All rights reserved.Practice 6: Overview This practice covers the following topics: • Changing the data protection mode • Delaying the application of redo 6 .166 .

Oracle. .Creating a Logical Standby Database by Using Enterprise Manager 7 Copyright © 2006. All rights reserved.

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 Enterprise Manager 7 . Oracle.168 . All rights reserved. Oracle Database 10g: Data Guard Administration 1 .168 Copyright © 2006.

and active production database – Additional indexes and materialized views can be created for improved query performance. additional indexes and materialized views can be created to improve your reporting and query requirements and to suit your specific business requirements. Benefits of Implementing a Logical Standby Database A logical standby database provides disaster recovery. and queries). and data protection benefits that are similar to those of a physical standby database. and those tables are simultaneously available for read-access. All rights reserved. independent.Benefits of Implementing a Logical Standby Database • Provides an efficient use of system resources: – Open.169 Copyright © 2006. and users can perform normal data manipulation operations on tables in schemas that are not updated from the primary database. It can host multiple database schemas. Oracle. Oracle Database 10g: Data Guard Administration 1 . and active production database. • Reduces workload on the primary database by offloading the following workloads to a logical standby database – Reporting – Summations – Queries 7 . It also provides the following specialized benefits: • Efficient utilization of system resources: A logical standby database is an open. • 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. independent. thereby reducing the primary database workload. It remains open while the tables are updated from the primary database. summations.169 . high availability. Because the data can be presented with a different physical layout.

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.170 .170 Copyright © 2006. • Disaster recovery: A logical standby database provides a robust and efficient disaster-recovery solution. Oracle. Easy-to-manage switchover and failover capabilities allow easy role reversals between primary and logical standby databases.Benefits of Implementing a Logical Standby Database • Provides data protection: – Primary database corruptions not propagated • Provides disaster recovery capabilities: – Switchover and failover – Minimizes downtime for planned and unplanned outages 7 . minimizing the downtime of the primary database for planned and unplanned outages. Primary-side physical corruptions do not propagate through the redo data that are transported to the logical standby database. All rights reserved. Oracle Database 10g: Data Guard Administration 1 . Benefits of Implementing a Logical Standby Database (continued) • Data protection: A logical standby database provides a safeguard against data corruptions and user errors.

By default. • Database guard level applies to all users except SYS. This is because the database guard is automatically set to ALL.Securing Your Logical Standby Database • Configure the database guard to control user access to tables.171 . Oracle Database 10g: Data Guard Administration 1 . 7 . • Database guard level is set to ALL by broker automatically on the logical standby database. you must issue the ALTER DATABASE GUARD ALL command before opening the database. only the SYS user can modify data. • ALTER DATABASE GUARD command keywords: – ALL: prevents users from making changes to any data in the database. All rights reserved. it is not possible for a nonprivileged user to modify data on a Data Guard SQL Apply database. Oracle. When you set the security level to STANDBY. users are able to modify data that is not maintained by the logical apply engine. With this level of security. – STANDBY: prevents users from making changes to any data maintained by Data Guard SQL Apply. Failure to do so will allow jobs that are submitted through DBMS_JOB.171 Copyright © 2006. – NONE: normal security • Query GUARD_STATUS column in V$DATABASE. A security level of NONE permits 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.SUBMIT to be scheduled and to potentially modify tables in the logical standby database. Securing Your Logical Standby Database You can control user access to tables in a logical standby database by using the ALTER DATABASE GUARD command to configure the database guard.

Be aware of unsupported DDL commands. Enable supplemental logging. Oracle Database 10g: Data Guard Administration 1 . Preparing to Create a Logical Standby Database When creating a logical standby database. 5. Verify that the primary database is configured for ARCHIVELOG mode. 2.Preparing to Create a Logical Standby Database Perform the following steps on the primary database before creating a logical standby database: 1. 3. you must take several actions before you begin.172 . Ensure row uniqueness.172 Copyright © 2006. Check for unsupported data types. The following pages discuss these steps in detail. 7 . 4. Oracle. All rights reserved.

173 Copyright © 2006. All rights reserved. Oracle. Unsupported Objects If the primary database contains unsupported tables. Oracle Database 10g: Data Guard Administration 1 . • Unsupported objects: – Tables and sequences in the SYS schema – – – – Tables using table compression Tables used to support materialized views Global temporary tables Tables with unsupported data types (see list on next page) 7 . log apply services automatically exclude these tables when applying redo data to the logical standby database.Unsupported Objects • Log apply services automatically exclude unsupported objects when applying redo data to the logical standby database.173 .

174 Copyright © 2006. and UROWID – User-defined types – Object types REFs – Varrays – Nested tables – XMLtype 7 . 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. Oracle. Refer to Oracle Data Guard Concepts and Administration for additional information about unsupported data types and objects.174 . • Unsupported data types: – BFILE. All rights reserved. ROWID. Oracle Database 10g: Data Guard Administration 1 .Unsupported Data Types • Log apply services automatically exclude tables with unsupported data types when applying redo data to the logical standby database.

Oracle. All rights reserved.175 Copyright © 2006. 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.Checking for Tables with Unsupported Data Types Query DBA_LOGSTDBY_UNSUPPORTED on the primary database for tables with unsupported data types: SQL> desc DBA_LOGSTDBY_UNSUPPORTED Name -------------OWNER TABLE_NAME COLUMN_NAME DATA_TYPE Null? -------NOT NULL NOT NULL NOT NULL Type ------------VARCHAR2(30) VARCHAR2(30) VARCHAR2(30) VARCHAR2(106) 7 . consider using a physical standby database instead. this view does not show tables with table compression. Note: This view does not show any tables from the SYS schema because changes to the SYS schema object are not applied to the logical standby database. Any changes made to unsupported data types. In addition. Oracle Database 10g: Data Guard Administration 1 . These tables are not maintained (do not have DML applied) in the logical standby database. nor is an error message returned. or views on the primary database are neither propagated to the logical standby database. sequences. If the primary database includes unsupported tables that are critical.175 . tables. Checking for Tables with Unsupported Data Types You can query the DBA_LOGSTDBY_UNSUPPORTED data dictionary view to see all of the tables that contain data types that are not supported by logical standby databases.

176 .Unsupported DDL Commands • • • • • • • • • • • • • • • • 7 . Oracle. Unsupported DDL Commands Not all data definition language (DDL) commands that are executed on the primary database are applied to the logical standby database. All rights reserved. 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. Oracle Database 10g: Data Guard Administration 1 .176 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 • • • • • EXPLAIN LOCK TABLE SET CONSTRAINTS SET ROLE SET TRANSACTION Copyright © 2006.

TABLE_NAME. 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.-----------OWNER NOT NULL VARCHAR2(30) TABLE_NAME NOT NULL VARCHAR2(30) BAD_COLUMN VARCHAR2(1) • BAD_COLUMN values: – Y: Data type is unbounded.177 Copyright © 2006. Issue the following query to display a list of tables that SQL Apply might not be able to uniquely identify: SQL> 2 3 4 SELECT OWNER. • Add a primary key or unique index to ensure that SQL Apply can efficiently apply data updates 7 . a different mechanism must be used to match the updated row on the primary database to its corresponding row on the logical standby database. Oracle Database 10g: Data Guard Administration 1 . 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. – N: Table contains enough column information.177 . You can query the DBA_LOGSTDBY_NOT_UNIQUE view to identify tables in the primary database that do not have a primary key or unique index with NOT NULL columns. All rights reserved.-------.Ensuring Unique Row Identifiers • Query DBA_LOGSTDBY_NOT_UNIQUE on the primary database to find tables without a unique identifier: SQL> desc DBA_LOGSTDBY_NOT_UNIQUE Name Null? Type -------------. Oracle.BAD_COLUMN FROM DBA_LOGSTDBY_NOT_UNIQUE WHERE TABLE_NAME NOT IN (SELECT TABLE_NAME FROM DBA_LOGSTDBY_UNSUPPORTED). Primary keys and unique indexes can be used to match the corresponding rows.

then the table cannot be maintained properly and SQL Apply stops. If two rows in the table match except for values in their LOB column. the redo transport services and log apply services run more efficiently if you add a primary key. such as CLOB. you may want to consider adding a primary or unique key constraint on the table. If this view returns a row for a given 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. Oracle Database 10g: Data Guard Administration 1 . However.Ensuring Unique Row Identifiers (continued) The key column in this view is BAD_COLUMN.178 . You should consider adding a disabled RELY constraint to these tables (as described on the next page). 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.

7 . Be careful to select columns for the disabled RELY constraint that uniquely identify the row.Adding a Disabled Primary Key RELY Constraint You can add a disabled RELY constraint to uniquely identify rows: SQL> ALTER TABLE hr. last_name) 3 RELY DISABLE. Oracle. SQL Apply does not apply redo information to the logical standby database. assume that the HR.179 . Supplemental logging must be set to MINIMAL or FULL as described on the next page.EMPLOYEES table does not have a primary key. If the columns selected for the RELY constraint do not uniquely identify the row. The RELY constraint tells the system to log the named columns (in this example. you can create a disabled primary key RELY constraint on the table without incurring the overhead of maintaining a primary key on the primary database. employee_id and last_name) to identify rows in this table.179 Copyright © 2006. Note: For this example. Adding a Disabled Primary Key RELY Constraint If your application ensures that the rows in a table are unique. Oracle Database 10g: Data Guard Administration 1 .employees 2 ADD PRIMARY KEY (employee_id. All rights reserved.

180 Copyright © 2006. On the primary database. an application can identify updated rows logically rather than resorting to row IDs. this is not always sufficient to uniquely identify the row that changed. UNIQUE INDEX) COLUMNS. and additional information must be put into the stream of redo data. before-image logging of primary keys or unique indexes for all updates. Oracle Database 10g: Data Guard Administration 1 . With this type of logging. group. 7 . Because an Oracle Database logs only the columns that were modified. – None: No additional redo information added to the redo stream. This type of logging is required by SQL Apply. – Minimal: Minimal amount of information needed for LogMiner to identify.Supplemental Logging • Adds supplemental data to the log stream • Three levels of database supplemental logging: – Full: enables database-wide. and merge the redo operations that are associated with DML changes. All rights reserved. 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. before. Full supplemental logging (or identification key logging) enables database-wide. Note: The default for supplemental logging is None. Supplemental Logging Supplemental logging must be enabled on the primary database to support a logical standby database. The supplemental information that is added to the redo data helps SQL Apply correctly identify and maintain tables in the logical standby database. • SQL Apply requires full supplemental logging.image logging of primary keys or unique indexes (in the absence of primary keys) for all updates. Oracle. The supplemental_db_logging clauses of the ALTER DATABASE command instructs the Oracle Database server to add or stop adding supplemental data to the log stream.180 .

Enabling Supplemental Logging You must enable full supplemental logging before you create the logical standby database. • SUPPLEMENTAL_LOG_DATA_PK: All columns of the primary key are placed in the redo log whenever there is an update.181 Copyright © 2006. Note: If you enable full supplemental logging on your primary database and you have already created physical standby databases.181 . Note: Enterprise Manager automatically enables supplemental logging when you create the logical standby database. The following columns in the V$DATABASE view have a YES value after supplemental logging has been enabled. The reason is that the logical standby database cannot use archived redo logs that contain both supplemental log data and nonsupplemental log data. • SUPPLEMENTAL_LOG_DATA_UI: If any unique key columns are modified. YES represents the following for the respective columns: • SUPPLEMENTAL_LOG_DATA_MIN: LogMiner has sufficient information to support chained rows and various storage arrangements. UNIQUE INDEX) COLUMNS. • Verify that the following columns in V$DATABASE contain a YES value: – SUPPLEMENTAL_LOG_DATA_MIN – SUPPLEMENTAL_LOG_DATA_PK – SUPPLEMENTAL_LOG_DATA_UI 7 . Oracle Database 10g: Data Guard Administration 1 .Enabling Supplemental Logging • Data Guard broker automatically enables supplemental logging. then you must enable supplemental logging on each physical standby database to ensure that future switchovers work correctly. Oracle. all other columns belonging to the unique key are also logged. • Manually enable full supplemental logging before you create your logical standby: SQL> ALTER DATABASE ADD SUPPLEMENTAL LOG DATA 2 (PRIMARY KEY. SQL> ALTER SYSTEM ARCHIVE LOG CURRENT. All rights reserved.

• SHARED_POOL_SIZE: Set to 160 MB or greater.182 . If this value is changed.182 Copyright © 2006. • LOG_PARALLELISM: Value must be set to 1. The recommended value is 9. Your configuration may operate with a lower value. but in a production environment a lower value may cause performance degradation. Oracle Database 10g: Data Guard Administration 1 . • SHARED_POOL_SIZE: Value should be 160 MB or greater. LogMiner on the logical standby site cannot read the redo logs. Oracle. – Recommended value is 9. All rights reserved. This is the default value. This is a recommendation. The SQL Apply Service on the logical standby site uses several parallel processes when applying the SQL to the logical database.Verifying Values of Initialization Parameters Verify the values for the following initialization parameters on the primary database : • PARALLEL_MAX_SERVERS: – Set to 5 or greater. • LOG_PARALLELISM: Set to 1 (default). 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. 7 .

First.183 .183 Copyright © 2006. click Add Standby Database to invoke the Add Standby Database Wizard.” 7 . Oracle. Oracle Database 10g: Data Guard Administration 1 .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. All rights reserved.

184 . All rights reserved.” 7 . Using the Add Standby Database Wizard Select “Create a new logical standby database” on the Add Standby Database page. Oracle.Using the Add Standby Database Wizard Select “Create a new logical standby database.184 Copyright © 2006. and then click Continue. Oracle Database 10g: Data Guard Administration 1 .

185 . When you create a logical standby database. Click Next to continue. the wizard also identifies tables that cannot be supported in your logical standby database and displays a list on the Backup Type page. All rights reserved. Oracle.Step 1: Specifying the Backup Type 7 .185 Copyright © 2006. select one of the two backup operations to use to create the standby database (as you did when creating a physical standby database). Oracle Database 10g: Data Guard Administration 1 . Step 1: Specifying the Backup Type On the Backup Type page of the wizard.

Step 2: Specifying the Backup Options 7 . Oracle Database 10g: Data Guard Administration 1 .186 . All rights reserved.186 Copyright © 2006. specify the parameters that are required to perform a new backup of the primary database or to access an existing backup. Step 2: Specifying the Backup Options On the Backup Options page. Oracle. Click Next to continue. See the lesson titled “Creating a Configuration with Enterprise Manager” for additional information about the parameters on the Backup Options page.

Oracle Database 10g: Data Guard Administration 1 . All rights reserved. Oracle.Step 3: Selecting the Database Location Instance Name 7 . The standby database can be created in any Oracle home that has been discovered by Oracle Enterprise Manager.187 . Click Next to continue. Step 3: Selecting the Database Location Instance Name 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.187 Copyright © 2006. Only Oracle homes on hosts that match the architecture and version of the primary host are shown.

188 Copyright © 2006. All rights reserved. Step 4: Specifying the Standby Database File Locations Access Method On the File Locations page.188 . Oracle.Step 4: Specifying the Standby Database File Locations Access Method 7 . In this case. 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. you must choose a method to make the primary backup files accessible to the standby host. 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. Oracle Database 10g: Data Guard Administration 1 .

Step 4: Specifying the Standby Database File Locations File Locations 7 . Oracle Database 10g: Data Guard Administration 1 . You can optionally change the locations of individual standby database files by clicking Customize.ora files in the directory that is specified in the Network Configuration File Location section. Data Guard automatically adds configuration information for the new standby database to the listener. which displays the File Locations Customize page. Step 4: Specifying the Standby Database File Location File Locations When the primary and standby databases are on the same host. you can use the Standby Database File Locations section to put all the standby database files in an OFA directory structure.189 . The default location is the network administration directory of the standby database Oracle home. Oracle. or to keep file names and locations the same as the primary database.ora and tnsnames.189 Copyright © 2006. all standby database files are put in an Optimal Flexible Architecture (OFA) directory structure by default. All rights reserved. When the primary and standby databases are on different hosts.

Step 5: Specifying Standby Database Configuration Parameters On the Standby Configuration page. (Physical standby databases use the same database name as the primary. This name appears in the list of database targets maintained by Enterprise Manager. you can specify any name that conforms to Oracle naming conventions.190 Copyright © 2006. the following parameters must be configured: • Database Name: This field appears only when you are creating a new logical standby database. service provider name.Step 5: Specifying Standby Database Configuration Parameters 7 . It is recommended that this name be the same as the database unique name. Oracle. When you create a new logical standby database. This name must be unique in the Data Guard configuration. The default values are based on corresponding primary database settings.) A default database name is provided. target name. • Target Name: Specify a name for Enterprise Manager to use for the new standby database. The configuration parameters include the instance name. and standby archive location. Oracle Database 10g: Data Guard Administration 1 .190 . you can specify configuration parameters for the standby database. All rights reserved. • Database Unique Name: Specify a value for the DB_UNIQUE_NAME parameter.

you see the Data Guard Overview page. where you can monitor the progress of the standby creation job. Oracle Database 10g: Data Guard Administration 1 . Oracle. the Processing page appears. 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.Step 6: Reviewing the Configuration Information 7 . After the job submission is complete. The name of the job that is submitted is provided at the top of the page.191 . This page tracks each step through the submission of the standby creation job. When you click Finish.191 Copyright © 2006. The new standby database is created in the background by an Oracle Enterprise Manager job. All rights reserved.

Oracle. When the process completes. Oracle Database 10g: Data Guard Administration 1 . Standby Database Creation Processing You can view the progress of the Add Standby Database process on the Processing page.192 . All rights reserved. Enterprise Manager displays the Data Guard Overview page.Standby Database Creation Processing 7 .192 Copyright © 2006.

193 . All rights reserved.Automatic Deletion of Redo Log Files by SQL Apply Redo logs from primary database SQL Apply Transform redo information into SQL Logical standby database Delete redo log files 7 . Automatic Deletion of Redo Log Files by SQL Apply In Oracle Database 10g Release 2. Oracle. Oracle Database 10g: Data Guard Administration 1 .193 Copyright © 2006. 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. archived redo logs on the logical standby database are automatically deleted by SQL Apply after they have been applied.

'FALSE').'TRUE').APPLY_SET procedure as shown.194 . • Disabling the auto-delete feature: EXECUTE dbms_logstdby.apply_set ('LOG_AUTO_DELETE'. All rights reserved. the auto-delete feature is enabled in Oracle Database 10g Release 2.apply_set ('LOG_AUTO_DELETE'. Enabling and Disabling the Auto-Delete Feature You can enable the auto-delete feature for archived redo logs with the DBMS_LOGSTDBY. 7 . Oracle Database 10g: Data Guard Administration 1 .194 Copyright © 2006.Enabling and Disabling the Auto-Delete Feature • Enabling the auto-delete feature: EXECUTE dbms_logstdby. By default. Oracle.

Oracle. Oracle Database 10g: Data Guard Administration 1 .195 .Summary In this lesson. All rights reserved. you should have learned how to: • Explain the advantages of a logical standby database • Decide when to use a logical standby database • Create a logical standby by using Enterprise Manager 7 .195 Copyright © 2006.

All rights reserved. Oracle Database 10g: Data Guard Administration 1 . Oracle.196 .Practice 7: Overview This practice covers the following topics: • Creating a logical standby database using the Add Standby Database Wizard • Verifying the configuration 7 .196 Copyright © 2006.

.Creating a Logical Standby Database by Using SQL 8 Copyright © 2006. Oracle. All rights reserved.

Oracle.198 .198 Copyright © 2006. 8 . Oracle Database 10g: Data Guard Administration 1 . you should be able to use SQL commands to create a logical standby database.Objectives After completing this lesson. All rights reserved.

• Verify that the primary database is configured for ARCHIVELOG mode.199 Copyright © 2006. • Enable supplemental logging.199 . 8 . 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. • Ensure row uniqueness. Oracle. 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) Oracle Database 10g: Data Guard Administration 1 . Preparing to Create a Logical Standby Database These tasks were covered in the “Creating a Logical Standby Database by Using Enterprise Manager” lesson. perform the following steps on the primary database: • Check for unsupported data types. • Check the values of the initialization parameters. All rights reserved.Preparing to Create a Logical Standby Database As preparation for creating a logical standby database. • Be aware of unsupported DDL commands.

Creating a Logical Standby Database Each of these steps is outlined in detail in the remainder of this lesson. Convert to a logical standby database. 6. Oracle Database 10g: Data Guard Administration 1 . 4. Prepare the primary database to support a logical standby database. Build a LogMiner Dictionary in the redo data. Create a physical standby database. All rights reserved. Stop Redo Apply on the physical standby database.Creating a Logical Standby Database To create a logical standby database by using SQL commands: 1. 7.200 Copyright © 2006.200 . 5. 2. 3. 8 . Verify that the logical standby database is performing properly. Oracle. Open the logical standby database.

8 . 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.” b. Oracle. Create a physical standby database as described in the lesson titled “Creating a Physical Standby Database by Using SQL. Create a physical standby database. Ensure that the physical standby database is caught up to the primary database. including all database structural changes (such as adding or dropping data files). Step 1: Create a Physical Standby Database You create a logical standby database by first creating a physical standby database. Oracle Database 10g: Data Guard Administration 1 . Then you convert the physical standby database into a logical standby database.201 Copyright © 2006.Step 1: Create a Physical Standby Database a. b.201 . To create the physical standby database: a. All rights reserved.

Step 2: Stop Redo Apply on the Physical Standby Database • Before converting the physical standby database to a logical standby database. Oracle. Oracle Database 10g: Data Guard Administration 1 . you must stop Redo Apply by issuing the ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL command. 8 .202 Copyright © 2006. Step 2: Stop Redo Apply on the Physical Standby Database Before converting the physical standby database to a logical standby database. stop Redo Apply. All rights reserved.202 . • Required to avoid applying changes past the redo that contains the LogMiner dictionary. SQL> ALTER DATABASE RECOVER MANAGED STANDBY 2 DATABASE CANCEL.

include the LOG_ARCHIVE_DEST_3 destination on the primary database. Set the LOG_ARCHIVE_DEST_3 initialization parameter for transitioning to a logical standby role. Step 3: Prepare the Primary Database to Support a Logical Standby Database Perform the following steps to prepare the primary database to support a logical standby database: a. Use the ALTER SYSTEM SET SCOPE=BOTH command to dynamically set the LOG_ARCHIVE_DEST_n initialization parameters. STANDBY_ROLE) DB_UNIQUE_NAME=chicago' LOG_ARCHIVE_DEST_STATE_3=enable c.203 . This parameter takes effect only when the primary database is transitioned to the standby database role. To transition the primary database to a logical standby database role. LOG_ARCHIVE_DEST_3= 'LOCATION=/arch/chicago/ VALID_FOR=(STANDBY_LOGFILES. Prepare the primary database for role transitions by setting LOG_ARCHIVE_DEST_n parameters appropriately. Oracle Database 10g: Data Guard Administration 1 . The value of 3600 is recommended for best results when building a LogMiner dictionary for the logical standby database. Set the value of UNDO_RETENTION to 3600.ALL_ROLES) of the primary database. All rights reserved. Modify the LOG_ARCHIVE_DEST_1 parameter to be valid for (ONLINE_LOGFILES. b. Set the UNDO_RETENTION initialization parameter to 3600. you must modify the initialization parameters on the primary database so that no parameters need to change after a role transition. Oracle. c. b.Step 3: Prepare the Primary Database to Support a Logical Standby Database a. 8 . To transition the primary database to the logical standby role. The UNDO_RETENTION parameter specifies (in seconds) the amount of committed undo information to retain in the database.203 Copyright © 2006.

All rights reserved. Step 4: Build a LogMiner Dictionary in the Redo Data SQL Apply requires a LogMiner dictionary in the redo data so that it can properly interpret changes in the redo.BUILD procedure. • Supplemental logging is automatically enabled.204 Copyright © 2006.BUILD procedure waits for all existing transactions to complete so long-running transactions executing on the primary database will affect its operation. Oracle Database 10g: Data Guard Administration 1 . the LogMiner dictionary is built and supplemental logging is automatically enabled for logging primary key and unique-constraint/index columns.204 .Step 4: Build a LogMiner Dictionary in the Redo Data • Build a LogMiner dictionary in the redo data so that SQL Apply can properly interpret changes in the redo. When you execute the DBMS_LOGSTDBY. SQL> EXECUTE DBMS_LOGSTDBY. Oracle. Note: The DBMS_LOGSTDBY. 8 .BUILD.

c. Create a new password file using the orapwd utility.Archived redo log files that store redo data received the the primary database Modify the LOG_ARCHIVE_DEST_1 parameter to be valid for (ONLINE_LOGFILES. c. Adjust initialization parameters: LOG_ARCHIVE_DEST_n 8 .205 . Modify the LOG_ARCHIVE_DEST_n parameters to specify separate local destinations for: . b. 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. b. Shut down the instance and restart it in MOUNT mode. All rights reserved. Issue the ALTER DATABASE RECOVER TO LOGICAL STANDBY db_name command to continue applying redo data to the physical standby database until it is ready to convert to a logical standby database. The statement applies redo data until the LogMiner dictionary is found in the redo log files.ALL_ROLES). Shut down the logical standby database instance and restart it in MOUNT mode. Specify a database name (db_name) to identify the new logical standby database.Archived redo log files that store redo data generated by the logical standby database .Step 5: Transition to a Logical Standby Database a. Oracle.205 Copyright © 2006. SQL> ALTER DATABASE RECOVER TO 2 LOGICAL STANDBY db_name. Oracle Database 10g: Data Guard Administration 1 . Convert to a logical standby database. You must create a new password file because the conversion process changes the database name for the logical standby database. d. d. The redo log files contain the information needed to convert your physical standby database to a logical standby database. Create a new password file.

b.206 Copyright © 2006. All rights reserved. Oracle. On the logical standby database.206 . Start the application of redo data to the logical standby database: SQL> ALTER DATABASE START LOGICAL STANDBY 2 APPLY IMMEDIATE. On the logical standby database. Open the new logical standby database with the RESETLOGS option: SQL> ALTER DATABASE OPEN RESETLOGS. 8 . issue the ALTER DATABASE OPEN RESETLOGS command to open the database. b.Step 6: Open the Logical Standby Database a. issue the following command to start SQL Apply: ALTER DATABASE START LOGICAL STANDBY APPLY IMMEDIATE Oracle Database 10g: Data Guard Administration 1 . Step 6: Open the Logical Standby Database Perform the following steps to open the logical standby database and start SQL Apply: a.

Begin sending redo data to the standby database: SQL> ALTER SYSTEM ARCHIVE LOG CURRENT. This enables you to verify that the new archived redo log files were registered. NEXT_TIME.Step 7: Verify That the Logical Standby Database Is Performing Properly a. NEXT_TIME. Connect to the logical standby database and query the DBA_LOGSTDBY_LOG view to verify that the archived redo log files were registered on the logical standby system: SQL> SELECT SEQUENCE#. 2 DICT_BEGIN. you should verify that redo data is being transmitted from the primary database and applied to the standby database. Oracle Database 10g: Data Guard Administration 1 . All rights reserved. FIRST_TIME. Verify that the archived redo log files were registered: SQL> SELECT SEQUENCE#. Oracle.DICT_END 3 FROM DBA_LOGSTDBY_LOG ORDER BY SEQUENCE#. FIRST_TIME. Query the DBA_LOGSTDBY_LOG view to verify that the archived redo log files were registered.207 . DICT_END 3 FROM DBA_LOGSTDBY_LOG ORDER BY SEQUENCE#. b. Perform the following steps to verify that the logical standby database is functioning properly: a. c. 2 DICT_BEGIN. set up redo transport services. c. Step 7: Verify That the Logical Standby Database Is Performing Properly After you create your logical standby database. 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. 8 . Connect to the logical standby database and re-query the DBA_LOGSTDBY_LOG view as shown in step a. b.207 Copyright © 2006. and log apply services.

VALUE FROM V$LOGSTDBY_STATS 2 WHERE NAME = 'coordinator state'. e. LATEST_SCN 2 FROM V$LOGSTDBY_PROGRESS. f. View the V$LOGSTDBY view to see current SQL Apply activity: SQL> SELECT TYPE. f. Check the overall progress of SQL Apply: SQL> SELECT APPLIED_SCN. HIGH_SCN. e. Oracle.208 Copyright © 2006. A text message describing the current activity of each process that is involved in reading and applying changes is displayed. query the V$LOGSTDBY_STATS view to verify that redo data is being applied correctly: SQL> SELECT NAME. LATEST_SCN 2 FROM V$LOGSTDBY_PROGRESS. Oracle Database 10g: Data Guard Administration 1 . Query the V$LOGSTDBY view on the logical standby database to see a current snapshot of SQL Apply activity. Step 7: Verify That the Logical Standby Database Is Performing Properly (continued) d. On the logical standby database. A value of INITIALIZING in the VALUE column indicates that log apply services are preparing to begin SQL Apply.208 . All rights reserved. STATUS 2 FROM V$LOGSTDBY. Query the V$LOGSTDBY_PROGRESS view on the logical standby database to check the overall progress of SQL Apply: SQL> SELECT APPLIED_SCN. Verify that redo data is being applied correctly: SQL> SELECT NAME.Step 7: Verify That the Logical Standby Database Is Performing Properly d. 8 . but data from the archived redo log files is not being applied to the logical standby database. VALUE FROM V$LOGSTDBY_STATS 2 WHERE NAME = 'coordinator state'.

However. enabling you to return a database to its state at a time in the recent past.209 . Data Guard can recover and apply more redo data from standby redo log files than from the archived redo log files alone. 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. 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. • Upgrade the data protection mode: The Data Guard configuration is initially set up in maximum performance mode (the default). The standby redo logs should exist on both primary and standby databases and have the same size and names.Additional Configuration Tasks Perform the following tasks as appropriate for your configuration: • Configure standby redo logs. • Upgrade the data protection mode. or both. Oracle Database 10g: Data Guard Administration 1 . Oracle. • Enable Flashback Database: Flashback Database eliminates the need to re-create the primary database after a failover.209 Copyright © 2006. • Enable Flashback Database. You can enable Flashback Database on the primary database. the standby database.in-time recovery in its effects. Flashback Database is similar to conventional point. 8 . All rights reserved. during a failover. configuring standby redo logs is recommended on all standby databases because.

Summary In this lesson.210 . you should have learned how to use SQL commands to create a logical standby database.210 Copyright © 2006. 8 . All rights reserved. Oracle Database 10g: Data Guard Administration 1 . Oracle.

Creating a Logical Standby Database by Using SQL 8 Copyright © 2006. . Oracle. All rights reserved.

Oracle Database 10g: Data Guard Administration 1 .212 Copyright © 2006. Oracle.Objectives After completing this lesson. All rights reserved. 8 . you should be able to use SQL commands to create a logical standby database.212 .

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. 8 .213 . Preparing to Create a Logical Standby Database These tasks were covered in the “Creating a Logical Standby Database by Using Enterprise Manager” lesson. • Enable supplemental logging. • Check the values of the initialization parameters. 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) Oracle Database 10g: Data Guard Administration 1 . • Verify that the primary database is configured for ARCHIVELOG mode.213 Copyright © 2006.Preparing to Create a Logical Standby Database As preparation for creating a logical standby database. • Ensure row uniqueness. Oracle. All rights reserved. • Be aware of unsupported DDL commands. perform the following steps on the primary database: • Check for unsupported data types.

Stop Redo Apply on the physical standby database.214 . Prepare the primary database to support a logical standby database. 2.214 Copyright © 2006. Open the logical standby database.Creating a Logical Standby Database To create a logical standby database by using SQL commands: 1. Oracle. Build a LogMiner Dictionary in the redo data. 7. 3. Verify that the logical standby database is performing properly. Convert to a logical standby database. Creating a Logical Standby Database Each of these steps is outlined in detail in the remainder of this lesson. Create a physical standby database. Oracle Database 10g: Data Guard Administration 1 . All rights reserved. 5. 6. 8 . 4.

Create a physical standby database.215 . including all database structural changes (such as adding or dropping data files). Ensure that the physical standby database is caught up to the primary database. Oracle. Oracle Database 10g: Data Guard Administration 1 . b. All rights reserved.215 Copyright © 2006.” b. Then you convert the physical standby database into a logical standby database. Create a physical standby database as described in the lesson titled “Creating a Physical Standby Database by Using SQL.Step 1: Create a Physical Standby Database a. 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. Step 1: Create a Physical Standby Database You create a logical standby database by first creating a physical standby database. To create the physical standby database: a. 8 .

216 Copyright © 2006. stop Redo Apply. • Required to avoid applying changes past the redo that contains the LogMiner dictionary. All rights reserved. Oracle Database 10g: Data Guard Administration 1 .216 . Oracle. Step 2: Stop Redo Apply on the Physical Standby Database Before converting the physical standby database to a logical standby database. you must stop Redo Apply by issuing the ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL command. 8 .Step 2: Stop Redo Apply on the Physical Standby Database • Before converting the physical standby database to a logical standby database. SQL> ALTER DATABASE RECOVER MANAGED STANDBY 2 DATABASE CANCEL.

include the LOG_ARCHIVE_DEST_3 destination on the primary database. STANDBY_ROLE) DB_UNIQUE_NAME=chicago' LOG_ARCHIVE_DEST_STATE_3=enable c. Modify the LOG_ARCHIVE_DEST_1 parameter to be valid for (ONLINE_LOGFILES. c. Set the UNDO_RETENTION initialization parameter to 3600. LOG_ARCHIVE_DEST_3= 'LOCATION=/arch/chicago/ VALID_FOR=(STANDBY_LOGFILES. you must modify the initialization parameters on the primary database so that no parameters need to change after a role transition.217 Copyright © 2006. Oracle. b.Step 3: Prepare the Primary Database to Support a Logical Standby Database a. Oracle Database 10g: Data Guard Administration 1 . To transition the primary database to the logical standby role. To transition the primary database to a logical standby database role. Set the value of UNDO_RETENTION to 3600. This parameter takes effect only when the primary database is transitioned to the standby database role. Set the LOG_ARCHIVE_DEST_3 initialization parameter for transitioning to a logical standby role. All rights reserved. The value of 3600 is recommended for best results when building a LogMiner dictionary for the logical standby database. Step 3: Prepare the Primary Database to Support a Logical Standby Database Perform the following steps to prepare the primary database to support a logical standby database: a. b. Prepare the primary database for role transitions by setting LOG_ARCHIVE_DEST_n parameters appropriately. Use the ALTER SYSTEM SET SCOPE=BOTH command to dynamically set the LOG_ARCHIVE_DEST_n initialization parameters. The UNDO_RETENTION parameter specifies (in seconds) the amount of committed undo information to retain in the database.ALL_ROLES) of the primary database. 8 .217 .

• Supplemental logging is automatically enabled.BUILD. Step 4: Build a LogMiner Dictionary in the Redo Data SQL Apply requires a LogMiner dictionary in the redo data so that it can properly interpret changes in the redo.218 Copyright © 2006. All rights reserved. 8 .BUILD procedure. Oracle Database 10g: Data Guard Administration 1 . the LogMiner dictionary is built and supplemental logging is automatically enabled for logging primary key and unique-constraint/index columns. SQL> EXECUTE DBMS_LOGSTDBY. Note: The DBMS_LOGSTDBY.218 .Step 4: Build a LogMiner Dictionary in the Redo Data • Build a LogMiner dictionary in the redo data so that SQL Apply can properly interpret changes in the redo. When you execute the DBMS_LOGSTDBY.BUILD procedure waits for all existing transactions to complete so long-running transactions executing on the primary database will affect its operation. Oracle.

c.Archived redo log files that store redo data generated by the logical standby database . Specify a database name (db_name) to identify the new logical standby database. Convert to a logical standby database.219 Copyright © 2006. Issue the ALTER DATABASE RECOVER TO LOGICAL STANDBY db_name command to continue applying redo data to the physical standby database until it is ready to convert to a logical standby database. The statement applies redo data until the LogMiner dictionary is found in the redo log files. Shut down the instance and restart it in MOUNT mode. Create a new password file. Adjust initialization parameters: LOG_ARCHIVE_DEST_n 8 . d. Oracle Database 10g: Data Guard Administration 1 . The redo log files contain the information needed to convert your physical standby database to a logical standby database.219 . b. Create a new password file using the orapwd utility.Archived redo log files that store redo data received the the primary database Modify the LOG_ARCHIVE_DEST_1 parameter to be valid for (ONLINE_LOGFILES. d. c. 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. You must create a new password file because the conversion process changes the database name for the logical standby database. All rights reserved. Shut down the logical standby database instance and restart it in MOUNT mode. Oracle.ALL_ROLES). Modify the LOG_ARCHIVE_DEST_n parameters to specify separate local destinations for: . b. SQL> ALTER DATABASE RECOVER TO 2 LOGICAL STANDBY db_name.Step 5: Transition to a Logical Standby Database a.

b. issue the following command to start SQL Apply: ALTER DATABASE START LOGICAL STANDBY APPLY IMMEDIATE Oracle Database 10g: Data Guard Administration 1 . Oracle. All rights reserved. issue the ALTER DATABASE OPEN RESETLOGS command to open the database. Step 6: Open the Logical Standby Database Perform the following steps to open the logical standby database and start SQL Apply: a. Start the application of redo data to the logical standby database: SQL> ALTER DATABASE START LOGICAL STANDBY 2 APPLY IMMEDIATE.220 Copyright © 2006.Step 6: Open the Logical Standby Database a. 8 . On the logical standby database. Open the new logical standby database with the RESETLOGS option: SQL> ALTER DATABASE OPEN RESETLOGS.220 . On the logical standby database. b.

2 DICT_BEGIN. Connect to the logical standby database and query the DBA_LOGSTDBY_LOG view to verify that the archived redo log files were registered on the logical standby system: SQL> SELECT SEQUENCE#. Connect to the logical standby database and re-query the DBA_LOGSTDBY_LOG view as shown in step a. b. c.DICT_END 3 FROM DBA_LOGSTDBY_LOG ORDER BY SEQUENCE#. 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. FIRST_TIME. FIRST_TIME. All rights reserved. Begin sending redo data to the standby database: SQL> ALTER SYSTEM ARCHIVE LOG CURRENT. Verify that the archived redo log files were registered: SQL> SELECT SEQUENCE#. Oracle. you should verify that redo data is being transmitted from the primary database and applied to the standby database.221 Copyright © 2006. 2 DICT_BEGIN. This enables you to verify that the new archived redo log files were registered. and log apply services. Query the DBA_LOGSTDBY_LOG view to verify that the archived redo log files were registered.Step 7: Verify That the Logical Standby Database Is Performing Properly a. b. Step 7: Verify That the Logical Standby Database Is Performing Properly After you create your logical standby database. NEXT_TIME. 8 . c. Perform the following steps to verify that the logical standby database is functioning properly: a. set up redo transport services. DICT_END 3 FROM DBA_LOGSTDBY_LOG ORDER BY SEQUENCE#.221 . Oracle Database 10g: Data Guard Administration 1 . NEXT_TIME.

Step 7: Verify That the Logical Standby Database Is Performing Properly d. e. Query the V$LOGSTDBY_PROGRESS view on the logical standby database to check the overall progress of SQL Apply: SQL> SELECT APPLIED_SCN. f. query the V$LOGSTDBY_STATS view to verify that redo data is being applied correctly: SQL> SELECT NAME.222 Copyright © 2006. VALUE FROM V$LOGSTDBY_STATS 2 WHERE NAME = 'coordinator state'. STATUS 2 FROM V$LOGSTDBY. 8 . All rights reserved. A value of INITIALIZING in the VALUE column indicates that log apply services are preparing to begin SQL Apply.222 . e. On the logical standby database. LATEST_SCN 2 FROM V$LOGSTDBY_PROGRESS. LATEST_SCN 2 FROM V$LOGSTDBY_PROGRESS. Verify that redo data is being applied correctly: SQL> SELECT NAME. HIGH_SCN. Check the overall progress of SQL Apply: SQL> SELECT APPLIED_SCN. Step 7: Verify That the Logical Standby Database Is Performing Properly (continued) d. VALUE FROM V$LOGSTDBY_STATS 2 WHERE NAME = 'coordinator state'. Query the V$LOGSTDBY view 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. but data from the archived redo log files is not being applied to the logical standby database. Oracle Database 10g: Data Guard Administration 1 . f. View the V$LOGSTDBY view to see current SQL Apply activity: SQL> SELECT TYPE. Oracle.

enabling you to return a database to its state at a time in the recent past. configuring standby redo logs is recommended on all standby databases because.Additional Configuration Tasks Perform the following tasks as appropriate for your configuration: • Configure standby redo logs. All rights reserved. • Upgrade the data protection mode: The Data Guard configuration is initially set up in maximum performance mode (the default). or both. The standby redo logs should exist on both primary and standby databases and have the same size and names. 8 .in-time recovery in its effects. Flashback Database is similar to conventional point. the standby database.223 . However. Oracle. • Upgrade the data protection mode. Data Guard can recover and apply more redo data from standby redo log files than from the archived redo log files alone. You can enable Flashback Database on the primary database.223 Copyright © 2006. 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. • Enable Flashback Database. during a failover. 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. Oracle Database 10g: Data Guard Administration 1 . • Enable Flashback Database: Flashback Database eliminates the need to re-create the primary database after a failover.

Oracle Database 10g: Data Guard Administration 1 .224 .Summary In this lesson. Oracle. you should have learned how to use SQL commands to create a logical standby database.224 Copyright © 2006. 8 . All rights reserved.

Oracle. All rights reserved.Performing Switchover and Failover 9 Copyright © 2006. .

226 Copyright © 2006. you should be able to do the following: • Explain the database roles • Perform a switchover • Perform a failover • Use Flashback Database after a failover 9 . All rights reserved. Oracle Database 10g: Data Guard Administration 1 .Objectives After completing this lesson. Oracle.226 .

All rights reserved. Types of Roles in an Oracle Data Guard Configuration User roles are named groups of related privileges that you grant to users or other user roles. Database roles identify what “part” the database is “playing” in the Data Guard configuration. SQL> SELECT database_role FROM v$database. Oracle. • Database role: identifies what role (primary or standby) the database plays in a Data Guard configuration.Types of Roles in an Oracle Data Guard Configuration There are two types of roles in an Oracle Data Guard configuration: • User role: identifies the group and determines the privileges assigned to a user. User roles are designed to ease the administration of the end-user system and schema object privileges. 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 Oracle Database 10g: Data Guard Administration 1 .227 Copyright © 2006.227 . DATABASE_ROLE ---------------LOGICAL STANDBY 9 .

• With role management services. All rights reserved. Oracle Database 10g: Data Guard Administration 1 . and log apply services are applying the archived redo logs to the standby database.228 .228 Copyright © 2006. 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. – Standby role: The database is operating in the standby role. Oracle. you can change these roles dynamically. and redo transport services are shipping redo to the standby databases. 9 . or as a result of a database failure through a failover operation.Role Management Services • A database operates in one of two mutually exclusive roles in a Data Guard configuration: – Primary role: The database is operating in the primary role. Role Management Services You can use role management services to change the primary and standby roles dynamically as a planned transition called a switchover operation. For example.

229 Copyright © 2006.line interface (CLI). There is no need to re-create any of the databases in the switchover operation.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 failover 9 . Role Transitions: Switchover and Failover Switchover and failover operations are not invoked automatically. All rights reserved. There is no data divergence between the original and the new primary database after the successful completion of the database switchover.229 . Switchover You can use the switchover feature to switch the role of the primary database to one of the available standby databases. and the original primary database then becomes a standby database. Oracle Database 10g: Data Guard Administration 1 . The chosen standby database becomes the primary database. Oracle. You must initiate switchover or failover operations by using a SQL statement or by using the Data Guard GUI or Data Guard broker command.

the broker determines if a failover is necessary and initiates the failover to the specified target standby database automatically. When fast-start failover is enabled.Role Transitions: Switchover and Failover (continued) Failover You invoke a failover operation when a catastrophic failure occurs on the primary database.230 . the incapacitated primary database is removed from the Data Guard environment and a standby database assumes the primary database role. Note: You can enable fast-start failover to fail over automatically when the primary database becomes unavailable. and there is no possibility of recovering the primary database in a timely manner.” Oracle Database 10g: Data Guard Administration 1 . with no need for DBA intervention and with no loss of data. You invoke the failover operation on the standby database that you want to fail over to the primary role. During a failover operation. Fast-start failover is discussed in detail in the lesson titled “Enabling Fast-Start Failover.

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.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? Yes Switch over to best available standby database. All rights reserved. No Fail over to best available standby database. Oracle. No Can you run crash recovery to repair the primary database in a timely manner? Yes Repair primary database. In general. In general. you should always consider performing crash recovery to repair the primary database or performing a switchover before you consider performing a failover. 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. Repairing the primary database may be faster than transitioning a standby database to the primary role. Oracle Database 10g: Data Guard Administration 1 .231 Copyright © 2006.231 . even when you are using a no-data-loss environment. the best standby database to transition to is a physical standby database that has the most redo applied to it. However. If you can repair the primary 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. you also do not have to reconfigure client applications to connect to a new database. 9 .

If the switchover operation involves a physical standby database. Logical standby databases do not need to be shut down and restarted. Oracle. there is no need to shut down and restart either the primary database or any of the standby databases. Switchover A switchover operation transitions the primary database to the standby role and transitions the standby database to the primary role. If the switchover operation involves a logical standby database.232 . All rights reserved. However.Switchover • Transitions the roles of the primary and standby databases • No resetting of the online redo logs of the new primary database • No data loss 9 .232 Copyright © 2006. without resetting the online redo logs of the new primary database. there is no need to shut down and restart any other standby databases that are not participants in the switchover operation. both the primary database and the physical standby database switching over to the primary role will be shut down and restarted. Oracle Database 10g: Data Guard Administration 1 . Note: All extra RAC instances will be shut down and restarted.

233 . Switchovers are initiated only on the primary database. All rights reserved.Switchover: Before Read/write transactions Primary database Application San Francisco Boston Oracle Net Standby database Read-only reports Application 9 . They cannot be initiated from the standby database.233 Copyright © 2006. Oracle Database 10g: Data Guard Administration 1 . Oracle. Switchover: Before For example. assume that the primary database is located in San Francisco and the physical standby database is located in Boston.

234 . so active sessions for each system need to reconnect.234 Copyright © 2006. In our example. Oracle Database 10g: Data Guard Administration 1 . Data Guard does not automatically switch over sessions from one database to the other. each database has the role opposite to the one that it had before the switchover. Switchover: After After the switchover completes. Oracle. All rights reserved.Switchover: After Read-only reports Standby database Application San Francisco Boston Oracle Net Primary database Read/write transactions Application 9 . Boston is now the primary database and San Francisco is the standby database.

Standby Redo Logs and Switchovers Standby redo log configuration should be identical on the primary database and on any physical standby databases. Oracle. Online redo logs Standby redo logs Redo shipment Primary database Standby database RFS Standby redo logs 9 . Oracle Database 10g: Data Guard Administration 1 .Standby Redo Logs and Switchovers Standby redo logs should be configured on the primary database to ease switchovers. All rights reserved. Even though the standby redo logs are not used when the database is in the primary role.235 Copyright © 2006.235 . configuring the standby redo logs on the primary database is recommended in preparation for an eventual switchover operation.

Oracle Database 10g: Data Guard Administration 1 . 9 .236 .236 Copyright © 2006. Oracle. 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. All rights reserved.Preparing for a Switchover Verify the following in preparation for the switchover operation: network connectivity between the primary and standby locations.

To initiate a switchover by using Enterprise Manager: 1. c. Any active sessions connected to the primary database are automatically closed during the switchover. All rights reserved.237 Copyright © 2006. 2. 9 .237 . Performing a Switchover with Enterprise Manager The following tasks are performed when Enterprise Manager is used for the switchover: a. select the standby database that you want to become the primary database. Click Switchover. Oracle Database 10g: Data Guard Administration 1 . d.Performing a Switchover by Using Enterprise Manager Select the database and click Switchover. 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. If the switchover target is a physical standby database. and then the standby database is changed to the primary role. Oracle. the target and primary databases are each restarted. The primary database is first changed to the standby role. b. On the Data Guard page.

Oracle. The Data Guard Switchover Confirmation page appears.238 Copyright © 2006. You can view active sessions by clicking the Browse Primary Database Sessions link. Click Yes to continue with the switchover. 9 . All rights reserved. 5.Performing a Switchover by Using Enterprise Manager Click Yes to confirm. Performing a Switchover with Enterprise Manager (continued) 3. You cannot cancel the switchover operation after it has begun. or click No to cancel. Oracle Database 10g: Data Guard Administration 1 . 4.238 .

Oracle. • Wait for the Data Guard broker to complete the initialization tasks required to switch the database roles.Performing a Switchover by Using Enterprise Manager 9 . You can view the database alert log of the primary and standby databases by clicking the respective “View alert log” links. All rights reserved.239 Copyright © 2006. If the switchover target is a physical standby database. you are returned to the Data Guard page. Oracle Database 10g: Data Guard Administration 1 . After the switchover operation is complete. A new browser window opens with the content of the alert log.239 . it is restarted along with the primary database. Performing a Switchover with Enterprise Manager (continued) 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.

as described in the following steps. SQL> STARTUP MOUNT. Verify that it is possible to perform a switchover operation. Shut down the instance and restart the database in MOUNT mode: SQL> SHUTDOWN IMMEDIATE. Query the SWITCHOVER_STATUS column of the V$DATABASE view on the primary database to verify that it is possible to perform a switchover operation. To transition the primary database to a physical standby database role. Consider using the Data Guard broker to automate and simplify the switchover procedure. execute the following SQL statement: SQL> ALTER DATABASE COMMIT TO SWITCHOVER TO 2 PHYSICAL STANDBY WITH SESSION SHUTDOWN WAIT. 2. All rights reserved. 9 . On the original primary database: 1. You should not execute these steps when managing your configuration with the Data Guard broker. Shut down and restart the instance. Performing a Switchover to a Physical Standby by Using SQL You can perform a switchover using SQL. 3. Initiate the switchover operation on the primary database: SQL> ALTER DATABASE COMMIT TO SWITCHOVER TO 2 PHYSICAL STANDBY. Execute steps 1 through 3 on the original primary database: 1. 2. Oracle Database 10g: Data Guard Administration 1 . 3. The WAIT option specifies that control is not returned to you until the statement completes.240 .Performing a Switchover to a Physical Standby by Using SQL Perform these steps only if you are not using the Data Guard broker.240 Copyright © 2006. Oracle. A TO STANDBY value in the SWITCHOVER_STATUS column indicates that it is possible to switch the primary database to the standby role.

shut down and restart the new primary database. If it was not opened read-only. 4. Oracle. open the database. you should verify that the switchover notification has been processed by the standby database by querying the SWITCHOVER_STATUS column of the V$DATABASE fixed view on the standby database. SQL> STARTUP. If it was not opened read-only. Switch the physical standby database role to the primary role. Begin archiving logs to the physical standby database.241 Copyright © 2006.Performing a Switchover to a Physical Standby by Using SQL On the original physical standby database: 1. 7. open the database with the ALTER DATABASE OPEN command. Issue the following statement on the new primary database to start redo transport: SQL> ALTER SYSTEM SWITCH LOGFILE. 3. The selected physical standby database is now transitioned to the primary database role. 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. Oracle Database 10g: Data Guard Administration 1 . If the standby database was opened read-only. Verify the switchover status in the V$DATABASE view. You should see a value of TO_PRIMARY. SQL> SHUTDOWN IMMEDIATE. Performing a Switchover to a Physical Standby by Using SQL (continued) Execute steps 4 through 7 on the original standby database: 4. 5. 2.241 . After you switch the primary database to the standby role and the switchover notification has been received by the standby database. There is no need to shut down and restart any other standby databases that were online at the time of the switchover operation. shut down and restart the new primary database. If the standby database was opened read-only. 9 . All rights reserved.

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.242 Copyright © 2006. you must always initiate the switchover on the primary database and complete it on the logical standby database. Prepare the primary database for the switchover: SQL> ALTER DATABASE PREPARE TO SWITCHOVER 2 TO LOGICAL STANDBY. Oracle. All rights reserved. Oracle Database 10g: Data Guard Administration 1 . A TO STANDBY or SESSIONS ACTIVE value in the SWITCHOVER_STATUS column indicates that it is possible to switch the primary database to the standby role.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. 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. Perform steps 1 and 2 on the original primary database: 1.242 . 2. 9 . Performing a Switchover to a Logical Standby by Using SQL When you perform a switchover that changes roles between a primary database and a logical standby database. 2. Query the SWITCHOVER_STATUS column of the V$DATABASE view on the primary database to verify that it is possible to perform a switchover operation.

243 Copyright © 2006. 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.Performing a Switchover to a Logical Standby by Using SQL On the original logical standby database: 3. Oracle. All rights reserved. Oracle Database 10g: Data Guard Administration 1 . The sites receiving redo data from this logical standby database accept the redo data. Performing a Switchover to a Logical Standby by Using SQL (continued) Perform step 3 on the logical standby database: 3. 9 .243 . Prepare the logical standby database for switchover: SQL> ALTER DATABASE PREPARE TO SWITCHOVER 2 TO PRIMARY. 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. but they do not apply it.

When the query returns TO LOGICAL STANDBY in the SWITCHOVER_STATUS column. Oracle Database 10g: Data Guard Administration 1 . 5. All rights reserved. Executing this statement also prevents users from making any changes to the data being maintained in the logical standby database. 9 .Performing a Switchover to a Logical Standby by Using SQL On the original primary database: 4.244 Copyright © 2006. 5. Performing a Switchover to a Logical Standby by Using SQL (continued) Perform steps 4 and 5 on the original primary database: 4. proceed with step 5. Switch the primary database to the logical standby database role: SQL> ALTER DATABASE COMMIT TO SWITCHOVER 2 TO LOGICAL STANDBY. It also puts a marker in the redo data to provide a synchronization point for logical standby database operations.244 . 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. You can query V$TRANSACTIONS for the status of any current in-progress transactions that could delay execution of this statement. ensure that the primary database is in a quiet state with no update activity before issuing the switchover statement. Verify the switchover status in V$DATABASE. To ensure faster execution. Verify that the LogMiner dictionary was received by the primary database by querying the SWITCHOVER_STATUS column of V$DATABASE on the primary database. Oracle. This statement waits for all current transactions on the primary database to end and prevents any new users from starting new transactions.

7. Issue the following SQL statement to switch the logical standby database to the primary role: SQL> ALTER DATABASE COMMIT TO SWITCHOVER TO PRIMARY. When the status is TO PRIMARY. All rights reserved. Verify the switchover status in V$DATABASE.Performing a Switchover to a Logical Standby by Using SQL On the new primary database (original logical standby database): 6.245 . SQL> ALTER SYSTEM ARCHIVE LOG CURRENT. 9 . proceed with step 7. 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. 7. Performing a Switchover to a Logical Standby by Using SQL (continued) Perform steps 6. Oracle Database 10g: Data Guard Administration 1 . The SWITCHOVER_STATUS value is updated to show progress during the switchover. SQL> ALTER DATABASE COMMIT TO SWITCHOVER 2 TO PRIMARY.245 Copyright © 2006. Oracle. 7. Ensure that all standby databases begin receiving redo data. Verify that the switchover notification was processed by the target standby database by querying the SWITCHOVER_STATUS column of the V$DATABASE fixed view on the target standby database. Switch the logical standby database to the primary database role. and 8 on the new primary database (original logical standby database): 6. 8.

All rights reserved. SQL> ALTER DATABASE 2 START LOGICAL STANDBY APPLY.246 Copyright © 2006.246 . Oracle. Oracle Database 10g: Data Guard Administration 1 . Issue the following statement to start SQL Apply: SQL> ALTER DATABASE START LOGICAL STANDBY APPLY. 9 . Performing a Switchover to a Logical Standby by Using SQL (continued) Perform step 9 on the new logical standby database: 9.Performing a Switchover to a Logical Standby by Using SQL On the new logical standby database: 9. Start SQL Apply.

The database guard prevents users from making changes in the logical standby database. • There is no need to terminate user sessions. All rights reserved. • If you switch over to a logical standby database.Considerations When Performing a Switchover to a Logical Standby Database • Switchover operation does not cause a shutdown of the primary. because sessions on the old primary database may fail after the switchover operation completes and the database guard is turned on.247 Copyright © 2006. Considerations When Performing a Switchover to a Logical Standby Database Consider the following when performing a switchover to a logical standby database: • Unlike a switchover to a physical 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. you should terminate such open sessions now. However. Oracle Database 10g: Data Guard Administration 1 . • If you are switching over to a logical standby database. • Logical standby database may not have all data. a switchover to a logical standby database does not require a shutdown of the primary database. because neither database is shut down during the switchover operation. but termination is recommended. you do not need to terminate applications that are connected to the current primary database or to the logical standby database. 9 .247 . Oracle.

You cannot switch over to a time in the past.Situations That Prevent a Switchover You cannot perform a switchover in the following situations: • Archived redo log files are unavailable. • Production database is not open and cannot be opened. • Production database is not open and cannot be opened: A switchover is initiated on the primary database while it is in the open state. 9 . a switchover is not possible. Oracle. you always switch over to the current state of the primary database. If you cannot open the primary database. • Point-in-time recovery is required. you are not able to switch over to that standby database. All rights reserved. Oracle Database 10g: Data Guard Administration 1 .248 Copyright © 2006.248 . • Point-in-time recovery is required: When you perform a switchover to a standby database. 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.

• Standby databases that are online at the time of the failover operation. You cannot undo the failover and return the database to its former role as a standby database. recovery of the primary database may be faster. do not need to be shut down and restarted. In some cases. but are not involved in the role transition. Failing over to a standby database is a permanent operation.249 . you should invoke a failover operation only in an emergency. During a failover operation. Most failures can be resolved at a primary database within a reasonable amount of time.Failover Local Archiving Primary database San Francisco Boston Online Redo Logs Archived redo logs Application Read/write transactions Local archiving Standby Online redo database becomes logs primary database. the primary database is removed from the Data Guard environment and a standby database assumes the primary database role. It is not always necessary to fail over to the standby database. You must re-create (or flash back) the original primary database as a new standby database. 9 . All rights reserved.249 Copyright © 2006. Oracle. if desired. In a failover operation: • The original primary database is presumed to be lost. Because of this. Archived redo logs 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. Oracle Database 10g: Data Guard Administration 1 .

and the specific SQL commands that are used to initiate the failover. This should be avoided unless absolutely necessary because it causes all other databases in the configuration to become permanently disabled. 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. Depending on the protection mode under which the old primary database was operating before the failover. 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. Oracle Database 10g: Data Guard Administration 1 . the state of the configuration at the time of the failover. there may be some or no data loss during a failover. • Failover should be used only in an emergency.250 . Oracle. All rights reserved. a standby database transitions to the primary role and the old primary database is rendered unable to participate in the configuration.Failover Considerations • Old primary database is no longer part of the configuration. • Special-case failover: activation of a standby 9 . • Data loss is possible. There is also a special-case failover in which the standby database is activated. Failover Considerations During a failover operation.250 Copyright © 2006.

To initiate a failover by using Enterprise Manager: 1. The failed primary database is disabled by the broker and must be re-created. 2. Click Failover. Oracle.251 Copyright © 2006. On the Data Guard page. All rights reserved. The standby database then assumes the primary database role. 9 . 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. Oracle Database 10g: Data Guard Administration 1 .251 . select the standby database that you want to become the primary database.Performing a Failover by Using Enterprise Manager Select the database and click Failover.

Performing a Failover with Enterprise Manager (continued) 3.252 Copyright © 2006.Performing a Failover by Using Enterprise Manager 9 .252 . All rights reserved. Oracle. Confirm that you want to proceed with the failover operation by clicking Yes. Oracle Database 10g: Data Guard Administration 1 .

. you must specify the type of failover that you want to perform: .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. Oracle Corporation recommends that you specify this type of failover.253 Copyright © 2006.253 . 5. Select the failover option. Performing a Failover with Enterprise Manager (continued) 4. All rights reserved.Complete: All available redo is applied on the standby database. Oracle Database 10g: Data Guard Administration 1 . 9 . and then click Yes to confirm the failover operation. On the Data Guard Failover Confirmation page.Performing a Failover by Using Enterprise Manager Select the failover type and click Yes. Oracle.

254 . Oracle. Oracle Database 10g: Data Guard Administration 1 .254 Copyright © 2006. Performing a Failover with Enterprise Manager (continued) After you click Yes. the Failover Processing page shows you the progress of the failover operation. All rights reserved.Performing a Failover by Using Enterprise Manager 9 . You cannot cancel this operation after it begins.

the primary database and some standby databases may need to be reinstated or re-created. Enterprise Manager reinstates the database as a standby database to the new primary database. When the operation is completed. 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. To reinstate the database.Performing a Failover to a Physical Standby Database The physical standby database needs to be reinstated. Performing a Failover to a Physical Standby Database During the failover operation. it is not restarted.255 . 9 .255 Copyright © 2006. click the “Database must be reinstated” link. Click Reinstate on the General Properties page. the selected standby database transitions into the primary role. All rights reserved. the database to be reinstated and the new primary database must have network connectivity. it is restarted. After a complete or immediate failover. Oracle. the Data Guard Overview page reflects the updated configuration. If you are failing over to a logical standby database. In addition. If the failover target is a physical standby database. Oracle Database 10g: Data Guard Administration 1 .

The physical standby database is disabled.256 . any physical standby databases in the configuration are permanently disabled after the failover and are no longer usable. All rights reserved. Oracle Database 10g: Data Guard Administration 1 . 9 .Performing a Failover to a Logical Standby Database The logical standby database is now the primary database. Performing a Failover to a Logical Standby Database When you perform a failover to a logical standby database. These databases must be re-created from the new primary database.256 Copyright © 2006. Oracle.

Initiate the failover operation on the target standby database.Performing a Failover to a Physical Standby Database by Using SQL 1. If possible. 9 . SQL> SELECT thread#. Oracle. begin with step 1 to determine if any manual gap resolution steps must be performed. The query that is executed in step 1 displays information for the highest gap only. Complete the transition of the standby database to the primary database role. Execute the following command to register the redo log files: SQL> ALTER DATABASE REGISTER PHYSICAL LOGFILE 'filespec1'. Repeat step 1 until the query returns no rows.257 . copy all of the identified missing archived redo log files to the target standby database from the primary database and register them. (Optional) Restore the failed primary database.257 Copyright © 2006. query the V$ARCHIVE_GAP view. low_sequence#. no gaps in the archived redo log files should exist. Performing a Failover to a Physical Standby Database by Using SQL Perform the following steps to fail over to a physical standby database by using SQL. Oracle Database 10g: Data Guard Administration 1 . Convert the physical standby database to the primary role. and you can proceed directly to step 4. 2. high_sequence# 2 FROM v$archive_gap. Identify and resolve any gaps in the archived redo log files. 2. 1. 7. Repeat step 1 until all gaps are resolved. 3. Repeat step 1 until all gaps are resolved. Perform this step for each thread. Copy any other missing archived redo log files. 8. 6. All rights reserved. (Optional) Back up the new primary database. 5. The data returned reflects the highest gap only. To determine if there are gaps in the archived redo log files on the target standby database. Otherwise. 4. This view contains the sequence numbers of the archived redo log files that are known to be missing for each thread. Note: If the target standby database was operating in maximum protection mode.

If the physical standby database has not been opened in read-only mode since the last time it was started. Perform this step for each thread. 6. 5.258 . Execute the following SQL statement to initiate the failover: SQL> ALTER DATABASE RECOVER 2 MANAGED STANDBY DATABASE FINISH FORCE. If the physical database has been opened in read-only mode since the last time it was started. 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 an open backup of the database after opening the database.Performing a Failover to a Physical Standby Database by Using SQL (continued) 3. SQL> STARTUP. 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. To determine if there are any other missing archived redo log files. Although performing a backup immediately is not required. shut down the target standby database (new primary database) and restart it as follows: SQL> SHUTDOWN IMMEDIATE. Transition the physical standby database to the primary database role by issuing the following SQL statement: SQL> ALTER DATABASE COMMIT TO SWITCHOVER TO PRIMARY. Perform step 6 on the new primary database. Oracle Database 10g: Data Guard Administration 1 . you can no longer use this database as a standby database. open the new primary database as follows and proceed to step 7: SQL> ALTER DATABASE OPEN. During the failover process. query the V$ARCHIVE_GAP view (as described in step 1) to verify that no additional gaps were introduced in step 3. 7. SQL> SELECT UNIQUE THREAD# AS THREAD. After issuing this SQL statement. query the V$ARCHIVED_LOG view on the target standby database to obtain the highest sequence number for each thread. it is recommended because you cannot recover changes that are made after the failover without a complete backup copy of the database. After registering all available archived redo log files. MAX(SEQUENCE#) 2 OVER (PARTITION BY thread#) AS LAST 3 FROM V$ARCHIVED_LOG. 4. Then register those redo log files by issuing the following SQL statement: SQL> ALTER DATABASE REGISTER PHYSICAL LOGFILE 'filespec1'. Any subsequent redo that is received from the original primary database cannot be applied.

To reuse the old primary database in the new configuration. After performing a failover.Performing a Failover to a Physical Standby Database by Using SQL (continued) 8. After the failed primary database is restored and is operating in the standby role.259 .Use Flashback Database to restore the failed primary database to a point in time before the failover occurred. you can optionally perform a switchover to transition the databases to their original (pre-failure) roles.Re-create the failed database and add it to the configuration as a new standby database. you must re-create it as a standby database using a backup copy of the new primary database. you may be able to optionally restore the failed primary database as a new standby database using either of the following methods: . and then convert it into a standby database. the original primary database no longer participates in the configuration. . After a failover. Oracle Database 10g: Data Guard Administration 1 .

260 . all available redo has been applied. register the partially filled archive log file. 9 . 3. register the partially filled archived log file.260 Copyright © 2006. manually copy the redo logs to that standby database. LATEST_SCN 2 FROM V$LOGSTDBY_PROGRESS. On the logical standby database. Issue the following query: SQL> SELECT APPLIED_SCN. 2. When the values in the APPLIED_SCN and LATEST_SCN columns are equal. ensure that the remaining redo logs have been applied by checking the V$LOGSTDBY_PROGRESS view. If it exists.Performing a Failover to a Logical Standby Database by Using SQL 1. 4. Copy missing redo logs to the logical standby database. Ensure that all redo log files have been applied to the new primary database. If it exists. LATEST_SCN 2 FROM V$LOGSTDBY_PROGRESS. If redo logs exist on the primary database that have not yet been applied on the logical standby database. All rights reserved. this file has a sequence number that is one greater than the last registered archived log file. Oracle Database 10g: Data Guard Administration 1 . Issue the following SQL statement for each missing redo log file on the logical standby: SQL> ALTER DATABASE REGISTER LOGICAL LOGFILE 'filespec'. If it exists. Register the missing redo logs: SQL> ALTER DATABASE REGISTER LOGICAL 2 LOGFILE 'filespec'. 3. The logical standby database now contains as much data as possible from the primary database. Oracle. SQL> SELECT APPLIED_SCN. On the new primary database. You must register the redo log files that you manually copied from the original primary database. 4. Performing a Failover to a Logical Standby Database by Using SQL To perform failover for logical standby databases using SQL: 1. 2. check if there is a partially written archived log file.

6.261 Copyright © 2006. Begin SQL Apply operations on all logical standby databases: SQL> ALTER DATABASE START LOGICAL STANDBY 2 APPLY NEW PRIMARY dblink. apply remaining redo. as in the following example: SQL> ALTER SYSTEM SET LOG_ARCHIVE_DEST_STATE_2=ENABLE In general. 7. 9 . issue the following statements on the logical standby database that you are transitioning to the new primary role: SQL> ALTER DATABASE ACTIVATE LOGICAL STANDBY DATABASE 2 FINISH APPLY. Oracle Database 10g: Data Guard Administration 1 . Performing a Failover to a Logical Standby Database by Using SQL (continued) 5. stop SQL Apply. you must disable archiving of redo logs to remote destinations. Oracle. When the database operates in the standby role.261 . Enable archiving of redo logs to all remote logical standby destinations. Enable archiving of redo logs. Activate the new primary database: SQL> ALTER DATABASE ACTIVATE 2 LOGICAL STANDBY DATABASE 3 FINISH APPLY. and activate the database in the primary database role. All rights reserved. To stop the RFS process. 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. 6. you must enable archiving of redo logs to remote destinations.Performing a Failover to a Logical Standby Database by Using SQL 5. 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. 7. when the database operates in the primary role.

Oracle Database 10g: Data Guard Administration 1 .Activating a Standby Database When you are unable to fail over.262 . PHYSICAL or LOGICAL. 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 PHYSICAL STANDBY DATABASE. 9 . You can issue this command in a situation in which you cannot perform a failover operation.262 Copyright © 2006. Activating a Standby Database You can use the ALTER DATABASE ACTIVATE STANDBY DATABASE command to force the standby database into the primary role. Oracle. for the type of database that you are activating. All rights reserved. Specify the appropriate option. SQL> ALTER DATABASE ACTIVATE 2 LOGICAL STANDBY DATABASE.

Oracle Database 10g: Data Guard Administration 1 . Reinstate the database using the DGMGRL REINSTATE DATABASE command or the reinstate option in Enterprise Manager.263 .Restoring Databases After a Role Transition Additional steps may be needed to restore your disasterrecovery solution after a role transition: • Databases may be disabled. A database that must be re-created from a copy of the new primary database. it has the following status after a complete failover: ORA-16661: the standby database needs to be reinstated. Restoring Databases After a Role Transition If a database can be reinstated. All rights reserved. Re-create the standby database from a copy of the primary database and then reenable it. 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. The “Database must be reinstated” message is displayed in the Status column in Enterprise Manager. Oracle. – Re-create databases from a copy of the primary database and reenable the database. has the following status: ORA-16795: the broker detects that database re-creation is required.263 Copyright © 2006. 9 .

Oracle. the database reverts to its original role at the time of the flashback SCN or flashback time. failover. • Primary and standby databases retain their current roles when you flash back through physical standby switchovers or failovers. you could open standby databases as read-only only. making a physical standby database more useful. In a logical standby database. After noting or saving the results. Oracle Database 10g: Data Guard Administration 1 . • Database roles will be flashed back when you flash back through logical standby switchovers or failovers. All rights reserved. You can also use Flashback Database to undo a physical standby activation.Flashback Through Standby Database Role Transitions • Use Flashback Database to flash back a database to a point in time before a switchover or failover. 9 . • Flashback database can be used to undo a physical database activation. a physical standby database can be temporarily activated to run reports and tests. Read-only mode is usually not adequate for running report tools because these tools typically also change the database. For a logical standby database. the FLASHBACK DATABASE command reverts the database to a system change number (SCN) or timestamp before a switchover or failover. you can flash back your database to revert to a standby database. Previously.264 Copyright © 2006.264 . In Oracle Database 10g Release 2. or activation. The database role does not change when flashing back through a physical standby switchover. 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.

After a failover operation. You can flash back the old primary database so that it contains only those changes that are already applied to the old standby database. Oracle Database 10g: Data Guard Administration 1 . Note: You must have the Flashback Database feature enabled on the old primary 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. This enables you to convert the old primary database into a new standby database without restoring the old primary database. and the old primary database is placed in the “needs reinstatement” state. Oracle. All rights reserved. the old standby database becomes the new primary database. You can use the Flashback Database feature to convert the old primary database into a new standby database without re-creating the database.265 New primary database Copyright © 2006.265 .Using Flashback Database After Failover Primary database Redo Flashback Standby database Failover Redo New standby database 9 .

STARTUP MOUNT. 6. 4. 3. archive a new log to the new standby by issuing the following command: ALTER SYSTEM ARCHIVE LOG CURRENT. On the new standby database. 5. SRL FROM V$ARCHIVE_DEST_STATUS. The old primary database is now your new standby database. Check the status of the archive destinations and enable any that are not enabled. mount the old primary database. On the new primary database. After the old primary database site is available. Oracle Database 10g: Data Guard Administration 1 . 7. SHUTDOWN IMMEDIATE. use the following procedure to avoid reinstantiating the old primary database after a failover: 1. STATUS. Flash back the old primary database to the “standby became primary” SCN that you determined in step 1: FLASHBACK DATABASE TO SCN <SCN>. ALTER SYSTEM SET LOG_ARCHIVE_DEST_STATE_n=ENABLE. On the old primary database. 2. enable redo transport to the old primary database (new standby database). The role reversal is now complete: ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT.266 . 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. 8. If you are using real-time apply: ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE DISCONNECT. DEST_NAME.Using Flashback Database After Failover (continued) Physical Standby Configuration In a physical standby configuration. Shut down the old primary instance. On the new primary database. Then. PROTECTION_MODE. DESTINATION. start managed standby recovery. ERROR. STARTUP MOUNT. Mount the old primary database. issue the following command to convert the control file to a standby control file: ALTER DATABASE CONVERT TO PHYSICAL STANDBY. SELECT DEST_ID.

2. Enable the Data Guard guard to prevent the job queue from executing: ALTER DATABASE GUARD ALL. On the new primary database. Oracle Database 10g: Data Guard Administration 1 . 8. SHUTDOWN IMMEDIATE. 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_LOG WHERE NEXT_CHANGE# > (SELECT VALUE FROM DBA_LOGSTDBY_PARAMETERS WHERE NAME = 'STANDBY_BECAME_PRIMARY_SCN') AND FIRST_CHANGE <= (FLASHBACK_SCN from step 1). Start SQL Apply: ALTER DATABASE START LOGICAL STANDBY APPLY NEW PRIMARY mylink.267 . 7. On the new primary database. 5. 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. 3. 4. use the following procedure to avoid reinstantiating the old primary database after a failover: 1. Open the database with the RESETLOGS option: ALTER DATABASE OPEN RESETLOGS. 6. Flash back the old primary database to the “standby became primary” SCN that you determined in step 1: FLASHBACK DATABASE TO SCN <SCN>. Shutdown (if required) and mount the failed primary database. Create a database link to the new primary database: CREATE PUBLIC DATABASE LINK mylink CONNECT TO system IDENTIFIED BY password USING 'service_name_of_new_primary_database'.Using Flashback Database After Failover (continued) Logical Standby Configuration In a logical standby configuration. STARTUP MOUNT.

All rights reserved.268 Copyright © 2006. Oracle.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 9 .268 . Oracle Database 10g: Data Guard Administration 1 .

Practice 9: Overview This practice covers the following topics: • Performing a switchover • Performing a failover 9 . Oracle Database 10g: Data Guard Administration 1 .269 . Oracle. All rights reserved.269 Copyright © 2006.

.

Enabling Fast-Start Failover 10 Copyright © 2006. All rights reserved. . Oracle.

272 . Oracle Database 10g: Data Guard Administration 1 . Oracle.272 Copyright © 2006. 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 10 . All rights reserved.Objectives After completing this lesson.

All rights reserved. Note: Fast-start failover is an Oracle Data Guard 10g Release 2 feature. Oracle Database 10g: Data Guard Administration 1 .Fast-Start Failover: Overview Observer Primary database Fast-start failover standby database 10 .273 . 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.273 Copyright © 2006. The observer is an OCI client-side component that runs on a separate computer and monitors the availability of the primary database. Oracle.

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.274 .instance database • All instances of a Real Application Clusters (RAC) primary database crash • Shutdown abort of the primary database occurs Oracle Database 10g: Data Guard Administration 1 . 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.When Will Fast-Start Failover Occur? Observer Loss of connectivity > fast-start failover threshold Primary database Fast-start failover standby database 10 .274 Copyright © 2006. All rights reserved. Oracle.

Oracle. This installation includes DGMGRL and the Oracle Enterprise Manager agent. This installation includes DGMGRL but it does not include the Oracle Enterprise Manager agent. Observer 10 .275 . you must install DGMGRL and run the observer software on a computer system that is separate from the primary and standby systems. use one of the methods described as follows: • Install the complete Oracle Client Administrator by choosing the Administrator option in the Oracle Universal Installer.275 Copyright © 2006. • Manage the observer through Oracle Enterprise Manager or by using DGMGRL commands. allowing you to manage the observer using Oracle Enterprise Manager or DGMGRL commands. Installing the Observer To use fast-start failover. 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. • Install it on a different computer from the primary and standby databases. Oracle Database 10g: Data Guard Administration 1 . All rights reserved.Installing the Observer • The observer is a separate OCI client-side component that monitors the availability of the primary database. To install DGMGRL on the observer computer.

Configuring Fast-Start Failover The manual steps to configure fast-start failover are described in detail on the next few pages. Oracle. Specify the target standby database. Verify the configuration. Enable fast-start failover. Oracle Database 10g: Data Guard Administration 1 . Start the observer. 3. Configuring Fast-Start Failover by using Enterprise Manager Grid Control is described later in the lesson. 2.Configuring Fast-Start Failover 1. Set the FastStartFailoverThreshold property. 5.276 Copyright © 2006. 10 .276 . 4. All rights reserved.

Execute the command when connected to the primary database or to any standby database with connectivity to the primary database within the configuration. the Data Guard broker automatically sets the FastStartFailoverTarget property for the fast-start failover target standby database to the database name of the primary database. You do not need to set the FastStartFailoverTarget 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. The command syntax is as follows: EDIT DATABASE database-name SET PROPERTY FastStartFailoverTarget = FSFO-database-name.Step 1: Specifying the Target Standby Database EDRSR10P1_ORCL EDRSR10P1_SITE1 Primary database Fast-start failover standby database EDIT DATABASE edrsr10p1_orcl SET PROPERTY FastStartFailoverTarget = edrsr10p1_site1. Step 1: Specifying the Target Standby Database In a Data Guard configuration with multiple standby databases. Oracle Database 10g: Data Guard Administration 1 . When you enable fast-start failover.277 .277 Copyright © 2006. Oracle. Note: Database-name and FSFO-database-name are the values of the DB_UNIQUE_NAME initialization parameter for the respective databases. set the FastStartFailoverTarget property for the primary database to the fast-start failover target standby database. Before enabling fast-start failover. All rights reserved. 10 . you must set the FastStartFailoverTarget database property before enabling fast-start failover.

non. Recommended settings for the Fast-Start Failover Threshold are: • Single instance primary. 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 faststart failover. low latency.Step 2: Setting the Fast-Start Failover Threshold EDRSR10P1_ORCL Primary database EDIT CONFIGURATION SET PROPERTY FastStartFailoverThreshold = threshold-val. When choosing a value for this parameter. The default value for FSFT is 30 seconds. reliable network = 10-15 seconds • Single instance primary.278 . 10 .278 Copyright © 2006. if the network connection was temporarily broken for a few seconds) against the benefits of faster failover and less downtime during a critical outage.zero number of seconds. Note: You can modify this property regardless of whether fast-start failover is enabled or disabled. you must balance the increased risk of an unnecessary failover (for example. All rights reserved. Oracle. high latency network over WAN = 30-45 seconds • RAC primary = (CSS misscount + reconfiguration time) + 24-40 seconds Execute the EDIT CONFIGURATION SET PROPERTY FastStartFailoverThreshold = 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. The threshold value is specified as a positive. Oracle Database 10g: Data Guard Administration 1 .

The following prerequisites must be met to enable fast-start failover: • At least one enabled standby database with standby redo log files must exit. and initiate a fast-start failover when necessary.279 Copyright © 2006. Step 3: Enabling Fast-Start Failover You can use the Data Guard Manager command. the observer is able to observe the primary database and the standby database.279 . The redo transport mode property—LogXptMode—must be set to SYNC. SYNC. The log files being shipped to it must have the LGWR. Oracle. 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. In addition to enabling fast-start failover. Oracle Database 10g: Data Guard Administration 1 . you must start the observer as described later in this lesson. All rights reserved. • The primary database must be configured with standby redo log files.line interface (CLI)—DGMGRL—to enable faststart failover. When you issue the ENABLE FAST_START FAILOVER command. Its LogXptMode property must be set to SYNC.Step 3: Enabling Fast-Start Failover EDRSR10P1_ORCL Primary database EDRSR10P1_SITE1 Fast-start failover standby database ENABLE FAST_START FAILOVER. • The primary database and target standby database must have connectivity. • Flashback Database must be enabled on the primary database and target standby database. and AFFIRM attributes. 10 .

10 . Step 4: Starting the Observer Execute the START OBSERVER command to start the observer.Step 4: Starting the Observer Observer Primary database Fast-start failover standby database START OBSERVER [FILE=filename]. The START OBSERVER command directs DGMGRL to begin “observing” the Data Guard configuration to which DGMGRL is connected. then the observer idles waiting for fast-start failover to become enabled. Oracle. This information is recorded in the ObserverInfo configuration. Oracle Database 10g: Data Guard Administration 1 . 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. It provides the name of its host computer to the Data Guard broker. If you attempt to start a second observer for the configuration. When you execute the START OBSERVER command. the observer retrieves the primary database and the fast-start failover target standby database connect descriptors and begins observation. If you disable fast-start failover while the observer is observing the configuration. you will receive an error message. You must execute this command on the computer where the observer is to reside.level property and is displayed when you execute the SHOW CONFIGURATION VERBOSE command.280 Copyright © 2006. There can be only one observer for a Data Guard configuration at any one time. The primary database must be available for the START OBSERVER command to succeed. All rights reserved.280 .

The file contains a description of the primary and target standby databases.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.dat. a new file is created. the command-line prompt on the observer computer does not return until you issue the STOP OBSERVER command from another DGMGRL session. If you do not specify the FILE qualifier. Note: You can execute the START OBSERVER command regardless of whether fast-start failover is enabled.281 . If you stop the observer with the STOP OBSERVER command. If the file does not exist. the observer checks whether the file describes a valid fast-start failover environment for the Data Guard configuration to which the observer is connected. Oracle Database 10g: Data Guard Administration 1 . Use the FILE qualifier with the START OBSERVER command 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. then the observer’s DGMGRL process will terminate. foreground process.dat. If the configuration file exists. To issue commands and interact with the broker configuration. Control is not returned to you when the observer is successfully started. you must connect through another DGMGRL client session. The observer is a continuous. including connect descriptors. thus. the current working directory is searched for a file named FSFO.

Fast-Start Failover target EDRSR8P1_SITE2 .282 .Step 5: Verifying the Configuration DGMGRL> SHOW CONFIGURATION VERBOSE.Logical standby database Fast-Start Failover Threshold: 30 seconds Observer: EDRSR10P1 Current status for "EDRSR8P1_ORCL.Physical standby database .Primary database EDRSR8P1_SITE1 .oracle.oracle. Oracle Database 10g: Data Guard Administration 1 .com": SUCCESS 10 .282 Copyright © 2006.com Enabled: YES Protection Mode: MaxAvailability Fast-Start Failover: ENABLED Databases: EDRSR8P1_ORCL . Oracle. Configuration Name: EDRSR8P1_ORCL. Step 5: Verifying the Configuration Use the SHOW CONFIGURATION VERBOSE command to review information about the fast-start failover configuration. All rights reserved.

fs_failover_observer_present as OBS_PRES.Viewing Information SELECT fs_failover_status as STATUS. The observer automatically starts the reinstatement process.--------. Refer to the Data Guard broker drc* log files for additional information. .-------------. .-------SYNCHRONIZED EDRSR8P1_SITE1 30 YES OBS_HOST --------EDRSR10P1 10 . . Oracle.REINSTATE REQUIRED: The failed primary database requires reinstatement as a new standby database to the new primary database. . fs_failover_observer_host as OBS_HOST FROM v$database.BYSTANDER: Fast-start failover is enabled. fs_failover_current_target as CURR_TGET. but the primary database does not have a connection to the observer. fs_failover_threshold as THRESHOLD.283 Copyright © 2006. Viewing Information V$DATABASE contains the following columns providing detailed information about fast-start failover: • FS_FAILOVER_STATUS: .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. . STATUS CURR_TGET THRESHOLD OBS_PRES -----------.LOADING DICTIONARY: This status appears only on a logical standby database that has not completed loading a copy of the primary database data dictionary. Oracle Database 10g: Data Guard Administration 1 .REINSTATE FAILED: Reinstatement of the failed primary database as a new standby database failed.283 . but this standby database is not the target of the fast-start failover.DISABLED: Fast-start failover is disabled.REINSTATE IN PROGRESS: Reinstatement of the failed primary database as a new standby database is in progress. All rights reserved. .

STALLED: This status appears on the primary database if it simultaneously loses connection to both the target standby database and the observer while synchronized. . Fast-start failover is not possible.Viewing Information (continued) .SYNCHRONIZED: The primary database and the fast-start failover target standby database are synchronized with respect to redo.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.284 . . • FS_FAILOVER_CURRENT_TARGET: DB_UNIQUE_NAME of 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: . • FS_FAILOVER_OBSERVER_HOST: Name of the machine that is hosting the observer process Oracle Database 10g: Data Guard Administration 1 .UNSYNCHRONIZED: The target standby database does not have all the redo from the primary database.YES: Observer is connected to the local database. .NO: Observer is not connected to the local database. .

• Disable the Data Guard broker configuration.285 Copyright © 2006. All rights reserved. • Perform a failover or switchover to a standby database that is not the fast-start failover target.Prohibited Operations After Enabling Fast-Start Failover Maximum protection Maximum performance Disable or delete the fast-start failover standby database EDIT DATABASE SET PROPERTY LogXptMode EDIT DATABASE SET PROPERTY FastStartFailoverTarget 10 . • Remove the standby database that is the target of fast-start failover. Oracle.285 . • Disable the standby database that is the target of 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. Prohibited Operations After Enabling Fast-Start Failover After you have enabled fast-start failover. • Change the LogXptMode property for the primary or target standby databases. • Delete the Data Guard broker configuration. • Fail over to an unsynchronized fast-start failover target. • Alter the FastStartFailoverTarget database-level property of either the primary database or the standby database. Oracle Database 10g: Data Guard Administration 1 .

Oracle. Disabling Fast-Start Failover You can use the Data Guard CLI to disable fast-start failover. Oracle Database 10g: Data Guard Administration 1 . When you issue the DISABLE FAST_START FAILOVER command. 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.286 . then you can use the FORCE option to disable fast-start failover. the Data Guard broker disables fast-start failover on the target standby database and then disables fast-start failover on the primary database. If the primary database and the fast-start failover target standby database do not have connectivity with each other. The primary database and the faststart failover target standby database must have connectivity unless you use the FORCE option. All rights reserved.286 Copyright © 2006. 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. then the Data Guard broker will disable fast-start failover locally.Disabling Fast-Start Failover Observer Primary database Fast-start failover standby database DISABLE FAST_START FAILOVER [FORCE]. 10 . 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.

Disabling Fast-Start Failover (continued) If the standby database does not have connectivity with the primary database when you execute the DISABLE FAST_START FAILOVER command with the FORCE option on the fast-start failover target standby database. then the primary database will disable fast-start failover as previously described. Note: Disabling fast-start failover does not stop the observer. If the standby database does not have connectivity with the primary database when you execute the DISABLE FAST_START FAILOVER command with the FORCE option on a bystander standby database. or to the fast-start failover target standby database itself. Stopping the observer is discussed later in the lesson. You must issue the DISABLE FAST_START FAILOVER command on the primary database or a bystander standby database that has connectivity with the primary database. If the target standby database regains connectivity with the primary database. then it is ignored by the primary database. Fast-start failover will be reenabled on the bystander standby database automatically when connectivity with the primary database is restored. if fast-start failover is to be persistently disabled.287 . then fast-start failover will be disabled only on that target standby database. Oracle Database 10g: Data Guard Administration 1 .

Oracle. you must be willing to accept a data. • 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. Oracle Database 10g: Data Guard Administration 1 . In this case. Using the FORCE Option You should use the FORCE option 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.288 Copyright © 2006. The FORCE option enables you to disable fast-start failover without requiring connectivity with the target standby database or the observer.Using the FORCE Option Use the FORCE option 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 10 .288 .loss failover. • 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. All rights reserved.

All rights reserved. the Data Guard broker can accept a new observer regardless of whether the stopped observer is terminated. Oracle. You must issue this command on the primary database or on a standby database in the configuration that has connectivity to the primary database.289 . 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 OBSERVER command. If you execute this command when fast-start failover is enabled.289 Copyright © 2006.Stopping the Observer Observer Primary database Fast-start failover standby database STOP OBSERVER. use the STOP OBSERVER command to stop the 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. Oracle Database 10g: Data Guard Administration 1 . After you execute the STOP OBSERVER command. Note: The STOP OBSERVER command does not disable fast-start failover. 10 . The broker informs the observer the next time it is contacted by the observer. You can issue this command regardless of whether fast-start failover is enabled.

In addition. • A manual failover to the fast-start failover target standby database: This is permitted as long as the target standby database 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. The observer is prevented from retrying a fast-start failover and repeatedly failing. No switchovers are permitted to the fast-start failover target standby database if the configuration is unsynchronized. You can correct the problem and retry the manual failover operation. Performing Role Changes You 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. All rights reserved. Oracle Database 10g: Data Guard Administration 1 . If the failover fails. will delete its metadata state and terminate. You can perform manual failover if the faststart failover configuration is suspended.Performing Role Changes Failover Switchover Primary database Fast-start failover standby database 10 .290 . upon receiving an error status from the attempted fast-start failover. the Data Guard broker will ensure that fast-start failover is suspended to prevent the observer from performing a fast-start failover operation.290 Copyright © 2006. • 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.fast-start failover targets are not permitted. You can correct the problem and attempt a manual failover. Oracle. Switchovers to non. the Data Guard broker disables fast-start failover. the observer. If the manual failover fails.

and then you must first disable fast-start failover for that standby database by executing the DISABLE FAST_START FAILOVER FORCE command. The observer automatically reinstates the original primary database when it is restarted.Performing a Manual Failover EDRSR10P1_ORCL Failover EDRSR10P1_SITE1 Primary database Fast-start failover standby database FAILOVER TO edrsr10p1_site1.291 Copyright © 2006. Performing a Manual Failover You can perform a manual failover to the fast-start failover target standby database when faststart failover is suspended because the primary database has been shut down. Oracle. Note: You cannot perform a manual failover if the fast-start failover target standby database is not synchronized with the primary database. After you disable fast-start failover and perform the failover. Oracle Database 10g: Data Guard Administration 1 . 10 . The manual failover preserves the fast-start failover environment and the Data Guard configuration remains in maximum availability mode.291 . The FAILOVER command succeeds if the fast-start failover configuration is synchronized. All rights reserved. fast-start failover is disabled for the entire configuration and the protection mode is changed to maximum performance. If you must fail over to an unsynchronized fast-start failover target standby database or a bystander standby database.

• The observer in the fast-start failover configuration can connect to the original primary database. Oracle. you have not performed a subsequent failover or switchover before the original primary database restarting. Oracle Database 10g: Data Guard Administration 1 . You cannot perform a subsequent fast-start failover until the original primary database is reinstated without reconfiguring the fast-start failover environment. Automatic Reinstatement After Fast-Start Failover Reinstatement of the original primary database is critical for reestablishing high availability after a fast-start failover. • In a multi–standby database configuration. 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.Automatic Reinstatement After Fast-Start Failover EDRSR10P1_ORCL EDRSR10P1_SITE1 Fast-start failover standby database Primary database 10 . 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.292 . • The original primary database must be able to connect to the new primary database to complete the reinstatement operation. All rights reserved.292 Copyright © 2006.

293 .Automatic Reinstatement After Fast-Start Failover (continued) If these conditions are not met. You can then request manual reinstatement of the original primary database using the CLI or Enterprise Manager. Oracle Database 10g: Data Guard Administration 1 . automatic reinstatement of the original primary database will not take place and appropriate errors will be logged.

If the conditions for reinstatement are not satisfied. 10 .Manually Reinstating the Database EDRSR10P1_ORCL EDRSR10P1_SITE1 Fast-start failover standby database Primary database REINSTATE DATABASE edrsr10p1_orcl. Note: The REINSTATE DATABASE database-name command does not require fast-start failover to be enabled. then the original primary database is reinstated as a standby database to the new primary database. If the database name specified is the original primary database and fast-start failover is enabled.294 Copyright © 2006. Manually Reinstating the Database Use the REINSTATE DATABASE database-name command to reinstate the database. In that case. 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.294 . then the request fails and the specified database remains disabled. the observer will automatically reinstate the database. Oracle Database 10g: Data Guard Administration 1 . All rights reserved. It can be used to reinstate an original primary database after a conventional no-data. It accepts archived redo log files from the new primary database and serves as the faststart failover target should the new primary database fail. Oracle.loss failover. The fast-start failover configuration is updated to reflect the availability of the new standby database. This command is not needed when fast-start failover is enabled and the database to be reinstated is the original primary database.

Oracle. Oracle Database 10g: Data Guard Administration 1 . click the Disabled link next to Fast-Start Failover to invoke the fast-start failover wizard to enable fast-start failover.Using Enterprise Manager to Enable Fast-Start Failover Click Disabled to invoke the fast-start failover wizard.295 . Using Enterprise Manager to Enable Fast-Start Failover On the Data Guard page.295 Copyright © 2006. All rights reserved. 10 .

10 .296 Copyright © 2006. Oracle. click the Set Observer button.296 .Using Enterprise Manager to Enable Fast-Start Failover Select the database. All rights reserved. Click Set Observer. Oracle Database 10g: Data Guard Administration 1 . If the observer has not been started. the observer host. optionally. Using Enterprise Manager to Enable Fast-Start Failover (continued) Select the fast-start failover target database and.

Using Enterprise Manager to Enable Fast-Start Failover 10 . All rights reserved. Oracle Database 10g: Data Guard Administration 1 .297 . Oracle.297 Copyright © 2006. Using Enterprise Manager to Enable Fast-Start Failover (continued) Specify the Observer host and Observer Oracle Home to indicate where the observer will be started.

flash recovery area size.Using Enterprise Manager to Enable Fast-Start Failover 10 . Oracle. the Enable Flashback Logging page displays.298 Copyright © 2006. Specify the flash recovery area location. and flashback retention time for each database. All rights reserved.298 . Using Enterprise Manager to Enable Fast-Start Failover (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. Oracle Database 10g: Data Guard Administration 1 .

Using Enterprise Manager to Enable Fast-Start Failover 10 . confirm that you want to enable fast-start failover to the named database. Oracle. Oracle Database 10g: Data Guard Administration 1 . Using Enterprise Manager to Enable Fast-Start Failover (continued) On the Confirmation: Enable Fast-Start Failover page.299 . All rights reserved.299 Copyright © 2006.

if required. • Fast-start failover is enabled. you are returned to the Data Guard page. the fast-start enabling process begins. After the processing steps are complete. if required. • The protection mode is upgraded to Maximum Availability. All rights reserved. On the Data Guard Fast-start Failover Processing page you can observe the progress of the faststart failover enabling operation as the following steps are performed: • Standby redo log files are created on the primary and standby databases.Using Enterprise Manager to Enable Fast-Start Failover 10 . Oracle Database 10g: Data Guard Administration 1 .300 . Using Enterprise Manager to Enable Fast-Start Failover (continued) After you confirm that you want to enable fast-start failover to a specific database. • The primary database and standby database is restarted. • The observer process is started.300 Copyright © 2006. Oracle.

Oracle. Changing the Protection Mode and Disabling Fast-Start Failover If you change the protection mode to a mode that does not support fast-start failover.301 .Changing the Protection Mode and Disabling Fast-Start Failover 10 . Oracle Database 10g: Data Guard Administration 1 . then you implicitly disable fast-start failover.301 Copyright © 2006. All rights reserved.

All rights reserved.Using Enterprise Manager to Disable Fast-Start Failover Click the Enabled link to access the Change Mode page. Using Enterprise Manager to Disable Fast-Start Failover Access the Fast-Start Failover: Change Mode page by clicking the Fast-Start Failover link. Oracle Database 10g: Data Guard Administration 1 .302 . Selecting Disable and the Stop observer option on the Fast-Start Failover: Change Mode page to disable fast-start failover. 10 .302 Copyright © 2006. Oracle.

Using Enterprise Manager to Suspend Fast-Start Failover 10 . All rights reserved.303 Copyright © 2006. Do not select the “Stop observer” option. Oracle. Oracle Database 10g: Data Guard Administration 1 .303 . Using Enterprise Manager to Suspend Fast-Start Failover Suspend fast-start failover by selecting Disable on the Fast-Start Failover: Change Mode page.

304 Copyright © 2006. Oracle Database 10g: Data Guard Administration 1 . All rights reserved.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 10 .304 . Oracle.

305 Copyright © 2006.305 . All rights reserved.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 10 . Oracle Database 10g: Data Guard Administration 1 . Oracle.

.

. All rights reserved.Enabling Fast-Start Failover 10 Copyright © 2006. Oracle.

Oracle.Objectives After completing this lesson.308 . All rights reserved.308 Copyright © 2006. 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 10 . Oracle Database 10g: Data Guard Administration 1 .

Fast-Start Failover: Overview Observer Primary database Fast-start failover standby database 10 . 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.309 Copyright © 2006. 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 the availability of the primary database.309 . Oracle. Oracle Database 10g: Data Guard Administration 1 . All rights reserved. Note: Fast-start failover is an Oracle Data Guard 10g Release 2 feature.

310 Copyright © 2006.310 . Oracle.When Will Fast-Start Failover Occur? Observer Loss of connectivity > fast-start failover threshold Primary database Fast-start failover standby database 10 . 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 Oracle Database 10g: Data Guard Administration 1 . and between the primary database and the fast-start failover target standby database. All rights reserved. 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.

Installing the Observer To use fast-start failover.311 Copyright © 2006. Oracle Database 10g: Data Guard Administration 1 . allowing you to manage the observer using Oracle Enterprise Manager or DGMGRL commands.Installing the Observer • The observer is a separate OCI client-side component that monitors the availability of the primary database. This type of installation enables you to manage the observer using DGMGRL commands but not Oracle Enterprise Manager. you must install DGMGRL and run the observer software on a computer system that is separate from the primary and standby systems. All rights reserved. • Install the full Oracle Database 10g software kit.311 . This installation includes DGMGRL and the Oracle Enterprise Manager agent. To install DGMGRL on the observer computer. Observer 10 . Oracle. • Manage the observer through Oracle Enterprise Manager or by using DGMGRL commands. • Install it on a different computer from the primary and standby databases. This installation includes DGMGRL but it does not include the Oracle Enterprise Manager agent. use one of the methods described as follows: • Install the complete Oracle Client Administrator by choosing the Administrator option in the Oracle Universal Installer.

10 .Configuring Fast-Start Failover 1. 2. Oracle. All rights reserved. Specify the target standby database. 4. Oracle Database 10g: Data Guard Administration 1 . Start the observer. 5. Set the FastStartFailoverThreshold property. 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. Enable fast-start failover.312 .312 Copyright © 2006. Verify the configuration. 3.

Step 1: Specifying the Target Standby Database EDRSR10P1_ORCL EDRSR10P1_SITE1 Primary database Fast-start failover standby database EDIT DATABASE edrsr10p1_orcl SET PROPERTY FastStartFailoverTarget = edrsr10p1_site1. Before enabling fast-start failover. The command syntax is as follows: EDIT DATABASE database-name SET PROPERTY FastStartFailoverTarget = FSFO-database-name.313 . You do not need to set the FastStartFailoverTarget 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. Step 1: Specifying the Target Standby Database In a Data Guard configuration with multiple standby databases. Execute the command when connected to the primary database or to any standby database with connectivity to the primary database within the configuration.313 Copyright © 2006. 10 . the Data Guard broker automatically sets the FastStartFailoverTarget property for the fast-start failover target standby database to the database name of the primary database. Oracle Database 10g: Data Guard Administration 1 . When you enable fast-start failover. you must set the FastStartFailoverTarget database property before enabling fast-start failover. All rights reserved. Oracle. Note: Database-name and FSFO-database-name are the values of the DB_UNIQUE_NAME initialization parameter for the respective databases. set the FastStartFailoverTarget property for the primary database to the fast-start failover target standby database.

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 faststart failover. low latency. When choosing a value for this parameter. you must balance the increased risk of an unnecessary failover (for example.Step 2: Setting the Fast-Start Failover Threshold EDRSR10P1_ORCL Primary database EDIT CONFIGURATION SET PROPERTY FastStartFailoverThreshold = threshold-val. The threshold value is specified as a positive. All rights reserved.zero number of seconds. if the network connection was temporarily broken for a few seconds) against the benefits of faster failover and less downtime during a critical outage. high latency network over WAN = 30-45 seconds • RAC primary = (CSS misscount + reconfiguration time) + 24-40 seconds Execute the EDIT CONFIGURATION SET PROPERTY FastStartFailoverThreshold = 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. Oracle. 10 . non.314 . Note: You can modify this property regardless of whether fast-start failover is enabled or disabled. Recommended settings for the Fast-Start Failover Threshold are: • Single instance primary. The default value for FSFT is 30 seconds. Oracle Database 10g: Data Guard Administration 1 .314 Copyright © 2006. reliable network = 10-15 seconds • Single instance primary.

• The primary database and target standby database must have connectivity. the observer is able to observe the primary database and the standby database. you must start the observer as described later in this lesson. 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. In addition to enabling fast-start failover. Oracle Database 10g: Data Guard Administration 1 . When you issue the ENABLE FAST_START FAILOVER command.315 Copyright © 2006. Its LogXptMode property must be set to SYNC. Step 3: Enabling Fast-Start Failover You can use the Data Guard Manager command. 10 . SYNC. • The primary database must be configured with standby redo log files.Step 3: Enabling Fast-Start Failover EDRSR10P1_ORCL Primary database EDRSR10P1_SITE1 Fast-start failover standby database ENABLE FAST_START FAILOVER. and initiate a fast-start failover when necessary.line interface (CLI)—DGMGRL—to enable faststart failover. and AFFIRM attributes. The log files being shipped to it must have the LGWR.315 . The following prerequisites must be met to enable fast-start failover: • At least one enabled standby database with standby redo log files must exit. • Flashback Database must be enabled on the primary database and target standby database. The redo transport mode property—LogXptMode—must be set to SYNC. Oracle. All rights reserved.

316 Copyright © 2006. the observer retrieves the primary database and the fast-start failover target standby database connect descriptors and begins observation.316 . If you attempt to start a second observer for the configuration. When you execute the START OBSERVER command. you will receive an error message. Step 4: Starting the Observer Execute the START OBSERVER command to start the observer. Oracle. It provides the name of its host computer to the Data Guard broker. All rights reserved. This information is recorded in the ObserverInfo configuration. The START OBSERVER command directs DGMGRL to begin “observing” the Data Guard configuration to which DGMGRL is connected. then the observer idles waiting for fast-start failover to become enabled. Oracle Database 10g: Data Guard Administration 1 . The primary database must be available for the START OBSERVER command to succeed.level property and is displayed when you execute the SHOW CONFIGURATION VERBOSE command. 10 . There can be only one observer for a Data Guard configuration at any one time.Step 4: Starting the Observer Observer Primary database Fast-start failover standby database START OBSERVER [FILE=filename]. If you disable fast-start failover while the observer is observing the configuration. You must execute this command on the computer where the observer is to reside. 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.

thus.dat. If you stop the observer with the STOP OBSERVER command. then the observer’s DGMGRL process will terminate. the current working directory is searched for a file named FSFO. If the configuration file exists. Note: You can execute the START OBSERVER command regardless of whether fast-start failover is enabled.dat.317 . The observer is a continuous. Oracle Database 10g: Data Guard Administration 1 . Use the FILE qualifier with the START OBSERVER command 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. If the file does not exist. a new file is created.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. To issue commands and interact with the broker configuration. including connect descriptors. If you do not specify the FILE qualifier. the observer checks whether the file describes a valid fast-start failover environment for the Data Guard configuration to which the observer is connected. the command-line prompt on the observer computer does not return until you issue the STOP OBSERVER command from another DGMGRL session. Control is not returned to you when the observer is successfully started. you must connect through another DGMGRL client session. The file contains a description of the primary and target standby databases. foreground process.

oracle.Step 5: Verifying the Configuration DGMGRL> SHOW CONFIGURATION VERBOSE.oracle.Primary database EDRSR8P1_SITE1 . Oracle Database 10g: Data Guard Administration 1 .318 .Logical standby database Fast-Start Failover Threshold: 30 seconds Observer: EDRSR10P1 Current status for "EDRSR8P1_ORCL.Physical standby database . Oracle.Fast-Start Failover target EDRSR8P1_SITE2 .com Enabled: YES Protection Mode: MaxAvailability Fast-Start Failover: ENABLED Databases: EDRSR8P1_ORCL . Configuration Name: EDRSR8P1_ORCL.318 Copyright © 2006. Step 5: Verifying the Configuration Use the SHOW CONFIGURATION VERBOSE command to review information about the fast-start failover configuration. All rights reserved.com": SUCCESS 10 .

REINSTATE REQUIRED: The failed primary database requires reinstatement as a new standby database to the new primary database. .REINSTATE IN PROGRESS: Reinstatement of the failed primary database as a new standby database is in progress.319 .BYSTANDER: Fast-start failover is enabled.319 Copyright © 2006. The observer automatically starts the reinstatement process.DISABLED: Fast-start failover is disabled.Viewing Information SELECT fs_failover_status as STATUS. All rights reserved. Oracle Database 10g: Data Guard Administration 1 .--------.-------SYNCHRONIZED EDRSR8P1_SITE1 30 YES OBS_HOST --------EDRSR10P1 10 . . .LOADING DICTIONARY: This status appears only on a logical standby database that has not completed loading a copy of the primary database data dictionary. . fs_failover_threshold as THRESHOLD. fs_failover_observer_present as OBS_PRES. . fs_failover_observer_host as OBS_HOST FROM v$database. but this standby database is not the target of the fast-start failover. Refer to the Data Guard broker drc* log files for additional information. Viewing Information V$DATABASE contains the following columns providing detailed information about fast-start failover: • FS_FAILOVER_STATUS: . .-------------. but the primary database does not have a connection to the observer. Oracle. fs_failover_current_target as CURR_TGET.REINSTATE FAILED: Reinstatement of the failed primary database as a new standby database failed.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. STATUS CURR_TGET THRESHOLD OBS_PRES -----------.

• FS_FAILOVER_OBSERVER_HOST: Name of the machine that is hosting the observer process Oracle Database 10g: Data Guard Administration 1 .UNSYNCHRONIZED: The target standby database does not have all the redo from the primary database. .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. .320 . • FS_FAILOVER_CURRENT_TARGET: DB_UNIQUE_NAME of 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: . . . Fast-start failover is not possible.NO: Observer is not connected to the local database.STALLED: This status appears on the primary database if it simultaneously loses connection to both the target standby database and the observer while synchronized.YES: Observer is connected to the local database.SYNCHRONIZED: The primary database and the fast-start failover target standby database are synchronized with respect to redo.Viewing Information (continued) .

• Disable the standby database that is the target of fast-start failover.321 Copyright © 2006. • Remove the standby database that is the target of fast-start failover. • Disable the Data Guard broker configuration.321 . • Fail over to an unsynchronized fast-start failover target. Oracle Database 10g: Data Guard Administration 1 . 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 the LogXptMode property for the primary or target standby databases.Prohibited Operations After Enabling Fast-Start Failover Maximum protection Maximum performance Disable or delete the fast-start failover standby database EDIT DATABASE SET PROPERTY LogXptMode EDIT DATABASE SET PROPERTY FastStartFailoverTarget 10 . • Perform a failover or switchover to a standby database that is not the fast-start failover target. All rights reserved. Oracle. • Alter the FastStartFailoverTarget database-level property of either the primary database or the standby database. • Delete the Data Guard broker configuration. Prohibited Operations After Enabling Fast-Start Failover After you have enabled fast-start failover.

If the primary database and the fast-start failover target standby database do not have connectivity with each other. Oracle. the Data Guard broker disables fast-start failover on the target standby database and then disables fast-start failover on the primary database. 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.Disabling Fast-Start Failover Observer Primary database Fast-start failover standby database DISABLE FAST_START FAILOVER [FORCE]. All rights reserved. Disabling Fast-Start Failover You can use the Data Guard CLI to disable fast-start failover. 10 . 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. 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. The primary database and the faststart failover target standby database must have connectivity unless you use the FORCE option.322 Copyright © 2006. then the Data Guard broker will disable fast-start failover locally. then you can use the FORCE option to disable fast-start failover. Oracle Database 10g: Data Guard Administration 1 . When you issue the DISABLE FAST_START FAILOVER command.322 .

if fast-start failover is to be persistently disabled. then fast-start failover will be disabled only on that target standby database.323 . then it is ignored by the primary database. or to the fast-start failover target standby database itself. If the target standby database regains connectivity with the primary database. then the primary database will disable fast-start failover as previously described. Stopping the observer is discussed later in the lesson. You must issue the DISABLE FAST_START FAILOVER command on the primary database or a bystander standby database that has connectivity with the primary database. If the standby database does not have connectivity with the primary database when you execute the DISABLE FAST_START FAILOVER command with the FORCE option on a bystander standby database. Note: Disabling fast-start failover does not stop the observer. Fast-start failover will be reenabled on the bystander standby database automatically when connectivity with the primary database is restored. Oracle Database 10g: Data Guard Administration 1 .Disabling Fast-Start Failover (continued) If the standby database does not have connectivity with the primary database when you execute the DISABLE FAST_START FAILOVER command with the FORCE option on the fast-start failover target standby database.

Oracle Database 10g: Data Guard Administration 1 . • 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. Using the FORCE Option You should use the FORCE option 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.loss failover.324 Copyright © 2006. The FORCE option enables you to disable fast-start failover without requiring connectivity with the target standby database or the observer. All rights reserved.Using the FORCE Option Use the FORCE option 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 10 .324 . Oracle. you must be willing to accept a data. In this case.

10 .Stopping the Observer Observer Primary database Fast-start failover standby database STOP OBSERVER. You can issue this command regardless of whether fast-start failover is enabled. The observer does not immediately stop when you execute the STOP OBSERVER command. 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.325 Copyright © 2006. use the STOP OBSERVER command to stop the observer. After you execute the STOP OBSERVER command. If you execute this command when fast-start failover is enabled. Oracle Database 10g: Data Guard Administration 1 . Note: The STOP OBSERVER command does not disable fast-start failover. then the fast-start failover target standby database must have connectivity to the primary database. Oracle. All rights reserved. the Data Guard broker can accept a new observer regardless of whether the stopped observer is terminated. You must issue this command on the primary database or on a standby database in the configuration that has connectivity to the primary database. The broker informs the observer the next time it is contacted by the observer.325 .

the Data Guard broker will ensure that fast-start failover is suspended to prevent the observer from performing a fast-start failover operation. Oracle Database 10g: Data Guard Administration 1 . Switchovers to non. • 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.Performing Role Changes Failover Switchover Primary database Fast-start failover standby database 10 . 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. The observer is prevented from retrying a fast-start failover and repeatedly failing. All rights reserved.fast-start failover targets are not permitted. You can correct the problem and retry the manual failover operation. • A manual failover to the fast-start failover target standby database: This is permitted as long as the target standby database is synchronized. If the manual failover fails. Oracle. If the failover fails. In addition. No switchovers are permitted to the fast-start failover target standby database if the configuration is unsynchronized. Performing Role Changes You 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. You can correct the problem and attempt a manual failover.326 Copyright © 2006. You can perform manual failover if the faststart failover configuration is suspended. will delete its metadata state and terminate. upon receiving an error status from the attempted fast-start failover. the observer.326 . the Data Guard broker disables fast-start failover.

Oracle Database 10g: Data Guard Administration 1 . and then you must first disable fast-start failover for that standby database by executing the DISABLE FAST_START FAILOVER FORCE command. The manual failover preserves the fast-start failover environment and the Data Guard configuration remains in maximum availability mode. 10 .327 . All rights reserved. The observer automatically reinstates the original primary database when it is restarted.Performing a Manual Failover EDRSR10P1_ORCL Failover EDRSR10P1_SITE1 Primary database Fast-start failover standby database FAILOVER TO edrsr10p1_site1.327 Copyright © 2006. The FAILOVER command succeeds if the fast-start failover configuration is synchronized. fast-start failover is disabled for the entire configuration and the protection mode is changed to maximum performance. After you disable fast-start failover and perform the failover. Oracle. If you must fail over to an unsynchronized fast-start failover target standby database or a bystander standby database. Performing a Manual Failover You can perform a manual failover to the fast-start failover target standby database when faststart failover is suspended because the primary database has been shut down. Note: You cannot perform a manual failover if the fast-start failover target standby database is not synchronized with the primary database.

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.328 Copyright © 2006. All rights reserved. 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. Oracle Database 10g: Data Guard Administration 1 . • The observer in the fast-start failover configuration can connect to the original primary database. • In a multi–standby database configuration.328 . you have not performed a subsequent failover or switchover before the original primary database restarting.Automatic Reinstatement After Fast-Start Failover EDRSR10P1_ORCL EDRSR10P1_SITE1 Fast-start failover standby database Primary database 10 . 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 must be able to connect to the new primary database to complete the reinstatement operation. Oracle.

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. Oracle Database 10g: Data Guard Administration 1 . You can then request manual reinstatement of the original primary database using the CLI or Enterprise Manager.329 .

330 Copyright © 2006. All rights reserved. It can be used to reinstate an original primary database after a conventional no-data. If the conditions for reinstatement are not satisfied.Manually Reinstating the Database EDRSR10P1_ORCL EDRSR10P1_SITE1 Fast-start failover standby database Primary database REINSTATE DATABASE edrsr10p1_orcl. The fast-start failover configuration is updated to reflect the availability of the new standby database. Oracle Database 10g: Data Guard Administration 1 .loss failover. then the original primary database is reinstated as a standby database to the new primary database. This command is not needed when fast-start failover is enabled and the database to be reinstated is the original primary database. It accepts archived redo log files from the new primary database and serves as the faststart failover target should the new primary database fail. Oracle. Manually Reinstating the Database Use the REINSTATE DATABASE database-name command to reinstate the database. 10 . then the request fails and the specified database remains disabled. In that case. 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. If the database name specified is the original primary database and fast-start failover is enabled. the observer will automatically reinstate the database. Note: The REINSTATE DATABASE database-name command does not require fast-start failover to be enabled.330 .

Using Enterprise Manager to Enable Fast-Start Failover Click Disabled to invoke the fast-start failover wizard. Using Enterprise Manager to Enable Fast-Start Failover On the Data Guard page.331 . click the Disabled link next to Fast-Start Failover to invoke the fast-start failover wizard to enable fast-start failover. 10 . Oracle Database 10g: Data Guard Administration 1 .331 Copyright © 2006. All rights reserved. Oracle.

Using Enterprise Manager to Enable Fast-Start Failover Select the database. optionally. All rights reserved. 10 . Oracle Database 10g: Data Guard Administration 1 . If the observer has not been started.332 Copyright © 2006.332 . the observer host. Using Enterprise Manager to Enable Fast-Start Failover (continued) Select the fast-start failover target database and. Click Set Observer. click the Set Observer button. Oracle.

All rights reserved.333 .Using Enterprise Manager to Enable Fast-Start Failover 10 . Oracle Database 10g: Data Guard Administration 1 .333 Copyright © 2006. Using Enterprise Manager to Enable Fast-Start Failover (continued) Specify the Observer host and Observer Oracle Home to indicate where the observer will be started. Oracle.

334 Copyright © 2006. If the primary database or the standby database does not have flashback logging enabled. Oracle. the Enable Flashback Logging page displays.Using Enterprise Manager to Enable Fast-Start Failover 10 . Oracle Database 10g: Data Guard Administration 1 . flash recovery area size. and flashback retention time for each database.334 . Specify the flash recovery area location. Using Enterprise Manager to Enable Fast-Start Failover (continued) Flashback logging must be enabled on the primary database and the standby database to enable fast-start failover. All rights reserved.

Using Enterprise Manager to Enable Fast-Start Failover 10 . confirm that you want to enable fast-start failover to the named database. Oracle Database 10g: Data Guard Administration 1 .335 . All rights reserved. Using Enterprise Manager to Enable Fast-Start Failover (continued) On the Confirmation: Enable Fast-Start Failover page. Oracle.335 Copyright © 2006.

Oracle Database 10g: Data Guard Administration 1 .336 Copyright © 2006. • The observer process is started. After the processing steps are complete. you are returned to the Data Guard page. All rights reserved. if required. if required. Using Enterprise Manager to Enable Fast-Start Failover (continued) After you confirm that you want to enable fast-start failover to a specific database. • Fast-start failover is enabled. • The primary database and standby database is restarted.336 . On the Data Guard Fast-start Failover Processing page you can observe the progress of the faststart failover enabling operation as the following steps are performed: • Standby redo log files are created on the primary and standby databases. the fast-start enabling process begins. • The protection mode is upgraded to Maximum Availability.Using Enterprise Manager to Enable Fast-Start Failover 10 . Oracle.

Oracle.337 . Oracle Database 10g: Data Guard Administration 1 .337 Copyright © 2006.Changing the Protection Mode and Disabling Fast-Start Failover 10 . All rights reserved. then you implicitly disable fast-start failover. Changing the Protection Mode and Disabling Fast-Start Failover If you change the protection mode to a mode that does not support fast-start failover.

10 .338 Copyright © 2006.338 . Using Enterprise Manager to Disable Fast-Start Failover Access the Fast-Start Failover: Change Mode page by clicking the Fast-Start Failover link.Using Enterprise Manager to Disable Fast-Start Failover Click the Enabled link to access the Change Mode page. All rights reserved. Oracle. Selecting Disable and the Stop observer option on the Fast-Start Failover: Change Mode page to disable fast-start failover. Oracle Database 10g: Data Guard Administration 1 .

Using Enterprise Manager to Suspend Fast-Start Failover

10 - 339

Copyright © 2006, Oracle. All rights reserved.

Using Enterprise Manager to Suspend Fast-Start Failover Suspend fast-start failover by selecting Disable on the Fast-Start Failover: Change Mode page. Do not select the “Stop observer” option.

Oracle Database 10g: Data Guard Administration 1 - 339

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

10 - 340

Copyright © 2006, Oracle. All rights reserved.

Oracle Database 10g: Data Guard Administration 1 - 340

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

10 - 341

Copyright © 2006, Oracle. All rights reserved.

Oracle Database 10g: Data Guard Administration 1 - 341

Using Data Guard in a Real Application Clusters Configuration

11
Copyright © 2006, Oracle. All rights reserved.

Objectives

After completing this lesson, you should be able to deploy Data Guard in a Real Application Clusters environment.

11 - 344

Copyright © 2006, Oracle. All rights reserved.

Oracle Database 10g: Data Guard Administration 1 - 344

Real Application Clusters and Data Guard

Possible combinations of instances in the primary and standby databases:
Primary Instance Single-Instance Multi-Instance Single-Instance Standby Database Yes Yes Multi-Instance Standby Database Yes Yes

11 - 345

Copyright © 2006, Oracle. All rights reserved.

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.

Oracle Database 10g: Data Guard Administration 1 - 345

Data protection modes: In a RAC configuration that is configured for maximum protection or maximum availability mode.346 . This action maintains the data integrity of the data that has been transmitted to that destination and can be recovered. Oracle Database 10g: Data Guard Administration 1 .346 Copyright © 2006. Data Guard runs the site in resynchronization mode until no gaps remain. • Data protection modes: Maximum protection or maximum availability mode. the standby destination can participate in the Data Guard configuration again. Oracle. Configuration Considerations with RAC Format for archived redo log file names: The thread variable (%t or %T) in the LOG_ARCHIVE_FORMAT parameter is mandatory for Real Application Clusters to uniquely identify the archived redo log files.Configuration Considerations with RAC • Format for archived redo log file names: Thread variable (%t or %T) of LOG_ARCHIVE_FORMAT is mandatory. When the failed standby destination comes back up. All rights reserved. 11 . all instances could stop shipping redo. Then. any instance that loses connectivity with a standby destination causes all other instances to create a sync point for that destination.

any instance that loses connectivity with a standby destination causes all other instances to create a sync point for that destination. the standby destination can participate in the Data Guard configuration again. Then. This action maintains the data integrity of the data that has been transmitted to that destination and can be recovered.Configuration Considerations with RAC (continued) Data protection modes: In a RAC configuration that is configured for maximum protection or maximum availability mode. When the failed standby destination comes back up. Data Guard runs the site in resynchronization mode until no gaps remain.347 . Oracle Database 10g: Data Guard Administration 1 .

Oracle Database 10g: Data Guard Administration 1 . All rights reserved.348 .Multi-Instance Primary Database with a Single-Instance Standby Database Primary database Standby database 11 . Multi-Instance Primary with a Single-Instance Standby You can create a single. Oracle.348 Copyright © 2006. Each instance of the primary database sends redo to the one instance of the standby.instance standby database by using either SQL commands or Enterprise Manager. The standby database automatically determines the correct order in which to apply the archived redo log files.

Multi-Instance Primary Database with a Multi-Instance Standby Database Primary database Standby database 11 . During role changes and protection mode upgrades. Click Add Standby Database to invoke the Add Standby Database Wizard. All rights reserved. and then select “Add an existing standby database. the broker can manage these instances when it comes to conducting state changes. Multi-Instance Primary with a Multi-Instance Standby Although the Add Standby Database Wizard does not create a RAC 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.349 .349 Copyright © 2006. Oracle. the broker also manages the instance restarts because it is integrated with the RAC Cluster Ready Services (CRS). role changes. 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. After they are added. Oracle Database 10g: Data Guard Administration 1 . If a new primary instance is added. and so on. you can use it to add an existing RAC standby database to a Data Guard configuration.

In this case. Oracle.350 MRP Standby recovery instance D Copyright © 2006. All rights reserved.Redo Transport with RAC to RAC Primary instance A Archived logs LGWR Standby redo files Online redo files LGWR RFS Archived logs ARCn Physical standby database Standby instance C Primary database Archived logs Primary instance B 11 . When both the primary and standby databases are in a Real Application Clusters configuration. Redo Transport with RAC to RAC The best practice is to send all redo to the recovery instance on the standby RAC. then a single instance of the standby database applies all sets of log files that are transmitted by the primary instances.350 . the standby instances that are not applying redo data cannot be in read-only mode while Redo Apply is in progress. Oracle Database 10g: Data Guard Administration 1 .

Oracle. All rights reserved. define the LGWR attribute for the LOG_ARCHIVE_DEST_n parameter to specify that the LGWR process performs the archival operation. 2. Oracle Database 10g: Data Guard Administration 1 .351 Copyright © 2006. Setting Up a Primary Database with RAC To configure redo transport services on the primary database: 1. 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.351 . On all instances.Setting Up a Primary Database with RAC Primary instance A Archived logs LGWR Primary database LGWR Online redo files Archived logs Primary instance B 11 .

Oracle Database 10g: Data Guard Administration 1 .352 . Setting Up a Standby Database with RAC To configure redo transport services on the standby database: 1. Create the standby redo log files.Setting Up a Standby Database with RAC Standby instance C Standby redo files Physical standby database RFS Archived logs ARCn MRP Standby recovery instance D 11 . On the recovery instance. All rights reserved. the standby redo log files must reside on disk devices that are shared by all instances. 3. Oracle. 2. In a Real Application Clusters environment.352 Copyright © 2006. Start log apply services on the recovery instance. define the LOCATION attribute of the LOG_ARCHIVE_DEST_1 initialization parameter to archive locally.

SRL' SIZE 50M. The THREAD n syntax is optional. you may need more standby redo log groups. This is applicable only if you are using the RAC. assign more standby redo log groups to that thread. With this clause. If you have threads that generate more redo than others. Oracle.353 . Because standby redo log groups are now assigned to a given thread. All rights reserved. Data Guard automatically assigns the standby redo log to a thread at run time. It is usually sufficient to assign one or two more than there are online log files.353 Copyright © 2006. Assigning Threads to Standby Redo Log Groups Use the THREAD n clause in the ALTER DATABASE ADD STANDBY LOGFILE statement to assign a standby redo log group to a specific thread. Oracle Database 10g: Data Guard Administration 1 . 11 .Assigning Threads to Standby Redo Log Groups Standby database Primary database Standby redo logs SQL> ALTER DATABASE ADD STANDBY LOGFILE 2 THREAD 1 'STBY_LOGFILE_1. you can balance the use of standby redo log groups across all threads. This is because there is no longer a pool of files available for any thread. If the syntax is omitted.

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. the broker leverages the availability of the RAC standby database by automatically failing over log apply services to a different standby instance. but redo transport services stop transmitting redo data to the standby database. — — Default is 120 seconds.354 Copyright © 2006. Set to 0 (zero) to disable.354 . Apply Instance Failover When the apply instance fails. 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. • Non-broker configuration: Set up a list of destination connect identifiers. – Optionally set PreferredApplyInstance. 11 . To select an appropriate timeout value.Apply Instance Failover • If the apply instance fails. All rights reserved. not only does log apply services stop applying log files to the standby database. Oracle Database 10g: Data Guard Administration 1 . To tolerate a failure of the apply instance. transport of redo is also halted by default. • Broker configuration: – Set ApplyInstanceTimeout to avoid downtime. To set up apply instance failover in a Data Guard broker–controlled configuration. 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. Oracle.

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. the apply process (Redo Apply or SQL Apply) would need to be manually started in the new instance with SQL*Plus. the broker picks a random instance that is currently running to be the new apply instance. it waits until the system’s TCP/IP timeout). However.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.ora file on the primary database. 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 Oracle Database 10g: Data Guard Administration 1 . after a timeout period that is specified in the NET_TIMEOUT attribute of the log_archive_dest_n parameter (if NET_TIMEOUT is not specified.355 . If PreferredApplyInstance is not set. LGWR chooses the next entry in the list to send redo data to. as in the following example: CHICAGO= (DESCRIPTION= (ADDRESS_LIST= (ADDRESS=(PROTOCOL=tcp)(HOST=chicago_n1-server)(PORT=1521)) (ADDRESS=(PROTOCOL=tcp)(HOST=chicago_n2-server)(PORT=1521))) (CONNECT_DATA= (SERVICE_NAME=CHICAGO))) In this case.

After the switchover completes.356 . Failovers: Before performing a failover to a RAC standby database. Oracle Database 10g: Data Guard Administration 1 . only one primary instance and one standby instance can be active during a switchover. shut down all but one standby instance.Role Transitions with RAC • Switchovers: Only one primary instance and one standby instance can be active during a switchover. restart the primary and standby instances that you shut down during the switchover. Role Transitions with RAC Switchovers: For a RAC database. shut down all but one primary instance and one standby instance. All rights reserved. shut down all but one standby instance. Oracle. restart the instances that were shut down.356 Copyright © 2006. • Failovers: Before performing a failover to a RAC standby database. Before a switchover. After the failover completes. 11 .

Oracle Database 10g: Data Guard Administration 1 . INST_NUMBER INST_NAME ----------. Troubleshooting Switchover failure: When your database is using RAC.357 .oracle. All rights reserved.Troubleshooting • Switchover failure • Avoiding downtime during a network outage 11 . Oracle. When other instances are active. ALTER DATABASE COMMIT TO SWITCHOVER TO STANDBY * ORA-01105: mount is incompatible with mounts by other instances Query the V$ACTIVE_INSTANCES view to determine which instances are causing the problem: SQL> SELECT * FROM v$active_instances.nl.357 Copyright © 2006. active instances prevent a switchover from being performed.-----------------------------1 nleduc1.com:orcl1 Connect to this instance and shut it down. an attempt to switch over fails and the following error message appears: SQL> ALTER DATABASE COMMIT TO SWITCHOVER TO STANDBY.

it is important to use the following procedures to prevent damage to your data. If you choose to change the primary database to maximum availability mode. 3. The maximum protection mode dictates that if the last participating standby database becomes unavailable. Open the RAC primary database for general access. 2. For example. At this point. consider changing the primary database to operate in either maximum availability or maximum performance mode until network connectivity is restored. Change the mode from maximum protection to either maximum availability or maximum performance. the following statement sets the maximum availability protection mode: ALTER DATABASE SET STANDBY DATABASE TO MAXIMIZE AVAILABILITY. Issue the STARTUP MOUNT command to start one instance: STARTUP MOUNT. If you change the primary database to maximum availability mode. 4. a network outage between the primary database and all of its standby databases will disable the primary database until the network connection is restored.358 . Mount a single instance of the RAC primary database without opening it for general access. The following steps describe what to do if the network goes down and you want to change the protection mode for the RAC configuration. processing halts on the primary database.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. Oracle Database 10g: Data Guard Administration 1 . The example assumes that you are using a server parameter file (SPFILE) rather than a text initialization parameter file (PFILE). perform the following steps to revert to maximum protection mode: 1. Open the RAC primary database for general access. but you gain the ability to use the primary database until the network problem is resolved. 1. all RAC primary instances are shut down. If you expect the network to be down for an extended period of time. it is possible for there to be a lag between the primary and standby databases. Shut down all instances of the RAC primary database. When the network comes back up later. 2. Change the mode on the RAC primary database from its current mode (maximum availability or maximum performance) to maximum protection mode. 3.

359 . Oracle. you should have learned how to deploy Data Guard in a Real Application Clusters environment. 11 .359 Copyright © 2006. Oracle Database 10g: Data Guard Administration 1 .Summary In this lesson. All rights reserved.

.

Oracle. .Other Considerations for Oracle Data Guard 12 Copyright © 2006. All rights reserved.

Oracle Database 10g: Data Guard Administration 1 .Objectives After completing this lesson. All rights reserved.362 Copyright © 2006. Oracle. you should be able to do the following: • Back up the primary database with a physical standby database • Back up a logical standby database • Use Flashback Database features in a Data Guard configuration • Encrypt redo information • Configure cascaded redo log destinations 12 .362 .

Oracle Database 10g: Data Guard Administration 1 . Both the primary database and standby database must use the same recovery catalog. • Control file backups are not interchangeable. All rights reserved. are not interchangeable. • Primary and standby databases must use the same recovery catalog. • It is not necessary to register the standby database. In other words.363 . and you can restore a backup of a primary data file to the standby database. Offloading Backups to a Physical Standby Recovery Manager (RMAN) can back up the standby database and its associated archived redo logs. The standby control file and primary control file.Offloading Backups to a Physical Standby • Backups of data files and archived redo logs are fully interchangeable. Oracle.363 Copyright © 2006. simply connect to the standby database and execute the BACKUP command. Note that you do not need to register the standby database in the catalog if the primary is already registered. you can execute the RESTORE command to restore a backup of a standby data file to the primary database. 12 . however. Standby backups of data files and archived redo logs are fully interchangeable with primary database backups.

3. Issue the BACKUP command.364 . Using RMAN to Back Up a Physical Standby Database Use the RMAN BACKUP command to back up the standby database. 2. 4. Invoke RMAN. except that the backup takes place on the standby site. Allocate channels if needed. Oracle. Use the LIST command to verify the backup. Performing a backup on the standby database is exactly the same as a backup of the primary database. Oracle Database 10g: Data Guard Administration 1 . 12 . All rights reserved.364 Copyright © 2006.Using RMAN to Back Up a Physical Standby Database 1.

When you back up the standby database. • You must be connected to the recovery catalog when backing up. Restrictions and Usage Notes If physical standby database backups are to be usable for restore jobs at the primary site. Essentially. Also. • You must connect to the physical standby database with the TARGET keyword. Oracle Database 10g: Data Guard Administration 1 . • You cannot back up the standby control file. Oracle. You cannot back up the standby control file.365 . 12 . you must connect to the standby database with the TARGET keyword (not the AUXILIARY keyword). All rights reserved. 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. the standby database is “substituting” for the primary database during the backup. 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.Restrictions and Usage Notes • The database you are backing up must be a physical standby database.365 Copyright © 2006. you cannot make an image copy or non-RMAN backup of the standby control file and then use it to restore the primary database.

Backup and Recovery of a Logical Standby Database • Backup considerations: – Use the same backup method that you use for your primary database.366 Copyright © 2006. Oracle Database 10g: Data Guard Administration 1 . Oracle. 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. You can use the same recovery techniques as with any other database for loss of data files or online log files. – Files are not interchangeable with the primary database. All rights reserved.366 . you must use a binary copy of the control file when performing the recovery. The backup files are not interchangeable with the primary database. Remember that this is a different database. You must use the backups of the logical (not the primary) database. Using a trace file or the CREATE CONTROLFILE command for control file recovery does not create a logical standby control file. 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. • Recovery considerations: – Can recover like any other database for loss of individual files – Need to re-create if you lose entire database – Must use a binary copy of control file for control-file recovery 12 . This command creates a binary copy of the control file with the name that you supply. • Issue the following command while the logical standby database is open: ALTER DATABASE BACKUP CONTROLFILE TO '<filename>'. you must re-create the logical standby. If the entire logical standby database is lost. If you lose all copies of your control file.

Oracle Database 10g Release 2 maintains the flashback logs through the above global database changes. Oracle. thereby extending the functionality of the Flashback Database command. you can use flashback database functionality to flash back through the global database changes described above. Flashback Across Database Changes In Oracle Database 10g Release 2. Flashback Database must be previously enabled. To flash back through any of these database state changes.367 Copyright © 2006. Previously. the flashback logs were discarded. Oracle Database 10g: Data Guard Administration 1 . All rights reserved. when any of these global database changes were made.367 .Flashback Across Database Changes Flashback Database restores the database to a point-intime before the following global database changes: • Database RESETLOGS operation • Database switchover or failover to a physical or logical standby database • Physical standby database activation 12 . Enabling Flashback Database for your database remains unchanged from the previous release.

Oracle. All rights reserved.368 .time apply feature. Oracle Database 10g: Data Guard Administration 1 . You can protect a physical standby database from logical data corruption or user error by using Flashback Database. Using Flashback Database and Real-Time Apply You can reduce failover time by using the Oracle Data Guard real.Using Flashback Database and Real-Time Apply RFS Primary database MRP Standby redo log ARC0 Archived redo logs Standby database 12 .368 Copyright © 2006.

369 Copyright © 2006.2) FROM v$database. 2. This is necessary to enable the standby to recover properly through the OPEN RESETLOGS. On the primary database. If the physical standby database’s SCN is far enough behind the primary database’s SCN. it is possible that the Redo Apply service might not halt when it encounters the OPEN RESETLOGS command in the redo information. Use the following query to find the “before RESETLOGS” SCN: SELECT TO_CHAR(resetlogs_change# . Oracle Database 10g: Data Guard Administration 1 . obtain the current SCN by using the following query: SELECT TO_CHAR(current_scn) FROM v$database.369 . Oracle. then the Redo Apply service will be able to interpret the OPEN RESETLOGS command without stopping. determine an SCN that is at least two SCNs prior to the SCN when the OPEN RESETLOGS command was issued. All rights reserved. Using Flashback Database After RESETLOGS Physical Standby Configuration For a physical standby database. Use the following procedure to avoid re-creating a standby database after you have performed an OPEN RESETLOGS on the primary database and the managed recovery process has halted on the physical standby database: 1.Using Flashback Database After RESETLOGS Primary database RESETLOGS after point-in-time recovery Redo Standby database Flashback Redo Primary database Standby database 12 . On the standby database.

Oracle Database 10g: Data Guard Administration 1 . then the SQL Apply service will be able to interpret the OPEN RESETLOGS command without stopping.2) FROM v$database. If the logical standby database’s SCN is far enough behind the primary database’s SCN. This is necessary to enable the standby to recover properly through the OPEN RESETLOGS. 4. 2.370 . On the standby database. obtain the current SCN with the following query: SELECT TO_CHAR(current_scn) FROM v$database. Logical Standby Configuration For a logical standby database. 3. 4.Using Flashback Database After RESETLOGS (continued) 3. Flash back the standby database to the “before RESETLOGS” SCN that you queried in step 1: FLASHBACK STANDBY DATABASE TO SCN <before RESETLOGS SCN>. The standby database should now be ready to receive and apply logs from the primary database: ALTER DATABASE START LOGICAL STANDBY APPLY IMMEDIATE. Flash back the standby database to the “before RESETLOGS” SCN that you queried in step 1: FLASHBACK STANDBY DATABASE TO SCN <before RESETLOGS SCN>. Restart managed recovery on the standby database. On the primary database. Use the following query to find the “before RESETLOGS” SCN: SELECT TO_CHAR(resetlogs_change# . Restart SQL Apply on the standby database. determine an SCN that is at least two SCNs prior to the SCN when the OPEN RESETLOGS command was issued. The standby database should now be ready to receive and apply logs from the primary database: ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT. Use the following procedure to avoid re-creating a standby database after you have performed an OPEN RESETLOGS on the primary database and the SQL Apply process has halted on the logical standby database: 1. it is possible that the SQL Apply service might not halt when it encounters the OPEN RESETLOGS command in the redo information.

From the Encryption Type list. REQUIRED. The SQLNET. f. select one of the following: REQUESTED. (Optional) In the Encryption Seed field. Oracle. the encryption seed for the client should not be the same as that for the server.371 Copyright © 2006. Navigate to the Oracle Advanced Security profile. Select CLIENT or SERVER from the list. c. enter between 10 and 70 random characters. Repeat this procedure to configure encryption on the other system.ORA parameters to enable Oracle Net to encrypt the redo traffic shipped to the standby. 2. Refer to the Oracle Database Advanced Security Administrator’s Guide for detailed information. Oracle Database 10g: Data Guard Administration 1 .Enabling Redo Encryption Primary database Redo information encrypted Standby database 12 . d. Choose File > Save Network Configuration.371 . An outline of the tasks to configure encryption on the client and on the server using Oracle Net Manager is as follows: a. b. Install the Oracle Advanced Security option at both the primary and standby databases. or REJECTED. ACCEPTED. Choose the Encryption tab. Configure the appropriate SQLNET. All rights reserved. e. g.ORA file is updated. Enabling Redo Encryption You can optionally enable encryption of the redo data by using the following procedure: 1.

372 . All rights reserved. Oracle Database 10g: Data Guard Administration 1 . using a combination of the capabilities of Data Guard.Activating a Physical Standby Database for Reporting Redo transport Primary database Redo apply Physical standby database Activate for reporting Guaranteed restore point Flashback Redo stream 12 . Oracle. You do not need to re-create the physical standby database from a backup copy of the primary database.372 Copyright © 2006. Activating a Physical Standby Database for Reporting In Oracle Database 10g Release 2. 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. and the Flashback Database features. Data Guard automatically synchronizes it with the primary database. When the physical standby database is flashed back. guaranteed restore points.

b.373 . Oracle Database 10g: Data Guard Administration 1 . c. Create a guaranteed restore point. perform the following steps to ensure that the physical standby database can be reverted to the restore point: a. All rights reserved. On the physical standby database.Activating a Physical Standby Database for Reporting 1. On the primary database. b. Activating a Physical Standby Database for Reporting (continued) The steps to activate a physical standby database for reporting are outlined on this page and the next. Defer the log archive destination for the physical standby database. Archive the current log. Specify initialization parameters to define the flash recovery area if not already configured. Cancel Redo Apply. 2. 12 . Oracle.373 Copyright © 2006. perform the following steps: a.

On the primary database.374 Copyright © 2006. Oracle Database 10g: Data Guard Administration 1 . you should note that any results stored in the database by a reporting tool are lost when the standby database is flashed back. it does not receive logs from the primary database to provide disaster protection. Convert it back into a physical standby database.374 . Oracle. 12 . Also. 6. Flash back to the restore point. Perform reporting or testing on the activated database. 7. 5. 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. b. Revert the activated database to a physical standby database: a. 4. reenable archiving to the physical standby database destination. Activate the physical standby database and set protection mode to maximum performance. All rights reserved. In this case. you should use multiple standby databases to ensure full disaster protection while a standby is activated temporarily.Activating a Physical Standby Database for Reporting 3. Any results that should be saved must be copied from the database before flashing it back. Activating a Physical Standby Database for Reporting (continued) When you activate a physical standby database temporarily as read/write.

Oracle Database 10g: Data Guard Administration 1 . All rights reserved. Oracle.Cascaded Redo Log Destinations Primary database Redo Standby database Standby database Redo 12 .375 Copyright © 2006. you can implement cascaded redo log destinations.375 . Cascading Redo Log Destinations To reduce the load on your primary system. 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.

Oracle Database 10g: Data Guard Administration 1 . – Configure LOG_ARCHIVE_DEST_n to send redo to the next standby. define sufficient standby redo log files and ensure that archiving is enabled. you should have defined a local archive destination to be used for local archiving when the physical standby database transitions to the primary role. When the physical standby database switches roles.376 Physical standby Physical or logical standby Copyright © 2006. For example. use the LGWR transport.376 . Use either the SYNC or the ASYNC network protocol. Primary database 12 . • On the receiving standby database: – Configure standby redo logs. you might define the LOG_ARCHIVE_DEST_1 initialization parameter to be the 'LOCATION=/physical1/arch' location.Configuring Cascaded Redo Log Destinations: Physical Standby • On the primary database. depending on your requirements. Configuring Cascaded Redo Log Destinations: Physical Standby To enable a physical standby database to send the incoming redo data to another set of destinations. any archived redo log files are put into that directory with the same format that you defined with the LOG_ARCHIVE_FORMAT initialization parameter. All rights reserved. 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 LGWR transport method. as part of the original setup of the physical standby database. Remember that. • On the receiving physical standby database. • Define the LOG_ARCHIVE_DEST_n initialization parameter on the physical standby database that will define the end points of the cascade. Oracle.

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. The shipping of redo back to the primary or another standby is not a problem. but also to the other standby databases and the primary database if they are defined and enabled.Configuring Cascaded Redo Log Destinations: Physical Standby (continued) This local archiving destination can be the same as the one that is defined in the parameter STANDBY_ARCHIVE_DEST. then the shipping of redo acts as an active gap resolution. If the destination is another standby database and it has not received the log file successfully.377 . However. You can avoid the shipping of redo to the primary and other standbys by setting the state to DEFER for any destinations not involved in the cascade. you must remember to enable them again if you do a switchover or failover operation. Oracle Database 10g: Data Guard Administration 1 . but this is not required. the total remote destinations still cannot exceed 10. define the destinations for the primary database and other standby databases as well as for the cascading standby databases. including the local archiving destination. If you want to have one initialization parameter file handle both the cascaded redo log destinations and the original primary and standby destinations. because the receiving database will reject it. However.

378 Copyright © 2006. Role Transitions with Cascaded Redo Log Destinations The process to perform a switchover or failover is exactly the same in a cascaded redo log destinations configuration. Oracle. Any standby database that receives redo data that is cascaded from a logical standby database cannot participate in a switchover involving the primary database. 12 . – May take longer • Standby databases that receive redo data from a logical standby database cannot participate in a switchover involving the primary 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.) If you fail over to a database that receives redo data generated by a logical standby database. because all physical standby databases that receive retransmitted primary database redo data are identical and valid for role transitions.378 . (Only logical standby databases that receive redo data directly from the primary database can participate in switchovers.Role Transitions with Cascaded Redo Log Destinations • Standby databases that receive redo data from a physical standby database: – No change: Switchover and failover are exactly the same. The only difference is that additional time may be required for the end-of-redo data to cascade to the standby database. All rights reserved. Oracle Database 10g: Data Guard Administration 1 .

you should have learned how to: • Back up the primary database with a physical standby database • Back up a logical standby database • Use Flashback Database features in a Data Guard configuration • Encrypt redo information • Configure cascaded redo log destinations 12 .379 .379 Copyright © 2006. Oracle Database 10g: Data Guard Administration 1 .Summary In this lesson. All rights reserved. Oracle.

.

Oracle. . All rights reserved.13 Workshop Copyright © 2006.

you should be able to do the following: • Explain the workshop methodology • Explain the workshop setup 13 . All rights reserved. Oracle Database 10g: Data Guard Administration 1 .Objectives After completing this lesson. Oracle.382 .382 Copyright © 2006.

All rights reserved. • You use Enterprise Manager and SQL commands to manage your Data Guard configuration. Oracle.383 Copyright © 2006.Workshop Premise • You are the DBA of a growing company that has decided to implement Oracle Data Guard to protect its Oracle database.383 . Oracle Database 10g: Data Guard Administration 1 . 13 .

you perform the following tasks: • Create one or more standby databases. • Perform failovers.384 Copyright © 2006. Oracle. • Change the protection mode. • Verify the configurations. Oracle Database 10g: Data Guard Administration 1 .384 . 13 . All rights reserved. • Retrieve information from the standby database.Workshop Flow In this workshop.

General Notes for the Workshop The scenarios should be performed in order. Verifying that the automatic gap detection and resolution feature is working properly 4.385 . Oracle. All rights reserved. and disaster recovery 2. data protection. Verifying the configuration and the operation of log transport and apply services 3.Workshop Scenarios The workshop comprises the following scenarios: 1. Changing the protection mode to meet stated requirements 13 . Creating a Data Guard configuration to ensure high availability.385 Copyright © 2006. Oracle Database 10g: Data Guard Administration 1 .

Workshop Scenarios 5. Configuring the standby database so that users can use it for reporting 8. All rights reserved. Oracle.386 Copyright © 2006. Adding a data file to your primary database 7.386 . Verifying that the automatic gap detection and resolution feature is working properly 13 . Adding a standby database that will support reporting 9. Oracle Database 10g: Data Guard Administration 1 . Configuring the feature that will ensure you will not need to re-create the primary database after failover 6.

Oracle. Returning to your original Data Guard configuration 13 .Workshop Scenarios 10. All rights reserved. Configuring SQL Apply so that specified DML statements are not executed on the logical standby database 11.387 . Oracle Database 10g: Data Guard Administration 1 . Performing a failover operation 13. Adding your original primary database back into the configuration 14.387 Copyright © 2006. Creating a new view on the logical standby database 12.

388 Copyright © 2006. All rights reserved.Summary In this lesson. Oracle Database 10g: Data Guard Administration 1 . 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 13 .388 . Oracle.

Workshop Preparation To prepare for the workshop. Perform the following steps: 1. 2. Invoke DBCA on the server machine your standby databases are on and delete your standby databases. you need to drop your Data Guard configuration and your standby databases. Click Yes on the Confirmation: Remove Data Guard Configuration page to confirm. Oracle Database 10g: Data Guard Administration 1 . Access the Data Guard page and disable fast-start failover. 4. Change the protection mode from Maximum Availability to Maximum Performance. 5.389 . Drop your Data Guard configuration by selecting Remove Data Guard Configuration in the Additional Administration section. Remove your <HOSTNAME>_SITE1 and <HOSTNAME>_SITE2 databases from Grid Control. 3.

You want to ensure that you have created your standby database successfully and that the log transport and apply services are working. 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. due to network problems). For example. Use Enterprise Manager to confirm that your Data Guard configuration is functioning properly. which then automatically transmits the missing archived redo log files to the standby databases. Change the protection mode so that your configuration meets these requirements. Oracle Database 10g: Data Guard Administration 1 . redo data being generated on the primary database cannot be sent to those standby databases. Create your standby database to meet these requirements with the following specifications: Standby database unique and target name: <YOUR_HOSTNAME>_SITE1 Location: Create your standby database on the next-highest student PC in your classroom. 1. 4. Disable log transport services to your standby database. switch the log on your primary database. data protection. Verify that this feature is working properly in your configuration by simulating a loss of connectivity. create your physical standby database named EDRSR8P1_SITE1 on EDRSR8P2. create your standby database on EDRSR8P1. and reenable log transport services to your standby database. 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. 3. 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. As an example. You need to create a Data Guard configuration to ensure high availability. if your host name is EDRSR8P1. 2.Workshop Scenarios In the workshop you will create standby databases and modify your configuration to meet the business requirements outlined in the workshop scenarios. and disaster recovery for your enterprise data. Once a connection is reestablished. You want to be able to open your standby database in read-only mode so that queries can be executed. If you are on EDRSR8P12. 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. 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.390 . if connectivity is lost between the primary and one or more standby databases (for example. the missing archived redo log files (referred to as a gap) are automatically detected by Data Guard.

391 . summations. Oracle Database 10g: Data Guard Administration 1 . 9. and reenable log transport services to your standby database.Workshop Scenarios (continued) 5. 6. 7. and reporting activities against at all times with the following specifications: Standby database unique and target name: <HOSTNAME>_SITE2 Location: Create your standby database on the next-highest student PC in your classroom. For example. The application users need to run some additional reports and do not want to impact the production system. In addition. you would like to add a standby database to your configuration for additional data protection. create your standby database on EDRSR8P1. Perform the steps required to make the standby database available for this reporting task. Add the data file with the following specifications: Data file name: /u01/app/oracle/oradata/orcl/example02. 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. You have determined that the users will need to run reports on a regular basis and do not want to impact the production database. if your host name is EDRSR8P1. If you are on EDRSR8P12. 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. Disable log transport services to your standby database. create your standby database on EDRSR8P2. 8. You want to ensure that you will not need to re-create the primary database after you have performed a failover operation. 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. Configure a second standby database that will be available for users to perform queries.dbf Data file size: 2 MB Verify that the new data file has been added to your standby database. You have been asked to add a data file to the EXAMPLE tablespace in your primary database. switch the log on your primary database.

oracle.EMP_NAME table on the primary database and commit your changes.com database as your primary database. you need to configure SQL Apply so that certain DML statements are not executed against those tables on the logical standby database. Fail over to your physical standby database. Return to your original Data Guard configuration with your HOSTNAME_ORCL.employees WHERE 1=2.emp_name AS SELECT first_name. Add your original primary database back into your Data Guard configuration as a physical standby database. last_name FROM hr. Insert a few rows into the HR.emp_90_vw AS SELECT * FROM hr. Define a filter that prevents SQL Apply from issuing DML statements against the HR. 11. Force a log switch on the primary database and then verify that the new rows are not applied to your logical standby database.employees WHERE department_id=90. You decide to test this feature first by creating a new table on the primary database as follows: CREATE TABLE hr. Oracle Database 10g: Data Guard Administration 1 .Workshop Scenarios (continued) 10. You have experienced a failure on your primary database server. 12.392 . Because the users want to use some tables in the new standby database to report against for historical purposes. You have been asked to create a view for the users to query on the logical standby database.EMP_NAME table on the logical standby database. You have been able to restore the server which your primary database was on. 13. 14. Create the view as follows: CREATE VIEW hr.

Sign up to vote on this title
UsefulNot useful