Backing Up Primary and Standby Databases
This section describes how to register and backup primary and standby databases to the Recovery Appliance.
Pre-Requisites for Primary and Standby Databases with Recovery Appliance
The Recovery Appliance requires a few operations be carried out, or their conditions present, before the primary and standby databases can backup to the Recovery Appliance.
- On either the primary or standby Recovery Appliance, log in as
RASYS
or user with equivalentadmin_user
. - Create a new Protection Policy on Primary and Standby Recovery Appliance. This step is optional, because you can use an existing protection policy.Run the command
racli create protection_policy.
.Here is an example command formatted for readability.racli create protection_policy --protection_policy_name=GOLD_POLICY --storage_location_name=DELTA --recovery_window_goal=30days --unprotected_window=15min --guaranteed_copy=NO --allow_backup_deletion=YES --store_and_forward=NO
- Create the VPC user account on the primary and the standby Recovery Appliance.This step is only necessary if a new user is desired. An existing VPC user account can be used.Run the command
racli add db_user.
.Here is an example command formatted for readability for amyVpcUser1
.racli add db_user --user_name=myVpcUser1 --user_type=vpc
If using Enterprise Manager, it will not be aware of the VPC, which will result in Enterprise Manager not being able to perform the database-side configuration to send backups to the Recovery Appliance or schedule backups to the Recovery Appliance.
Enterprise Manager becomes aware of Recovery Appliance VPCs when the Recovery Appliance administrator runs the Enterprise Manager
Add Protected Database
workflow, such as in the next step. - Make the Enterprise Manager aware of the Recovery Appliance Virtual Private Catalogs.This step is only necessary if Enterprise Manager is used.
- In the Enterprise Manager
Targets
menu, selectDatabases
. - On the
Databases
page, select the menu itemAvailability > Recovery Catalogs
.· - Select the base Recovery Appliance catalog, then click
Manage Virtual Private Catalogs
.· - Select the
Manage an existing virtual private catalog with Enterprise Manager
radio button and continue through the process.
- In the Enterprise Manager
- Add the primary database to the primary and standby Recovery Appliances.Run the command
racli add protected_db
.Here is an example command formatted for readability.racli add protected_db --db_unique_name=myDatabase --protection_policy_name=GOLD --reserved_space=1500G
--reserved_space
should be about two times (2x) the size of the database.Note:
You can only register a primary database (not a standby). You are registering the
db_unique_name
of the primary database on both the primary and standby Recovery Appliances.The steps can be delayed on the Dataguard Database if it is created later.
- Allow VPC users to manage the primary database on both primary and standby Recovery Appliance.Run the command
racli grant db_access.
.Here is an example.racli grant db_access --db_unique_name=myDatabase --tenant_identifier=TENANT_ID --username=myVpcUser1
This operation connects the Recovery Appliance VPC user to the database, so that the
myVpcUser1
account can used to manage the new database. This account is used for backing up and restoring the database. Multiple VPC users can be allowed to manage the database, but typically only one is used.
Preparing the Protected Database Servers
The protected database servers require some preparation before registering the primay and the standby databases.
Note:
This only needs to be done once for each$ORACLE_HOME
. These steps can be done later on the Standby Database server(s), if it is created later.
- [Alternative 1] Execute the Java RA backup module.
- Download the current backup module from Oracle, which can be found: Oracle ZDLRA Backup Module.
- Following the information from the
README
file, run thera_install.jar
file.
The two steps that need to be completed are:
- Creating the wallet file to store the Recovery Appliance catalog credentials.
- Dowloading the current
libra.so
for the appropriate OS/platform.
For the RAC cluster:
- Either run this process on all nodes; or
- Add the configuration files on all nodes.
- Wallet file
libra.so
sqlnet.org
changes
Run the command.
- [Alternative 2, as well as steps that follow.] Manually configure the protected database server.
- Create the wallet on the protected database server(s).
- Create a directory to hold the wallet (
$ORACLE_HOME/dbs/zdlra
). - Run
mkstore
to create wallet file, or add new credentials using theezconnect
format.
Run themkstore
command .mkstore -wrl $ORACLE_HOME/dbs/zdlra/ -createCredential <db SCAN listener:PORT/Service:dedicated> <VPCUSER> <password>
Note:
- Add the connect string/VPC user for both the primary and the standby Recovery Appliance. This needs to be done for both the primary database server(s) and the standby database server(s)
- This must be done on every host in a RAC cluster. The
sqlnet.ora
and wallet file can be copied between nodes. - Each database home connecting to the Recovery Appliance needs to have this done, and it needs to be copied over to any new installations.
- The wallet file needs to be backed up as part of an OS backup.
- This can be pre-staged if you are using a standard VPCUSER account for the database. Copy a current wallet file containing the VPCUSER credentials from a central location.
- Only one connect string (
/@<db SCAN listener:PORT/Service:dedicated>
) can be in the wallet for each$ORACLE_HOME
.
- Create a directory to hold the wallet (
- Test the wallet on the protected database server(s).
On all of the database servers for both the primary and the standby Recovery Appliance, test the wallet file entry with SQLPLUS commands.
SQL > sqlplus /@<primary ZDLRA connection> SQL> sqlplus /@<standby ZDLRA connections> SQL> sqlplus /@<db SCAN listener:PORT/Service:dedicated>
Example:
SQL> sqlplus /@slcm_adm03_scan.us.mycompany.com:1521/zdlra1:dedicated
- List the credentials.
mkstore -wrl $ORACLE_HOME/dbs/zdlra -listCredential
- Add the wallet location lines to the
sqlnet.ora
file.This is an optional step if not utilizing real-time redo for any databases in this$ORACLE_HOME
location. It should look like this.SQLNET.WALLET_OVERRIDE = true WALLET_LOCATION = (SOURCE = (METHOD = FILE) (METHOD_DATA = (DIRECTORY = <ORACLE_HOME>/dbs/zdlra) ) )
- Add the SBT library file to the protected database server(s).
- Either download the current
libra.so
file; - OR copy the current
libra.so
file from another server utilizing the same OS/platform
Note:
- This typically sits in the
$ORACLE_HOME/lib
directory. - This needs to be done for all nodes in a RAC cluster. The library can be copied from one node to another.
- Either download the current
Register the Primary Protected Database
Register the primary protected database with the primary and secondary Recovery Appliance
- Connect to the Recovery Appliance catalog.
Run the command
RMAN> CONNECT TARGET / connected to target database: PROD (DBID=1619241818) RMAN> CONNECT CATALOG /@<db_SCAN_name:PORT/Service:dedicated> connected to recovery catalog database RMAN> REGISTER DATABASE; database registered in recovery catalog starting full resync of recovery catalog full resync complete
Note:
After registering the database manually, you may see a message from within Enterprise Manager regarding this configuration. Follow its link to the Recovery Catalog Settings and change the database to use a recovery catalog rather than thecontrolfile
. - (Optional) Configure real-time redo apply for the primary protected database and the standby database.
- The database must be in
archivelog
mode. - The database
db_unique_name
must be set
- The database must be in
- Update wallet configuration
Typically the same VPCUSER account on the ZDLRA that manages the databases backups, is utilized for redo transport. This user will be in the wallet already.
If the automated
ra_install.jar
process was used to configure the Recovery Appliance, then ensure you followed the steps to add the wallet location to theSQLNET.ORA
file. - Update database configuration parameters on both the primary and standby databases.
.REMOTE_LOGIN_PASSWORDFILE=shared LOG_ARCHIVE_FORMAT=’log_%d_%t_%s_%r.arc’
- Set the
LOG_ARCHIVE_CONFIG
initialization parameter on primary to include aDG_CONFIG
list.From the protected database, alter the archive log configuration to include both the Recovery Appliance, and the current protected database.
.SQL > ALTER SYSTEM SET LOG_ARCHIVE_CONFIG= ’DG_CONFIG=(<ZDLRA DB>,<DB_UNIQUE_NAME_PRIMARY>,<DB_UNIQUE_NAME_STANDY>)’ SCOPE=BOTH;
- Create redo transport users on primary database.
Note:
You will be adding the VPC user for both primary and the standby Recovery Appliance.From the primary protected database, create the VPC users in the database that will be used to send primary redo logs.
.SQL>create <VPCUSER PRIMARY> identified by xxx; SQL> grant create session to <VPCUSER PRIMARY >; SQL>grant sysdg to <VPCUSER PRIMARY > ; --- if 12c SQL>grant sysoper to <VPCUSER PRIMARY >; -- Not 12c SQL>create <VPCUSER STANDBY> identified by xxx; SQL> grant create session to <VPCUSER STANDBY >; SQL>grant sysdg to <VPCUSER STANDBY > ; --- if 12c SQL>grant sysoper to <VPCUSER STANDBY >; -- Not 12c SQL> alter system archive log current; -- ensure it transfers to standby database.
- Copy the password file from the primary database to the standby database.
Note:
This must be after the VPCUSER for the standby database is created to ensure it contains both.Copy the
orapw<primarydatabase>
file from$ORACLE_HOME/dbs
on the primary database server to$ORACLE_HOME/dbs/orapw<stdby database>
on the standby database server. - Verify the password file on both the primary database and the standby database.Execute on both the primary and the dataguard database. You should see both VPC users in the password file.
SQL> select * from v$pwfile_users;
Change redo Transport
- Change the redo transport user on primary database.
Alter the
redo_transport_user
parameter to utilize the primary Recovery Appliance VPCUSER.SQL> alter system redo_transport_user=<VPCUSER PRIMARY>;
- Change the redo transport user on standby database.
Note:
If the Standby database is created later, this step can be delayed.
SQL> Alter system set redo_transport_user=<VPCUSER STANDBY>;
- Add the primary Recovery Appliance as an archive destination to the primary database.
Update the next log destination to contain primary Recovery Appliance connection information. Use the connect string specified when creating the wallet file.
SQL> ALTER SYSTEM SET LOG_ARCHIVE_DEST_<next>= ‘SERVICE=”<primary string from wallet>”, VALID_FOR=(ALL_LOGFILES, ALL_ROLES) ASYNC DB_UNIQUE_NAME=<primary ZDLRA DB>’ SCOPE=BOTH;
Update the next log destination state to be enabled.
SQL> ALTER SYSTEM SET LOG_ARCHIVE_DEST_STATE_<next>= ENABLE SCOPE=BOTH;
- Bounce the primary database to enable changes.
If the database already has the
sqnet.ora
file in place when started, this is not necessary.Shutdown/startup all instances to enable the sql*net change.
- Add standby Recovery Appliance as an archive destination to the standby database.
Update the next log destination to contain standby ZDLRA connection information. Use the connect string specified when creating the wallet file
SQL> ALTER SYSTEM SET LOG_ARCHIVE_DEST_<next>= ‘SERVICE=”<standby string from wallet>”, VALID_FOR=(ALL_LOGFILES, ALL_ROLES) ASYNC DB_UNIQUE_NAME=<standby ZDLRA DB>’ SCOPE=BOTH;
Update the next log destination state to be enabled.
SQL> ALTER SYSTEM SET LOG_ARCHIVE_DEST_STATE_<next>= ENABLE SCOPE=BOTH
- Test the archive log configuration on the primary database.
select status,error from v$archive_dest where dest_id=<destination>;
Ensure recovery is still working correctly after changing user.
- Add default channel configuration in primary database and standby database.
The channel will be configured to point to the appropriate Recovery Appliance.
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=< string from wallet >’)"; RMAN> CONFIGURE DEVICE TYPE 'SBT_TAPE' PARALLELISM <n> BACKUP TYPE TO BACKUPSET; RMAN> CONFIGURE CONTROLFILE AUTOBACKUP ON; RMAN> CONFIGURE BACKUP OPTIMIZATION ON; RMAN> CONFIGURE ARCHIVELOG DELETION POLICY TO SHIPPED TO ALL STANDBY; RMAN> CONFIGURE DEFAULT DEVICE TYPE to SBT_TAPE;
- Perform an explicit level 0 backup
RMAN> connect target / RMAN> connect catalog /@<string from wallet> RMAN>run { backup cumulative incremental level 0 section size 32g database plus archivelog not backed up; }
- Schedule a regular Incremental
RMAN> connect target / RMAN> connect catalog /@<string from wallet> RMAN>run { backup cumulative incremental level 1 database plus archivelog not backed up; }