• Brusque/SC
  • (47) 3053-7082
-
-

Blog

08 de dezembro de 2021

Dica Oracle - RMAN - Simulando backup para fita

Se você não possui drive de fita mas quer simular um backup para fita ou mesmo realizar testes quando dizem que o problema está no RMAN e não no produto de terceiros como NetBackup, NetWorker, Data Protector e TSM, por exemplo, utilize a API oracle.disksbt que a Oracle fornece para simular o uso da MML (Media Management Library) fazendo com o que um diretório do servidor seja tratado igual a uma unidade de fita.

A API pode ser especificada na alocação do canal ou configurada nas parametrizações do RMAN onde será atribuída automaticamente ao canal quando um backup SBT_TAPE for executado inibindo a necessidade de alocar o canal com os parâmetros manualmente.
 
SBT_LIBRARY : recebe a API que simula o uso da MML;
 
BACKUP_DIR : recebe o diretório que serão gerados os arquivos de backup.
 
  • Na Alocação do canal
[oracle@db3 ~]$ mkdir -p /orabackup/sbt
[oracle@db3 ~]$ rman target /

Recovery Manager: Release 12.2.0.1.0 - Production on Tue Feb 13 18:32:40 2018

Copyright (c) 1982, 2017, Oracle and/or its affiliates.  All rights reserved.

connected to target database: CDB1 (DBID=913632474)

RMAN> RUN {
2> ALLOCATE CHANNEL CH01 DEVICE TYPE 'SBT_TAPE' PARMS="SBT_LIBRARY=oracle.disksbt, ENV=(BACKUP_DIR=/orabackup/sbt)";
3> BACKUP CURRENT CONTROLFILE;
4> }

using target database control file instead of recovery catalog
allocated channel: CH01
channel CH01: SID=56 device type=SBT_TAPE
channel CH01: WARNING: Oracle Test Disk API

Starting backup at 13-FEB-18
channel CH01: starting full datafile backup set
channel CH01: specifying datafile(s) in backup set
including current control file in backup set
channel CH01: starting piece 1 at 13-FEB-18
channel CH01: finished piece 1 at 13-FEB-18
piece handle=2jsr52rc_1_1 tag=TAG20180213T173331 comment=API Version 2.0,MMS Version 8.1.3.0
channel CH01: backup set complete, elapsed time: 00:00:01
Finished backup at 13-FEB-18

Starting Control File and SPFILE Autobackup at 13-FEB-18
piece handle=c-913632474-20180213-00 comment=API Version 2.0,MMS Version 8.1.3.0
Finished Control File and SPFILE Autobackup at 13-FEB-18
released channel: CH01

RMAN> exit


Recovery Manager complete.
[oracle@db3 ~]$ ls -lrt /orabackup/sbt/
total 49164
-rw-r--r--. 1 oracle oinstall 25165840 Feb 13 18:33 2jsr52rc_1_1
-rw-r--r--. 1 oracle oinstall 25165840 Feb 13 18:33 c-913632474-20180213-00
-rw-r--r--. 1 oracle oinstall     3360 Feb 13 18:33 Oracle_Disk_SBT_Catalog

 

  • Nas parametrizações do RMAN
[oracle@db3 ~]$ rman target /

Recovery Manager: Release 12.2.0.1.0 - Production on Tue Feb 13 18:43:04 2018

Copyright (c) 1982, 2017, Oracle and/or its affiliates.  All rights reserved.

connected to target database: CDB1 (DBID=913632474)

RMAN> show all;

using target database control file instead of recovery catalog
RMAN configuration parameters for database with db_unique_name CDB1 are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
CONFIGURE BACKUP OPTIMIZATION OFF; # default
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP ON; # default
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default
CONFIGURE RMAN OUTPUT TO KEEP FOR 7 DAYS; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/orabin/app/oracle/product/12.2.0.1/dbhome_1/dbs/snapcf_cdb1.f'; # default

RMAN> CONFIGURE CHANNEL DEVICE TYPE 'SBT_TAPE' PARMS="SBT_LIBRARY=oracle.disksbt, ENV=(BACKUP_DIR=/orabackup/sbt)";

new RMAN configuration parameters:
CONFIGURE CHANNEL DEVICE TYPE 'SBT_TAPE' PARMS  "SBT_LIBRARY=oracle.disksbt, ENV=(BACKUP_DIR=/orabackup/sbt)";
new RMAN configuration parameters are successfully stored

RMAN> CONFIGURE DEFAULT DEVICE TYPE TO 'SBT_TAPE';

new RMAN configuration parameters:
CONFIGURE DEFAULT DEVICE TYPE TO 'SBT_TAPE';
new RMAN configuration parameters are successfully stored

RMAN> backup current controlfile format 'exemplo2.bkp';

Starting backup at 13-FEB-18
allocated channel: ORA_SBT_TAPE_1
channel ORA_SBT_TAPE_1: SID=59 device type=SBT_TAPE
channel ORA_SBT_TAPE_1: WARNING: Oracle Test Disk API
channel ORA_SBT_TAPE_1: starting full datafile backup set
channel ORA_SBT_TAPE_1: specifying datafile(s) in backup set
including current control file in backup set
channel ORA_SBT_TAPE_1: starting piece 1 at 13-FEB-18
channel ORA_SBT_TAPE_1: finished piece 1 at 13-FEB-18
piece handle=exemplo2.bkp tag=TAG20180213T174719 comment=API Version 2.0,MMS Version 8.1.3.0
channel ORA_SBT_TAPE_1: backup set complete, elapsed time: 00:00:01
Finished backup at 13-FEB-18

Starting Control File and SPFILE Autobackup at 13-FEB-18
piece handle=c-913632474-20180213-01 comment=API Version 2.0,MMS Version 8.1.3.0
Finished Control File and SPFILE Autobackup at 13-FEB-18

RMAN> exit


Recovery Manager complete.
[oracle@db3 ~]$ ls -lrt /orabackup/sbt/
total 98328
-rw-r--r--. 1 oracle oinstall 25165840 Feb 13 18:33 2jsr52rc_1_1
-rw-r--r--. 1 oracle oinstall 25165840 Feb 13 18:33 c-913632474-20180213-00
-rw-r--r--. 1 oracle oinstall 25165840 Feb 13 18:47 exemplo2.bkp
-rw-r--r--. 1 oracle oinstall 25165840 Feb 13 18:47 c-913632474-20180213-01
-rw-r--r--. 1 oracle oinstall     5600 Feb 13 18:47 Oracle_Disk_SBT_Catalog

 

A nível de curiosidade, a API existe desde a versão 9i do Oracle Database!

 

Postado por: Anderson Graf
274 visualizações

Compartilhe este post

Converse com a equipe Exímio

Encontre a melhor solução para sua empresa
Agende uma conversa com a nossa equipe!

Conteudo

Newsletter

Receba todas as nossas
novidades no seu e-mail