Oracle by Example brandingManage Backups

section 0Before You Begin

This 15-minute tutorial shows you how to manage backups after you create them.

Select the Oracle Database release:

Background

An essential part of a backup and recovery strategy is managing backups after you create them. Backup management includes deleting obsolete backups and performing periodic checks to ensure that backups are available and usable. In a multitenant environment, you can manage backups for the whole multitenant container database (CDB) or for one or more pluggable databases (PDBs).

You should manage your backups by deleting obsolete backups and performing periodic checks to ensure that backups are available and usable.

What Do You Need?

  • Oracle Database 18c19c

section 1Display Backup Information

  1. Switch to the sqlplus terminal window. Query the V$RMAN_BACKUP_JOB_DETAILS view to display backup job history.
    SQL> select session_key, input_type, status, start_time,
    end_time, elapsed_seconds/3600 hrs
    from v$rman_backup_job_details;
    SESSION_KEY INPUT_TYPE STATUS START_TIM END_TIME HRS ----------- ------------- ----------------------- --------- --------- ---------- 6 DB FULL COMPLETED 28-MAR-19 28-MAR-19 18.62 15 DB FULL COMPLETED 29-MAR-19 29-MAR-19 .019444444

section 2Crosscheck Backups

  1. Execute the LIST BACKUP SUMMARY command to view a list of all backup sets.
    RMAN> list backup summary;
    
    List of Backups
    ===============
    Key     TY LV S Device Type Completion Time #Pieces #Copies Compressed Tag
    ------- -- -- - ----------- --------------- ------- ------- ---------- ---
    1       B  F  A DISK        28-MAR-19       1       1       NO         TAG20190328T031342
    2       B  F  A DISK        28-MAR-19       1       1       NO         TAG20190328T031342
    3       B  F  A DISK        28-MAR-19       1       1       NO         TAG20190328T031342
    4       B  F  A DISK        28-MAR-19       1       1       NO         TAG20190328T031438
    5       B  A  A DISK        28-MAR-19       1       1       NO         TAG20190328T214935
    6       B  F  A DISK        28-MAR-19       1       1       NO         TAG20190328T214936
    7       B  F  A DISK        28-MAR-19       1       1       NO         TAG20190328T214936
    8       B  F  A DISK        28-MAR-19       1       1       NO         TAG20190328T214936
    9       B  A  A DISK        28-MAR-19       1       1       NO         TAG20190328T215052
    10      B  F  A DISK        28-MAR-19       1       1       NO         TAG20190328T215053
    11      B  F  A DISK        28-MAR-19       1       1       NO         TAG20190328T220511
    12      B  A  A DISK        29-MAR-19       1       1       NO         TAG20190329T005836
    13      B  F  A DISK        29-MAR-19       1       1       NO         TAG20190329T005838
    14      B  F  A DISK        29-MAR-19       1       1       NO         TAG20190329T005838
    15      B  F  A DISK        29-MAR-19       1       1       NO         TAG20190329T005838
    16      B  A  A DISK        29-MAR-19       1       1       NO         TAG20190329T005944
    17      B  F  A DISK        29-MAR-19       1       1       NO         TAG20190329T005945
    
  2. Execute the CROSSCHECK BACKUP command to crosscheck all backup sets.
    RMAN> crosscheck backup;
    

    Click the output.txt to view the output.

  3. Enter the CROSSCHECK BACKUPSET command to crosscheck the specified backupset.
    RMAN> crosscheck backupset 1;
                                                                                                                                                                                                         
    using channel ORA_DISK_1                                                                                                                                                                             
    crosschecked backup piece: found to be 'AVAILABLE'                                                                                                                                                   
    backup piece handle=/scratch/u01/app/oracle/recovery_area/ORCL/backupset/2019_03_28/o1_mf_nnndf_TAG20190328T031342_g9s7lpwz_.bkp RECID=1 STAMP=1004066022                                            
    Crosschecked 1 objects                                                                                                                                                                               
    

section 3Delete Expired Backups

  1. Enter the DELETE EXPIRED BACKUP command to delete expired backups from the RMAN repository.
    RMAN> delete expired backup;                                                                                                                                                                                                                                                                                                                                                                          
    using channel ORA_DISK_1                                                                                                                                                                             
    specification does not match any backup in the repository

section 4Monitor Fast Recovery Area Space Usage

You should monitor the Fast Recovery Area to ensure that it is large enough to contain backups and other recovery-related files. Note that space usage in your database may vary from what is shown in this tutorial.

  1. Query the V$RECOVERY_FILE_DEST view to obtain information about the Fast Recovery Area.
    SQL> select * from v$recovery_file_dest;
    
    NAME
    --------------------------------------------------------------------------------
    SPACE_LIMIT SPACE_USED SPACE_RECLAIMABLE NUMBER_OF_FILES     CON_ID
    ----------- ---------- ----------------- --------------- ----------
    /scratch/u01/app/oracle/recovery_area
     1.0737E+10 1.0249E+10         129386496              21          0
    
  2. Query the V$RECOVERY_AREA_USAGE view to obtain additional information about the Fast Recovery Area.

    SQL> select file_type, percent_space_used PCT_USED, percent_space_reclaimable PCT_RECLAIM, number_of_files NO_FILES from v$recovery_area_usage;
    FILE_TYPE PCT_USED PCT_RECLAIM   NO_FILES
    ----------------------- ---------- ----------- ----------
    CONTROL FILE                     0           0          0
    REDO LOG                         0           0          0
    ARCHIVED LOG                  1.37        1.37          3
    BACKUP PIECE                 87.22           0         17
    IMAGE COPY                       0           0          0
    FLASHBACK LOG                 5.86           0          3
    FOREIGN ARCHIVED LOG             0           0          0
    AUXILIARY DATAFILE COPY          0           0          0
    
    8 rows selected.