RMAN - Abordando Oracle Secure Backup Cloud Module para o Amazon AWS S3
Autor: Eduardo Legatti | Publicado: 2016-10-04T14:09:00-03:00

Olá,


 O Amazon S3 é um serviço de armazenamento na nuvem disponibilizado pela Amazon (AWS). Para DBAs que administram bancos de dados Oracle na infraestrutura da AWS usando uma máquina EC2, existe uma alternativa de armazenar backups físicos realizados pelo RMAN diretamente no S3 como se fosse uma fita (tape). Vale a pena salientar que os arquivos enviados pelo RMAN para este tape, no caso o S3, tem um formato próprio e só são reconhecidos pelo RMAN quando conectado diretamente utilizando a library OSB para o AWS S3, ou seja, os arquivos no S3 não serão reconhecidos pelo RMAN caso os mesmos sejam baixados diretamente do S3 para o sistema de arquivos. Para este propósito, existem outras formas como usar utilitários da AWS, como por exemplo, o AWS S3 sync para enviar arquivos diretamente da flash_recovery_area para um bucket no S3. 

A simulação que irei realizar neste artigo é em um ambiente Linux. Não irei abordar aqui, mas vale a pena salientar, que é necessário ter uma conta no site da Oracle OTN, bem como ter uma conta no site da AWS já com um bucket S3 configurado e com as devidas permissões. No mais, o primeiro passo é instalar o java versão superior a 1.7 ou superior e realizar o download do módulo OSB (osbws_install.jar) no site da Oracle. Segue abaixo os procedimentos para instalação do módulo.
 
Verificando a versão do java.

$ /usr/local/jdk7/bin/java -version
java version "1.7.0_79"
Java(TM) SE Runtime Environment (build 1.7.0_79-b15)
Java HotSpot(TM) 64-Bit Server VM (build 24.79-b02, mixed mode)

 

 Após verificado a versão do java e da realização do download do módulo OSB, irei realizar a instalação do mesmo conforme a seguir. Irei configurar a integração do RMAN com S3 usando a instância BD01. Neste momento, será necessário informar o AWSID, AWSKey, otnUser e otnPass.
 
$ export ORACLE_SID=BD01
$ /usr/local/jdk7/bin/java -jar osbws_install.jar -AWSID [awsid] -AWSKey [awskey] -otnUser [otnuser] -otnPass [otnpass]
  -walletDir /u01/app/oracle/product/11.2.0/dbhome_1/dbs/osbws_wallet
  -libDir /u01/app/oracle/product/11.2.0/dbhome_1/lib

Oracle Secure Backup Web Service Install Tool, build 2016-07-12
AWS credentials are valid.
Oracle Secure Backup Web Service wallet created in directory /u01/app/oracle/product/11.2.0/dbhome_1/dbs/osbws_wallet.
Oracle Secure Backup Web Service initialization file /u01/app/oracle/product/11.2.0/dbhome_1/dbs/osbwsbd01.ora created.
Downloading Oracle Secure Backup Web Service Software Library from file osbws_linux64.zip.
Downloaded 27239574 bytes in 9 seconds. Transfer rate was 3026619 bytes/second.
Download complete.

 

 Após realizada a instalação, será necessário criar um link simbólico no sistema operacional como demonstrado a seguir.

$ ln -s /u01/app/oracle/product/11.2.0/dbhome_1/lib/libosbws.so /u01/app/oracle/product/11.2.0/dbhome_1/lib/libobk.so

 

 O próximo passo será realizar um teste de conectividade. É possível perceber que o arquivo osbwsBD01.ora foi criado em $ORACLE_HOME e este é o arquivo de configuração para conexão com o bucket S3 na AWS. Nele é possível configurar a credencial na AWS e o bucket S3 que deverá ser utilizado pelos backups com o RMAN. Abaixo segue alguns nomes fictícios para fins didáticos.

$ cat /u01/app/oracle/product/11.2.0/dbhome_1/dbs/osbwsBD01.ora

cat osbwsBD01.ora
OSB_WS_HOST=https://s3.amazonaws.com
OSB_WS_WALLET='location=file:/u01/app/oracle/product/11.2.0/dbhome_1/dbs/osbws_wallet CREDENTIAL_ALIAS=rman_aws'
OSB_WS_BUCKET='rman_backup'

 

 Agora irei realizar um teste de conectividade com o bucket S3.

$ export ORACLE_SID=BD01
$ sbttest osbws_readme.txt -dbname BD01

The sbt function pointers are loaded from libobk.so library.
-- sbtinit succeeded
-- sbtinit (2nd time) succeeded
sbtinit: vendor description string=Oracle Secure Backup
sbtinit: Media manager is version 3.16.7.12
sbtinit: Media manager supports SBT API version 2.0
sbtinit: allocated sbt context area of 1064 bytes
-- sbtinit2 succeeded
-- regular_backup_restore starts ................................
-- sbtbackup succeeded
write 100 blocks
-- sbtwrite2 succeeded
-- sbtclose2 succeeded
sbtinfo2: SBTBFINFO_NAME=osbws_readme.txt
sbtinfo2: SBTBFINFO_COMMENT=Oracle Secure Backup Web Services Library
sbtinfo2: SBTBFINFO_METHOD=stream
sbtinfo2: SBTBFINFO_ORDER=random access
sbtinfo2: SBTBFINFO_SHARE=multiple users
sbtinfo2: SBTBFINFO_LABEL=s3.amazonaws.com/rman_backup
-- sbtinfo2 succeeded
-- sbtrestore succeeded
file was created by this program:
&nbsp;&nbsp;&nbsp;&nbsp; seed=1291994907, blk_size=16384, blk_count=100
read 100 buffers
-- sbtread2 succeeded
-- sbtclose2 succeeded
-- sbtremove2 succeeded
-- regular_backup_restore ends&nbsp;&nbsp; ................................
-- sbtcommand succeeded
proxy copy is not supported
-- sbtend succeeded
*** The SBT API test was successful ***

 

 Caso durante o teste de conectividade ocorra o erro [KBHS-00713: HTTP client error ''], é porque possivelmente o endereço no parâmetro OSB_WS_HOST deverá ser trocado de http:// para https://.
  

 A seguir irei realizar algumas configurações e testes de backup/recover diretamente de dentro do RMAN acessando o bucket S3.

$ export ORACLE_SID=BD01
$ rman target /

Recovery Manager: Release 11.2.0.3.0 - Production on Tue Oct 4 10:09:43 2016

Copyright (c) 1982, 2011, Oracle and/or its affiliates.&nbsp; All rights reserved.

connected to target database: BD01 (DBID=2858829824)

RMAN&gt; configure channel device type sbt parms 'SBT_LIBRARY=/u01/app/oracle/product/11.2.0/dbhome_1/lib/libosbws.so SBT_PARMS=(OSB_WS_PFILE=/u01/app/oracle/product/11.2.0/dbhome_1/dbs/osbwsBD01.ora)';

using target database control file instead of recovery catalog
new RMAN configuration parameters:
CONFIGURE CHANNEL DEVICE TYPE 'SBT_TAPE' PARMS&nbsp; 'SBT_LIBRARY=/u01/app/oracle/product/11.2.0/dbhome_1/lib/libosbws.so SBT_PARMS=(OSB_WS_PFILE=/u01/app/oracle/product/11.2.0/dbhome_1/dbs/osbwsBD01.ora)';
new RMAN configuration parameters are successfully stored

RMAN&gt; configure default device type to sbt;

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

RMAN&gt; configure device type sbt_tape parallelism 1 backup type to compressed backupset;

new RMAN configuration parameters:
CONFIGURE DEVICE TYPE 'SBT_TAPE' PARALLELISM 1 BACKUP TYPE TO COMPRESSED BACKUPSET;
new RMAN configuration parameters are successfully stored


RMAN&gt; show all;

RMAN configuration parameters for database with db_unique_name BD01 are:
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 4 DAYS;
CONFIGURE BACKUP OPTIMIZATION ON;
CONFIGURE DEFAULT DEVICE TYPE TO 'SBT_TAPE';
CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE SBT_TAPE TO '%F'; # default
CONFIGURE DEVICE TYPE DISK BACKUP TYPE TO COMPRESSED BACKUPSET PARALLELISM 1;
CONFIGURE DEVICE TYPE 'SBT_TAPE' PARALLELISM 1 BACKUP TYPE TO COMPRESSED BACKUPSET;
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE SBT_TAPE TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE SBT_TAPE TO 1; # default
CONFIGURE CHANNEL DEVICE TYPE 'SBT_TAPE' PARMS&nbsp; 'SBT_LIBRARY=/u01/app/oracle/product/11.2.0/dbhome_1/lib/libosbws.so SBT_PARMS=(OSB_WS_PFILE=/u01/app/oracle/product/11.2.0/dbhome_1/dbs/osbwsBD01.ora)';
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 ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/app/oracle/product/11.2.0/dbhome_1/dbs/snapcf_BD01.f'; # default



 Realizadas as configurações acima, irei prosseguir com algumas operações de backup/recover para fins de demonstração.

RMAN&gt; backup tablespace USERS;

Starting backup at 04/10/2016
allocated channel: ORA_SBT_TAPE_1
channel ORA_SBT_TAPE_1: SID=6 device type=SBT_TAPE
channel ORA_SBT_TAPE_1: Oracle Secure Backup Web Services Library VER=3.16.7.12
channel ORA_SBT_TAPE_1: starting full datafile backup set
channel ORA_SBT_TAPE_1: specifying datafile(s) in backup set
input datafile file number=00004 name=/u01/oradata/BD01/users01.dbf
channel ORA_SBT_TAPE_1: starting piece 1 at 04/10/2016
channel ORA_SBT_TAPE_1: finished piece 1 at 04/10/2016
piece handle=10rbtt89_1_1 tag=TAG20160729T143033 comment=API Version 2.0,MMS Version 3.16.7.12
channel ORA_SBT_TAPE_1: backup set complete, elapsed time: 00:00:25
Finished backup at 04/10/2016

Starting Control File and SPFILE Autobackup at 04/10/2016
piece handle=c-2858829824-20160729-01 comment=API Version 2.0,MMS Version 3.16.7.12
Finished Control File and SPFILE Autobackup at 04/10/2016


RMAN&gt; list backup;

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


BS Key&nbsp; Type LV Size&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
4117&nbsp;&nbsp;&nbsp; Full&nbsp;&nbsp;&nbsp; 3.50M&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SBT_TAPE&nbsp;&nbsp;&nbsp; 00:00:24&nbsp;&nbsp;&nbsp;&nbsp; 04/10/2016
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; BP Key: 4117&nbsp;&nbsp; Status: AVAILABLE&nbsp; Compressed: NO&nbsp; Tag: TAG20160729T143033
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Handle: 10rbtt89_1_1&nbsp;&nbsp; Media: s3.amazonaws.com/rman_backup
&nbsp; List of Datafiles in backup set 4117
&nbsp; File LV Type Ckp SCN&nbsp;&nbsp;&nbsp; Ckp Time&nbsp;&nbsp; Name
&nbsp; ---- -- ---- ---------- ---------- ----
&nbsp; 4&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Full 7840655778587 04/10/2016 /u01/oradata/BD01/users01.dbf

BS Key&nbsp; Type LV Size&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
4118&nbsp;&nbsp;&nbsp; Full&nbsp;&nbsp;&nbsp; 17.25M&nbsp;&nbsp;&nbsp;&nbsp; SBT_TAPE&nbsp;&nbsp;&nbsp; 00:01:05&nbsp;&nbsp;&nbsp;&nbsp; 04/10/2016
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; BP Key: 4118&nbsp;&nbsp; Status: AVAILABLE&nbsp; Compressed: NO&nbsp; Tag: TAG20160729T143058
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Handle: c-2858829824-20160729-01&nbsp;&nbsp; Media: s3.amazonaws.com/rman_backup
&nbsp; SPFILE Included: Modification time: 04/10/2016
&nbsp; SPFILE db_unique_name: BD01
&nbsp; Control File Included: Ckp SCN: 7840655778602&nbsp;&nbsp; Ckp time: 04/10/2016



 Após a realização do backup físico pelo RMAN, irei simular uma falha na instância do Oracle e iniciar o processo de restore/recover do banco de dados.

SQL*Plus: Release 11.2.0.3.0 Production on Tue Oct 4 10:15:32 2016

Copyright (c) 1982, 2011, Oracle.&nbsp; All rights reserved.

Connected to an idle instance.

SQL&gt; startup
ORACLE instance started.

Total System Global Area 2137886720 bytes
Fixed Size&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2230072 bytes
Variable Size&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1459620040 bytes
Database Buffers&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 671088640 bytes
Redo Buffers&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 4947968 bytes
Banco de dados montado.
ORA-01157: n?o e possivel identificar/bloquear arquivo de dados 4 - consulte
arquivo de analise DBWR
ORA-01110: 4 do arquivo de dados: '/u01/oradata/BD01/users01.dbf'


Segue abaixo a simulação do restore e recover do banco de dados.

$ rman target /

Recovery Manager: Release 11.2.0.3.0 - Production on Tue Oct 4 10:20:25 2016

Copyright (c) 1982, 2011, Oracle and/or its affiliates.&nbsp; All rights reserved.

connected to target database: BD01 (DBID=2858829824, not open)

RMAN&gt; restore datafile 4;

Starting restore at 04/10/2016
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=156 device type=DISK
allocated channel: ORA_SBT_TAPE_1
channel ORA_SBT_TAPE_1: SID=189 device type=SBT_TAPE
channel ORA_SBT_TAPE_1: Oracle Secure Backup Web Services Library VER=3.16.7.12

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 00004 to /u01/oradata/BD01/users01.dbf
channel ORA_SBT_TAPE_1: reading from backup piece 10rbtt89_1_1
channel ORA_SBT_TAPE_1: piece handle=10rbtt89_1_1 tag=TAG20160729T143033
channel ORA_SBT_TAPE_1: restored backup piece 1
channel ORA_SBT_TAPE_1: restore complete, elapsed time: 00:00:15
Finished restore at 04/10/2016

RMAN&gt; recover datafile 4;

Starting recover at 04/10/2016
using channel ORA_DISK_1
using channel ORA_SBT_TAPE_1

starting media recovery
media recovery complete, elapsed time: 00:00:02

Finished recover at 04/10/2016

RMAN&gt; alter database open;

database opened



 Caso seja necessário realizar um restore completo de todos os arquivos de dados incluindo control files e spfile segue um exemplo abaixo.

$ export NLS_LANG=AMERICAN_AMERICA.WE8MSWIN1252
$ export NLS_DATE_FORMAT='dd/mm/yyyy hh24:mi:ss'
$ export ORA_RMAN_SGA_TARGET=512
$ rman target /

Recovery Manager: Release 11.2.0.3.0 - Production on Tue Oct 4 10:36:12 2016

Copyright (c) 1982, 2011, Oracle and/or its affiliates.&nbsp; All rights reserved.

connected to target database (not started)

RMAN&gt; startup nomount

startup failed: ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file '/u01/app/oracle/product/11.2.0/dbhome_1/dbs/initBD01.ora'

starting Oracle instance without parameter file for retrieval of spfile
Oracle instance started

Total System Global Area&nbsp;&nbsp;&nbsp;&nbsp; 534462464 bytes

Fixed Size&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2230072 bytes
Variable Size&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 192940232 bytes
Database Buffers&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 331350016 bytes
Redo Buffers&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 7942144 bytes

RMAN&gt; run {
2&gt; allocate channel d1_tape_backup DEVICE TYPE 'SBT_TAPE' PARMS 'SBT_PARMS=(OSB_WS_PFILE=/u01/app/oracle/product/11.2.0/dbhome_1/dbs/osbwsBD01.ora),SBT_LIBRARY=/u01/app/oracle/product/11.2.0/dbhome_1/lib/libosbws.so';
3&gt; set DBID 2858829824
4&gt; restore spfile from autobackup;
5&gt; release channel d1_tape_backup;
6&gt; }

using target database control file instead of recovery catalog
allocated channel: d1_tape_backup
channel d1_tape_backup: SID=396 device type=SBT_TAPE
channel d1_tape_backup: Oracle Secure Backup Web Services Library VER=3.16.7.12

executing command: SET DBID

Starting restore at 04/10/2016 10:46:13

channel d1_tape_backup: looking for AUTOBACKUP on day: 20160801
channel d1_tape_backup: AUTOBACKUP found: c-2858829824-20160801-02
channel d1_tape_backup: restoring spfile from AUTOBACKUP c-2858829824-20160801-02
channel d1_tape_backup: SPFILE restore from AUTOBACKUP complete
Finished restore at 04/10/2016 10:49:07

released channel: d1_tape_backup

RMAN&gt; shutdown immediate

Oracle instance shut down

RMAN&gt; startup nomount

connected to target database (not started)
Oracle instance started

Total System Global Area&nbsp;&nbsp;&nbsp;&nbsp; 730714112 bytes

Fixed Size&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2231952 bytes
Variable Size&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 205521264 bytes
Database Buffers&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 515899392 bytes
Redo Buffers&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 7061504 bytes

RMAN&gt; show all;

RMAN configuration parameters for database with db_unique_name BD01 are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
CONFIGURE BACKUP OPTIMIZATION OFF; # default
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP OFF; # 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 ARCHIVELOG DELETION POLICY TO NONE; # default

RMAN&gt; run {
2&gt; allocate channel d1_tape_backup DEVICE TYPE 'SBT_TAPE' PARMS 'SBT_PARMS=(OSB_WS_PFILE=/u01/app/oracle/product/11.2.0/dbhome_1/dbs/osbwsBD01.ora),SBT_LIBRARY=/u01/app/oracle/product/11.2.0/dbhome_1/lib/libosbws.so';
3&gt; set DBID 2858829824
4&gt; restore controlfile from autobackup;
5&gt; release channel d1_tape_backup;
6&gt; }

allocated channel: d1_tape_backup
channel d1_tape_backup: SID=96 device type=SBT_TAPE
channel d1_tape_backup: Oracle Secure Backup Web Services Library VER=3.16.7.12

executing command: SET DBID

Starting restore at 04/10/2016 10:53:20

channel d1_tape_backup: looking for AUTOBACKUP on day: 20160801
channel d1_tape_backup: AUTOBACKUP found: c-2858829824-20160801-02
channel d1_tape_backup: restoring control file from AUTOBACKUP c-2858829824-20160801-02
channel d1_tape_backup: control file restore from AUTOBACKUP complete
output file name=/u01/oradata/BD01/control01.ctl
output file name=/u01/oradata/BD01/control02.ctl
Finished restore at 04/10/2016 10:56:25

released channel: d1_tape_backup

RMAN&gt; alter database mount;

database mounted

RMAN&gt; restore database;

Starting restore at 04/10/2016 10:59:56
Starting implicit crosscheck backup at 04/10/2016 10:59:56
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=96 device type=DISK
Finished implicit crosscheck backup at 04/10/2016 10:59:56

Starting implicit crosscheck copy at 04/10/2016 10:59:56
using channel ORA_DISK_1
Finished implicit crosscheck copy at 04/10/2016 10:59:56

searching for all files in the recovery area
cataloging files...
cataloging done

List of Cataloged Files
=======================
File Name: /u01/flash_recovery_area/BD01/archivelog/2016_10_04/o1_mf_1_39_csz3zwqn_.arc
File Name: /u01/flash_recovery_area/BD01/autobackup/2016_10_04/o1_mf_s_918747652_csz5xnol_.bkp
File Name: /u01/flash_recovery_area/BD01/autobackup/2016_10_04/o1_mf_s_918745687_csz407xh_.bkp

using channel ORA_DISK_1
allocated channel: ORA_SBT_TAPE_1
channel ORA_SBT_TAPE_1: SID=127 device type=SBT_TAPE
channel ORA_SBT_TAPE_1: Oracle Secure Backup Web Services Library VER=3.16.7.12

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 00001 to /u01/oradata/BD01/system01.dbf
channel ORA_SBT_TAPE_1: restoring datafile 00002 to /u01/oradata/BD01/sysaux01.dbf
channel ORA_SBT_TAPE_1: restoring datafile 00003 to /u01/oradata/BD01/undotbs01.dbf
channel ORA_SBT_TAPE_1: restoring datafile 00004 to /u01/oradata/BD01/users01.dbf
channel ORA_SBT_TAPE_1: reading from backup piece 02rc5mvi_1_1
channel ORA_SBT_TAPE_1: piece handle=02rc5mvi_1_1 tag=LEVEL-0
channel ORA_SBT_TAPE_1: restored backup piece 1
channel ORA_SBT_TAPE_1: restore complete, elapsed time: 00:01:55
Finished restore at 04/10/2016 11:01:55

RMAN&gt; recover database;

Starting recover at 04/10/2016 11:02:04
using channel ORA_DISK_1
using channel ORA_SBT_TAPE_1
channel ORA_SBT_TAPE_1: starting incremental datafile backup set restore
channel ORA_SBT_TAPE_1: specifying datafile(s) to restore from backup set
destination for restore of datafile 00001: /u01/oradata/BD01/system01.dbf
destination for restore of datafile 00002: /u01/oradata/BD01/sysaux01.dbf
destination for restore of datafile 00003: /u01/oradata/BD01/undotbs01.dbf
destination for restore of datafile 00004: /u01/oradata/BD01/users01.dbf
channel ORA_SBT_TAPE_1: reading from backup piece 07rc5o8h_1_1
channel ORA_SBT_TAPE_1: piece handle=07rc5o8h_1_1 tag=LEVEL-1
channel ORA_SBT_TAPE_1: restored backup piece 1
channel ORA_SBT_TAPE_1: restore complete, elapsed time: 00:00:15
channel ORA_SBT_TAPE_1: starting incremental datafile backup set restore
channel ORA_SBT_TAPE_1: specifying datafile(s) to restore from backup set
destination for restore of datafile 00001: /u01/oradata/BD01/system01.dbf
destination for restore of datafile 00002: /u01/oradata/BD01/sysaux01.dbf
destination for restore of datafile 00003: /u01/oradata/BD01/undotbs01.dbf
destination for restore of datafile 00004: /u01/oradata/BD01/users01.dbf
channel ORA_SBT_TAPE_1: reading from backup piece 0crc5pad_1_1
channel ORA_SBT_TAPE_1: piece handle=0crc5pad_1_1 tag=LEVEL-1
channel ORA_SBT_TAPE_1: restored backup piece 1
channel ORA_SBT_TAPE_1: restore complete, elapsed time: 00:00:07

starting media recovery

archived log for thread 1 with sequence 38 is already on disk as file /u01/flash_recovery_area/BD01/archivelog/2016_10_04/o1_mf_1_38_csz0s6qq_.arc
archived log for thread 1 with sequence 39 is already on disk as file /u01/flash_recovery_area/BD01/archivelog/2016_10_04/o1_mf_1_39_csz3zwqn_.arc
archived log file name=/u01/flash_recovery_area/BD01/archivelog/2016_10_04/o1_mf_1_38_csz0s6qq_.arc thread=1 sequence=38
archived log file name=/u01/flash_recovery_area/BD01/archivelog/2016_10_04/o1_mf_1_39_csz3zwqn_.arc thread=1 sequence=39
media recovery complete, elapsed time: 00:00:00
Finished recover at 04/10/2016 11:02:30

RMAN&gt; alter database open resetlogs;

database opened



 Caso precise fazer um backup de toda a Flash Recovery Area para o S3 usando o RMAN, bastará utilizar um comando conforme exemplo a seguir.

run {
&nbsp;allocate channel d1_tape_backup DEVICE TYPE 'SBT_TAPE' PARMS 'SBT_PARMS=(OSB_WS_PFILE=/u01/app/oracle/product/11.2.0/dbhome_1/dbs/osbwsBD01.ora),SBT_LIBRARY=/u01/app/oracle/product/11.2.0/dbhome_1/lib/libosbws.so';
&nbsp;backup recovery area;
&nbsp;release channel d1_tape_backup;
&nbsp;}



 Para apagar os arquivos do S3 diretamente pelo RMAN, basta utilizar o comando abaixo.

run {
 allocate channel d1_tape_backup DEVICE TYPE 'SBT_TAPE' PARMS 'SBT_PARMS=(OSB_WS_PFILE=/u01/app/oracle/product/11.2.0/dbhome_1/dbs/osbwsBD01.ora),SBT_LIBRARY=/u01/app/oracle/product/11.2.0/dbhome_1/lib/libosbws.so';
 delete backup device type sbt_tape;
}