How to use ZDLRA and enroll a database

ZDLRA it is an Oracle dedicate appliance specialized to manage your backups, but more than that, provide you zero data loss. I already made an introduction about ZDLRA in my previous post and here I will show how to use and enrolling protected database at ZDLRA: enroll database, create policies and access with rman. Understand how to use ZDLRA, at least the starting point.

Every project starts with scope definition, steps, and requirements. It is not different for ZDLRA project, it is a big appliance, expensive, and integrate a lot of things in just one place: backups, archivelogs, redo, replication, and RPO. The requirements vary from project to project, I will not discuss that here. But will show you the tech part about the usage.

The post has two divisions, the first it is the technical part. You can check how to do that. The second contains the information/documentation part, where I will show more details about the steps.

TECH PART

All the commands here will be made using the CLI interface to cover and show you more details. But you can do the same using EM/CC.

The steps below are in order of execution, but a little detail. If you already have defined in your ZDLRA one catalog user, or want to share rman catalogs between databases, you can jump the create user and policy part.

VPC User

Create the VPC (Virtual Private Catalog) user at ZDLRA database (connected as sysdba):

SQL> create user cat_zdlra identified by s3nhazdlra;

User created.

SQL> grant create session to cat_zdlra;

Grant succeeded.

SQL>

It is possible to do the same using the command “/opt/oracle.RecoveryAppliance/bin/racli add vpc_user -username=<USERNAME>” that avoid you connect as sys/system at ZDLRA database. And probably in the future will be the only way to do that at CLI.

After here, all the commands are done with RASYS user at ZDLRA database.

Policy

Create a policy that will protect the database. This include retention (and max) window for backups:

[oracle@zdlranode1-cli ~]$ sqlplus rasys/change^Me2

SQL*Plus: Release 12.2.0.1.0 Production on Sun Aug 11 14:58:37 2019

Copyright (c) 1982, 2016, Oracle.  All rights reserved.

Last Successful login time: Sun Aug 11 2019 14:55:30 +02:00

Connected to:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production

SQL> 
SQL> BEGIN
  2  DBMS_RA.CREATE_PROTECTION_POLICY(
  3      protection_policy_name => 'ZDLRA'
  4      , description => 'Policy ZDLRA'
  5      , storage_location_name => 'DELTA'
  6      , recovery_window_goal => INTERVAL '30' DAY
  7      , max_retention_window => INTERVAL '90' DAY
  8      , guaranteed_copy => 'NO'
  9      , allow_backup_deletion => 'YES'
 10  );
 11  END;
 12  /

PL/SQL procedure successfully completed.

SQL> SELECT policy_name
  2         , description
  3         , recovery_window_goal
  4         , max_retention_window
  5         , recovery_window_sbt
  6  FROM ra_protection_policy
  7  ORDER BY policy_name;

POLICY_NAME                    DESCRIPTION                                        RECOVERY_WINDOW_GOAL                 MAX_RETENTION_WINDOW                 RECOVERY_WINDOW_SBT
------------------------------ -------------------------------------------------- ------------------------------------ ------------------------------------ ------------------------------------
BRONZE                         Default Bronze Protected Policy                    +000000003 00:00:00.000000                                                +000000030 00:00:00.000000
GOLD                           Default Gold Protected Policy                      +000000035 00:00:00.000000                                                +000000090 00:00:00.000000
PLATINUM                       Default Platinum Protected Policy                  +000000045 00:00:00.000000                                                +000000090 00:00:00.000000
SILVER                         Default Silver Protected Policy                    +000000010 00:00:00.000000                                                +000000045 00:00:00.000000
ZDLRA                          Policy ZDLRA                                       +000000030 00:00:00.000000           +000000090 00:00:00.000000

SQL>

Add and Database Grant

Grant access of database to be backed to ZDLRA. Linking VPC, Policy, and reserved space:

SQL> BEGIN 
2 DBMS_RA.ADD_DB(
3       db_unique_name => 'ORCL18'
4       , protection_policy_name => 'ZDLRA'
5       , reserved_space => '5G'
6 );
7 END; 
8 /

PL/SQL procedure successfully completed.

SQL> BEGIN
  2  DBMS_RA.GRANT_DB_ACCESS (
  3        db_unique_name => 'ORCL18'
  4        , username => 'CAT_ZDLRA'
  5  );
  6  END;
  7  /

PL/SQL procedure successfully completed.

SQL>
SQL> SELECT db_unique_name, db_key, dbid, policy_name, storage_location,recovery_window_goal, space_usage FROM ra_database;

DB_UNIQUE_NAME           DB_KEY       DBID POLICY_NAME     STORAGE_LOCATION     RECOVERY_WINDOW_GOAL                 SPACE_USAGE
-------------------- ---------- ---------- --------------- -------------------- ------------------------------------ -----------
ORCL18                                     ZDLRA           DELTA                +000000030 00:00:00.000000                     0

SQL>

Library/Wallet/TNS

There are two ways to create the wallet needed to access ZDLRA from rman at your database. The first is “downloading/installing” the ra_library:

[oracle@orcloel7 tmp]$ unzip ra_installer.zip
Archive:  ra_installer.zip
  inflating: ra_install.jar
  inflating: ra_readme.txt
[oracle@orcloel7 tmp]$
[oracle@orcloel7 tmp]$ echo $ORACLE_HOME
/u01/app/oracle/product/18.6.0.0/dbhome_1
[oracle@orcloel7 tmp]$ echo $ORACLE_SID
ORCL18
[oracle@orcloel7 tmp]$ java -version
openjdk version "1.8.0_131"
OpenJDK Runtime Environment (build 1.8.0_131-b12)
OpenJDK 64-Bit Server VM (build 25.131-b12, mixed mode)
[oracle@orcloel7 tmp]$
[oracle@orcloel7 tmp]$ java -jar ra_install.jar -dbUser zdlravpc -dbPass passvpc -host zdlra-scan -port 1521 -serviceName zdlra -walletDir $ORACLE_HOME/dbs/ra_wallet -libdir $ORACLE_HOME/lib
Recovery Appliance Install Tool, build 12.2.0.1.0DBBKPCSBP_2018-06-12
Recovery Appliance credentials are valid.
Recovery Appliance wallet created in directory /u01/app/oracle/product/18.6.0.0/dbhome_1/dbs/ra_wallet.
Recovery Appliance initialization file /u01/app/oracle/product/18.6.0.0/dbhome_1/dbs/raORCL18.ora created.
Downloading Recovery Appliance Software Library from file ra_linux64.zip.
Download complete.
[oracle@orcloel7 tmp]$
[oracle@orcloel7 tmp]$
[oracle@orcloel7 tmp]$ cat $ORACLE_HOME/dbs/raORCL18.ora
RA_WALLET='LOCATION=file:/u01/app/oracle/product/18.6.0.0/dbhome_1/dbs/ra_wallet CREDENTIAL_ALIAS=zdlra-scan:1521/zdlra'[oracle@orcloel7 tmp]$
[oracle@orcloel7 tmp]$
[oracle@orcloel7 tmp]$ mkstore -wrl /u01/app/oracle/product/18.6.0.0/dbhome_1/dbs/ra_wallet -listCredential
Oracle Secret Store Tool Release 18.0.0.0.0 - Production
Version 18.1.0.0.0
Copyright (c) 2004, 2017, Oracle and/or its affiliates. All rights reserved.

List credential (index: connect_string username)
1: zdlra-scan:1521/zdlra ZDLRAVPC
[oracle@orcloel7 tmp]$
[oracle@orcloel7 tmp]$ ls -l $ORACLE_HOME/lib/libra.so
-rw-r--r-- 1 oracle oinstall 88213653 Aug  7 22:54 /u01/app/oracle/product/18.6.0.0/dbhome_1/lib/libra.so
[oracle@orcloel7 tmp]$

The process created a file called a config file ra<DBNAME> that links to wallet/credential used. This credential name is used as a parameter in SBT_LIBRARY at rman channel.

The other way is “manually”. This way allows more control and you can create (or reuse) a wallet with the credential name that you want. You can download the library from note Doc ID 2219812.1 and use it, and just creating the wallet manually

[oracle@orcloel7 tmp]$ unzip ra_linux64.zip
Archive:  ra_linux64.zip
  inflating: libra.so
  inflating: metadata.xml
[oracle@orcloel7 tmp]$
[oracle@orcloel7 tmp]$ cp ./libra.so /u01/app/oracle/product/18.6.0.0/dbhome_1/lib/libra.so
[oracle@orcloel7 tmp]$
[oracle@orcloel7 tmp]$ cd $ORACLE_HOME/dbs
[oracle@orcloel7 dbs]$ pwd
/u01/app/oracle/product/18.6.0.0/dbhome_1/dbs
[oracle@orcloel7 dbs]$
[oracle@orcloel7 dbs]$ mkstore -wrl /u01/app/oracle/product/18.6.0.0/dbhome_1/dbs/ra_wallet -createALO
Oracle Secret Store Tool Release 18.0.0.0.0 - Production
Version 18.1.0.0.0
Copyright (c) 2004, 2017, Oracle and/or its affiliates. All rights reserved.

[oracle@orcloel7 dbs]$
[oracle@orcloel7 dbs]$ mkstore -wrl /u01/app/oracle/product/18.6.0.0/dbhome_1/dbs/ra_wallet -createCredential zdlra-scan:1521/zdlra:CAT_ZDLRA cat_zdlra s3nhazdlra
Oracle Secret Store Tool Release 18.0.0.0.0 - Production
Version 18.1.0.0.0
Copyright (c) 2004, 2017, Oracle and/or its affiliates. All rights reserved.

[oracle@orcloel7 dbs]$
[oracle@orcloel7 dbs]$ mkstore -wrl /u01/app/oracle/product/18.6.0.0/dbhome_1/dbs/ra_wallet -listCredential
Oracle Secret Store Tool Release 18.0.0.0.0 - Production
Version 18.1.0.0.0
Copyright (c) 2004, 2017, Oracle and/or its affiliates. All rights reserved.

List credential (index: connect_string username)
1: zdlra-scan:1521/zdlra:CAT_ZDLRA cat_zdlra
[oracle@orcloel7 dbs]$
[oracle@orcloel7 dbs]$ vi $ORACLE_HOME/dbs/raORCL18.ora
[oracle@orcloel7 dbs]$
[oracle@orcloel7 dbs]$ cat $ORACLE_HOME/dbs/raORCL18.ora
RA_WALLET='LOCATION=file:/u01/app/oracle/product/18.6.0.0/dbhome_1/dbs/ra_wallet CREDENTIAL_ALIAS=zdlra-scan:1521/zdlra:CAT_ZDLRA'
[oracle@orcloel7 dbs]$

Independent of the chosen method, you need to add an entry for ZDLRA at database tnsnames.ora and to sqlnet.ora pointing to wallet (this will be needed just in case of Real-time redo usage)

[oracle@orcloel7 dbs]$ tnsping zdlra

TNS Ping Utility for Linux: Version 18.0.0.0.0 - Production on 07-AUG-2019 23:40:07

Copyright (c) 1997, 2018, Oracle.  All rights reserved.

Used parameter files:

Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = zdlra-scan)(PORT = 1521)) (CONNECT_DATA = (SERVICE_NAME = zdlra)))
OK (20 msec)
[oracle@orcloel7 dbs]$
[oracle@orcloel7 dbs]$ vi $ORACLE_HOME/network/admin/sqlnet.ora
[oracle@orcloel7 dbs]$
[oracle@orcloel7 dbs]$ cat $ORACLE_HOME/network/admin/sqlnet.ora
NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)

SQLNET.WALLET_OVERRIDE = true

WALLET_LOCATION =
(
   SOURCE =
      (METHOD = FILE)
      (METHOD_DATA =
         (DIRECTORY = /u01/app/oracle/product/18.6.0.0/dbhome_1/dbs/ra_wallet)
      )
)
[oracle@orcloel7 dbs]$

RMAN

Now, you can connect to ZDLRA rman catalog using the VPC user and register database

[oracle@orcloel7 ~]$ rman target=/ catalog=cat_zdlra/s3nhazdlra@zdlra

Recovery Manager: Release 18.0.0.0.0 - Production on Sun Aug 11 16:05:22 2019
Version 18.6.0.0.0

Copyright (c) 1982, 2018, Oracle and/or its affiliates.  All rights reserved.

connected to target database: ORCL18 (DBID=3914023082)
connected to recovery catalog database
PL/SQL package CAT_ZDLRA.DBMS_RCVCAT version 18.03.00.00. in RCVCAT database is not current
PL/SQL package CAT_ZDLRA.DBMS_RCVMAN version 18.03.00.00 in RCVCAT database is not current

RMAN>

RMAN> register database;

database registered in recovery catalog
starting full resync of recovery catalog
full resync complete

RMAN>

You can register a default channel. Look the wallet file and credential name that need to be the same that we created before

RMAN> CONFIGURE CHANNEL 1 DEVICE TYPE 'SBT_TAPE' FORMAT '%d_%U' PARMS "SBT_LIBRARY=/u01/app/oracle/product/18.6.0.0/dbhome_1/lib/libra.so, ENV=(RA_WALLET='location=file:/u01/app/oracle/product/18.6.0.0/dbhome_1/dbs/ra_wallet credential_alias=zdlra-scan:1521/zdlra:CAT_ZDLRA')" CONNECT 'sys/welcome1@orcl18';

new RMAN configuration parameters:
CONFIGURE CHANNEL 1 DEVICE TYPE 'SBT_TAPE' FORMAT   '%d_%U' PARMS  "SBT_LIBRARY=/u01/app/oracle/product/18.6.0.0/dbhome_1/lib/libra.so, ENV=(RA_WALLET='location=file:/u01/app/oracle/product/18.6.0.0/dbhome_1/dbs/ra_wallet credential_alias=zdlra-scan:1521/zdlra:CAT_ZDLRA')" CONNECT '*';
new RMAN configuration parameters are successfully stored
starting full resync of recovery catalog
full resync complete

RMAN>

And perform a backup:

RMAN> RUN {
2> BACKUP INCREMENTAL LEVEL 0 DEVICE TYPE SBT FILESPERSET 1 DATABASE TAG 'BKP-DB-INC0';
3> SQL 'ALTER SYSTEM ARCHIVE LOG CURRENT';
4> BACKUP DEVICE TYPE SBT FILESPERSET 100 FORMAT '%U' ARCHIVELOG ALL NOT BACKED UP TAG 'BKP-ARCH';
5> }

Starting backup at 11-08-2019_16:38:56
allocated channel: ORA_SBT_TAPE_1
channel ORA_SBT_TAPE_1: SID=67 device type=SBT_TAPE
channel ORA_SBT_TAPE_1: RA Library (ZDLRA) SID=8FD95E0CDD7C38B4E053010310AC2725
channel ORA_SBT_TAPE_1: starting incremental level 0 datafile backup set
channel ORA_SBT_TAPE_1: specifying datafile(s) in backup set
input datafile file number=00001 name=/u01/app/oracle/oradata/ORCL18/system01.dbf
channel ORA_SBT_TAPE_1: starting piece 1 at 11-08-2019_16:38:58
channel ORA_SBT_TAPE_1: finished piece 1 at 11-08-2019_16:42:23
piece handle=ORCL18_06u8v052_1_1 tag=BKP-DB-INC0 comment=API Version 2.0,MMS Version 12.2.0.2
channel ORA_SBT_TAPE_1: backup set complete, elapsed time: 00:03:25
channel ORA_SBT_TAPE_1: starting incremental level 0 datafile backup set
channel ORA_SBT_TAPE_1: specifying datafile(s) in backup set
input datafile file number=00003 name=/u01/app/oracle/oradata/ORCL18/sysaux01.dbf
channel ORA_SBT_TAPE_1: starting piece 1 at 11-08-2019_16:42:23
channel ORA_SBT_TAPE_1: finished piece 1 at 11-08-2019_16:46:08
piece handle=ORCL18_07u8v0bf_1_1 tag=BKP-DB-INC0 comment=API Version 2.0,MMS Version 12.2.0.2
channel ORA_SBT_TAPE_1: backup set complete, elapsed time: 00:03:45
channel ORA_SBT_TAPE_1: starting incremental level 0 datafile backup set
channel ORA_SBT_TAPE_1: specifying datafile(s) in backup set
input datafile file number=00004 name=/u01/app/oracle/oradata/ORCL18/undotbs01.dbf
channel ORA_SBT_TAPE_1: starting piece 1 at 11-08-2019_16:46:08
channel ORA_SBT_TAPE_1: finished piece 1 at 11-08-2019_16:47:23
piece handle=ORCL18_08u8v0ig_1_1 tag=BKP-DB-INC0 comment=API Version 2.0,MMS Version 12.2.0.2
channel ORA_SBT_TAPE_1: backup set complete, elapsed time: 00:01:15
channel ORA_SBT_TAPE_1: starting incremental level 0 datafile backup set
channel ORA_SBT_TAPE_1: specifying datafile(s) in backup set
input datafile file number=00007 name=/u01/app/oracle/oradata/ORCL18/users01.dbf
channel ORA_SBT_TAPE_1: starting piece 1 at 11-08-2019_16:47:24
channel ORA_SBT_TAPE_1: finished piece 1 at 11-08-2019_16:47:39
piece handle=ORCL18_09u8v0ks_1_1 tag=BKP-DB-INC0 comment=API Version 2.0,MMS Version 12.2.0.2
channel ORA_SBT_TAPE_1: backup set complete, elapsed time: 00:00:15
Finished backup at 11-08-2019_16:47:39

Starting Control File and SPFILE Autobackup at 11-08-2019_16:47:39
piece handle=c-3914023082-20190811-01 comment=API Version 2.0,MMS Version 12.2.0.2
Finished Control File and SPFILE Autobackup at 11-08-2019_16:48:20

sql statement: ALTER SYSTEM ARCHIVE LOG CURRENT

Starting backup at 11-08-2019_16:49:07
current log archived
using channel ORA_SBT_TAPE_1
channel ORA_SBT_TAPE_1: starting archived log backup set
channel ORA_SBT_TAPE_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=4 RECID=1 STAMP=1016038141
input archived log thread=1 sequence=5 RECID=2 STAMP=1016038147
channel ORA_SBT_TAPE_1: starting piece 1 at 11-08-2019_16:49:20
channel ORA_SBT_TAPE_1: finished piece 1 at 11-08-2019_16:50:25
piece handle=0bu8v0og_1_1 tag=BKP-ARCH comment=API Version 2.0,MMS Version 12.2.0.2
channel ORA_SBT_TAPE_1: backup set complete, elapsed time: 00:01:05
Finished backup at 11-08-2019_16:50:25

Starting Control File and SPFILE Autobackup at 11-08-2019_16:50:25
piece handle=c-3914023082-20190811-02 comment=API Version 2.0,MMS Version 12.2.0.2
Finished Control File and SPFILE Autobackup at 11-08-2019_16:50:42

RMAN>

DOC PART

As told before, good backup protection starts with you understanding the requirements. Mainly the protection policy expiration for backup, retention windows and the types of database that you need to protect. Unfortunately, these are very related to your project. The idea below it is to show what you need to understand ZDLRA, the how-to was showing above in the Tech Part.

The base for ZDLRA configuration starts with the policy definition, but not just the technical part, you need to understand project definition and impacts. Another point is guaranteeing the access to ZDLRA, this is done with the library (that goes in each database), and with a wallet to configure the rman channel. In the end, we can configure the rman properties and do a backup.

Unfortunately, the information how to enroll a database at ZDLRA are spread in several chapters in some docs:

I will try to summarize all the information that you need to understand the ZDLRA process to enroll database.

DBMS_RA and RA_VIEWS

ZDLRA appliance contains one Oracle database that stores two things, the rman catalog, and the received backups. There is one package called DMBS_RA that it is used to manage and sustains most of the activities related to ZDLRA. This package belongs to rasys user and the list of procedures can be checked at “Zero Data Loss Recovery Appliance Administrator’s Guide”.

Beside the DBAMS_RA exists the RA_* views where you can check information about ZDLRA data. These views can be used to verify databases, policies, errors logs, and tasks. I will discuss some of them in other posts, but you can see the list at “Zero Data Loss Recovery Appliance Administrator’s Guide”.

VPC user

The first step ZDLRA is to create the Virtual Private Catalog (VPC) user and it represents the RMAN catalog to manage your backups. It is called virtual because it shares the RC_* catalog views from the internal ZDLRA metadata. This allows centralized catalog management from ZDLRA, and make easier some maintenance (like move databases from catalogs) and the automatic catalog actions from ZDLRA (virtual backups, backup expiration, and deletion).

The user that you create will be used to connect trough rman at “CATALOG” and represent one user at ZDLRA database. This user has just “CREATE SESSION” permission and it is the only command that you execute with SYS/SYSTEM user.

The detail here is if you are intending to use Real-time redo for your database, the same user needs to be created in your database too. This is needed because to use Real-time redo you need to set the parameter redo_transport_user at the database with this username than ZDLRA as value.

Policies

The base for every kind of backup strategy is the protection policy, where you define the retention for your backups, expiration time, and other definition. For ZDLRA you create the policy through DBMS_RA.CREATE_PROTECTION_POLICY.

I recommend that you check the DBMS_RA.CREATE_PROTECTION_POLICY definition at documentation because it is very well documented, and Chapter 5 from Administrator’s guide. As already told before, the first step is Plan. Plan what you need for expiration for backups, plan the databases that have the same requirements, or plan the tape/replication needs. It is not just your backup that depends on it, but your restore/recovery too.

DBMS_RA.CREATE_PROTECTION_POLICY:

PROCEDURE create_protection_policy (
   protection_policy_name IN VARCHAR2,
   description IN VARCHAR2 DEFAULT NULL,
   storage_location_name IN VARCHAR2,
   polling_policy_name IN VARCHAR2 DEFAULT NULL,
   recovery_window_goal IN DSINTERVAL_UNCONSTRAINED,
   max_retention_window IN DSINTERVAL_UNCONSTRAINED DEFAULT NULL,
   recovery_window_sbt IN DSINTERVAL_UNCONSTRAINED DEFAULT NULL,
   unprotected_window IN DSINTERVAL_UNCONSTRAINED DEFAULT NULL,
   guaranteed_copy IN VARCHAR2 DEFAULT 'NO',
   allow_backup_deletion IN VARCHAR2 DEFAULT 'YES',
   store_and_forward IN VARCHAR2 DEFAULT 'NO');

The mains parameters here are:

  • protection_policy_name: The policy name.
  • storage_location_name: Where at ZDLRA the policy will store the backups, 99% of the time you will use DELTA (delta storage/diskgroup name).
  • recovery_window_goal: How much time the policy will store the backups for the database.
  • max_retention_window: Max period of retention that you want.
  • recovery_window_sbt: If you clone to tape, how much will be the retention period for tapes.
  • unprotected_window: Period that you can be “unprotected without backups” before receiving a warning.
  • guaranteed_copy: Two options NO/YES. For NO, always accept news backup (even if is in low space). If YES, the policy does not accept news backups because the previous is more important than new ones.
  • allow_backup_deletion: Allow rman delete backups.

The big point here is the difference between RECOVERY_WINDOW_GOAL and the MAX_RETENTION_GOAL, the best practices recommend at least 5 days of difference between them. But I suggest more because if you define MAX_RETENTION_GOAL, the ZDLRA understands this as a hard limit for retention and will try to clean the backup and this can cause some pressure over the system. This occurs because in high used environments (with a lot of databases, means tons of jobs) or with large backups (TB’s of bigfiles tablespace, means long-time jobs) the check about what needs to be deleted against receiving new backups can delay index new backups. Or even cause problems between validate jobs and purge jobs for those are between the retention and max retention value.

Talking about retention, everything that it is below recovery_window_goal is protected, above this value it is not guaranteed because ZDLRA (maybe because low space pressure) can delete the backups. But if defined a low reserved space to store the database backups (we will see in the next topic), the retention period can’t be reached.

Another procedure that can be used is the DBMS_RA.UPDATE_PROTECTION_POLICY to modify existed policies. The parameters are the same than when we create the policy. ZDLRA came with pre-defined policies that can be used or modified as needed. But remember that the policies are shared for all databases and independent of the VPC catalog. So, it is possible that you need to define your own based on your requirements.

Remember that policies are shared between all the database and all the VPC users. Policies are global inside ZDLRA and if you change one attribute, this affects all databases.

Another point to check is the view RA_PROTECTION_POLICY to check the details for your policies.

Add and Database Grant

Adding database at ZDLRA it is done in two steps. The first it adds the database using DBMS_RA.ADD_DB and the second is granting access using DBMS_RA. GRANT_DB_ACCESS. Both are simple and have just a few parameters.

For ADD_DB:

PROCEDURE add_db (
   db_unique_name IN VARCHAR2,
   protection_policy_name IN VARCHAR2,
   reserved_space IN VARCHAR2);

Here we specify the database (using the same value than db_unique_name), the protection_policy for the database, and the reserved_space. This last parameter it is important because define the guaranteed space to store the backups, but if you specify a small value it is possible that does not cover the entire retention window.

Be aware that for ZDLRA you just need count one full plus incremental backups, so, the value it is small. By experience, one good start point is around database size + 20%. But you can tune the reserved_space and change if needed.

The details that need attention here is that the sum for all the databases protected can’t be higher than the available space for ZDLRA in delta storage. So, as an example, if you have 100TB of space for ZDLRA, the sum for reserved space for all databases can’t be higher than 100TB. If you pass you will be denied to add more database and the solution it is checked and tune the reserved spaces for the databases or by more storage.

After adding the database, you need to grant access for your database. To do that it is used the DBMS_RA.GRANT_DB_ACCESS:

PROCEDURE grant_db_access (
   username IN VARCHAR2,
   db_unique_name IN VARCHAR2);

This procedure links the database to be protected with the catalog for access through rman. The parameter username defines the desired VPC. If you need to change the catalog that protects the database, you just change using the same procedure and specify the new catalog.

Library/Wallet/TNS

The ZDLRA library (Backup Module) it is an Oracle SBT library that it is used at rman to transfer backups over the network. At the database side, it uses a library at $ORACLE_HOME/lib and wallet file to get credentials for connection at ZDLRA.

There are two ways to install the ZDLRA library at database side. Both are almost the same, but with one method you have more control for credentials that are used.

The first method is downloading the library from OTN site and installing it. It is a jar file that requires at least java 1.5 and during the installation, it checks the connection to ZDLRA, creates the wallet, configures the configFile, and put the library at Oracle home.

About the wallet, it is an “autologin” type (“-createALO”). This means that don’t need a password to read the credential (and) use it. The configFile it is under $ORACLE_HOME/dbs and follows the pattern ra<db_name>.ora for name and the content it is just the information pointing where it is the wallet.

The wallet is the most critical part for the access. It has the credential name for ZDLRA that you want to connect, and the name it is used in the rman channel configuration. If your Oracle home is shared by databases connecting for different VPC’s, you need to add (at same wallet) all the entries.

Another way it is done manually all the steps (I prefer this), download the library, create the wallet, and the configFile. Using this way, you can have more control about the credential name for your wallet, or reuse existing wallet to add a new entry. The best practices recommend to use the credential name as an ezconnect patter (host:port/service), but you can have an arbitrary name or add more info to uniquely identify it if needed.

You can check both ways to configure the backup module above in the Tech Part of this post.

But independent of the way that you choose to install the library you need to configure the tnsnames.ora and add the entry for ZDLRA database, and add at sqlnet.ora the information of your wallet. The tnsnames.ora will be used to connect catalog phase in rman. And the sqlnet.ora is optional and need just if you want to use real-time redo for archivelogs.

RMAN

After you create the VPC, Add/Grant the database in ZDLRA, install the library and configure the wallet you can connect at rman and backup the database. The first step, since ZDLRA it will be your catalog, is register the database.

After that, you can do the backup using the ZDLRA library. The default channel configuration follows this:

CONFIGURE CHANNEL 1 DEVICE TYPE 'SBT_TAPE' FORMAT '%d_%U' PARMS "SBT_LIBRARY=/u01/app/oracle/product/18.6.0.0/dbhome_1/lib/libra.so, ENV=(RA_WALLET='location=file:/u01/app/oracle/product/18.6.0.0/dbhome_1/dbs/ra_wallet credential_alias=zdlra-scan:1521/zdlra:CAT_ZDLRA')" CONNECT 'sys/welcome1@orcl18';

Where:

  • TYPE: SBT_TAPE or TAPE since it is tape MML library.
  • SBT_LIBRARY: point to the ZDLRA library (libra.so).
  • RA_WALLET: directory that you have your wallet.
  • CREDENTIAL_ALIAS: The credential name that it is inside the wallet. You can check with the mkstore command.

After that, you can perform the backup. Below I cropped the output from Tech Part above:

…
channel ORA_SBT_TAPE_1: SID=67 device type=SBT_TAPE
channel ORA_SBT_TAPE_1: RA Library (ZDLRA) SID=8FD95E0CDD7C38B4E053010310AC2725
channel ORA_SBT_TAPE_1: starting incremental level 0 datafile backup set
channel ORA_SBT_TAPE_1: specifying datafile(s) in backup set
input datafile file number=00001 name=/u01/app/oracle/oradata/ORCL18/system01.dbf
channel ORA_SBT_TAPE_1: starting piece 1 at 11-08-2019_16:38:58
channel ORA_SBT_TAPE_1: finished piece 1 at 11-08-2019_16:42:23
piece handle=ORCL18_06u8v052_1_1 tag=BKP-DB-INC0 comment=API Version 2.0,MMS Version 12.2.0.2
channel ORA_SBT_TAPE_1: backup set complete, elapsed time: 00:03:25
…

As you can see it used the “RA Library (ZDLRA)” and the MMS version is 12.2.0.2 (the version of the library).

Conclusion

Enroll a database at ZDLRA it is not difficult, you just need to follow few steps. The most critical here is not the technical part but understand correctly how to configure the protection policy for your appliance. It is there where you define backup expiration, retention, clone to tapes copies, and even pressure over ZDLRA. But besides that, it will save you in case of needed restore of your database.

Another detail is related to the wallet, it can be a little tricky to create the wallet or choose the correct credential name. If you need to use a wallet (that it is not ALO) for your database, check the ZDLRA doc or open an SR to see the correct steps.

About the docs, I really recommend that you read the Zero Data Loss Recovery Appliance Administrator’s Guide and Zero Data Loss Recovery Appliance Protected Database Configuration Guide to understand the ZDLRA.

For the next post, I will cover the backup phase in more details, the incremental forever strategy and what it is.

 

References

All the images and base info for this post came from these links:

https://docs.oracle.com/cd/E55822_01/AMAGD/toc.htm

https://docs.oracle.com/cd/E88198_01/AMPDB/toc.htm

https://www.oracle.com/technetwork/database/availability/con8830-zdlradeepdive-2811109.pdf

https://www.oracle.com/technetwork/database/availability/recovery-appliance-maint-practices-4487388.pdf

 

Disclaimer: “The postings on this site are my own and don’t necessarily represent my actual employer positions, strategies or opinions. The information here was edited to be useful for general purpose, specific data and identifications were removed to allow reach the generic audience and to be useful for the community.”

Share it

3 thoughts on “How to use ZDLRA and enroll a database

  1. Pingback: ZDLRA, Virtual Full Backup and Incremental Forever | Blog Fernando Simon

  2. Pingback: ZDLRA, Real-Time Redo | Fernando Simon

  3. Pingback: ZDLRA, Multi-site protection - ZERO RPO for Primary and Standby | Fernando Simon

Leave a Reply

Your email address will not be published. Required fields are marked *