Beruflich Dokumente
Kultur Dokumente
Guard Administration
Student Guide
D17316GC11
Edition 1.1
January 2005
D40345
Authors Copyright © 2005, Oracle. All rights reserved.
Publisher
Nita Brozowski
Contents
Preface
1 Oracle Data Guard: Overview
Objectives 1-2
Causes of Data Loss 1-3
Every System Faces Down Time 1-4
What Is Oracle Data Guard? 1-5
Types of Standby Databases 1-6
Oracle Data Guard Broker Framework 1-7
Types of Services 1-8
Role Transitions: Switchover and Failover 1-9
Data-Protection Modes 1-11
Benefits of Implementing Oracle Data Guard 1-13
Role of Data Guard in a High Availability Architecture 1-14
Oracle Data Guard and Real Application Clusters 1-16
Maximum Availability Architecture 1-17
Summary 1-18
Practice 1: Overview 1-19
2 Understanding the Oracle Data Guard Architecture
Objectives 2-2
Data Guard Operational Requirements: Hardware and Operating System 2-3
Data Guard Operational Requirements: Oracle Database Software 2-4
Oracle Data Guard: Architecture 2-6
Primary Database Flow 2-7
Standby Database Flow 2-8
Standby Redo Logs 2-9
Data Guard Redo Apply: Architecture 2-10
Data Guard SQL Apply: Architecture 2-12
SQL Apply Process: Architecture 2-13
Real-Time Apply 2-14
Setting the DB_UNIQUE_NAME Parameter 2-16
Specifying Role-Based Destinations 2-17
Combinations for VALID_FOR 2-19
Identifying Destination Settings 2-20
Standby Redo Log Configuration 2-21
Number of Standby Redo Logs 2-22
Using SQL to Add Standby Redo Logs 2-23
Using Enterprise Manager to Add Standby Redo Logs 2-24
Standby Database Modes 2-25
Summary 2-27
Practice 2-1: Overview (Architecture) 2-28
Practice 2-2: Overview (Installing the Oracle Management Agent) 2-29
Practice 2-3: Overview (Configuring Your Primary Database) 2-30
iii
3 Data Guard Broker and Enterprise Manager
Objectives 3-2
Features of Data Guard Broker 3-3
Data Guard Broker: Components 3-4
Data Guard Broker: Configurations 3-5
Data Guard Broker: Management Model 3-6
Data Guard Broker: Architecture 3-7
Life Cycle of a Broker Configuration 3-8
Data Guard Broker: Requirements 3-9
Data Guard Broker and the SPFILE 3-11
Data Guard Monitor: DMON Process 3-13
Data Guard Monitor: Configuration File 3-14
Benefits of Using the Data Guard Broker 3-15
Data Guard Broker Interfaces 3-17
Using Oracle Enterprise Manager 10g Grid Control 3-19
Data Guard Overview Page 3-20
Enterprise Manager Metrics and Alerts 3-21
Using Data Guard Metrics 3-22
Managing Data Guard Metrics 3-23
Benefits of Using Enterprise Manager 3-24
Using the Command-Line Interface of the Data Guard Broker 3-25
Summary 3-27
4 Creating a Configuration with Enterprise Manager
Objectives 4-2
Enabling FORCE LOGGING Mode 4-3
Using Enterprise Manager to Create a Broker Configuration 4-5
Creating a Configuration 4-6
Using the Add Standby Database Wizard 4-8
Step 1: Specify the Backup Type 4-9
Step 2: Specify the Backup Options 4-10
Step 3: Select the Oracle Home – Instance Name 4-11
Step 3: Select the Oracle Home – Oracle Home 4-12
Step 4: Specify the Standby Database File Locations – Access Method 4-13
Step 4: Specify the Standby Database File Locations – File Locations 4-14
Step 5: Specify Standby Database Configuration Parameters 4-15
Step 6: Review the Configuration Information 4-16
Standby Database Creation: Processing 4-17
Standby Database Creation: Progress 4-19
Standby Database Creation: Job Details 4-20
Verifying a Configuration 4-21
Reviewing Results of the Verify Operation 4-22
Creating Standby Redo Logs 4-23
Viewing the Data Guard Configuration Status 4-24
Viewing Data Guard Performance 4-25
Summary 4-27
Practice 4: Overview 4-28
iv
5 Creating a Physical Standby Database by Using SQL
Objectives 5-2
Steps to Create a Physical Standby Database 5-3
Preparing the Primary Database 5-4
Initialization Parameters on the Primary Database 5-5
LOG_ARCHIVE_CONFIG 5-6
LOG_ARCHIVE_DEST_n 5-7
LOCATION and SERVICE Attributes 5-8
LOG_ARCHIVE_DEST_STATE_n 5-9
Specifying Values for DB_FILE_NAME_CONVERT 5-10
Specifying Values for LOG_FILE_NAME_CONVERT 5-11
Specifying a Value for LOG_ARCHIVE_FORMAT 5-12
Specifying a Value for STANDBY_FILE_MANAGEMENT 5-13
ARCHIVE_LAG_TARGET 5-14
LOG_ARCHIVE_TRACE Parameter 5-15
LOG_ARCHIVE_TRACE 5-16
Backing Up the Primary Database by Using RMAN 5-17
Creating a Control File for the Standby Database 5-18
Copying Files to the Standby Database System 5-19
Oracle Managed Files (OMF) and Automatic Storage Management (ASM) 5-20
Initialization Parameters on the Standby 5-21
Specifying a Value for STANDBY_ARCHIVE_DEST 5-22
Setting Up the Environment to Support the Standby Database 5-23
Starting Up the Physical Standby Database 5-25
Additional Configuration Tasks 5-26
Special Note: Standby Database on Same System 5-27
Summary 5-28
6 Data Protection Modes and Log Transport Services
Objectives 6-2
Data Protection Modes and Log Transport Modes 6-3
Attributes of LOG_ARCHIVE_DEST_n 6-4
Setting the Log Transport Mode 6-6
Data Protection Modes 6-8
Maximum Protection 6-9
Maximum Availability 6-10
Maximum Performance 6-11
Setting the Data Protection Mode 6-12
Setting the Data Protection Mode by Using the CLI 6-14
Setting the Protection Mode by Using SQL 6-15
Delaying the Application of Redo 6-16
Using Enterprise Manager to Delay the Application of Redo 6-17
Setting LOG_ARCHIVE_DEST_n to Delay the Application of Redo 6-18
Using Flashback Database Instead of Apply Delay 6-19
Additional Attributes That Affect Log Transport Services 6-20
ALTERNATE and NOALTERNATE Attributes 6-21
MAX_FAILURE and NOMAX_FAILURE Attributes 6-22
NET_TIMEOUT and NONET_TIMEOUT Attributes 6-23
REOPEN and NOREOPEN Attributes 6-24
Summary 6-25
Practice 6: Overview 6-26
v
7 Data Guard SQL Apply Architecture
Objectives 7-2
Benefits of Implementing a Logical Standby Database 7-3
Securing Your Logical Standby Database 7-5
Preparing to Create a Logical Standby Database 7-6
Unsupported Data Types 7-7
Unsupported Objects 7-8
Checking for Tables with Unsupported Data Types 7-9
Unsupported DDL Commands 7-10
Ensuring Unique Row Identifiers 7-11
Adding a Disabled Primary Key RELY Constraint 7-13
Supplemental Logging 7-14
Enabling Supplemental Logging 7-16
Verifying Values of Initialization Parameters 7-17
Creating a Logical Standby Database with Enterprise Manager 7-18
Using the Add Standby Database Wizard 7-19
Step 1: Specifying the Backup Type 7-20
Step 2: Specifying the Backup Options 7-21
Step 3: Selecting the Oracle Home – Instance Name 7-22
Step 4: Specifying the Standby Database File Locations – Access Method 7-23
Step 4: Specifying the Standby Database File Location – File Locations 7-24
Step 5: Specifying Standby Database Configuration Parameters 7-25
Step 6: Reviewing the Configuration Information 7-26
Standby Database Creation Processing 7-27
Resolving a Failed or Canceled Configuration Creation 7-28
Summary 7-29
Practice 7: Overview 7-30
8 Creating a Logical Standby Database by Using SQL
Objectives 8-2
Preparing to Create a Logical Standby Database 8-3
Creating a Logical Standby Database 8-4
Step 1: Create a Physical Standby Database 8-5
Step 2: Prepare the Primary Database to Support a Logical Standby Database 8-6
Step 3: Prepare to Transition to a Logical Standby Database 8-8
Step 4: Start the Logical Standby Database 8-10
Step 5: Verify That the Logical Standby Database Is Performing Properly 8-12
Additional Configuration Tasks 8-14
Summary 8-15
9 Switchover and Failover
Objectives 9-2
Types of Roles in an Oracle Data Guard Configuration 9-3
Role Management Services 9-4
Role Transitions: Switchover and Failover 9-5
Role Transition Decision Tree 9-7
Switchover 9-8
Switchover: Before 9-9
Switchover: After 9-10
vi
Standby Redo Logs and Switchovers 9-11
Preparing for a Switchover 9-12
Performing a Switchover with Enterprise Manager 9-13
Performing a Switchover to a Physical Standby by Using SQL 9-16
Performing a Switchover to a Logical Standby by Using SQL 9-18
Considerations When Performing a Switchover to a
Logical Standby Database 9-23
Situations That Prevent a Switchover 9-25
Failover 9-26
Failover Considerations 9-27
Performing a Failover with Enterprise Manager 9-28
Performing a Failover to a Physical Standby Database 9-31
Performing a Failover to a Logical Standby Database 9-32
Performing a Failover to a Physical Standby Database by Using SQL 9-33
Performing a Failover to a Logical Standby Database by Using SQL 9-36
Activating a Standby Database 9-38
Using Flashback Database After Failover 9-39
Summary 9-42
Practice 9: Overview 9-43
10 Using Data Guard with RAC
Objectives 10-2
Real Application Clusters and Data Guard 10-3
Configuration Considerations with RAC 10-4
Multi-Instance Primary with a Single-Instance Standby 10-6
Multi-Instance Primary with a Multi-Instance Standby 10-7
Log Transport with RAC to RAC 10-8
Setting Up a Primary Database with RAC 10-9
Setting Up a Standby Database with RAC 10-10
Assigning Threads to Standby Redo Log Groups 10-11
Apply Instance Failover 10-12
Role Transitions with RAC 10-14
Troubleshooting 10-15
Summary 10-17
11 Other Considerations for Oracle Data Guard
Objectives 11-2
Offloading Backups to a Physical Standby 11-3
Backing Up a Physical Standby Database with RMAN 11-4
Backup and Recovery of a Logical Standby Database 11-6
Using Flashback Database and Real-Time Apply 11-7
Using Flashback Database After RESETLOGS 11-8
Enabling Redo Encryption 11-10
Cascaded Redo Log Destinations 11-11
Configuring Cascaded Redo Log Destinations: Physical Standby 11-12
Configuring Cascaded Redo Log Destinations: Logical Standby 11-14
Role Transitions with Cascaded Redo Log Destinations 11-16
Summary 11-17
vii
12 Workshop
Objectives 12-2
Workshop Premise 12-3
Workshop Flow 12-4
Workshop Scenarios 12-5
Summary 12-8
Workshop Steps 12-10
viii
Preface
Profile
Preface - 3
Related Publications
Oracle Publications
Title Part Number
Oracle Database Administrator's Guide 10g Release 1 (10.1) B10739-01
Oracle Database Concepts 10g Release 1 (10.1) B10743-01
Oracle Database Performance Tuning Guide
10g Release 1 (10.1) B10752-01
Oracle Database Reference 10g Release 1 (10.1) B10755-01
Oracle Database SQL Reference 10g Release 1 (10.1) B10759-01
Oracle Database Utilities 10g Release 1 (10.1) B10825-01
Oracle Data Guard Broker 10g Release 1 (10.1) B10822-01
Oracle Data Guard Concepts and Administration
10g Release 1 (10.1) B10823-01
Additional Publications
• System release bulletins
• Installation and user’s guides
• International Oracle User’s Group (IOUG) articles
• Oracle Magazine
Preface - 4
Oracle Data Guard: Overview
Computer viruses 7%
Software corruption 4%
Natural disasters 3%
Data Site
changes failure
Planned
down time
System
changes
Production Standby
database Redo transport database
Oracle Net
Database Database
copy
Oracle
Management
Server
Repository
Agent Agent
Primary Standby
database database
Data Data
Guard Guard
broker Enterprise Manager broker
Types of Services
The following types of services are available with Data Guard:
• Log transport services: Control the automated transmittal of redo information from
the primary database to one or more standby databases or destinations
• Log apply services: Control when and how the redo logs are applied to the standby
database
- Redo Apply: Technology used for physical standby databases. Redo data is
applied on the standby database by using the standard recovery techniques of
an Oracle database.
- SQL Apply: Technology used for logical standby databases. The received redo
data is first transformed into SQL statements, and then the generated SQL
statements are executed on the logical standby database.
• Role-management services: A database operates in one of two mutually exclusive
roles: primary or standby. Role-management services operate in conjunction with the
log 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.
• Maximum protection
• Maximum availability
• Maximum performance
Data-Protection Modes
Data Guard provides three high-level modes of data protection that you can configure to
balance cost, availability, performance, and transaction protection. You can configure the
Data Guard environment to maximize data protection, availability, or performance.
Maximum Protection
This protection mode guarantees that no data loss occurs if the primary database fails. To
provide this level of protection, the redo data that is needed to recover each transaction
must be written to both the local online redo log and to the standby redo log on at least one
standby database before the transaction commits. To ensure that data loss does not occur,
the primary database shuts down if a fault prevents it from writing its redo stream to at
least one remote standby redo log. For multiple-instance Real Application Clusters (RAC)
databases, Data Guard shuts down the primary database if it is unable to write the redo
records to at least one properly configured database instance.
Storage
failure
ASM
Human Flashback
error technology
Data
failures
Oracle HARD
Corruption RMAN
Site
Data Guard
failure
Clients
Oracle net
Online
redo Standby
logs redo logs Backup
FAL Reports
ARC0
ARC0
Oracle net
Online
redo Standby
logs redo logs Backup
FAL Reports
ARC0
ARC0
Oracle net
Online
redo Standby
logs redo logs Backup
FAL Reports
ARC0
ARC0
Standby Archived
Redo from redo logs redo logs
primary database
RFS ARC0
MRP/LSP
Standby database
Redo
stream
Backup
Transform redo
information into
SQL
Reports
LCR
Reader Preparer LCR Builder
:
Redo Shared
records pool
Redo data from Logical change records not
primary database Log Mining grouped into transactions Transaction
groups
Apply processing
Applier Coordinator Analyzer
Transactions to Transactions
Data files be applied sorted in
dependency
order
RFS
ARC0
Archived
redo log
Standby
files
database
Real-Time Apply
When you enable the optional real-time apply feature, log apply services apply the redo data
from standby redo log files in real time (at the same time the log files are being written to) as
opposed to recovering redo from archived redo log files when a log switch occurs. If for some
reason the apply service is unable to keep up (for example, if you have a physical standby in
READ ONLY mode for a period of time), then the apply service automatically goes to the archive
log files as needed. The apply service also tries to catch up and go back to reading the standby
redo log files as soon as possible.
Real-time application of redo information provides a number of benefits, including quicker
switchover and failover operations, instantly up-to-date results after you change a physical
standby database to read-only, up-to-date reporting from a logical standby database, and the
ability to leverage larger logs files.
Having larger log files with real-time apply is desirable because the apply service stays with a
log longer and the overhead of switching has less impact on the real-time apply processing.
The RECOVERY_MODE column of the V$ARCHIVE_DEST_STATUS view contains the value
MANAGED REAL TIME APPLY when log apply services are running in real-time apply mode.
San Francisco
SF1_DB
DB_UNIQUE_NAME = SF1_DB
Primary Standby
database database
Not used
LOG_ARCHIVE_DEST_2= location=
"/u01/app/oracle/oradata/orcldg2/arc",
valid_for=(STANDBY_LOGFILE,STANDBY_ROLE)
DB_UNIQUE_NAME = HRDB2
Online Standby
redo redo
Redo
logs shipment logs
RFS
Primary Standby
database database
• Client-side:
– Oracle Enterprise Manager 10g Grid Control
– DGMGRL (command-line interface)
• Server-side: Data Guard monitor
– DMON process
– Configuration files
Chicago Boston
Oracle Net
Primary Standby
site site
Standby database
Broker-controlled Standby database
databases Standby database
Standby database
Standby database
Standby database
Standby database
Primary database Standby database
Standby database
Instances
Instances
Create
configuration
Enable
configuration
• DG_BROKER_START = TRUE
• The primary database must be in ARCHIVELOG
mode.
• All databases must be in MOUNT or OPEN mode.
• Configure DG_BROKER_CONFIG_FILEn for any
RAC databases.
• START_OPTIONS for any RAC databases must be
set to MOUNT in the Oracle Cluster Repository
(OCR).
Configuration
Name: ORCL_EDRSR9P1.oracle.com
Enabled: YES
Protection Mode: MaxPerformance
Databases:
ORCL_EDRSR9P1 - Primary database
site1_edrsr9p1 - Physical standby database
site2_edrsr9p1 - Logical standby database
DGMGRL Commands
The following commands are available in DGMGRL (the Data Guard CLI). Many of these
commands have additional arguments that are not described here. This is simply an overview
listing.
• ADD: Adds a standby database to the broker configuration
• CONNECT: Connects a given username to the specified instance
• CREATE: Enables you to create broker configurations
• DISABLE: Enables you to disable broker control of a configuration or database so that the
object is no longer managed by the broker
• EDIT: Used to edit a configuration, database, or instance
• ENABLE: Enables you to enable broker control of a configuration or database
• EXIT/QUIT: Exits the Data Guard CLI (DGMGRL)
• FAILOVER: Performs a database failover operation in which one of the standby databases
changes to the role of primary database. This is an unplanned transition that may result in
the loss of application data.
• HELP: Displays online help for the commands in DGMGRL
• REMOVE: Removes a broker configuration, including all of its database profiles, a specified
standby database profile, or knowledge of an instance
Creating a Configuration
You can access the Data Guard features in Enterprise Manager by clicking Data Guard in
the High Availability section of the Administration page.
If your primary database is not already in a broker configuration, an information page
appears with this indication. Click the Add Standby Database link to invoke the Add
Standby Database Wizard.
Using the Add Standby Database Wizard, you perform the following steps:
1. Specify the backup type to use for the standby database creation.
2. Specify the backup options.
3. Select the Oracle home in which to create the standby database.
4. Specify the location for standby database files.
5. Specify standby database configuration parameters.
6. Review the configuration information.
Verifying a Configuration
After you create your configuration, you should use the Data Guard Verify operation to
check the configuration. You can invoke the Verify operation by clicking Verify in the
Additional Administration section of the Data Guard page. When you invoke the Verify
operation, a series of validation checks is performed on the Data Guard configuration,
including a health check of each database and each agent.
The Verify operation does the following:
• Determines the current data protection mode settings, including the current log
transport mode settings for each database and whether or not the standby redo logs are
configured properly. If standby redo logs are needed for any database, a message
indicates this on the Detailed Results page. You can then add the standby redo logs.
• Validates each database for the current status
• Performs a log switch on the primary database (for non-RAC databases) and verifies
that the log was applied on each standby database
• Checks the agent status for each database. The verify process executes a SQL*Plus job
on the agent if credentials are available. If credentials are not available to run the job,
the agent is pinged instead. If any errors occur during this process, a message appears
on the Detailed Results page.
• Displays the results of the Verify operation, including any errors
Note: You can cancel the Verify operation at any time by clicking Cancel.
Oracle Database 10g: Data Guard Administration 4-21
Reviewing Results
of the Verify Operation
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.
This setting enables the dynamic addition of a standby database to a Data Guard
configuration that has a Real Application Clusters primary database running in either
maximum protection or maximum availability mode. By default, the
LOG_ARCHIVE_CONFIG parameter enables the database to send and receive redo. After a
role transition, you may need to specify these settings again using the SEND, NOSEND,
RECEIVE, or NORECEIVE keywords.
Use the V$DATAGUARD_CONFIG view to see the current setting.
Note: The LOG_ARCHIVE_CONFIG initialization parameter replaces the
REMOTE_ARCHIVE_ENABLE initialization parameter, which will be deprecated in a future
release. Do not specify both parameters in the same SPFILE or text initialization parameter
file.
LOG_ARCHIVE_DEST_n
By using the various LOG_ARCHIVE_DEST_n attributes, you define most of the settings
for the Data Guard configuration. The transport service is directly controlled by these
settings. There are 35 different attributes that can be set for each LOG_ARCHIVE_DEST_n
parameter. Most have defaults that are adequate for most configurations. See Oracle Data
Guard Concepts and Administration for a compete list and description of each.
You should specify at least two LOG_ARCHIVE_DEST_n parameters (where n is an
integer from 1 to 10): one parameter for the required local archiving destination and another
parameter for a standby location. Query the V$ARCHIVE_DEST view to see current
settings of the LOG_ARCHIVE_DEST_n initialization parameter.
All LOG_ARCHIVE_DEST_n parameters must contain, at a minimum, either a LOCATION
or SERVICE attribute. In addition, you must have a LOG_ARCHIVE_DEST_STATE_n
parameter for each defined destination.
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). For
example, the LOG_ARCHIVE_DEST_STATE_2 parameter specifies the state of the
LOG_ARCHIVE_DEST_2 destination. The following are the valid values:
• ENABLE: Specifies that a valid log archive destination can be used for a subsequent
archiving operation (automatic or manual). This is the default.
• DEFER: Specifies that valid destination information and attributes are preserved but
that the destination is excluded from archiving operations until reenabled
• RESET: Functions similarly to DEFER but clears any error messages for the
destination if it had previously failed
• ALTERNATE: Specifies that the destination is not enabled but becomes enabled if
communication with another destination fails
In the example on the slide, destination 4 is an alternate for destination 3. Notice that
destination 3 has a state of ENABLE and 4 has a state of ALTERNATE. This has the effect of
making destination 4 wait for 3 to fail. In that case, the state of destination 4 becomes
ENABLE and the state of destination 3 becomes DEFER.
• 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.
• Applies to a database when in physical standby
mode
LOG_FILE_NAME_CONVERT = ('/oracle1/logs/',
'/ora1/stby_logs/')
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. Although the redo is
transmitted to the standby during normal operations, it is not applied to the standby database
until the online redo log file on the primary has been completed.
For example, in a configuration where the online redo log file is 100 MB and 80 MB have
been written, a failure at this point would mean that the 80 MB of redo must be applied to
the standby before the failover can complete. If you need to limit the amount of time to get
the standby up and running as a primary after a failover, you can define this parameter to
force a log switch after a certain amount of time, thereby enabling the redo to be applied.
If you set this parameter to too small a value, the primary database log files switch too often
and thus impact performance.
LOG_ARCHIVE_TRACE Parameter
You can set this parameter to trace the transmission of redo data to the standby system.
To enable, disable, or modify the LOG_ARCHIVE_TRACE parameter in a primary database,
do one of the following:
• Shut down the primary database, modify the initialization parameter file, and restart
the database.
• Issue an ALTER SYSTEM SET LOG_ARCHIVE_TRACE=trace_level
statement while the database is open or mounted.
If you change the value of this parameter dynamically with an ALTER SYSTEM statement,
the changes take effect at the start of the next archive operation.
Refer to Oracle Data Guard Concepts and Administration for additional information.
Primary Standby
OMF OMF
primary standby
STANDBY_ARCHIVE_DEST = '/standby/arc_dest/'
STANDBY_ARCHIVE_DEST = 'LOCATION=/standby/arc_dest/'
Primary Standby
/oracle/dba /oracle/standby/dba
Attributes of LOG_ARCHIVE_DEST_n
The following attributes of the LOG_ARCHIVE_DEST_n initialization parameter define the
log transport mode that is used by the primary database to send redo to the standby database:
• ARCH: Indicates that redo logs are transmitted to the destination during an archival
operation. A foreground archival operation or the archiver background processes
(ARCn) serve as the redo log transport service. This is the default.
• LGWR: Indicates that redo is transmitted to the destination concurrently while the
online redo log is being written. The log writer background process (LGWR) serves as
the redo log transport service. When transmitting redo to remote destinations, the
LGWR process establishes a network connection to the destination instance. If a
LGWR destination fails, the destination automatically reverts to using the archiver
process until the error is corrected. With the LGWR attribute, you have the following
additional options:
- SYNC=PARALLEL|NOPARALLEL: Specifies that network I/O is to be
performed synchronously for the destination. This means that after the I/O is
initiated, the LGWR process waits for the I/O to complete before
Maximum Protection
This protection mode ensures that no data loss will occur if the primary database fails. To
provide this level of protection, the redo data needed to recover each transaction must be
written to both the local online redo log and the standby redo log on at least one standby
database before the transaction commits. To ensure that data loss cannot occur, the primary
database shuts down if a fault prevents it from writing its redo stream to at least one remote
standby redo log. For multiple-instance RAC databases, Data Guard shuts down the primary
database if it is unable to write the redo records to at least one properly configured database
instance.
To enable maximum protection mode, perform the following configuration tasks:
• Configure standby redo log files on at least one standby database.
• Set the SYNC, LGWR, and AFFIRM attributes of the LOG_ARCHIVE_DEST_n
parameter for at least one standby database destination.
Maximum Availability
This protection mode provides the highest possible level of data protection without
compromising the availability of the primary database. Like maximum protection mode, a
transaction will not commit until the redo needed to recover that transaction is written to the
local online redo log and to at least one remote standby redo log. Unlike maximum
protection mode, the primary database does not shut down if a fault prevents it from writing
its redo stream to a remote standby redo log. Instead, the primary database operates in
maximum performance mode until the fault is corrected and all gaps in redo log files are
resolved. When all gaps are resolved, the primary database automatically resumes operating
in maximum availability mode.
This mode guarantees that no data loss will occur if the primary database fails, but only if a
second fault does not prevent a complete set of redo data from being sent from the primary
database to at least one standby database.
To enable maximum availability mode, perform the following configuration tasks:
• Configure standby redo log files on at least one standby database.
• Set the SYNC, LGWR, and AFFIRM attributes of the LOG_ARCHIVE_DEST_n
parameter for at least one standby database.
Maximum Performance
This protection mode (the default) provides the highest possible level of data protection
without affecting the performance of the primary database. This is accomplished by
allowing a transaction to commit as soon as the redo data needed to recover that transaction
is written to the local online redo log. The primary database's redo data stream is also
written to at least one standby database, but that redo stream is written asynchronously with
respect to the commitment of the transactions that create the redo data.
When network links with sufficient bandwidth are used, this mode provides a level of data
protection that approaches that of maximum availability mode with minimal impact on
primary database performance.
The maximum performance mode enables you to either set the LGWR and ASYNC attributes
or set the ARCH attribute on the LOG_ARCHIVE_DEST_n parameter for the standby
database destination. If the primary database fails, you can reduce the amount of data that is
not received on the standby destination by setting the LGWR and ASYNC attributes.
Delayed
application
Production Standby
database database
Standby1
No delay
Primary Standby2
database
4-hour delay
Standby3
8-hour delay
Primary Standby
database
• ALTERNATE, NOALTERNATE
• DEPENDENCY, NODEPENDENCY
• MAX_FAILURE, NOMAX_FAILURE
• NET_TIMEOUT, NONET_TIMEOUT
• REOPEN, NOREOPEN
MAX_FAILURE[=count]
• Number of times log transport services attempts
to reestablish communication
• Requires REOPEN
• No default count
NOMAX_FAILURE
• Default
• Same as MAX_FAILURE=0
log_archive_dest_3='SERVICE=o10g1 LGWR
MAX_FAILURE=30 REOPEN'
• REOPEN[=seconds]
– Minimum number of seconds to wait before retrying
a failed destination at log switch
– Failures can be network failures, quota exceptions,
disk full, and so on.
– Default: REOPEN with 300 seconds (5 minutes)
• NOREOPEN
– 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
NOMAX_FAILURE attributes
Unsupported Objects
Refer to Oracle Data Guard Concepts and Administration for additional information on
unsupported data types and objects.
Supplemental Logging
For logical standby to work properly, the logs must contain enough information for the
standby database to be created. The supplemental_db_logging clauses of the
ALTER DATABASE command instruct Oracle Database to add or stop adding supplemental
data to the log stream.
Supplemental logging must be enabled on the primary database to support a logical standby
database. Because an Oracle Database only logs the columns that were modified, this is not
always sufficient to uniquely identify the row that changed, and additional (supplemental)
information must be put into the stream of redo data. The supplemental information that is
added to the redo data helps SQL Apply correctly identify and maintain tables in the logical
standby database.
Supplemental logging can be enabled as follows:
• Full supplemental logging (or identification key logging) enables database-wide,
before-image logging of primary keys or unique indexes (in the absence of primary
keys) for all updates. With this type of logging, an application can identify updated
rows logically rather than resorting to row IDs. This type of logging is required by
SQL Apply.
Click Continue.
No
Can you run crash recovery to Repair
Yes
repair the primary database in primary
a timely manner? database.
No
Failover to best available
standby database.
Switchover
A switchover operation transitions the primary database to the standby role and transitions
the standby database to the primary role, without resetting the online redo logs of the new
primary database.
If the switchover operation involves a physical standby database, both the primary database
and the physical standby database that is switching over to the primary role must be shut
down and restarted. However, there is no need to shut down and restart any other standby
databases that are not participants in the switchover operation. If the switchover operation
involves a logical standby database, there is no need to shut down and restart either the
primary database or any of the standby databases. Logical standby databases do not need to
be shut down and restarted.
Read/write Primary
transactions database
Application
Standby Read-only
database reports
Application
Switchover: Before
For example, assume that the primary database is located in San Francisco and the physical
standby database is located in Boston. Switchovers are initiated only on the primary
database. They cannot be initiated from the standby database.
Read-only Standby
reports database
Application
Primary Read/write
database transactions
Application
Switchover: After
After the switchover completes, each database has the role opposite to the one that it had
before the switchover. In our example, Boston is now the primary database and San
Francisco is the standby database.
Data Guard does not automatically switch over sessions from one database to the other, so
active sessions for each system need to reconnect.
Primary Standby
database database
RFS
Standby
redo
logs
San Francisco
Application
Boston
Read/write Local
transactions archiving
Failover
You invoke a failover operation when a catastrophic failure occurs on the primary database
and there is no possibility of recovering the primary database in a timely manner. During a
failover operation, the primary database is removed from the Data Guard environment and a
standby database assumes the primary database role. Failing over to a standby database is a
permanent operation. You cannot undo the failover and return the database to its former role
as a standby database. Because of this, you should invoke a failover operation only in an
emergency.
It is not always necessary to fail over to the standby database. In some cases, recovery of the
primary database may be faster. Most failures can be resolved at a primary database within a
reasonable amount of time.
In a failover operation:
• The original primary database is presumed to be lost. You must re-create (or flash
back) the original primary database as a new standby database, if desired.
• Standby databases that are online at the time of the failover operation, but are not
involved in the role transition, do not need to be shut down and restarted.
Failover Considerations
During a failover operation, a standby database transitions to the primary role and the old
primary database is rendered unable to participate in the configuration. Depending on the
protection mode under which the old primary database was operating before the failover,
there may be no or some data loss during a failover. A failover is typically used only when a
primary database becomes incapacitated and there is no possibility of performing a
switchover or successfully repairing the primary database within a reasonable amount of
time. The specific actions that are performed during a failover vary depending on whether a
logical or physical standby database is involved in the failover operation, the state of the
configuration at the time of the failover, and the specific SQL commands that are used to
initiate the failover.
There is also a special-case failover in which the standby database is activated. This should
be avoided unless absolutely necessary because it causes all other databases in the
configuration to become permanently disabled.
Primary Standby
database database
Redo
Flashback Failover
Redo
New standby database New primary database
LGWR
Standby Physical
redo standby
files database
Online
redo
Primary files
database
LGWR RFS ARCn
Archived
Archived logs logs MRP
Primary instance B Standby recovery instance D
Primary instance A
Archived logs
LGWR
Online
redo
Primary files
database
LGWR
Archived logs
Primary instance B
Standby Physical
redo standby
files database
RFS ARCn
Archived
logs MRP
Standby recovery instance D
Primary Standby
database redo logs
• Switchover failure
• Avoiding down time during a network outage
Troubleshooting
Switchover failure: When your database is using RAC, active instances prevent a
switchover from being performed. When other instances are active, an attempt to switch
over fails and the following error message appears:
SQL> ALTER DATABASE COMMIT TO SWITCHOVER TO STANDBY;
ALTER DATABASE COMMIT TO SWITCHOVER TO STANDBY *
ORA-01105: mount is incompatible with mounts by other
instances
Query the GV$INSTANCE view to determine which instances
are causing the problem:
SQL> SELECT INSTANCE_NAME, HOST_NAME FROM GV$INSTANCE
2 WHERE INST_ID <>
3 (SELECT INSTANCE_NUMBER FROM V$INSTANCE);
INSTANCE_NAME HOST_NAME
------------- ---------
INST2 standby2
Connect to this instance and shut it down.
1. Invoke RMAN.
2. Allocate channels if needed.
3. Issue the BACKUP command.
4. Use the LIST command to verify the backup.
• Backup considerations:
– Use same backup method you use for your primary
database.
– Files are not interchangeable with 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
Primary
database
MRP
Standby
redo log
ARC0
Archived Standby
redo logs database
Primary Standby
database database
Redo
RESETLOGS
after
Flashback
point-in-time
recovery
Redo
Primary database Standby database
Redo
Primary Standby
information
database database
encrypted
Primary Standby
database database
Redo
Standby
database
Redo
2. You want to ensure that you have created your standby database successfully and that
the log transport and apply services are working. Use Enterprise Manager to confirm
that your Data Guard configuration is functioning properly.
3. You understand that Data Guard can automatically detect archive gaps and resolve
those gaps by copying the missing sequence of log files to the standby destination. As
an example, if connectivity is lost between the primary and one or more standby
databases (for example, due to network problems), redo data being generated on the
primary database cannot be sent to those standby databases. Once a connection is
reestablished, the missing archived redo log files (referred to as a gap) are
automatically detected by Data Guard, which then automatically transmits the missing
archived redo log files to the standby databases. Verify that this feature is working
properly in your configuration by simulating a loss of connectivity. Disable log
transport services to your standby database, switch the log on your primary database,
and re-enable log transport services to your standby database.
4. Maximum performance is the default protection mode and provides the highest level of
data protection that is possible without affecting the performance of the primary
database. This is accomplished by allowing a transaction to commit as soon as the redo
data needed to recover that transaction is written to the local online redo log.
You have determined that you need to change the data protection mode to ensure the
redo data needed to recover each transaction is written to both the local online redo log
and to the standby redo log on at least one standby database before the transaction
commits. You also want to configure the protection mode so that the primary database
does not shut down if a fault prevents it from writing its redo stream to a remote
standby redo log. Change the protection mode so that your configuration meets these
requirements.
5. You want to ensure fast switchover and failover times should you need to perform
those operations. Configure the Data Guard feature that enables log apply services to
apply redo data as it is received, without waiting for the current standby redo log file to
be archived.
6. You want to ensure that you will not need to re-create the primary database after you
have performed a failover operation. Configure the feature that will enable you to flash
back the failed primary database to a point in time before the failover and convert it
into a standby database for the new primary database.
7. You have been asked to add an additional data file to the EXAMPLE tablespace in your
primary database. Add the data file with the following specifications:
Data file name: /u01/app/oracle/oradata/orcl/example02.dbf
Data file size: 2 MB
Verify that the new data file has been added to your standby database.
8. The application users need to run some additional reports and do not want to impact
the production system. Perform the steps required to make the standby database
available for this reporting task. Verify that you can query tables in the standby
database and then restart real-time apply so that the standby database will be
resynchronized with the primary database.
9. You have determined that the users will need to run reports on a regular basis and do
not want to impact the production database. In addition, you would like to add an
additional standby database to your configuration for additional data protection.
Configure a second standby database that will be available for users to perform
queries, summations, and reporting activities against at all times with the following
specifications:
Standby database unique and target name: <HOSTNAME>_SITE2
Location: Create your standby database on the next-highest student PC in your
classroom. For example, if your host name is EDRSR8P1, create your standby
database on EDRSR8P2. If you are on EDRSR8P12, create your standby database on
EDRSR8P1.
10. Verify that the automatic gap detection and resolution feature is working properly in
your configuration by simulating a loss of connectivity to your new standby database.
Disable log transport services to your standby database, switch the log on your primary
database, and re-enable log transport services to your standby database.
11. Because the users want to use some tables in the new standby database to report
against for historical purposes, you need to configure SQL Apply so that certain DML
statements are not executed against those tables on the logical standby database. You
decide to test this feature first by creating a new table on the primary database as
follows:
CREATE TABLE hr.emp_name
AS SELECT first_name, last_name
FROM hr.employees
WHERE 1=2;
Define a filter that prevents SQL Apply from issuing DML statements against the
HR.EMP_NAME table on the logical standby database. Insert a few rows into the
HR.EMP_NAME table on the primary database and commit your changes. Force a log
switch on the primary database and then verify that the new rows are not applied to
your logical standby database.
12. You have been asked to create a view for the users to query on the logical standby
database. Create the view as follows:
CREATE VIEW hr.emp_90_vw
AS SELECT *
FROM hr.employees
WHERE department_id=90;
13. You have experienced a failure on your primary database server. Fail over to your
physical standby database.
14. Your logical standby database is disabled after the failover. Enable your logical
standby database.
15. You have been able to restore the server which your primary database was on. Add
your original primary database back into your Data Guard configuration as a physical
standby database.
Practices and
Solutions
Practice 1: Oracle Data Guard Overview
3. Which one of the following operations would you perform when the primary
database is completely lost?
a. Switchover
b. Apply backups to standby
c. Apply redo logs
d. Failover
Solution: d
6. Which protection mode will cause the primary database to be shut down if contact
with all standby databases is lost?
a. Maximum protection
b. Maximum availability
c. Maximum performance
Solution: a
7. Which protection mode has the lowest impact on the performance of the primary
database but has the possibility of data loss?
a. Maximum protection
b. Maximum availability
c. Maximum performance
Solution: c
8. Real Application Clusters and Oracle Data Guard should not be used together
because they basically do the same thing.
a. True
b. False
Solution: b
2. Which one of the following is not an operational requirement for the Data Guard
environment?
a. The primary and standby databases must use the same database release.
b. Each primary and standby database must have its own control file.
c. The primary database must operate in ARCHIVELOG mode.
d. The standby must be on the same node as the primary.
Solution: d
./runInstaller
6. On the “Specify File Locations” page, accept the defaults in the Source Path and
Destination Name fields. Verify that Destination Path is set to
/u01/app/oracle/product/10.1.0/agent. Click Next.
7. On the “Set a Product to Install” page, select “Additional Management Agent.” Click
Next.
8. On the “Specify Oracle Management Service Location” page, enter the following
information about the host machine that Oracle Enterprise Manager Grid Control is
installed on:
Management Service Host Name: <OMS_host>
Management Service Port: 4889
Click Next.
10. Click Install on the Summary page. The Install page appears showing the progress of
the installation.
11. The “Setup Privileges” dialog box appears instructing you to execute the root.sh
script. Open a new terminal window and log in as the root user.
[oracle@EDRSR10P1 oracle]$ su -
Password:
[root@EDRSR10P1 root]# cd /u01/app/oracle/product/10.1.0/agent
[root@EDRSR10P1 root]# ./root.sh
Accept the default values for all prompts during the execution of the root.sh
script.
After the root.sh script completes, return to the Setup Privileges dialog box and
click OK.
12. The Configuration Assistants page appears. Once the configuration is complete, the
“End of Installation” page appears. Verify that the installation was successful and
click Exit to exit the Oracle Universal Installer. Click Yes in the Exit dialog box.
13. Configure monitoring credentials for your database. Open your browser and enter the
following URL:
http://<oms_host>:7777/em
14. Log in as the user sysman with password oracle1, and change the Monitor
Password for your database to oracle.
a. Log in as the user sysman with password of oracle1 and click Login.
b. Review the licensing information and click “I agree.”
c. Select Targets and click Databases.
d. Select your database (<HOSTNAME>_ORCL) from the list of databases and
click Configure.
e. Enter the Monitor Password of oracle and click Test Connection.
f. Verify the connection is successful and click Next. Click Submit.
g. Click OK.
Primary Database
Database Name: ___________________________________________________
Instance Name: ____________________________________________________
Database Unique Name: _____________________________________________
Target Name: _____________________________________________________
Host: ____________________________________________________________
Oracle Home: _____________________________________________________
Standby Database
Database Name: ___________________________________________________
Instance Name: ____________________________________________________
Database Unique Name: _____________________________________________
Target Name: _____________________________________________________
Host: ____________________________________________________________
Oracle Home: _____________________________________________________
Type of standby: ___________________________________________________
Standby Database
Database Name: ___________________________________________________
Instance Name: ____________________________________________________
Database Unique Name: _____________________________________________
Target Name: _____________________________________________________
Host: ____________________________________________________________
Oracle Home: _____________________________________________________
Type of standby: ___________________________________________________
1. Invoke Enterprise Manager Grid Control and view your database home page.
a. Enter the URL supplied by your instructor: http://hostname:7777/em
b. Supply the following to log in to Grid Control:
User name: SYSMAN
Password: _________
c. Click Login.
d. Click Targets to access the Hosts page.
e. Click Databases to access the Databases page.
f. Select your database by clicking on the database link name.
Important: Because you are logging in as the SYSMAN user, you will be able to see
and modify all databases in your class room. Be careful as you select only your
database in the list.
3. Configure ARCHIVELOG mode for your database. Use the flash recovery area for
the archive log destination. Do not set up any other destinations at this time. You
must be logged in as SYSDBA to complete this task.
a. On your database home page, click Maintenance to access the Maintenance
page.
b. Click Configure Recovery Settings to access the Configure Recovery Settings
page.
c. Because you are logged in as SYSTEM, you must click Logout in the upper
right corner to change the login user.
d. Select “Log out of Database: hostname_ORCL.oracle.com” and “Display
database login page after logout.” Click OK.
e. Enter the username of SYS, password of ORACLE, and select SYSDBA from
the “Connect As” drop-down menu. Click Login.
f. On your database home page, click Maintenance to access the Maintenance
page.
g. Click Configure Recovery Settings to access the Configure Recovery Settings
page.
h. Select “ARCHIVELOG Mode” in the Media Recovery section.
i. Accept the default of USE_DB_RECOVERY_FILE_DEST in destination 10 to
indicate that the flash recovery area should be used.
j. Click Apply.
k. Click Yes on the confirmation page to restart the database instance.
l. Confirm the host and database credentials. Click OK.
m. Click Yes to restart the database instance after shutdown.
n. An Update Message is displayed confirming your change.
1. Invoke SQL*Plus and enable FORCE LOGGING mode for your database.
a. Open a terminal window and invoke SQL*Plus.
[oracle@EDRSR4P1 oracle]$ sqlplus /nolog
SQL*Plus: Release 10.1.0.3.0 - Production on Wed Dec 1
12:50:51 2004
Copyright (c) 1982, 2004, Oracle. All rights reserved.
SQL>
b. Connect to your database as SYS with SYSDBA privileges.
SQL> connect / as sysdba
Connected.
c. Issue the ALTER DATABASE FORCE LOGGING SQL command.
SQL> alter database force logging;
Database altered.
2. Invoke Enterprise Manager 10g Grid Control and access your database home page.
a. Enter the URL supplied by your instructor: http://hostname:7777/em
b. Supply the following to log in to Grid Control:
User name: SYSMAN
Password: _________
c. Click Login.
d. Click Targets to access the Hosts page.
e. Click Databases to access the Databases page.
f. Click the link for your database to access the database home page.
3. Create a physical standby database with the following specifications by using Grid
Control:
Primary database unique name: <HOSTNAME>_ORCL
Standby database unique and target name: <HOSTNAME>_SITE1
Location: Create your physical standby database on the next highest student PC in
your classroom. For example, if your host name is EDRSR8P1, create your physical
standby database named EDRSR8P1_SITE1 on EDRSR8P2. If you are using
EDRSR8P12, create your standby on EDRSR8P1.
Note: Your instructor may modify this configuration.
a. Access your database home page and select Administration to access the
Administration page.
b. Click Data Guard in the High Availability section.
c. Click Add Standby Database to invoke the Add Standby Database Wizard.
d. Select “Create a new physical standby database” and click Continue.
e. Select “Perform a live backup of the primary database” and click Next.
f. Accept the default location for the backup and the default option to delete the
working directory after the standby creation. Click Next.
g. Accept the default instance name of dg2. Enter the credentials for the standby
host machine if they differ from the default supplied. Select the host in the
Standby Database Oracle Home section as described above. Click Next.
h. Accept the default, to transfer files, in the Backup File Access section. Select
“Convert to Oracle OFA” in the Standby Database File Locations section.
Accept the default location for the network configuration file location. Click
Next.
i. Specify Database Unique Name and Target Name as <HOSTNAME>_SITE1.
Accept the default location for the archived redo logs. Click Next.
j. Review your configuration information and click Finish.
k. After you are returned to the Data Guard page, select “Real Time: 1 Minute
Refresh” from the View Data drop-down menu to monitor the creation of your
standby database. The creation is complete when the status changes to Normal.
4. After the physical standby creation is complete, use Verify to validate the
configuration and add standby redo logs.
a. Access your Data Guard configuration by selecting your primary database.
Select Data Guard in the High Availability section of the Administration page.
b. Click Verify in the Additional Administration section.
c. Review the information in the “Detailed Results” section.
d. Select “Create standby redo logs for the following database(s)” to create
standby redo logs for your primary and standby databases. Click OK.
1. Using Enterprise Manager, change the data protection mode for your standby
database to maximum protection.
a. On the Databases target page, click the link for your primary database.
b. Click Administration.
c. Click Data Guard in the High Availability section.
d. In the Overview section, click the link in the Protection Mode field to access
the Edit Protection Mode: Select page.
e. Select Maximum Protection and click Continue.
f. Accept the default selection of your physical standby database and click OK.
g. Click Yes on the Confirmation: Edit Protection Mode page.
h. You are returned to the Data Guard Overview page. Verify that your protection
mode has been changed to maximum protection.
2. Using Enterprise Manager, configure a delay for the application of redo to the
standby database to allow you to stop the application of any corrupt data. Set the
delay for 2 hours (120 minutes).
a. Select your standby database and click Edit on the Data Guard page.
b. Click Standby Role Properties on the Edit Standby Database Properties page.
c. Enter the delay value of 120 in the Apply Delay field.
d. Click Apply.
3. In preparation for later practices, use Enterprise Manager to change the data
protection mode back to maximum performance.
a. Navigate to the Data Guard page.
b. Click the link in the Protection Mode field to access the Edit Protection Mode:
Select page.
c. Select Maximum Performance and click Continue.
d. Accept the default selection of your physical standby database and click OK.
e. Click Yes on the Confirmation: Edit Protection Mode page.
f. You are returned to the Data Guard Overview page. Verify that your protection
mode has been changed to maximum performance.
4. You decide that you no longer want the delayed application of redo. Use Enterprise
Manager to disable the delay in the application of redo.
a. Select your standby database and click Edit on the Data Guard page.
b. Click Standby Role Properties on the Edit Standby Database Properties page.
c. Enter the delay value of 0 in the Apply Delay field.
d. Click Apply.
1. Create a logical standby database with the following specifications using Enterprise
Manager:
Standby database unique and target name: <HOSTNAME>_SITE2
Location: Create your physical standby database on the next highest student PC in
your classroom. For example, if your host name is EDRSR8P1, create your physical
standby database named EDRSR8P1_SITE2 on EDRSR8P2. If you are on
EDRSR8P12, create your standby on EDRSR8P1.
Note: Your instructor may modify this configuration.
a. Select your primary database on the Databases target page.
b. Select Administration to access the Administration page.
c. Click Data Guard in the High Availability section.
d. Click Add Standby Database in the Standby Databases section to invoke the
Add Standby Database Wizard.
e. Select “Create a new logical standby database” and click Continue.
f. Select “Perform a live backup of the primary database” and click Next.
g. Accept the default location for the backup and the default option to delete the
working directory after the standby creation. Enter primary host credentials if
needed. Click Next.
h. Accept the default instance name of dg3. Enter the credentials for the host
machine if they differ from the default supplied. Select the host in the Standby
Database Oracle Home section as described above. Click Next.
i. Accept the default, to transfer files, in the Backup File Access section. Select
“Convert to Oracle OFA” in the Standby Database File Locations section.
Accept the default location for the network configuration file location. Click
Next.
j. Accept the default Database Name. Specify Database Unique Name and Target
Name as <HOSTNAME>_SITE2. Accept the default location for the archived
redo logs. Click Next.
k. Review your configuration information and click Finish.
l. Select "Real Time: 1 Minute Refresh" in the View Data drop-down menu to
monitor the creation.
2. After the logical standby database creation is complete, use Verify to validate the
configuration.
a. Access your Data Guard configuration by selecting your primary database.
Select Data Guard in the High Availability section of the Administration page.
b. Click Verify in the Additional Administration section.
c. View progress on the Processing: Verify page.
d. Review results in the Detailed Results window. Click OK to return to the Data
Guard page.
5. Verify that the HR.MY_TABLE table you created in step 1 exists on your new
primary database.
a. Access the database home page for your new primary database.
b. Log in to your database as SYS with a password of ORACLE as SYSDBA.
c. Select Tables in the Schema section of the Administration page.
d. Enter HR in the Schema field and MY_TABLE in the Object Name field.
e. Click Go.
To prepare for the workshop, you need to drop your Data Guard configuration and your
standby databases. Follow the steps below to accomplish these tasks.
1. Access the Data Guard page and drop your Data Guard configuration by selecting
Remove Data Guard Configuration in the Additional Administration section. Click
Yes on the Confirmation: Remove Data Guard Configuration page to confirm.
2. Open a terminal window and telnet to the machine your standby databases are on.
Log in as the oracle user with password of oracle. Edit the /etc/oratab file
on the machine that your standby databases are on to add entries for these databases.
The entries use the instance name to reference the instance and database. This step is
required so that you will be able to delete the databases using DBCA.
Add entries as follows:
dg2:/u01/app/oracle/product/10.1.0/db_1:N
dg3:/u01/app/oracle/product/10.1.0/db_1:N
3. Invoke DBCA on the server machine your standby databases are on and delete your
standby databases.
In a terminal window, logged on as the oracle user, invoke DBCA by entering dbca
at the command prompt.
a. Click Next on the DBCA Welcome page.
b. Select “Delete a Database” and click Next.
c. Select “dg2” and click Finish.
d. Click Yes to confirm the deletion.
e. Click Yes to perform another operation.
f. Repeat the deletion steps for “dg3.”
g. After you complete the deletion of dg3, click No to exit DBCA.
1. You need to create a Data Guard configuration to ensure high availability, data
protection, and disaster recovery for your enterprise data. You want to be able to
open your standby database in read-only mode so that queries can be executed.
Create your standby database to meet these requirements with the following
specifications:
Standby database unique and target name: <YOUR_HOSTNAME>_SITE1
Location: Create your standby database on the next highest student PC in your
classroom. For example, if your host name is EDRSR8P1, create your physical
standby database named EDRSR8P1_SITE1 on EDRSR8P2. If you are on
EDRSR8P12, create your standby database on EDRSR8P1.
a. Select your primary database on the Databases page.
b. Select Data Guard in the High Availability section of the Administration page.
c. On the Data Guard page, click Add Standby Database.
d. Select “Create a new physical standby database” and click Continue.
e. Select “Perform a live backup of the primary database” and click Next.
f. Accept the default location for the Working Directory. Enter the Primary Host
Credentials if not already populated. Click Next.
g. Accept the default instance name. Select the host for the Oracle Home and
click Next.
h. Select “Transfer files from the primary host working directory to a standby host
working directory” and “Convert to OFA.” Click Next.
i. Change the Database Unique Name and Target Name to
<HOSTNAME>_SITE1 as described above. Accept the default for the Standby
Archive location. Click Next.
j. Review the information and click Finish.
k. When the Data Guard page reappears, select Real Time: 1 Minute Refresh in
the View Data drop-down menu. You can also click the link in the Status
column to review additional information.
2. You want to ensure that you have created your standby database successfully and
that the log transport and apply services are working. Use Enterprise Manager to
confirm that your Data Guard configuration is functioning properly.
a. Click Verify in the Additional Administration section of the Data Guard page.
b. Click OK to create standby redo logs.
3. You understand that Data Guard can automatically detect archive gaps and resolve
those gaps by copying the missing sequence of log files to the standby destination.
As an example, if connectivity is lost between the primary and one or more standby
databases (for example, due to network problems), redo data being generated on the
primary database cannot be sent to those standby databases. Once a connection is
reestablished, the missing archived redo log files (referred to as a gap) are
automatically detected by Data Guard, which then automatically transmits the
missing archived redo log files to the standby databases. Verify that this feature is
working properly in your configuration by simulating a loss of connectivity. Disable
log transport services to your standby database, switch the log on your primary
database, and re-enable log transport services to your standby database.
a. Disable log transport services as follows:
On the Data Guard page, select the standby database and click Edit.
Select the Standby Role Properties page.
Expand Show Advanced Properties.
Select OFF in the Log Shipping drop-down menu. Click Apply.
Select the Databases targets tab.
b. Force three to five log switches on the primary database as follows:
Click the link for your primary database on the Databases targets tab.
Select Redo Log Groups on the Administration page for the primary database.
Select Switch Logfile in the Actions drop-down menu and click Go.
Repeat three to five times.
Return to the Data Guard page and observe the difference in the current log
number for the primary database and the last received log for the standby
database.
c. Enable log transport services to the physical standby database as follows:
On the Data Guard page, select the standby database and click Edit.
Select the Standby Role Properties page.
Expand Show Advanced Properties.
Select ON in the Log Shipping drop-down menu. Click Apply.
d. Verify that all redo has been applied as follows:
Return to the Data Guard page and observe that the standby database has
received the redo log files from the primary database.
4. Maximum performance is the default protection mode and provides the highest level
of data protection that is possible without affecting the performance of the primary
database. This is accomplished by allowing a transaction to commit as soon as the
redo data needed to recover that transaction is written to the local online redo log.
You have determined that you need to change the data protection mode to ensure the
redo data needed to recover each transaction is written to both the local online redo
log and to the standby redo log on at least one standby database before the
transaction commits. You also want to configure the protection mode so that the
primary database does not shut down if a fault prevents it from writing its redo
stream to a remote standby redo log. Change the protection mode so that your
configuration meets these requirements.
Change the protection mode to maximum availability as follows:
a. On the Data Guard page, click the link in the Protection Mode field.
b. Select Maximum Availability and click Continue.
c. Click OK on the Edit Protection Mode: Standby Databases and Redo Logs
page.
d. Click Yes on the Confirmation: Edit Protection Mode page.
5. You want to ensure fast switchover and failover times should you need to perform
those operations. Configure the Data Guard feature that enables log apply services to
apply redo data as it is received, without waiting for the current standby redo log file
to be archived.
Enable real-time apply for your Data Guard configuration as follows:
a. On the Data Guard page, select your standby database and click Edit.
b. Click Standby Role Properties.
c. Expand Show Advanced Properties.
d. Select ON from the Real Time Apply drop-down menu.
e. Click Apply.
f. Return to the Data Guard page by clicking the Data Guard breadcrumb.
6. You want to ensure that you will not need to re-create the primary database after you
have performed a failover operation. Configure the feature that will enable you to
flash back the failed primary database to a point in time before the failover and
convert it into a standby database for the new primary database.
Enable Flashback Database for your primary database, setting the retention time to
12 hours as follows:
a. Navigate to the Maintenance page for your primary database.
b. Select Configure Recovery Settings in the Backup/Recovery section of the
Maintenance page.
c. Select “Enable flashback logging for fast database point-in-time recovery.”
d. Enter 12 hours in the “Flashback Retention Time” field.
e. Click Apply.
f. Click Yes to restart the database instance.
g. Enter the Host Credentials and Database Credentials if they are not supplied.
Click OK.
h. Click Yes to restart the database instance.
i. Return to the database home page after the database instance has been restarted.
7. You have been asked to add an additional data file to the EXAMPLE tablespace in
your primary database. Add the data file with the following specifications:
Data file name: /u01/app/oracle/oradata/orcl/example02.dbf
Data file size: 2 MB
Verify that the new data file has been added to your standby database.
a. Add the new tablespace as follows:
Select the primary database.
Select Tablespaces in the Storage section of the Administration page.
Select the EXAMPLE tablespace.
Select Add Datafile in the Actions drop-down menu and click Go.
Enter example02.dbf in the File Name field and 2 MB in the File Size field.
Click OK.
An update message is displayed.
DB_UNIQUE_NAME
------------------------------
EDRSR10P1_SITE1
SQL> SELECT name FROM v$datafile;
NAME
----------------------------------------------------------------
/u01/app/oracle/product/10.1.0/db_1/oradata/dg2/system01.dbf
/u01/app/oracle/product/10.1.0/db_1/oradata/dg2/undotbs01.dbf
/u01/app/oracle/product/10.1.0/db_1/oradata/dg2/sysaux01.dbf
/u01/app/oracle/product/10.1.0/db_1/oradata/dg2/users01.dbf
/u01/app/oracle/product/10.1.0/db_1/oradata/dg2/example01.dbf
/u01/app/oracle/product/10.1.0/db_1/oradata/dg2/example02.dbf
6 rows selected.
8. The application users need to run some additional reports and do not want to impact
the production system. Perform the steps required to make the standby database
available for this reporting task. Verify that you can query tables in the standby
database and then restart real-time apply so that the standby database will be
resynchronized with the primary database.
a. On the Data Guard page, select the standby database and click Edit.
b. Select “Read Only” in the Log Apply Services section. Click Apply.
c. Return to the Data Guard page and verify the status of Normal, Read-only for
your standby database.
d. Open a terminal window and telnet to the machine your standby database is on.
Log in as the oracle user with password of oracle. Invoke SQL*Plus.
Connect as the HR user and query the HR.EMPLOYEES table as follows:
SQL> SELECT count(*) FROM employees;
Sample output is as follows:
[oracle@EDRSR4P1 oracle]$ export ORACLE_SID=dg2
[oracle@EDRSR4P1 oracle]$ sqlplus /nolog
SQL*Plus: Release 10.1.0.3.0 - Production on Thu Dec 9 13:38:59
2004
Copyright (c) 1982, 2004, Oracle. All rights reserved.
COUNT(*)
----------
107
SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release
10.1.0.3.0 -
With the Partitioning, OLAP and Data Mining options
e. On the Data Guard page, select the standby database and click Edit.
f. Select Online in the Log Apply Services section. Click Apply.
g. Return to the Data Guard page and verify the status of Normal for your standby
database.
h. Open a terminal window and telnet to the machine your standby database is on.
Log in as the oracle user with password of oracle. Invoke SQL*Plus.
Connect as the HR user and attempt to query the HR.EMPLOYEES table as
follows:
SQL> SELECT count(*) FROM employees;
Sample output is as follows:
[oracle@EDRSR4P1 oracle]$ sqlplus /nolog
SQL*Plus: Release 10.1.0.3.0 - Production on Thu Dec 9 13:45:18
2004
Copyright (c) 1982, 2004, Oracle. All rights reserved.
SQL> connect hr/hr
ERROR:
ORA-00604: error occurred at recursive SQL level 1
ORA-01219: database not open: queries allowed on fixed
tables/views only
9. You have determined that the users will need to run reports on a regular basis and do
not want to impact the production database. In addition, you would like to add an
additional standby database to your configuration for additional data protection.
Configure a second standby database that will be available for users to perform
queries, summations, and reporting activities against at all times with the following
specifications:
Standby database unique and target name: <HOSTNAME>_SITE2
Location: Create your standby database on the next highest student PC in your
classroom. For example, if your host name is EDRSR8P1, create your standby
database on EDRSR8P2. If you are on EDRSR8P12, create your standby database on
EDRSR8P1.
a. On the Data Guard page, click Add Standby Database.
b. Select “Create a new logical standby database” and click Continue.
c. Select “Perform a live backup of the primary database” and click Next.
d. Accept the default location for the Working Directory. Enter the Primary Host
Credentials if not already populated. Click Next.
e. Accept the default instance name. Select the host for the Oracle Home and
click Next.
f. Select “Transfer files from the primary host working directory to a standby host
working directory” and “Convert to OFA.” Click Next.
g. Change the Database Unique Name and Target Name to
<HOSTNAME>_SITE2 as described above. Click Next.
10. Verify that the automatic gap detection and resolution feature is working properly in
your configuration by simulating a loss of connectivity to your new standby
database. Disable log transport services to your standby database, switch the log on
your primary database, and re-enable log transport services to your standby database.
a. Disable log transport services to the logical standby database as follows:
On the Data Guard page, select the logical standby database and click Edit.
Select the Standby Role Properties page.
Expand Show Advanced Properties.
Select OFF in the Log Shipping drop-down menu. Click Apply.
Return to the Databases target page.
b. Force three to five log switches on your primary database as follows:
Select your primary database on the Database target page by clicking on the
link
Select Redo Log Groups on the Administration page for the primary database.
Select Switch Logfile in the Actions drop-down menu and click Go.
Repeat three to five times.
Return to the Data Guard page and observe the difference in the current log
number for the primary database and the last received log for the logical
standby database.
c. Enable log transport services to the logical standby database as follows:
On the Data Guard page, select your logical standby database and click Edit.
Select the Standby Role Properties page.
Expand Show Advanced Properties.
Select ON in the Log Shipping drop-down menu. Click Apply.
d. Verify that all redo has been applied to the logical standby database as follows:
Return to the Data Guard page and observe that the standby database has
received the redo log files from the primary database.
11. Because the users want to use some tables in the new standby database to report
against for historical purposes, you need to configure SQL Apply so that certain
DML statements are not executed against those tables on the logical standby
database. You decide to test this feature first by creating a new table on the primary
database as follows:
CREATE TABLE hr.emp_name
AS SELECT first_name, last_name
FROM hr.employees
WHERE 1=2;
Define a filter that prevents SQL Apply from issuing DML statements against the
HR.EMP_NAME table on the logical standby database. Insert a few rows into the
HR.EMP_NAME table on the primary database and commit your changes. Force a log
switch on the primary database and then verify that the new rows are not applied to
your logical standby database.
a. Open a terminal window.
b. Change to the labs directory.
c. Invoke SQL*Plus and connect as hr/hr. Execute the lab_12_11_a.sql
script in your labs directory to create the HR.EMP_NAME table as described.
Maintain the SQL*Plus session for later steps.
d. Configure SQL Apply on the logical standby database so that no DML
statements are executed against the HR.EMP_NAME as follows:
Navigate to the Data Guard page.
Select the logical standby database and click Edit.
Click Standby Role Properties.
Expand Show Advanced Properties.
Click Add in the Skip Table Entries section.
Enter the following information in the specified fields:
SQL Statement: DML
Schema: HR
Object Name: EMP_NAME
Select “Always skip this statement type.”
Click OK.
Verify the information in the Skip Table Entries section and click Apply.
A success message is displayed.
COUNT(*)
----------
0
12. You have been asked to create a view for the users to query on the logical standby
database. Create the view as follows:
CREATE VIEW hr.emp_90_vw
AS SELECT *
FROM hr.employees
WHERE department_id=90;
a. Invoke SQL*Plus and connect to your logical standby database as the SYS
user. Set the Data Guard guard to STANDBY so that you can create a view by
issuing the following statement:
ALTER DATABASE GUARD STANDBY;
Sample output is as follows:
[oracle@EDRSR4P1 oracle]$ export ORACLE_SID=dg3
[oracle@EDRSR4P1 oracle]$ sqlplus /nolog
SQL*Plus: Release 10.1.0.3.0 - Production on Fri Dec 10 10:01:36
2004
Copyright (c) 1982, 2004, Oracle. All rights reserved.
SQL> connect / as sysdba
Connected.
SQL> ALTER DATABASE GUARD STANDBY;
Database altered.
b. Connect to your logical standby database as HR, with HR as the password.
Create a view on the HR.EMPLOYEES table as follows:
CREATE VIEW emp_90_vw
AS SELECT *
FROM employees
WHERE department_id=90;
You can use the lab_12_12_b.sql script to create the view.
c. Connect to your logical standby database as SYS and set the Data Guard guard
back to ALL as follows:
ALTER DATABASE GUARD ALL;
Sample output is as follows:
SQL> connect / as sysdba
Connected.
SQL> ALTER DATABASE GUARD ALL;
Database altered.
13. You have experienced a failure on your primary database server. Fail over to your
physical standby database.
a. On the Data Guard page, select your physical standby database and click
Failover.
On the Confirmation: Redirect page, click Yes to continue with the failover.
On the Confirmation: Failover page, select Complete and click Yes.
The Processing: Failover page is displayed.
The Data Guard page is displayed after processing completes.
b. Force one or two log switches as follows:
Click on the link for your new primary database.
Select the Administration page and click Redo Log Groups.
Select “Switch logfile” in the Actions drop-down menu and click Go. Repeat.
Return to the Data Guard page.
14. Your logical standby database is disabled after the failover. Enable your logical
standby database.
a. Access the Data Guard page. Your logical standby database shows a status of
“Disabled.” Click the “Disabled” link.
b. On the Edit Standby Database Properties page, click Enable. The logical
standby database is reset and is now part of your configuration.
c. Click Verify to verify your Data Guard configuration.
d. Review the results of the verify and click OK to return to the Data Guard
configuration.
15. You have been able to restore the server on which your primary database was
originally located. Add your original primary database back into your Data Guard
configuration as a physical standby database.
a. Open a terminal window and telnet to the machine your standby database is on.
Log in as the oracle user with password of oracle. On the NEW primary
database, issue the follow query in SQL*Plus:
SELECT standby_became_primary_scn FROM v$database;
Make note of the SCN value you obtained in the
query:_____________________
Sample output is as follows:
[oracle@EDRSR4P1 oracle]$ export ORACLE_SID=dg2
[oracle@EDRSR4P1 oracle]$ sqlplus /nolog
SQL*Plus: Release 10.1.0.3.0 - Production on Fri Dec 10 10:15:14
2004
Copyright (c) 1982, 2004, Oracle. All rights reserved.
SQL> connect / as sysdba
Connected.
SQL> SELECT db_unique_name, database_role
2 FROM v$database;
DB_UNIQUE_NAME DATABASE_ROLE
------------------------------ ----------------
EDRSR10P1_SITE1 PRIMARY
b. Using SQL*Plus, start the old primary database instance and place the database
in MOUNT mode.
STARTUP MOUNT;
Sample output is as follows:
[oracle@EDRSR10P1 oracle]$ sqlplus /nolog
SQL*Plus: Release 10.1.0.3.0 - Production on Fri Dec 10 10:18:16
2004
Copyright (c) 1982, 2004, Oracle. All rights reserved.
SQL> connect / as sysdba
Connected to an idle instance.
SQL> STARTUP MOUNT;
ORACLE instance started.
Total System Global Area 188743680 bytes
Fixed Size 778312 bytes
Variable Size 70262712 bytes
Database Buffers 117440512 bytes
Redo Buffers 262144 bytes
Database mounted.
c. Flashback the old primary database to the SCN value you determined in step a.
FLASHBACK DATABASE TO BEFORE SCN <SCN>;
Your old primary database is now serving as a new physical standby database.
Sample output is as follows:
SQL> FLASHBACK DATABASE TO BEFORE SCN 1710595;
Flashback complete.
d. On the new physical standby database, disable Flashback Database.
ALTER DATABASE FLASHBACK OFF;
Sample output is as follows:
SQL> ALTER DATABASE FLASHBACK OFF;
Database altered.
e. On the new physical standby database, determine the names of the control files
by issuing the following command:
SELECT name FROM v$controlfile;
Sample output is as follows:
SQL> SELECT name FROM v$controlfile;
NAME
-----------------------------------------------------------
/u01/app/oracle/oradata/orcl/control01.ctl
/u01/app/oracle/oradata/orcl/control02.ctl
/u01/app/oracle/oradata/orcl/control03.ctl
f. On the new physical standby database, create the standby control file:
ALTER DATABASE CREATE STANDBY CONTROLFILE AS
'control_file_name';
Sample output is as follows:
SQL> ALTER DATABASE CREATE STANDBY CONTROLFILE
2 AS '$ORACLE_BASE/oradata/orcl/sb_control.ctl';
SQL> ALTER DATABASE CREATE STANDBY CONTROLFILE
2 AS '$ORACLE_BASE/oradata/orcl/sb_control.ctl';
Database altered.
g. Shut down the new physical standby database:
SHUTDOWN IMMEDIATE;
Sample output is as follows:
SQL> SHUTDOWN IMMEDIATE;
ORA-01109: database not open
Database dismounted.
ORACLE instance shut down.
h. Using operating system commands, copy the newly created control (step f) to
the locations of your existing control files (as determined in step e).
Sample output is as follows:
[oracle@EDRSR10P1 oracle]$ cd $ORACLE_BASE/oradata/orcl
[oracle@EDRSR10P1 orcl]$ ls
control01.ctl example02.dbf orcl_srl3.f sb_control.ctl
undotbs01.dbf
control02.ctl orcl_srl0.f redo01.log sysaux01.dbf
users01.dbf
control03.ctl orcl_srl1.f redo02.log system01.dbf
example01.dbf orcl_srl2.f redo03.log temp01.dbf
[oracle@EDRSR10P1 orcl]$ cp sb_control.ctl control01.ctl
cp: overwrite `control01.ctl'? y
[oracle@EDRSR10P1 orcl]$ cp sb_control.ctl control02.ctl
cp: overwrite `control02.ctl'? y
[oracle@EDRSR10P1 orcl]$ cp sb_control.ctl control03.ctl
cp: overwrite `control03.ctl'? y
i. Start the instance and mount the database using your new control files:
STARTUP MOUNT;
Sample output is as follows:
[oracle@EDRSR10P1 orcl]$ sqlplus /nolog
SQL*Plus: Release 10.1.0.3.0 - Production on Fri Dec 10 10:29:40
2004
Copyright (c) 1982, 2004, Oracle. All rights reserved.
SQL> connect / as sysdba
Connected to an idle instance.
SQL> startup mount
ORACLE instance started.
• Real-time apply
• Recovery through OPEN RESETLOGS
• Flashback Database support
• Simplified configuration management with the
VALID_FOR attribute
• Standby redo log support on logical standby
databases
• Improved redo data transmission security
• Improved Data Guard support for RAC
• Zero downtime instantiation of logical
standby databases