Taking whole Oracle Database backup

Antes de disparar o backup em si, podemos checar se o diretório de FRA, que abrigará os backup pieces, está definido:

[oracle@oel8 ~]$ sqlplus / as sysdba
 
SQL*Plus: Release 18.0.0.0.0 - Production on Fri Mar 12 05:26:29 2021
Version 18.3.0.0.0
 
Copyright (c) 1982, 2018, Oracle.  All rights reserved.
 
 
Connected to:
Oracle Database 18c Enterprise Edition Release 18.0.0.0.0 - Production
Version 18.3.0.0.0
 
SQL> SHO PARAMETER db_recovery_file_dest
 
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
db_recovery_file_dest                string      /oracle/fra
db_recovery_file_dest_size           big integer 2G
SQL>

Baixando e montando o banco de dados para permitir o backup:

SQL> SHU IMMEDIATE;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> STARTUP MOUNT;
ORACLE instance started.
 
Total System Global Area 1610612016 bytes
Fixed Size                  8658224 bytes
Variable Size             520093696 bytes
Database Buffers         1073741824 bytes
Redo Buffers                8118272 bytes
Database mounted.
SQL> SELECT INSTANCE_NAME,STATUS FROM V$INSTANCE;
 
INSTANCE_NAME    STATUS
---------------- ------------
RMANDB           MOUNTED

Utilizando o RMAN para disparar o comando de backup. Como os valores dos parâmetros persistentes do RMAN estão todos como Default, e no comando não estou alterando nenhum outro parâmetro, o comportamento que o mesmo adotará será criar o backup piece no diretório da FRA, utilizando apenas um canal:

[oracle@oel8 oracle]$ rman target /
 
Recovery Manager: Release 18.0.0.0.0 - Production on Fri Mar 12 05:41:07 2021
Version 18.3.0.0.0
 
Copyright (c) 1982, 2018, Oracle and/or its affiliates.  All rights reserved.
 
connected to target database: RMANDB (DBID=3825250984, not open)
 
RMAN> BACKUP DATABASE;
 
Starting backup at 2021-03-12:05:41:16
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=7 device type=DISK
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00001 name=/oracle/dados/RMANDB/datafile/o1_mf_system_h8nynqfx_.dbf
input datafile file number=00003 name=/oracle/dados/RMANDB/datafile/o1_mf_sysaux_h8nyq35q_.dbf
input datafile file number=00004 name=/oracle/dados/RMANDB/datafile/o1_mf_undotbs1_h8nyrjdr_.dbf
input datafile file number=00005 name=/oracle/dados/RMANDB/datafile/ts_cortex_catalog.dbf
input datafile file number=00007 name=/oracle/dados/RMANDB/datafile/o1_mf_users_h8nyrkn7_.dbf
channel ORA_DISK_1: starting piece 1 at 2021-03-12:05:41:18
channel ORA_DISK_1: finished piece 1 at 2021-03-12:05:42:23
piece handle=/oracle/fra/RMANDB/backupset/2021_03_12/o1_mf_nnndf_TAG20210312T054118_j4pb9gv3_.bkp tag=TAG20210312T054118 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:01:05
Finished backup at 2021-03-12:05:42:23
 
Starting Control File and SPFILE Autobackup at 2021-03-12:05:42:24
piece handle=/oracle/fra/RMANDB/autobackup/2021_03_12/o1_mf_s_1066973440_j4pbck5m_.bkp comment=NONE
Finished Control File and SPFILE Autobackup at 2021-03-12:05:42:27
 
RMAN>

Analisando os detalhes dos backupsets 2 e 3 com o comando LIST:

RMAN> LIST BACKUPSET 2,3;
 
 
List of Backup Sets
===================
 
 
BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ -------------------
2       Full    1.15G      DISK        00:00:41     2021-03-12:05:41:59
        BP Key: 2   Status: AVAILABLE  Compressed: NO  Tag: TAG20210312T054118
        Piece Name: /oracle/fra/RMANDB/backupset/2021_03_12/o1_mf_nnndf_TAG20210312T054118_j4pb9gv3_.bkp
  List of Datafiles in backup set 2
  File LV Type Ckp SCN    Ckp Time            Abs Fuz SCN Sparse Name
  ---- -- ---- ---------- ------------------- ----------- ------ ----
  1       Full 1805356    2021-03-12:05:30:40              NO    /oracle/dados/RMANDB/datafile/o1_mf_system_h8nynqfx_.dbf
  3       Full 1805356    2021-03-12:05:30:40              NO    /oracle/dados/RMANDB/datafile/o1_mf_sysaux_h8nyq35q_.dbf
  4       Full 1805356    2021-03-12:05:30:40              NO    /oracle/dados/RMANDB/datafile/o1_mf_undotbs1_h8nyrjdr_.dbf
  5       Full 1805356    2021-03-12:05:30:40              NO    /oracle/dados/RMANDB/datafile/ts_cortex_catalog.dbf
  7       Full 1805356    2021-03-12:05:30:40              NO    /oracle/dados/RMANDB/datafile/o1_mf_users_h8nyrkn7_.dbf
 
BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ -------------------
3       Full    10.20M     DISK        00:00:01     2021-03-12:05:42:25
        BP Key: 3   Status: AVAILABLE  Compressed: NO  Tag: TAG20210312T054224
        Piece Name: /oracle/fra/RMANDB/autobackup/2021_03_12/o1_mf_s_1066973440_j4pbck5m_.bkp
  Control File Included: Ckp SCN: 1805356      Ckp time: 2021-03-12:05:30:40
  SPFILE Included: Modification time: 2021-03-12:05:40:39
  SPFILE db_unique_name: RMANDB
 
RMAN>

Realizando consulta sobre a porcentagem de uso da FRA:

SQL> SET LIN 300
SQL> SELECT FILE_TYPE,PERCENT_SPACE_USED,PERCENT_SPACE_RECLAIMABLE,NUMBER_OF_FILES FROM V$RECOVERY_AREA_USAGE;
 
FILE_TYPE               PERCENT_SPACE_USED PERCENT_SPACE_RECLAIMABLE NUMBER_OF_FILES
----------------------- ------------------ ------------------------- ---------------
CONTROL FILE                           .49                         0               1
REDO LOG                              7.32                         0               3
ARCHIVED LOG                             0                         0               0
BACKUP PIECE                         58.52                        .5               3
IMAGE COPY                               0                         0               0
FLASHBACK LOG                            0                         0               0
FOREIGN ARCHIVED LOG                     0                         0               0
AUXILIARY DATAFILE COPY                  0                         0               0
 
8 rows selected.

Realizando a remoção dos backupsets 2 e 3:

[oracle@oel8 oracle]$ rman target /
 
Recovery Manager: Release 18.0.0.0.0 - Production on Fri Mar 12 05:58:53 2021
Version 18.3.0.0.0
 
Copyright (c) 1982, 2018, Oracle and/or its affiliates.  All rights reserved.
 
connected to target database: RMANDB (DBID=3825250984, not open)
 
RMAN> DELETE BACKUPSET 2,3;
 
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=45 device type=DISK
 
List of Backup Pieces
BP Key  BS Key  Pc# Cp# Status      Device Type Piece Name
------- ------- --- --- ----------- ----------- ----------
2       2       1   1   AVAILABLE   DISK        /oracle/fra/RMANDB/backupset/2021_03_12/o1_mf_nnndf_TAG20210312T054118_j4pb9gv3_.bkp
3       3       1   1   AVAILABLE   DISK        /oracle/fra/RMANDB/autobackup/2021_03_12/o1_mf_s_1066973440_j4pbck5m_.bkp
 
Do you really want to delete the above objects (enter YES or NO)? YES
deleted backup piece
backup piece handle=/oracle/fra/RMANDB/backupset/2021_03_12/o1_mf_nnndf_TAG20210312T054118_j4pb9gv3_.bkp RECID=2 STAMP=1066974078
deleted backup piece
backup piece handle=/oracle/fra/RMANDB/autobackup/2021_03_12/o1_mf_s_1066973440_j4pbck5m_.bkp RECID=3 STAMP=1066974145
Deleted 2 objects
 
 
RMAN>

Consultando FRA novamente:

SQL> set lin 300
SQL> SELECT FILE_TYPE,PERCENT_SPACE_USED,PERCENT_SPACE_RECLAIMABLE,NUMBER_OF_FILES FROM V$RECOVERY_AREA_USAGE;
 
FILE_TYPE               PERCENT_SPACE_USED PERCENT_SPACE_RECLAIMABLE NUMBER_OF_FILES
----------------------- ------------------ ------------------------- ---------------
CONTROL FILE                           .49                         0               1
REDO LOG                              7.32                         0               3
ARCHIVED LOG                             0                         0               0
BACKUP PIECE                            .5                         0               1
IMAGE COPY                               0                         0               0
FLASHBACK LOG                            0                         0               0
FOREIGN ARCHIVED LOG                     0                         0               0
AUXILIARY DATAFILE COPY                  0                         0               0
 
8 rows selected.

Obs: Este procedimento foi criado pelo senhor Ahmed Baraka (www.ahmedbaraka.com) e foi apenas reproduzido por mim em um laboratório pessoal para fins de aprendizado.

Leave a Comment

Your email address will not be published.