Oracle 12c, 18c and 19c

Table of contents
No headers

Oracle Backup

When Amanda is configured and licensed for Oracle backup, Amanda Enterprise uses Oracle's RMAN and native OS tools to back up Oracle data files, control files, and archive logs. 

 

There are two ways to backup Oracle using Amanda Enterprise: 

  1. Using RMAN to backup to temporary local disk on the Amanda client and backing up to Amanda server (amoracle application). Disk space on the client to store backup images temporarily is required for this method. Archive logs will also be backed up. 
  2. Using RMANMedia Management Library and directly backing up to Amanda server (amrmanapplication). Archive logs will also be backed up by default.  

Both methods can be configured using Zmanda Management Console. 

 

The Oracle backup procedure using above methods using RMAN can be customized to suit customer needs. For example: Oracle backup can be customized to backup table spaces only.  For more information on how to customize Oracle backup, please email Zmanda Services ([email protected]) 

 

Preparing the Oracle Server for Backup and Restore  

 

These instructions assume you have already installed and licensed the Amanda server and the Oracle server being backed up as described hereThere are a number of additional steps. Both backup methods require the same configuration on the Oracle Server (Amanda Client). 

  •  

  • Make sure that the version of RMAN running matches the version of the Oracle server being backed up. If you are using different group for Oracle user on the Oracle server other than oinstall, you should configure it in the /etc/zmanda/zmc_aee/zmc_user_dumptypes file on the Amanda server. For example: The oracle user belongs to dba group, add the following entry in theapp_amrman_user section of the /etc/zmanda/zmc_aee/zmc_user_dumptypes file. 

  •  

define application-tool "app_amrman_user" { 

        property "ORACLE-GROUP" "dba" 

} 

  •  

  • On the Amanda client you must manually add entries to /etc/amanda/amanda-client.conf that define the Oracle SIDs being backed up, as well as the "SID List" that will be used to select the databases in the ZMC Sources page. The syntax for entries is as follows: 

  •  

  • property "SID-list-name-BACKUP-DIRECTORY" "Backup_path_on_client" 

  • property "SID-list-name-ORACLE-SIDS" "SID_1" "[SID_2" ...] 

  • property "SID-ORACLE-HOME" "Oracle_Home_Directory_for_SID" 

  • property "SID-ORACLE-PATH" "Oracle_Path_for_SID" 

  • property "SID-ORACLE-CONNECT-STRING" "Connect_string_for_SID" 

  •  

  • The following describes the variable portions of the entries: 

  •  

  • SID-list-name 

  •  

  • When you select Linux-Oracle as the Backup Type from the Backup What page, you are prompted to enter an SID List Name rather than a Disk. The amanda-client.conf entries described here allow you to define which SIDs belong to that list and how they will be backed up. 

  •  

    Backup_path_on_client 
  •  

  • Specify where to store the backup image on the client. Backup images are removed after transfer to the Amanda server. This directory requires sufficient space to hold a full backup of all SIDs selected for backup for amoracle backups. In case of amrman backups, it is used for storing temporary command files and named pipes. The Oracle user (the OS user through which Oracle is run) must be the owner of the client backup directory (the backup_path_on_client defined above). 

  •  

  • The Oracle user's group should have read/write permissions on this backup directory, and the amandabackup user on the client OS should belong to the same group. For example, If Oracle is run by user oracle and the default group of the oracle user is oinstall, then the amandabackup user should be a member of the oinstall group. To ensure this, follow these steps (substituting your local oracle GID for oinstallif necessary): 

  •  

  • Login to the Oracle server as root and type the following command: 

  •  

  • id oracle    uid=501(oracle) gid=501(oinstall) groups=501(oinstall),502(dba) 

  • Determine the gid, and modify group membership for the amandabackup user:

  • # usermod -G oinstall amandabackup 

  • Confirm that the change was made correctly: 

  • # id amandabackup   uid=502(amandabackup) gid=6(disk) groups=6(disk),501(oinstall) 

  •  

  • SID 

 

The Oracle System Identifier is used to specify which databases to back up. 

 

Oracle_Home_Directory_for_SID 

 

Specify the home directory for the database to back up. This environment includes the location of  installed product files, the PATH variable pointing to the binary files of installed products, registry entries, net service names, and program groups. It is usually a sub-directory of ORACLE_BASE. Output of command oraenv can provide the value. 

 

Oracle_Path_for_SID 

 

The path to Oracle binaries for the SID being backed up. Oracle rman command must be located in this directory. 

 

Connect_string_for_SID 

 

The connection string to access the SID being backed up, in the standard Oracle connect string format. For example (some of the parameters shown are optional; others are omitted):

oracle_user/oracle_user_password@databasename_serverhostname:port_#/service_name 

 

The Oracle user (oracle_user in the above example) used for connection should be sys with sysdba Oracle role. If you want to use another Oracle user, sysdba oracle privilege must be granted to the user.

 

The following example defines an SID list named Oracle, which includes SIDs orcl and zmanda. The local temporary directory to store backup images for the SIDs is /tmp/zmanda. Note that SID orclsol will not be selected for backup because it is not defined in the SID list: 

property "oracle-BACKUP-DIRECTORY" "/tmp/zmanda 

property "oracle-ORACLE-SIDS" "orcl" "zmanda" 

property "orcl-ORACLE-HOME" "/home/oracle/app/oracle/product/12.1.0/db_1"  

property "orcl-ORACLE-PATH" "/home/oracle/app/oracle/product/12.1.0/db_1/bin"  

property "orcl-ORACLE-CONNECT-STRING" "SYS/fakepw!@orcl 

property "orclsol-ORACLE-HOME" "/orclhome 

property "orclsol-ORACLE-PATH" "/orclhome/bin"  

property "orclsol-ORACLE-CONNECT-STRING" "SYS/fakepw!@orclsol 

property "zmanda-ORACLE-HOME" "/home/oracle/app/oracle/product/12.1.0/db_3"  

property "zmanda-ORACLE-PATH" "/home/oracle/app/oracle/product/12.1.0/db_3/bin"  

property "zmanda-ORACLE-CONNECT-STRING" "SYS/fakepw!@zmanda 

 

For further details on Oracle parameters, see man amoracle and man amrman; these man pages are installed on the server along with Amanda Enterprise Edition. 

 

Lastly, make sure that all Oracle databases selected for backup are mounted and open. For restore, the databases should be mounted but closed.  

 

Configuring Oracle Backups on the Amanda server from the ZMC Backup What Page  

 

After you have prepared the Amanda client/Oracle Server by editing the amanda-client.conf file as described above, you can use the ZMC to configure and schedule Oracle backups. You can add Oracle databases as a DLE to a backup set. It is recommended that you use separate backup sets for Oracle databases. 

On the Sourcespage, you will prompted to select what type of object you want to back up. Choose Oracle on Linux/Solaris under Databases, and the following options are displayed: 

 

 

 

Host Name 

The name of the machine running the Oracle database server you intend to back up. 

 

SID List Name 

 

The SID List Name for the group of SIDs being backed up. This is defined in the amanda-client.conf file as described in the section above. 

 

Encryption and Compression 

 

Select these options as desired. They are described in more detail here.

 

Advanced Options 

 

For details on the Estimate option, see the Backup Where Advanced Options help. The Amanda Backup Client Application field allows you to select override RMAN (rather than the default oracle) as the program used to back up the Oracle database as shown below. Using RMAN as the backup application leverages the RMAN media management interface to send Oracle data directly to backup media, thus giving better control of the backup process, and eliminating the need for disk space to store the backup on the Oracle server. Note that backups produced using RMAN will require additional restoration steps as describe. For Oracle backups, changing Alias, Client Max Backups and Disable Staging fields is not recommended. 

 

 

Click Add or Update. Make sure Check Hosts is successful. You can then configure the backup set just as you would any other by setting the options on Backup Where, Backup How, and Backup When, etc. 

 

Performing Oracle Restores using the Zmanda Management Console and RMAN  

 

Restoration involves two main steps: 

  1. Use the Zmanda Management Console to restore the files to a directory you create on the client machine for that purpose. Additional disk space is for restoration on the Destination Host. 

  1. Use the Oracle RMAN utility to apply the restored backup to the Oracle server. 

  2.  

  3. Using the ZMC to restore to a directory on the client  

  1.  

  2. Log on to the client machine where the Oracle databases are being restored. Create a directory on a file system that has sufficient space to store the restored files. 

  1. Use the ZMC Restore What page to decide which backups to restore as shown below. Enter the backup date, Alias/Directory Path (BETSOL in the example below)  and Oracle server name (192.168.53.89 in the example below) used during backup.  

 

 

 

In the newly created directory, use the ZMC Restore pages to restore the Oracle backup, specifying the directory youcreated in the previous step as the Destination Directory on the Restore Where page. 

  1. Check the file ownerships of the restored database files. You may have to change the file/group ownership to the Oracle user/group (For example: oracle/orainstall) before trying to use the RMAN steps described in the next two sections to recover the database. 

 

Restore procedure if RMAN MML (RMAN) was used for backup  

 

If RMAN was specified as the Custom Application on the Sources page, you will need to make RMAN aware of the Amanda media before a restore can be completed. After restoring from the ZMC as described above, follow these steps: 

  1. Login to the Oracle server as a user who owns the oracle instance. 
     

  1. Connect to database via RMAN. 
     

  1. From the RMAN prompt, configure SBT_TAPE to use Zmanda'sAMMML library. For example: In this example, the Oracle backup images have been restored to /home/oracle_restore directory using ZMC. The example below shows ammml.so location of 64-bit client. If you are using 32bit client, the SBT_LIBRARY should be set to /usr/lib/amanda/application/ammml.so 
     
    CONFIGURE CHANNEL DEVICE TYPE 'SBT_TAPE' PARMS 
    'SBT_LIBRARY=/usr/lib64/amanda/application/ammml.so,ENV=(BACKUP_DIR=/home/oracle_restore)' 

 

  1. CATALOG all extracted backup pieces. All backup pieces have to be catalogued. If you are backing up table space, archived logs separately, extract all components in a directory before cataloguing the backup pieces. 

 
 CATALOG DEVICE TYPE 'SBT_TAPE' BACKUPPIECE '/home/oracle_restore/5kk8v9pt_1_1';  
 
or  a RUN {} block can be written for the same. For example: 
 
RUN 
{ 
  CATALOG DEVICE TYPE 'SBT_TAPE' BACKUPPIECE 
'/home/oracle_restore/4skbv4ic_1_1.17'; 
  CATALOG DEVICE TYPE 'SBT_TAPE' BACKUPPIECE 
'/home/oracle_restore/4tkbv4k2_1_1.17'; 
  CATALOG DEVICE TYPE 'SBT_TAPE' BACKUPPIECE 
'/home/oracle_restore/4ukbv4ln_1_1.17'; 
  CATALOG DEVICE TYPE 'SBT_TAPE' BACKUPPIECE 
'/home/oracle_restore/4vkbv4nc_1_1.17'; 
  CATALOG DEVICE TYPE 'SBT_TAPE' BACKUPPIECE 
'/home/oracle_restore/50kbv4p2_1_1.17'; 
  CATALOG DEVICE TYPE 'SBT_TAPE' BACKUPPIECE 
'/home/oracle_restore/51kbv4qn_1_1.17'; 
  CATALOG DEVICE TYPE 'SBT_TAPE' BACKUPPIECE 
'/home/oracle_restore/52kbv4sc_1_1.17'; 
  CATALOG DEVICE TYPE 'SBT_TAPE' BACKUPPIECE 
'/home/oracle_restore/53kbv4u2_1_1.17'; 
  CATALOG DEVICE TYPE 'SBT_TAPE' BACKUPPIECE 
'/home/oracle_restore/54kbv4vo_1_1.17'; 
  CATALOG DEVICE TYPE 'SBT_TAPE' BACKUPPIECE 
'/home/oracle_restore/55kbv57j_1_1.17'; 
  CATALOG DEVICE TYPE 'SBT_TAPE' BACKUPPIECE 
'/home/oracle_restore/56kbv581_1_1.17'; 
} 

Verify all catalogued backup pieces using list backup RMAN command. 

 

RMAN> list backup; 
 
 
List of Backup Sets 
=================== 
 
BS Key  Type LV Size       Device Type Elapsed Time Completion Time 
------- ---- -- ---------- ----------- ------------ --------------- 
9       Full    Unknown    SBT_TAPE    00:00:26     17-DEC-09 
       BP Key: 15   Status: AVAILABLE  CompressedNO  Tag: TAG20091217T043756 
       Handle: /home/oracle_restore/system_<wbr/>tbs/09l13rl4_1_1.17   Media: 
 List of Datafiles in backup set 9 
 File LV Type Ckp SCN    Ckp Time  Name 
 ---- -- ---- ---------- --------- ---- 
 1       Full 675339     17-DEC-09 /u02/oradata/db10g/system01.<wbr/>dbf 
 
BS Key  Type LV Size       Device Type Elapsed Time Completion Time 
------- ---- -- ---------- ----------- ------------ --------------- 
10      Full    Unknown    SBT_TAPE    00:00:02     17-DEC-09 
       BP Key: 16   Status: AVAILABLE  CompressedNO  Tag: TAG20091217T043756 
       Handle: /home/oracle_restore/system_<wbr/>tbs/0al13rm8_1_1.17   Media: 
 Control File Included: Ckp SCN: 675370       Ckp time: 17-DEC-09 
 SPFILE Included: Modification time: 16-DEC-09 

 

RMAN is now configured to complete the Oracle recovery as described below. 

 

Using RMAN to Complete the Restore  

 

Before running RMAN, you may want to read "Using RMAN for Restores" from the Oracle documentation".

Start RMAN for all the databases being restored. These databases should be mounted but closed. Execute RMAN RESTORE commands to restore from the directory created above. Execute the RMAN RECOVER command after the RESTORE is successful. When you are done, you can delete the directory you created for the recovery. 

RMAN command example to restore and recover the deleted data file from one of the table spaces. 
 
RMAN> restore datafile '/u02/oradata/ORCL/datafile/zmanda_tsp.dfb'; 
 
Starting restore at 03-MAR-09 
allocated channel: ORA_DISK_1 
channel ORA_DISK_1: SID=130 device type=DISK 
allocated channel: ORA_SBT_TAPE_1 
channel ORA_SBT_TAPE_1: SID=128 device type=SBT_TAPE 
channel ORA_SBT_TAPE_1: AMANDA MEDIA MANAGEMENT LIBRARY FOR ORACLE 
 
channel ORA_SBT_TAPE_1: starting datafile backup set restore 
channel ORA_SBT_TAPE_1: specifying datafile(s) to restore from backup set 
channel ORA_SBT_TAPE_1: restoring datafile 00005 to 
/u02/oradata/ORCL/datafile/zmanda_tsp.dfb 
channel ORA_SBT_TAPE_1: reading from backup piece 5kk8v9pt_1_1 
channel ORA_SBT_TAPE_1: errors found reading piece handle=5kk8v9pt_1_1 
channel ORA_SBT_TAPE_1: failover to piece 
handle=/u02/oracle_bkp_test/restore/5kk8v9pt_1_1 
tag=TAG20090303T043820 
channel ORA_SBT_TAPE_1: restored backup piece 1 
channel ORA_SBT_TAPE_1: restore complete, elapsed time: 00:00:01 
Finished restore at 03-MAR-09 
 
RMAN> recover datafile '/u02/oradata/ORCL/datafile/zmanda_tsp.dfb'; 
 
Starting recover at 03-MAR-09 
using channel ORA_DISK_1 
using channel ORA_SBT_TAPE_1 
 
starting media recovery 
media recovery complete, elapsed time: 00:00:00 
 
Finished recover at 03-MAR-20 

Online the table space that had missing data file or corrupted data file. Oracle will perform table space recovery.