Database States

Nel documento Oracle® Data Guard Broker 10g (pagine 49-53)

Managing Databases

4.2 Database States

Managing Databases

This chapter describes managing the states and properties that are specific to the database. This chapter contains the following sections:

Section 4.1, "Database Objects"

Section 4.2, "Database States"

Section 4.3, "Database Properties"

Section 4.4, "Managing Redo Transport Services"

Section 4.5, "Managing Log Apply Services"

Section 4.6, "Managing Data Protection Modes"

Section 4.7, "Database Status"

4.1 Database Objects

The broker manages database objects. A database object corresponds to a primary or standby database. The broker uses each object’s profile to manage and monitor the state of a single database.

The broker distinguishes between physical and logical standby databases. These databases are configured with profiles having states and properties that are appropriate for their standby types.

4.2 Database States

When a configuration is enabled, its databases can be in one of several states. Table 4–1 describes all of the possible primary and standby database states.

Table 4–1 Database States and Descriptions

Database Role State Name Description

Primary ONLINE The primary database is open for read/write access and redo transport services are archiving online redo log files to the standby databases.

If this is a RAC database, all started instances are open in read/write mode and have redo transport services running.

This is the default state for a primary database when it is enabled for the first time.

Database States

Primary LOG-TRANSPORT-OFF The primary database is open for read/write access, but redo transport services are not transmitting redo data to the standby databases.

If this is a RAC database, all started instances are open in read/write mode and redo transport services are not running on any instances.

Physical standby ONLINE The physical standby database is mounted and Redo Apply is started. The standby database is not open for read-only queries.

If the standby database is a RAC database, the broker starts log apply services on exactly one standby instance, called the apply instance. If this instance fails, the broker automatically chooses another started instance. This new instance then becomes the apply instance.

This is the default state for a physical standby database when it is enabled for the first time.

Physical standby LOG-APPLY-OFF The physical standby database is mounted, but Redo Apply is stopped. The standby database is not open for read-only queries.

If this is a RAC database, there is no instance running log apply services until you change the database state to ONLINE.

Physical standby READ-ONLY The physical standby database is open for read-only queries, and Redo Apply is stopped.

If this is a RAC database, one or more instances will be open in read-only mode.

Redo Apply is not running on any instance.

Logical standby ONLINE The logical standby database is open for read-only queries and SQL Apply is started.

The logical standby database guard is on.

If this is a RAC database, SQL Apply is running on one instance, the apply instance. If this instance fails, the broker automatically chooses another started instance. This new instance becomes the apply instance.

This is the default state for a logical standby database when it is enabled for the first time.

Logical standby LOG-APPLY-OFF The logical standby database is open for read-only queries, and SQL Apply is not running. The logical standby database guard is on.

If this is a RAC database, there is no instance running SQL Apply until you change the database state to ONLINE.

Table 4–1 (Cont.) Database States and Descriptions Database Role State Name Description

Database States

4.2.1 Database State Transitions

Figure 4–1 graphically shows the possible transitions between the states that were described in Table 4–1. The figure shows the database state transitions that can occur on a primary database, a physical standby database, and a logical standby database.

This figure has three groupings of circles representing each state (one group for each database type) with arrows showing the transitions that are allowed between the states on each database.

Figure 4–1 Database State Transition Diagrams

You can use the DGMGRL EDIT DATABASE command to explicitly change the state of a database. For example, the EDIT DATABASE command in the following example changes the state of the North_Sales database to LOG-TRANSPORT-OFF.

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

Succeeded.

All OFFLINE When you set the state of a standby database to OFFLINE, the broker automatically shuts down the database, turns off redo transport services to this database, and leaves the database as disabled in the broker

configuration. The broker will not manage this database until you restart the database.

When you set the state of a primary database to OFFLINE, the broker automatically shuts down the database. The primary database is not available, and the broker is no longer managing the entire Data Guard configuration.

You need to restart the database to resume broker control.

If this is a RAC database, all started instances are shutdown.

See Also: Chapter 8 for complete information about the EDIT DATABASE command. See Chapter 6 for examples of performing state transitions using Enterprise Manager.

Table 4–1 (Cont.) Database States and Descriptions Database Role State Name Description

Primary Role Standby Role

Database States

The following sections describe in more detail the possible state transitions for primary and standby databases.

Primary database state transitions

For the primary database, when transitioning from any state to the ONLINE state, the broker sets up redo transport services to all broker-managed standby databases using the log transport-related properties of the standby databases. See Section 4.4 for the list of all log transport-related properties. Redo transport services setup is done by setting the LOG_ARCHIVE_DEST_n and LOG_ARCHIVE_DEST_STATE_n initialization parameters on the primary database, and the LOG_ARCHIVE_CONFIG initialization parameter on all databases (primary or standby). If necessary, the broker also sets up the data protection mode of the database to match the protection mode recorded in the broker configuration file, and opens the database for read and write access. Finally, the broker switches a log for each thread to initiate redo transport services.

When transitioning from any state to the LOG-TRANSPORT-OFF state, the broker turns off redo transport services to all broker-managed standby databases by resetting the LOG_ARCHIVE_DEST_STATE_n initialization parameter. Transmission of redo data to all broker-managed standby databases is stopped. Log files continue to be archived at the primary database.

When transitioning to the OFFLINE state, the broker shuts down the primary

database. The primary database is not available, and the broker is no longer managing the configuration. To transition out of the OFFLINE state, you need to start up the database in the mounted mode. The broker will restore the primary database to the ONLINE state.

If the primary database is a RAC database, the broker configures redo transport services on all primary instances with the exact same settings.

Physical standby database state transitions

For a physical standby database, when transitioning from any state to the ONLINE state, the broker starts Redo Apply with options specified by the log apply-related properties. See Section 4.5 for the property list. If the standby database is a RAC database, the broker starts Redo Apply on one standby instance, called the apply instance.

When transitioning to the LOG-APPLY-OFF state, the broker stops Redo Apply if the database is in the ONLINE state, or closes the database if the database is in the READ-ONLY state.

When transitioning to the READ-ONLY state, the broker stops Redo Apply if it is running, and opens the database for read-only access. If the standby database is a RAC database, all currently active instances will be open READ-ONLY.

Note: Before setting the state to OFFLINE, you should carefully consider whether or not the interruption in access to data and computing resources is necessary.

See Also: Section 4.4 for more details on managing redo transport services

Database Properties

When transitioning to the OFFLINE state, the broker shuts down the standby database.

The standby database is not available, the broker stops redo transport services to this database, and the broker stops managing this database. To transition out of the OFFLINE state, you need to start up the database in the mounted mode. The broker restores the standby database to the state it was in before the OFFLINE state.

Logical standby database state transitions

For a logical standby database, when transitioning from any state to the ONLINE state, the broker opens the database if it is not yet opened, enables the database guard to prevent modifications to tables in the logical standby database, and starts SQL Apply with options specified by the log apply-related properties. If the logical standby database is a RAC database, the broker starts SQL Apply on one standby instance, the apply instance.

When transitioning to the LOG-APPLY-OFF state, the broker stops SQL Apply.

When transitioning to the OFFLINE state, the broker shuts down the logical standby database. The logical standby database is not available, the broker stops redo transport services to this database, and the broker stops managing this database. To transition out of the OFFLINE state, you need to start up the database in the mounted mode. The broker restores the standby database to the state it was in before the OFFLINE state.

Nel documento Oracle® Data Guard Broker 10g (pagine 49-53)