Emulando una Super DLT a Disco

Por Alberto Silva
Publicado en noviembre 2009


Descubriendo Oracle Test Disk API


En mi búsqueda para encontrar ambientes que puedan emular tecnología muy costosa, me encontré con un problema cuando respalde el Flash Recovery Area. El error ORA-6747 indica que no es posible respaldar a disco la (FRA) y debe ser asignado una canal SBT. La verdad que si no tengo cintas estoy "frito" y no puedo respaldar en caso de alguna catástrofe.

Respaldando Flash Recovery Area con RMAN

Al configurar el (FRA) con RMAN, sera posible mantener los respaldos realizados sin tener que ser llevados a cinta. Esto aumenta la disponibilidad de respaldos en caso de alguna falla y disminuye el MTTR.

 

MTTR 'Mean Time to Recover'
Este término significa el tiempo promedio que
se demora al recuperar un sistema. En este caso,
es tiempo que demora recuperar la base de
datos.

 

Para revisar el espacio disponible en el (FRA), se puede consultar la siguiente vista:

SQL> select SPACE_RECLAIMABLE from
V$RECOVERY_FILE_DEST; SPACE_RECLAIMABLE ----------------- 43008

El valor de esta columna se incrementa cada vez que se realiza un respaldo, si esta definido en el flash recovery area.

API oracle.disksbt

El oracle.disksbt es un API que nos provee Oracle para poder testear procedimientos de respaldo que utilizan dispositivos SBT. En este caso se define como un pseudo dispositivo de cinta que en definitiva esta configurado contra un filesystem ó directorio definido para almacenar ahí los respaldos realizados con esta API. Finalmente, RMAN asume que tiene una cinta y que el dispositivo SBT esta disponible cada vez que necesita consultar, respaldar o recuperar. Es importante generar una configuración persistente mediante la definición del parámetro con el comando CONFIGURE.

1. Crear un directorio donde el usuario dueño del motor Oracle pueda escribir.
    ejemplo : mkdir /oracle/tape_backup

2. Llamando a la API desde RMAN
    Ej: run {     allocate channel DR1 device type 'SBT_TAPE'
    PARMS="SBT_LIBRARY=oracle.disksbt,ENV=(BACKUP_DIR=/oracle/type_backup)"
;
    backup as compressed backupset database plus archivelog;
    backup current controlfile;
    backup spfile tag=FULL_DB
    }

allocated channel: DR1
channel DR1: sid=134 devtype=SBT_TAPE
channel DR1: WARNING: Oracle Test Disk API

Starting backup at 27-AUG-09
current log archived
channel DR1: starting compressed archive log backupset
channel DR1: specifying archive log(s) in backup set
input archive log thread=1 sequence=17 recid=17 stamp=695996692
input archive log thread=1 sequence=18 recid=18 stamp=695996761
input archive log thread=1 sequence=19 recid=19 stamp=695997028
channel DR1: starting piece 1 at 27-AUG-09
channel DR1: finished piece 1 at 27-AUG-09
piece handle=2skno4j5_1_1 tag=TAG20090827T123029 comment=API Version 2.0,MMS Version 8.1.3.0
channel DR1: backup set complete, elapsed time: 00:00:02
Finished backup at 27-AUG-09

Starting backup at 27-AUG-09
channel DR1: starting compressed full datafile backupset
channel DR1: specifying datafile(s) in backupset
input datafile fno=00001 name=/oracle/product/10.2.0/oradata/BIZPR1/BIZPR1/system01.dbf
input datafile fno=00003 name=/oracle/product/10.2.0/oradata/BIZPR1/BIZPR1/sysaux01.dbf
input datafile fno=00002 name=/oracle/product/10.2.0/oradata/BIZPR1/BIZPR1/undotbs01.dbf
input datafile fno=00004 name=/oracle/product/10.2.0/oradata/BIZPR1/BIZPR1/users01.dbf
channel DR1: starting piece 1 at 27-AUG-09
channel DR1: finished piece 1 at 27-AUG-09
piece handle=2tkno4j8_1_1 tag=TAG20090827T123031 comment=API Version 2.0,MMS Version 8.1.3.0
channel DR1: backup set complete, elapsed time: 00:01:25
Finished backup at 27-AUG-09

Starting backup at 27-AUG-09
current log archived
channel DR1: starting compressed archive log backupset
channel DR1: specifying archive log(s) in backup set
input archive log thread=1 sequence=20 recid=20 stamp=695997117
channel DR1: starting piece 1 at 27-AUG-09
channel DR1: finished piece 1 at 27-AUG-09
piece handle=2ukno4lv_1_1 tag=TAG20090827T123159 comment=API Version 2.0,MMS Version 8.1.3.0
channel DR1: backup set complete, elapsed time: 00:00:02
Finished backup at 27-AUG-09

Starting backup at 27-AUG-09
channel DR1: starting full datafile backupset
channel DR1: specifying datafile(s) in backupset
including current control file in backupset
channel DR1: starting piece 1 at 27-AUG-09
channel DR1: finished piece 1 at 27-AUG-09
piece handle=2vkno4m2_1_1 tag=TAG20090827T123202 comment=API Version 2.0,MMS Version 8.1.3.0
channel DR1: backup set complete, elapsed time: 00:00:02
Finished backup at 27-AUG-09

Starting backup at 27-AUG-09
channel DR1: starting full datafile backupset
channel DR1: specifying datafile(s) in backupset
including current SPFILE in backupset
channel DR1: starting piece 1 at 27-AUG-09
channel DR1: finished piece 1 at 27-AUG-09
piece handle=30kno4m5_1_1 tag=FULL_DB comment=API Version 2.0,MMS Version 8.1.3.0
channel DR1: backup set complete, elapsed time: 00:00:02
Finished backup at 27-AUG-09

Starting Control File and SPFILE Autobackup at 27-AUG-09
piece handle=c-3301411538-20090827-09 comment=API Version 2.0,MMS Version 8.1.3.0
Finished Control File and SPFILE Autobackup at 27-AUG-09
released channel: DR1 RMAN> list backup;

List of Backup Sets
===================

BS Key   Size Device  Type Elapsed Time  Completion  Time
----------  -----------------  ---------------------------  ----------------  --------
4452 256.00K SBT_TAPE 00:00:01 27-AUG-09
BP Key: 4454 Status: AVAILABLE Compressed: YES Tag: TAG20090827T123029
Handle: 2skno4j5_1_1 Media:

List of Archived Logs in backup set 4452
Thrd  Seq Low  SCN Low  Time  Next  SCN Next Time
------- ------- ---------- --------- ---------- -------------
1 17 490207 27-AUG-09 490569 27-AUG-09
1 18 490569 27-AUG-09 490612 27-AUG-09
1 19 490612 27-AUG-09 490799 27-AUG-09

BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
4453 Full 95.00M SBT_TAPE 00:01:22 27-AUG-09
BP Key: 4455 Status: AVAILABLE Compressed: YES Tag: TAG20090827T123031
Handle: 2tkno4j8_1_1 Media:

List of Datafiles in backup set 4453 File LV Type Ckp SCN Ckp Time Name
-------------------- --------------- ----------------- ------------------ --------------- -------------
1 Full 490809 27-AUG-09 /oracle/product/10.2.0/oradata/BIZPR1/BIZPR1/system01.dbf
2 Full 490809 27-AUG-09 /oracle/product/10.2.0/oradata/BIZPR1/BIZPR1/undotbs01.dbf
3 Full 490809 27-AUG-09 /oracle/product/10.2.0/oradata/BIZPR1/BIZPR1/sysaux01.dbf
4 Full 490809 27-AUG-09 /oracle/product/10.2.0/oradata/BIZPR1/BIZPR1/users01.dbf

BS Key Size Device Type Elapsed Time Completion Time
-------- ------------------- ------------ --------------- ----------------------
4468 256.00K SBT_TAPE 00:00:01 27-AUG-09
BP Key: 4473 Status: AVAILABLE Compressed: YES Tag: TAG20090827T123159
Handle: 2ukno4lv_1_1 Media:

List of Archived Logs in backup set 4468
Thrd Seq Low SCN Low Time Next SCN Next Time
---------- ------------ ---------- ------------ ------------ ---------
1 20 490799 27-AUG-09 490843 27-AUG-09

BS Key Type LV Size Device Type Elapsed Time Completion Time
---------- --------- ------ -------------- --------------- --------------- -----------------
4481 Full 7.00M SBT_TAPE 00:00:01 27-AUG-09
BP Key: 4483 Status: AVAILABLE Compressed: NO Tag: TAG20090827T123202
Handle: 2vkno4m2_1_1 Media:
Control File Included: Ckp SCN: 490863 Ckp time: 27-AUG-09

BS Key Type LV Size Device Type Elapsed Time Completion Time
----------- -------- ------- -------------- --------------- ---------------- ------------------
4493 Full 256.00K SBT_TAPE 00:00:01 27-AUG-09
BP Key: 4495 Status: AVAILABLE Compressed: NO Tag: FULL_DB
Handle: 30kno4m5_1_1 Media:
SPFILE Included: Modification time: 27-AUG-09

BS Key Type LV Size Device Type Elapsed Time Completion Time
----------- --------- ---- ------------- -------------- --------------- --------------------
4505 Full 7.25M SBT_TAPE 00:00:01 27-AUG-09
BP Key: 4507 Status: AVAILABLE Compressed: NO Tag: TAG20090827T123209
Handle: c-3301411538-20090827-09 Media:
Control File Included: Ckp SCN: 490886 Ckp time: 27-AUG-09
SPFILE Included: Modification time: 27-AUG-09

Y ahora podemos respaldar el Flash Recovery Area:

RMAN> backup recovery area;

Starting backup at 27-AUG-09
allocated channel: ORA_SBT_TAPE_1
channel ORA_SBT_TAPE_1: sid=134 devtype=SBT_TAPE
channel ORA_SBT_TAPE_1: WARNING: Oracle Test Disk API
specification does not match any datafile copy in the repository
specification does not match any backupset in the repository
skipping archive log file /oracle/product/10.2.0/db_1/flash_recovery_area/BIZPR1/ archivelog/2009_08_27/o1_ mf_1_17_59fdtmw0_.arc; already backed up 1 time(s) skipping archive log file /oracle/product/10.2.0/db_1/flash_recovery_area/BIZPR1/ archivelog/2009_08_27/o1_ mf_1_18_59fdws7p_.arc; already backed up 1 time(s) skipping archive log file /oracle/product/10.2.0/db_1/flash_recovery_area/BIZPR1/archivelog/2009_08_27/o1_ mf_1_19_59ff54nn_.arc; already backed up 1 time(s) skipping archive log file /oracle/product/10.2.0/db_1/flash_recovery_area/BIZPR1/archivelog/2009_08_27/o1_ mf_1_20_59ff7xl3_.arc; already backed up 1 time(s) Finished backup at 27-AUG-09

Un Abrazo.
Alberto Silva


Publicado Por Alberto Silva. Blogger regional Oracle. Conócelo a él y a otros Bloggers de la región aquí.