Configuring Replication on Zero Data Loss Recovery Appliance

Oracle Zero Data Loss is the most powerfull Oracle Database Backup Appliance in the market. Full integration with RMAN, Data Guard, Multitenant Architecture and much more.

On this article, let’s see how to Configure replication between 2 ZDLs, building a High Availability backup architecture.

First, let’s explain all the information used in this article:

We will use a total of three VPC users:

raha_local_vpcuser: which will be created on both RAs for local connection to each Appliance;

raha_common_vpcuser: which will also be created on both Recovery Appliances, but its purpose is to allow cross-connection between the RAs in case of a disaster;

repuser_from_raha1: which will be responsible for replicating backups between the RAs.

We will refer to the Recovery Appliances as RAHA1 and RAHA2.

Let’s divide the configuration in steps, to organize better all commands.

Step 1: Create VPC database users on the upstream and downstream Recovery Appliances

First, the virtual private users must be created on each Appliance, one common and one local.

Using the root user, create two VPC users on RAHA1 and RAHA2.

The first VPC user, raha_local_vpcuser may have different passwords on the RAHA1 and RAHA2 Recovery Appliances.

The second VPC user, raha_common_vpcuser, must use the same password on both RAHA1 and RAHA2 Recovery Appliances.

On RAHA1:

[raha1@root ]$ racli add vpc_user –user_name raha_local_vpcuser
raha_local_vpcuser New Password: raha_local_vpcuser_password
Sun Mar 25 08:27:53 2018: Start: Add vpc user raha_local_vpcuser.
Sun Mar 25 08:27:53 2018: Add vpc user raha_local_vpcuser successfully.
Sun Mar 25 08:27:53 2018: End: Add vpc user raha_local_vpcuser.

[raha1@root ]$ racli add vpc_user –user_name raha_common_vpcuser
raha_common_vpcuser New Password: raha_common_vpcuser_password
Sun Mar 25 08:27:53 2018: Start: Add vpc user raha_common_vpcuser.
Sun Mar 25 08:27:53 2018: Add vpc user raha_common_vpcuser successfully.
Sun Mar 25 08:27:53 2018: End: Add vpc user raha_common_vpcuser.

On RAHA2:

[raha2@root ]$ racli add vpc_user –user_name raha_local_vpcuser
raha_local_vpcuser New Password: raha_local_vpcuser_password
Sun Mar 25 08:27:53 2018: Start: Add vpc user raha_local_vpcuser.
Sun Mar 25 08:27:53 2018: Add vpc user raha_local_vpcuser successfully.
Sun Mar 25 08:27:53 2018: End: Add vpc user raha_local_vpcuser.

[raha2@root ]$ racli add vpc_user –user_name raha_common_vpcuser
raha_common_vpcuser New Password: raha_common_vpcuser_password
Sun Mar 25 08:27:53 2018: Start: Add vpc user raha_common_vpcuser.
Sun Mar 25 08:27:53 2018: Add vpc user raha_common_vpcuser successfully.
Sun Mar 25 08:27:53 2018: End: Add vpc user raha_common_vpcuser.

Create on RAHA2, the VPC user that will be used by the replication server to send backups from the RAHA1 Recovery Appliance to the RAHA2 Recovery Appliance.

[raha2@root ]$ racli add vpc_user –user_name repuser_from_raha1
repuser_from_raha1 New Password: repuser_from_raha1_password
Sun Mar 25 08:35:01 2018: Start: Add vpc user repuser_from_raha1.
Sun Mar 25 08:35:01 2018: Add vpc user repuser_from_raha1 successfully.
Sun Mar 25 08:35:01 2018: End: Add vpc user repuser_from_raha1.
Step 2: Modify the Oracle Network Configuration Files Used for Transparent Failover to the Downstream Recovery Appliance

Edit the tnsnames.ora file and add the following entry:

$ cd ${ORACLE_HOME}/network/admin

DR_RAHA =
  (DESCRIPTION_LIST =
    (LOAD_BALANCE = off)
    (FAILOVER = on)
    (DESCRIPTION =
      (CONNECT_TIMEOUT = 5)
      (TRANSPORT_CONNECT_TIMEOUT = 3)
      (RETRY_COUNT = 3)
      (ADDRESS_LIST =
        (ADDRESS = (PROTOCOL = TCP)(HOST = ra1ingest-scan)(PORT = <PORT>))
      )
      (CONNECT_DATA =
        (SERVICE_NAME = raha1)
      )   
  ) 
  (DESCRIPTION =
      (CONNECT_TIMEOUT = 5)
      (TRANSPORT_CONNECT_TIMEOUT = 3)
      (RETRY_COUNT = 3)
      (ADDRESS_LIST =
        (ADDRESS = (PROTOCOL = TCP)(HOST = ra2ingest-scan)(PORT = <PORT>))
      )
      (CONNECT_DATA =
        (SERVICE_NAME = raha2)
      )
  ) 
)

DR_RAHA1 =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (CONNECT_TIMEOUT = 5)
      (TRANSPORT_CONNECT_TIMEOUT = 3)
      (RETRY_COUNT = 3)
      (ADDRESS_LIST =
        (ADDRESS = (PROTOCOL = TCP)(HOST = ra1ingest-scan)(PORT = <PORT>))
      )
      (CONNECT_DATA =
        (SERVICE_NAME = raha1)
      ) 
   ) 
)

DR_RAHA2 =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (CONNECT_TIMEOUT = 5)
      (TRANSPORT_CONNECT_TIMEOUT = 3)
      (RETRY_COUNT = 3)
      (ADDRESS_LIST =
        (ADDRESS = (PROTOCOL = TCP)(HOST = ra2ingest-scan)(PORT = <PORT>))
      )
      (CONNECT_DATA =
        (SERVICE_NAME = raha2)
      )    
   ) 
)
Step 3: Configure the Replication Server to Replicate Database Backups from RAHA1 to RAHA2

Let’s create the replication server between RAHA1 and RAHA2.

Create on RAHA1 the replication wallet that points to RAHA2.

[raha1@root ]$ mkstore -wrl file:/dbfs_repdbfs/REPLICATION -createALO

Add credentials to the wallet. On RAHA1, add the credentials to log in to RAHA2.

[raha1@root ]$ mkstore -wrl file:/dbfs_repdbfs/REPLICATION -createCredential ra2repl-scan.<domain>:<PORT>/raha2 repuser_from_raha1 repuser_from_raha1_password

Create the RA replication server. On RAHA1, create the RA replication server.

[raha1@root ]$ sqlplus rasys/<RASYS_PASSWORD>

SQL> exec dbms_ra.create_replication_server( replication_server_name => ‘RAHA2_REP’, sbt_so_name=> ‘libra.so’, max_streams => 8, catalog_user_name => ‘RASYS’, 
wallet_alias => ‘ra2repl-scan.<domain>:<PORT>/raha2’, wallet_path => ‘file:/dbfs_repdbfs/REPLICATION’);

PL/SQL procedure successfully completed.
Step 4: Configure the Upstream and Downstream Recovery Appliances

Create the protection policy for the protected database on the downstream Recovery Appliance and add the database database.

On RAHA2, create a replication policy to be used for the database CDB122HA.

Note: Since the RAHA2 Recovery Appliance will not normally be accepting redo data from the CDB122HA database, the parameter unprotected data window is set to 1.25 days to prevent false alerts if the CDB122HA database is inactive.

[raha2@root ]$ sqlplus rasys/<RASYS_PASSWORD>

SQL> exec dbms_ra.create_protection_policy( protection_policy_name => ‘cdb122ha_PP’ , storage_location_name => ‘DELTA’ , recovery_window_goal => numtodsinterval(3,’DAY’) ,
unprotected_window => numtodsinterval(1.25,’DAY’),  allow_backup_deletion => ‘NO’, store_and_forward => ‘YES’);

PL/SQL procedure successfully completed.

SQL> exec dbms_ra.add_db(db_unique_name => ‘cdb122ha’, protection_policy_name => ‘cdb122ha_PP’, reserved_space => ‘1T’);

PL/SQL procedure successfully completed.

SQL> exec dbms_ra.grant_db_access(username => ‘repuser_from_raha1‘, db_unique_name => ‘cdb122ha’);

PL/SQL procedure successfully completed.
Step 5: Create the protection policy for the protected databases on the upstream Recovery Appliance and add the database.

On RAHA1, create the protection policy to be used for the CDB122HA database.

[raha1@root ]$ sqlplus rasys/<RASYS_PASSWORD>

SQL> exec dbms_ra.create_protection_policy( protection_policy_name => ‘cdb122ha_PP’ , storage_location_name => ‘DELTA’ , recovery_window_goal => numtodsinterval(3,’DAY’) , unprotected_window => numtodsinterval(5,’MINUTE’) , allow_backup_deletion => ‘NO’);

PL/SQL procedure successfully completed.

SQL> exec dbms_ra.add_db(db_unique_name => ‘cdb122ha’, protection_policy_name => ‘cdb122ha_PP’, reserved_space => ‘1T’);

PL/SQL procedure successfully completed.

SQL> exec dbms_ra.grant_db_access(username => ‘repuser_from_raha1‘, db_unique_name => ‘cdb122ha’);

PL/SQL procedure successfully completed.
Step 6: Add the protection policy to the replication server that was configured on the upstream Recovery Appliance.

On RAHA1, add the protection policy for the CDB122HA database.

[raha1@root ]$ sqlplus rasys/<RASYS_PASSWORD>

SQL> exec dbms_ra.add_replication_server( replication_server_name => ‘RAHA2_REP’, protection_policy_name => ‘cdb122ha_PP’);

PL/SQL procedure successfully completed.
Step 7: Register the Protected Database with the Upstream Recovery Appliance

The commands below should be executed on each host where the protected database runs, if it is a RAC.

Configure the sqlnet.ora file to be used by RMAN to connect to the correct Recovery Appliance.

cd ${ORACLE_HOME}/network/admin

Then edit the sqlnet.ora file and make sure that the following parameters are correctly configured:

SQLNET.WALLET_OVERRIDE = true
NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)
WALLET_LOCATION =
  (SOURCE =
    (METHOD = FILE)
    (METHOD_DATA =
      (DIRECTORY = <ORACLE_HOME>/dbs/zdlra)
    )
) 

SQLNET.EXPIRE_TIME = 10
Step 8: Create a Wallet that Stores the Credentials for Each VPC user

Execute these steps if the wallet does not already exist on each protected database host:

$ mkstore -wrl file:<ORACLE_HOME>/dbs/zdlra – createALO
Step 9: Create Aliases for the Credentials of Each of the Three Users that Will be Used by RMAN

On each host, run the mkstore command. Enter the appropriate password when prompted.

$ mkstore -wrl file:<ORACLE_HOME>/dbs/zdlra – createCredential dr_raha2 raha_local_vpcuser raha_local_vpcuser_password

$ mkstore -wrl file:<ORACLE_HOME>/dbs/zdlra – createCredential dr_raha1 raha_local_vpcuser raha_local_vpcuser_password

$ mkstore -wrl file:<ORACLE_HOME>/dbs/zdlra – createCredential dr_raha raha_common_vpcuser raha_common_vpcuser_password
Step 10: Verify that the Credentials are Working Correctly by Connecting Within Each Target Using Only the Credential Aliases.

On each protected database host, execute the following:

$ sqlplus /@dr_raha1
Step 11: Register the Protected Database with the Recovery Appliance on RAHA1

On one of the protected database hosts, execute:

$ rman target / catalog /@dr_raha1

RMAN> register database;
Step 12: Perform a Backup Test of a Current Control File to the Recovery Appliance RAHA1
$ man target / catalog /@dr_raha1

RMAN> CONFIGURE CHANNEL DEVICE TYPE ‘SBT_TAPE’ FORMAT ‘%d_%U’ PARMS “SBT_LIBRARY=<ORACLE_HOME>/lib/libra.so, ENV=(RA_WALLET=’location=file:<ORACLE_HOME>/dbs/zdlra credential_alias=dr_raha1′)”;
RMAN> backup device type sbt current controlfile tag ‘controltest’;
Starting backup at 05-JUN-18
allocated channel: ORA_SBT_TAPE_1
channel ORA_SBT_TAPE_1: SID=2320 instance=cdb122ha1 device type=SBT_TAPE
channel ORA_SBT_TAPE_1: RA Library (RAHA1) SID=6DE9FE3D49ED4598E05311F3850AC59F
allocated channel: ORA_SBT_TAPE_2
channel ORA_SBT_TAPE_2: SID=2516 instance=cdb122ha1 device type=SBT_TAPE
channel ORA_SBT_TAPE_2: RA Library (RAHA1) SID=6DE9FE48D84C48C8E05311F3850A89BE
channel ORA_SBT_TAPE_1: starting full datafile backup set
channel ORA_SBT_TAPE_1: specifying datafile(s) in backup set including current control file in
backup set
channel ORA_SBT_TAPE_1: starting piece 1 at 05-JUN-18
channel ORA_SBT_TAPE_1: finished piece 1 at 05-JUN-18 piece handle=CDB122HA_2kt4m80u_1_1
tag=CONTROLTEST comment=API Version 2.0,MMS Version 3.17.1.26
channel ORA_SBT_TAPE_1: backup set complete, elapsed time: 00:00:15
Finished backup at 05-JUN-18
Starting Control File and SPFILE Autobackup at 05-JUN-18 piece handle=c-3244939197-20180605-00
comment=API Version 2.0,MMS Version 3.17.1.26
Finished Control File and SPFILE Autobackup at 05-JUN-18
Step 12+1: List the Backup set that Was Just Created

Verify that there are two copies of the control file, one on the Recovery Appliance RAHA1 and the other on the Recovery Appliance RAHA2.

RMAN> list backupset tag CONTROLTEST;

List of Backup Sets
===================
BS Key Type LV Size
——- —- — ———-
220 Full 138.75M
Control File Included: Ckp SCN: 9076177 Ckp time: 05-JUN-18
Backup Set Copy #1 of backup set 220
Device Type Elapsed Time Completion Time Compressed Tag
———– ———— ————— ———- —
SBT_TAPE 07:00:21 05-JUN-18 NO CONTROLTEST
List of Backup Pieces for backup set 220 Copy #1
BP Key Pc# Status Media Piece Name
——- — ———– ———————– ———-
221 1 AVAILABLE Recovery Appliance (RAHA1) CDB122HA_2kt4m80u_1_1
Backup Set Copy #2 of backup set 220
Device Type Elapsed Time Completion Time Compressed Tag
———– ———— ————— ———- —
SBT_TAPE 07:00:21 05-JUN-18 NO CONTROLTEST
List of Backup Pieces for backup set 220 Copy #2
BP Key Pc# Status Media Piece Name
——- — ———– ———————– ———-
246 1 AVAILABLE Recovery Appliance (RAHA2) RA_SBT_CDB122HA_3244939197_230_2kt4m80u_1_2_220
Step 14: Add the Remaining Privileges to both Upstream and Downstream Recovery Appliances

Add remaining privileges for VPC users. On RAHA1, add access privileges for a remaining VPC user.

SQL> exec dbms_ra.grant_db_access(username => ‘raha_common_vpcuser‘, db_unique_name => ‘cdb122ha’);

PL/SQL procedure successfully completed.

On RAHA2, add access privileges for the two remaining VPC users. These users are pre-configured in case of eventual backup failure due to RAHADR1 being unavailable.

SQL> exec dbms_ra.grant_db_access(username => ‘raha_local_vpcuser‘, db_unique_name => ‘cdb122ha’);

PL/SQL procedure successfully completed.

SQL> exec dbms_ra.grant_db_access(username => ‘raha_common_vpcuser‘, db_unique_name => ‘cdb122ha’);

PL/SQL procedure successfully completed.
Step 15: Verify that the Credentials are Working Correctly.

Connect to the appliances using only the credential alias. On each host, execute the follow:

$ sqlplus /@dr_raha2

$ sqlplus /@dr_raha
Step 16: Configure the Communication Channel Parameter for use with the DR_RAHA Load Balance Alias

On one of the protected database servers, run:

$ rman target / catalog /@dr_raha1

RMAN> CONFIGURE CHANNEL DEVICE TYPE ‘SBT_TAPE’ FORMAT ‘%d_%U’ PARMS “SBT_LIBRARY=<ORACLE_HOME>/lib/libra.so, ENV=(RA_WALLET=’location=file:<ORACLE_HOME>/dbs/zdlra credential_alias=dr_raha’)”;

Optionally, configure the following parameters, which are best practice recommendations.

RMAN> CONFIGURE BACKUP OPTIMIZATION on;
RMAN> CONFIGURE CONTROLFILE AUTOBACKUP on;
RMAN> CONFIGURE DEFAULT DEVICE TYPE TO sbt;
RMAN> CONFIGURE DEVICE TYPE SBT_TAPE PARALLELISM 2 BACKUP TYPE TO BACKUPSET;
RMAN> CONFIGURE SNAPSHOT CONTROLFILE NAME TO ‘+RECOC1/cdb122ha/snapcf.f’;
RMAN> CONFIGURE ARCHIVELOG DELETION POLICY TO backed up 1 times to device type sbt;
Step 17: Configure Backup Operation for Upstream and Downstream RAs

Create two RMAN scripts used to backup the database, one for each Recovery Appliance. On one of the hosts, create the text file backup_database_rahadr1.rman

{ 
allocate channel raha1_sbt_1 device type sbt format ‘%d_%U’ PARMS=”SBT_LIBRARY=<ORACLE_HOME>/lib/libra.so, ENV=(RA_WALLET=’location=file:<ORACLE_HOME>/dbs/zdlra credential_alias=dr_raha1′)”;
allocate channel raha1_sbt_2 device type sbt format ‘%d_%U’ PARMS=”SBT_LIBRARY=<ORACLE_HOME>/lib/libra.so, ENV=(RA_WALLET=’location=file:<ORACLE_HOME>/dbs/zdlra credential_alias=dr_raha1′)”;
backup tag ‘&1’ cumulative incremental level 1 filesperset 1 section size 64g database plus archivelog not backed up filesperset 32 delete input;
}

On one of the hosts, create the text file backup_database_rahadr2.rman

{ 
allocate channel raha2_sbt_1 device type sbt format ‘%d_%U’ PARMS=”SBT_LIBRARY=<ORACLE_HOME>/lib/libra.so, ENV=(RA_WALLET=’location=file:<ORACLE_HOME>/dbs/zdlra credential_alias=dr_raha2′)”;
allocate channel raha2_sbt_2 device type sbt format ‘%d_%U’ PARMS=”SBT_LIBRARY=<ORACLE_HOME>/lib/libra.so, ENV=(RA_WALLET=’location=file:<ORACLE_HOME>/dbs/zdlra credential_alias=dr_raha2′)”;
backup tag ‘&1’ cumulative incremental level 1 filesperset 1 section size 64g database plus archivelog not backed up filesperset 32 delete input;
}

Load the script into the RAHA1 Recovery Appliance. Make sure the script does not exist by trying to delete it first and then load the script.

[raha1@root ]$  rman target / catalog /@dr_raha1

RMAN> delete script backup_database;
RMAN> create script backup_database from file ‘/home/oracle/backup_database_raha1.rman’;

Load the script into the RAHA2 Recovery Appliance.

[raha2@root ]$   rman target / catalog /@dr_raha2

RMAN> delete script backup_database;
RMAN> create script backup_database from file ‘/home/oracle/backup_database_raha2.rman’;
Step 18: Verify That the Credentials Have Access to the Database

In one of protected database host, run the follow:

$ rman target / catalog /@dr_raha

RMAN> print script backup_database;

printing stored script: backup_database
{
allocate channel raha1_sbt_1 device type sbt format ‘%d_%U’ PARMS=”SBT_LIBRARY=<ORACLE_HOME>/lib/libra.so, ENV=(RA_WALLET=’location=file:<ORACLE_HOME>/dbs/zdlra credential_alias=dr_raha1′)”;
allocate channel raha1_sbt_2 device type sbt format ‘%d_%U’ PARMS=”SBT_LIBRARY=<ORACLE_HOME>/lib/libra.so, ENV=(RA_WALLET=’location=file:<ORACLE_HOME>/dbs/zdlra credential_alias=dr_raha1′)”;
backup tag ‘&1’ cumulative incremental level 1 filesperset 1 section size 64g database plus archivelog not backed up filesperset 32 delete input;
}
Step 19: Backup Operation

The following RMAN command should be used for all RMAN backup operations.

Due you are using dr_raha load balance connection string, the script will log into RAHA1 if it is running; otherwise, it will log into RAHA2.

$ rman target / catalog /@dr_raha

RMAN> run { execute script backup_database using ‘Level1’; }

executing script: backup_database
allocated channel: raha1_sbt_1
channel raha1_sbt_1: SID=1936 instance=cdb122ha1 device type=SBT_TAPE
channel raha1_sbt_1: RA Library (RAHA1) SID=6DEA2A958DFBE0CFE05311F3850AB3AB
allocated channel: rahadr1_sbt_2
channel raha1_sbt_2: SID=394 instance=cdb122ha1 device type=SBT_TAPE
channel raha1_sbt_2: RA Library (RAHA1) SID=6DEA2A9CC2BBE0D0E05311F3850AC634

Note the channel allocation, we are logging into RAHA1 (raha1_sbt_1 & raha1_sbt_2) as well as specifying the RA database RAHA1.

In the next article, we will configure redo transport.


2 comentários sobre “Configuring Replication on Zero Data Loss Recovery Appliance

Deixe um comentário