Cache in TimesTen Works With Asynchronous Active Data Guard
You can cache tables from an Oracle Active Data Guard with the asynchronous redo transport mode into read-only cache groups.
When using cache with Active Data Guard, you can only use read-only cache groups that are replicated within an active standby pair replication scheme.
The Active Data Guard configuration includes a primary Oracle database that communicates over an asynchronous transport to a single physical standby Oracle database. As shown in Figure 10-1, the primary Oracle database is located on the primary site, while the standby Oracle database is located on a disaster recovery site.
Figure 10-1 Recommended Configuration for Asynchronous Active Data Guard
Description of "Figure 10-1 Recommended Configuration for Asynchronous Active Data Guard"
On TimesTen, the read-only cache groups on the primary site are autorefreshed from the primary Oracle database; however, the only transactions that are autorefreshed are those whose changes have been successfully replicated to the standby Oracle database. Once refreshed to the active master, all changes are then propagated to the TimesTen standby master and a read-only subscriber using standard TimesTen replication processes.
For the best failover and recovery action, you should locate the read-only subscriber
on the same disaster recovery site as the standby
Oracle database. Create this read-only subscriber
with the ttRepAdmin -duplicate
-activeDataGuard
utility option, which
replicates the read-only cache groups directly to
the subscriber as it would to a standby master
database. That is, instead of the cache groups being
converted to tables when replicated to a subscriber,
the cache groups themselves are replicated to the
read-only subscriber. This is to provide a recovery
and failover option if the primary site fails. See
Recovery After Failure When Using Asynchronous Active Data Guard.
The following sections provide more details on the environment for asynchronous Active Data Guard when using replicated read-only cache groups:
Configuring the Primary and Standby Oracle Databases
When you create and configure Active Data Guard with primary and standby Oracle databases, ensure that the configuration includes specific configuration that supports the TimesTen cache environment.
-
Configure both the primary and standby Oracle databases to use Flashback queries. See Configuring Recovery Settings in the Oracle Database 2 Day DBA guide.
-
The Data Guard configuration must be managed by the Data Guard Broker so that the TimesTen daemon processes and application clients respond faster to failover and switchover events. See the Data Guard Broker guide.
-
Create two supporting database services on both the primary and standby Oracle databases in the Oracle Cluster. One database service points to the primary Oracle Database and the other points to the physical standby Oracle Database. You can create these either through role based services or through system triggers.
See the following sections for details.
Configuring Oracle Database Services Through Role Based Services
You can automatically control the startup of Oracle database services on both the primary and standby Oracle databases by assigning a database role to each service.
An Oracle database service automatically starts when the Oracle database
starts if the Oracle database policy is set to AUTOMATIC
and if the
service role matches the current role of the database. In this case, the role for
the Oracle database is either in the primary or standby role as part of the Active
Data Guard configuration.
Configure services with the srvctl
utility identically on all
Oracle databases in the Data Guard configuration. The following example shows two
services created identically on both the primary and the standby Oracle databases.
See srvctl
add service in the Oracle Database Administrator's Guide.
The following steps add the primaryrole
and standbyrole
database services to both the primary and standby Oracle databases when the primary Oracle database is located in Austin and the standby Oracle database is located in Houston.
Configuring the Active Standby Pair With Read-Only Cache Groups
The Active Data Guard with asynchronous redo transport mode supports an active standby pair replication scheme that only contains replicated read-only cache groups.
All replicated read-only cache groups must be created before you create the active standby pair. You cannot exclude a replicated read-only cache group when you are creating the active standby pair and you cannot add another replicated read-only cache group to the active standby pair after creation.
When you create and configure an active standby pair to support replicated read-only cache groups, perform the following to support asynchronous Active Data Guard:
Recovery After Failure When Using Asynchronous Active Data Guard
There are recommended recovery procedures if the primary Oracle database fails, the standby Oracle database fails, or the entire primary site fails taking down the primary Oracle database as well as the active and standby masters.
Failure of the Standby Oracle Database
When the standby Oracle database in an Active Data Guard configuration fails, the cache agent retries the connection to the standby Oracle database.
Note:
You can notify the cache agent of whether the standby Oracle database is active or has failed by calling the ttCacheADGStandbyStateSet
built-in procedure with either the ON
or the FAILED
arguments.
-
If a timeout is set, then the cache agent waits for the amount of time specified with the
ttCacheADGStandbyTimeoutSet
built-in procedure. If the standby Oracle database has not recovered after this period, then the cache agent sets the state of the standby Oracle database by calling thettCacheADGStandbyStateSet
built-in procedure with theFAILED
argument and then facilitates autorefresh using only the primary Oracle database. -
If no timeout has been set with the
ttCacheADGStandbyTimeoutSet
built-in procedure (default value is 0), then the cache agent continues to wait on the standby Oracle database, unless you inform the cache agent that the standby Oracle database is not recovering by calling thettCacheADGStandbyStateSet
built-in procedure with theFAILED
argument.
Once the state of the standby Oracle database is set to FAILED
, the cache agent resumes autorefresh with only the primary Oracle database until you reset the state of the standby Oracle database by calling the ttCacheADGStandbyStateSet
built-in procedure with the ON
argument. Even if the standby Oracle database eventually does recover, the cache agent does not recognize that the standby Oracle database is active until you reset its state to ON
.
Once the state of the standby Oracle database is set to ON
, the cache agent pauses to wait for the standby Oracle database to catch up to the primary Oracle database. After which, the cache agent resumes autorefresh from the primary Oracle database for those transactions that have successfully replicated to the standby Oracle database.
You can restore the original Active Data Guard configuration by dropping the active standby pair and then loading the cache groups.
See ttCacheADGStandbyTimeoutSet and ttCacheADGStandbyStateSet in the Oracle TimesTen In-Memory Database Reference.
Failure of the Primary Oracle Database
If the primary Oracle database fails, then Data Guard switches over to the standby Oracle database and the TimesTen cache agent switches autorefresh over to the new primary Oracle database.
Figure 10-2 Failure of the Primary Oracle Database
Description of "Figure 10-2 Failure of the Primary Oracle Database"
Failure of the Primary Site
If the entire site where the primary Oracle database as well as the active and standby master databases are located fails, then the standby Oracle database becomes the primary Oracle database.
After which, you may want the disaster recovery site to become the primary TimesTen database. Thus, on the disaster recovery site, the standby Oracle database is now a sole Oracle database and the read-only subscriber becomes a single TimesTen database that caches data in the Oracle database.
Transform the subscriber into a single TimesTen database with cached tables by:
-
Drop the active standby pair on the TimesTen database on the disaster recovery site.
-
Alter the existing read-only cache groups on the disaster recovery site to set the autorefresh state to on.
After which, the cache tables on the TimesTen database in the disaster recovery site receive updates from the new primary Oracle database.
Figure 10-3 Recovery After Failure of Primary Site
Description of "Figure 10-3 Recovery After Failure of Primary Site"
The following is the process to recover a failed primary site and rebuild your environment to the original state:
-
Create a new active standby pair on the disaster recovery site.
-
Alter the existing read-only cache groups on the disaster recovery site to set the autorefresh state to off to stop any future updates from the primary Oracle database.
-
Create the ADG enabled read-only subscriber on the recovered primary site.
-
Drop the active standby pair on the ADG enabled read-only subscriber on the primary site, if it still exists after recovering the primary site.
-
Switch over the Oracle databases in the Active Data Guard. Currently, the applications are updating the primary Oracle database on the disaster recovery site. However, once you recover the Oracle database on the primary site, we want it to take over again as the primary and to make the Oracle database on the disaster recovery site as the secondary.
The TimesTen database starts to receive updates from the Oracle database on the primary site.
-
Create a new active standby pair on the primary site.
-
Create a new ADG enabled read-only subscriber on the disaster recovery site.