In an environment where Backup and Redo Apply are configured, a protected database sends backups and redos to a primary Recovery Appliance under normal circumstances. When the primary appliance is unavailable, the protected database sends backups and redos to an alternate Recovery Appliance until the service on the primary is restored.
The alternate appliance does not create virtual full backups from the temporary backups it receives; it stores only the incremental backup pieces and archive logs. When the primary appliance is back online and fully operational, the alternate appliance forwards all temporary backups to the primary appliance, which uses them to create the corresponding virtual full backups. After all virtual full backups have been created, the protected database resumes sending backups and redos to the primary appliance. The alternate appliance deletes the temporary backups from local storage only after they have been successfully forwarded to the primary appliance.
Configuring Backup and Redo Failover
- Configure the Primary Recovery Appliance
- Configure the Alternate Recovery Appliance
- Configure Replication from the Alternate to the Primary Recovery Appliance
- Configure the Protected Database to Send Backups
Configuring the Primary Recovery Appliance for Backup and Redo Failover
To configure the primary ZDLRA for backup and redo failover, you perform several tasks to set up a downstream ZDL in a replication scenario
Task 1: Create a VPC user and a replication user on the primary Recovery Appliance
Log in to the ZDL as root and run the command below to create the VPC user:
racli add db_user --user_name=vpcuser --user_type=vpc
Enter the user password when prompted.
Create the replication user repuser_from_alternate with the CREATE SESSION privilege while logged in to SQL*Plus:
sqlplus "/as sysdba"
CREATE USER repuser_from_alternate IDENTIFIED BY password;
GRANT CREATE SESSION TO repuser_from_alternate;
Task 2: Create a protection policy on the primary Recovery Appliance
To create a protection policy, follow the instructions below. Make sure that the store_and_forward parameter is set to NO.
Run the command below to create a protection policy named primary_brf:
BEGIN
DBMS_RA.CREATE_PROTECTION_POLICY (
protection_policy_name => 'primary_brf',
description => 'For protected dbs on primary',
storage_location_name => 'delta',
recovery_window_goal => INTERVAL '28' DAY,
guaranteed_copy => 'NO',
store_and_forward => 'NO');
END;
Task 3: Add a protected database to the protection policy on the primary ZDLRA
Run the command below to add the orcl12 database to the primary_brf policy created earlier:
BEGIN
DBMS_RA.ADD_DB (
db_unique_name => 'orcl12',
protection_policy_name => 'primary_brf',
reserved_space => '128G');
END;
Task 4: Grant database access to the VPC user and the replication user on the primary ZDLRA
Run the commands below to grant the required privileges on the protected orcl12 database to the VPC user and the replication user:
BEGIN
DBMS_RA.GRANT_DB_ACCESS (
username => 'vpcuser',
db_unique_name => 'orcl12');
END;
BEGIN
DBMS_RA.GRANT_DB_ACCESS (
username => 'repuser_from_alternate',
db_unique_name => 'orcl12');
END;
Configuring the Alternate Recovery Appliance for Backup and Redo Failover
To configure the alternate Recovery Appliance, you will perform tasks similar to the upstream configuration in a replication scenario.
Task 1: Create a protection policy for backup and redo failover on the alternate Recovery Appliance
To create a protection policy, follow the instructions below. Make sure the store_and_forward parameter is set to YES.
Run the command below to create a protection policy named alt_brf:
BEGIN
DBMS_RA.CREATE_PROTECTION_POLICY (
protection_policy_name => 'alt_brf',
description => 'For protected dbs on alternate',
storage_location_name => 'delta',
recovery_window_goal => INTERVAL '28' DAY,
guaranteed_copy => 'NO',
store_and_forward => 'YES');
END;
Task 2: Add a protected database to the protection policy on the alternate ZDLRA
Run the command below to add the orcl12 database to the alt_brf policy created earlier:
BEGIN
DBMS_RA.ADD_DB (
db_unique_name => 'orcl12',
protection_policy_name => 'alt_brf',
reserved_space => '128G');
END;
Task 3: Grant database access to the VPC user and the replication user on the alternate ZDLRA
Run the commands below to grant the required privileges on the protected orcl12 database to the VPC user:
BEGIN
DBMS_RA.GRANT_DB_ACCESS (
username => 'vpcuser',
db_unique_name => 'orcl12');
END;
Configuring Replication for Backup and Redo Failover
After configuring the primary and alternate appliances, you will perform tasks similar to configuring replication from the alternate appliance to the primary. In this scenario, the alternate appliance acts as upstream and the primary appliance acts as downstream.
Task 1: Configure an Oracle Wallet on the alternate Recovery Appliance
On the alternate ZDLRA, use the mkstore utility to create an Oracle auto-login wallet and add the credential for the replication user you created earlier on the primary. The alternate Recovery Appliance requires this credential when connecting to the primary Recovery Appliance.
To configure the auto-login wallet on the alternate ZDLRA:
1. Run the following command to create an Oracle wallet in the /dbfs_repdbfs/REPLICATION directory:
mkstore -wrl /dbfs_repdbfs/REPLICATION -createALO
2. Run the command to add the replication user credentials:
mkstore -wrl wallet_location -createCredential serv_name rep_user pwd
The values to be substituted are defined as follows:
- wallet_location is the directory where you created the wallet in the previous step.
- serv_name is the Oracle network service name you use in an EZ Connect descriptor to identify the primary Recovery Appliance on the Oracle network.
- rep_user is the name of the replication user. The replication user is not created on the alternate ZDLRA.
- pwd is the password for the replication user
rep_user.
For example, the following command adds credentials for the network service name rapribrf-scan.acme.comusing port 1522, a database name rapri, and the replication user repuser_from_alternate:
mkstore -wrl /dbfs_repdbfs/REPLICATION -createCredential \
"rapribrf-scan.acme.com:1522/rapri" "repuser_from_alternate" "pwd"
3. Verify that the credentials were properly added for this user with the following command:
mkstore -wrl /dbfs_repdbfs/REPLICATION -listCredential
Oracle Secret Store Tool : Version 12.1.0.1 Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved.
List credential (index: connect_string username)
1: rapribrf-scan.acme.com:1522/rapri repuser_from_alternate
The result does not display the password.
Task 2: Create the replication server configuration on the alternate Recovery Appliance
For the primary Recovery Appliance to which this alternate Recovery Appliance will forward backups after an outage, configure a replication server by executing the DBMS_RA.CREATE_REPLICATION_SERVER command.
This task assumes the following:
- You will configure a replication server named
raprimary_rep. - The alternate Recovery Appliance will log in to the primary Recovery Appliance using the replication account
repuser_from_alternatethat you created earlier. - The configuration uses the network service name
rapribrf-scan.acme.com:1522/rapri, which you also stored in the Oracle wallet created previously. - The Oracle wallet is stored in
/dbfs_repdbfs/REPLICATION. - The Recovery Appliance Backup Module file, pre-installed on each Recovery Appliance, is
/u01/app/oracle/product/12.1.0.2/dbh1/lib/libra.so. This module acts as an SBT media management library. RMAN references this module when allocating or configuring a channel to back up to the Recovery Appliance.
To configure a replication server:
- Using SQL*Plus or SQL Developer, connect to the alternate Recovery Appliance catalog database with the
RASYSuser. - Execute the
DBMS_RA.CREATE_REPLICATION_SERVERpackage for the primary ZDLRA.
The example below creates a replication server named raprimary_rep for the primary Recovery Appliance:
BEGIN
DBMS_RA.CREATE_REPLICATION_SERVER (
replication_server_name => 'raprimary_rep',
sbt_so_name => '/u01/app/oracle/product/12.1.0.2/dbh1/lib/libra.so',
catalog_user_name => 'RASYS',
wallet_alias => 'rapribrf-scan.acme.com:1522/rapri',
wallet_path => 'file:/dbfs_repdbfs/REPLICATION');
END;
3. Confirm the creation of the replication server. The replication_server_name is converted to uppercase and stored as such. Therefore, queries using the name must also be in uppercase.
For example, run the following query:
SELECT COUNT(*) should_be_one
FROM RA_REPLICATION_SERVER
WHERE REPLICATION_SERVER_NAME = 'RAPRIMARY_REP';
SHOULD_BE_ONE
-------------
1
If the configuration was successful, it will return 1.
Task 3: Associate the alternate Recovery Appliance with the protection policy for Backup and Redo Failover
Specify the primary Recovery Appliance to which the alternate Recovery Appliance forwards backups after an outage by assigning the replication server to a protection policy.
This task assumes the following:
- You will use the replication server named
raprimary_rep, created earlier. - You will add the replication server to the protection policy
alt_brf, also created earlier.
To associate the replication server configuration with the backup and redo failover protection policy:
- Ensure you are connected to the metadata database on the alternate Recovery Appliance as a Recovery Appliance administrator.
- Execute the
DBMS_RA.ADD_REPLICATION_SERVERpackage to configure the backup and redo failover protection policy for the replication server.
For example, run the command below:
BEGIN
DBMS_RA.ADD_REPLICATION_SERVER (
replication_server_name => 'raprimary_rep',
protection_policy_name => 'alt_brf');
END;
Configuring the Protected Database for Backup and Redo Failover
After configuring replication for backup and redo failover, the protected database administrator must perform the tasks in this section so that the protected database can send backups to the primary Recovery Appliance under normal conditions and to the alternate Recovery Appliance during a planned or unplanned outage.
Task 1: Configure sqlnet.ora to point to the wallet location
Ensure that the sqlnet.ora file contains the location of the Oracle wallet.
The following example shows how the wallet location entry should appear:
SQLNET.WALLET_OVERRIDE = true
WALLET_LOCATION =
(SOURCE =
(METHOD = FILE)
(METHOD_DATA =
(DIRECTORY = /u01/app/oracle/product/12.1.0/dbhome_1/dbs/zdlra)
)
)
Task 2: Create an auto-login wallet in the location specified in sqlnet.ora
The example below creates a wallet in the /u01/app/oracle/product/12.1.0/dbhome_1/dbs/zdlra/ directory:
mkstore -wrl /u01/app/oracle/product/12.1.0/dbhome_1/dbs/zdlra/ -createALO
Task 3: Add the primary and alternate Recovery Appliance credentials to the wallet
In this task, the protected database administrator will add credentials for both the primary and alternate appliances using the VPC user created earlier to the wallet.
The following examples add the vpcuser credentials for the primary appliance rapribrf-scan.acme.com:1521/rapri:dedicated and the alternate appliance raaltbrf-scan.acme.com:1521/raalt:dedicated to the wallet on the protected database:
mkstore -wrl /u01/app/oracle/product/12.1.0/dbhome_1/dbs/zdlra/ -createCredential "rapribrf-scan.acme.com:1521/rapri:dedicated" "vpcuser" "pwd"
mkstore -wrl /u01/app/oracle/product/12.1.0/dbhome_1/dbs/zdlra/ -createCredential "raaltbrf-scan.acme.com:1521/raalt:dedicated" "vpcuser" "pwd"
Task 4: Register the protected database with the alternate ZDLRA and back up the controlfile
For this task, the protected database administrator performs steps 1 and 2, and the Recovery Appliance administrator performs step 3.
Register the database and back up the controlfile:
- Using RMAN, connect to the protected database as
TARGETand to the alternate Recovery Appliance catalog asCATALOG, then execute theREGISTER DATABASEcommand. - After the
REGISTER DATABASEcommand completes, back up the controlfile to the alternate Recovery Appliance:
BACKUP DEVICE TYPE SBT CURRENT CONTROLFILE;
- Verify that the controlfile backup has been replicated to the primary Recovery Appliance.
Task 5: Ensure the protected database is registered with the primary Recovery Appliance
This step confirms that the protected database is registered on the primary appliance. Since replication is configured when the database is registered with the alternate appliance in the previous task, the database should be automatically registered with the primary appliance.
To confirm registration on the primary appliance:
- In RMAN, connect to the database using the primary appliance credentials in the
CATALOGconnection string.
rman TARGET / CATALOG /@rapribrf-scan.acme.com:1521/rapri:dedicated
- Execute the
REGISTER DATABASEcommand.
The following error should be displayed:
RMAN-20002: target database already registered in recovery catalog
Notes:
The protected database administrator should also create a separate RMAN backup script that directs backups to the alternate Recovery Appliance when the primary appliance is unavailable and redirects backups to the primary appliance when it is back online. This script should connect to the alternate Recovery Appliance catalog and include the CONFIGURE CHANNEL or ALLOCATE CHANNEL command with the credential_alias set for the alternate appliance.
To send real-time redo logs to the alternate Recovery Appliance during a primary appliance outage, an ALTER SYSTEM SET LOG_ARCHIVE_DEST must be defined as ALTERNATE for the log archive destination used to connect to the primary appliance. The connection string must be defined in the Oracle auto-login wallet, similar to the connection string required for the primary appliance, using the same VPC user (although the password may be different).
Reference: Oracle ZDLRA High Availability