Oracle RMAN backup to Amazon cloud S3


After installation you can use to backup database cloud. The deposit is a replacement for tape and is available within a few hours. Of course, are determinants to backup to the cloud and depend on the size of the database, upload speed internet access and a defined geographic location. RESTORE speed is slower than from local storage, backup to the cloud is meant to replace the tape to improve our backup strategy. Amazon Web Services to use metered costs are very competitive, it does not require the licensed product and backup integrates directly with RMAN backup. This article provides a quick start to backup to the cloud with Oracle RMAN backups to AWS S3 environment using Oracle Secure Backup Cloud Module for Amazon S3 cloud service for backup.

Backing up to Amazon Web Services (AWS) S3

Backing up to the AWS Simple Storage Service - S3. Create an AWS S3 account and setup the necessary credentials.

  1. Install an AWS specific Oracle Secure Backup library into your Oracle Home (Digital Ocean droplet).
  2. Run an RMAN backup using the SBT_TAPE device type and setup SBT_TAPE.
  3. Test backup database and chceck backup in Amazon S3.

Creating new user for Amazon AWS S3

Creating an account with a security credential. In the top right corner of your AWS console navigate to “Security Credentials”:

From the “Users” option select "Create" and next "Create New Users":

Download credentials where contains "Access Key ID" and "Secret Access Key", as you’ll need this information during the setup.

Then

Setup enviroment virtual server on Digital Ocean

install JAVA on server (user root):

[root@centos-oracle-fra1-01 oracle]# yum install java-1.7.0-openjdk
...
...
...
Installed:
  java-1.7.0-openjdk.x86_64 1:1.7.0.111-2.6.7.2.0.1.el7_2

java version after install :

[root@centos-oracle-fra1-01 ~]# java -version
java version "1.7.0_111"
OpenJDK Runtime Environment (rhel-2.6.7.2.0.1.el7_2-x86_64 u111-b01)
OpenJDK 64-Bit Server VM (build 24.111-b01, mixed mode)

user oracle

su - oracle

Installing the Oracle Secure Backup Cloud Module for Amazon S3 modul

Installation Oracle Secure Backup Cloud Module for Amazon S3 is easy, modul is installed in your Oracle home. Download from OTN download an installer Java JAR file and copy and extract the zip to your database server [All Supported Platforms (2,635,099 bytes) (Requires Java version 1.7 or higher)].

Installation requires a few mandatory arguments:

The AWS credentials created previously

  1. Your OTN username (not Oracle account password)
  2. The location for the library file it will download. Usually use $ORACLE_HOME/lib
  3. The location for the secure wallet file which stores the AWS credentials

Install OSBWS

[oracle@oracle-fra ~]$ java -jar osbws_install.jar -AWSID A***Q -AWSKey l***9 -otnUser peter.bu***@webfly.*** -walletDir $ORACLE_HOME/dbs/osbws_wallet -libDir $ORACLE_HOME/lib
Oracle Secure Backup Web Service Install Tool, build 2016-09-30
AWS credentials are valid.
Oracle Secure Backup Web Service wallet created in directory /u01/app/oracle/product/12.1.0/db_1/dbs/osbws_wallet.
Oracle Secure Backup Web Service initialization file /u01/app/oracle/product/12.1.0/db_1/dbs/osbwswebfly01.ora created.
Downloading Oracle Secure Backup Web Service Software Library from file osbws_linux64.zip.
Downloaded 26528347 bytes in 2 seconds. Transfer rate was 13264173 bytes/second.
Download complete.
[oracle@oracle-fra ~]$ ls -l $ORACLE_HOME/dbs/osbws_wallet
total 4
-rw------- 1 oracle oinstall 1613 Oct 11 10:50 cwallet.sso
-rw------- 1 oracle oinstall    0 Oct 10 18:12 cwallet.sso.lck

Setup RMAN od Digital Ocean droplet

Sending the RMAN backup pieces to the AWS S3 storage is as simple as backing to the SBT_TAPE device. For example, backup tablespace user and then backup database.

[oracle@centos-oracle-fra1-01 ~]$ rman 
[oracle@centos-oracle-fra1-01 ~]$ connect target /
Recovery Manager: Release 12.1.0.2.0 - Production on Tue Oct 11 10:43:41 2016
Copyright (c) 1982, 2014, Oracle and/or its affiliates.  All rights reserved.

connected to target database: WEBFLY01 (DBID=3271592580)
RMAN>  run {
2> allocate channel aws_s3 type sbt
3> parms='SBT_LIBRARY=libosbws.so,SBT_PARMS=
4> (OSB_WS_PFILE=/u01/app/oracle/product/12.1.0/db_1/dbs/osbwswebfly01.ora)';
5> backup tablespace users;
6> }
using target database control file instead of recovery catalog
allocated channel: aws_s3
channel aws_s3: SID=38 device type=SBT_TAPE
channel aws_s3: Oracle Secure Backup Web Services Library VER=3.16.9.21

Starting backup at 11-OCT-16
channel aws_s3: starting full datafile backup set
channel aws_s3: specifying datafile(s) in backup set
input datafile file number=00006 name=/u01/app/oracle/oradata/webfly01/users01.dbf
channel aws_s3: starting piece 1 at 11-OCT-16
channel aws_s3: finished piece 1 at 11-OCT-16
piece handle=02ri392q_1_1 tag=TAG20161011T110042 comment=API Version 2.0,MMS Version 3.16.9.21
channel aws_s3: backup set complete, elapsed time: 00:00:07
Finished backup at 11-OCT-16
released channel: aws_s3

List backup:

RMAN> list backup of tablespace users;

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

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
1       Full    1.75M      SBT_TAPE    00:00:03     11-OCT-16
        BP Key: 1   Status: AVAILABLE  Compressed: NO  Tag: TAG20161011T110042
        Handle: 02ri392q_1_1   Media: s3.amazonaws.com/oracle-data-peterbuc-1
  List of Datafiles in backup set 1
  File LV Type Ckp SCN    Ckp Time  Name
  ---- -- ---- ---------- --------- ----
  6       Full 1701181    11-OCT-16 /u01/app/oracle/oradata/webfly01/users01.dbf
RMAN> list backup summary;

List of Backups
===============
Key     TY LV S Device Type Completion Time #Pieces #Copies Compressed Tag
------- -- -- - ----------- --------------- ------- ------- ---------- ---
1       B  F  A SBT_TAPE    11-OCT-16       1       1       NO         TAG20161011T110042
RMAN> configure channel device type sbt parms='SBT_LIBRARY=libosbws.so, SBT_PARMS=(OSB_WS_PFILE=/u01/app/oracle/product/12.1.0/db_1/dbs/osbwswebfly01.ora)';

new RMAN configuration parameters:
CONFIGURE CHANNEL DEVICE TYPE 'SBT_TAPE' PARMS  'SBT_LIBRARY=libosbws.so, SBT_PARMS=(OSB_WS_PFILE=/u01/app/oracle/product/12.1.0/db_1/dbs/osbwswebfly01.ora)';
new RMAN configuration parameters are successfully stored

Backup full database with SBT device (Amazon AWS S3)

RMAN> backup device type sbt database;
Starting backup at 11-OCT-16
allocated channel: ORA_SBT_TAPE_1
channel ORA_SBT_TAPE_1: SID=38 device type=SBT_TAPE
channel ORA_SBT_TAPE_1: Oracle Secure Backup Web Services Library VER=3.16.9.21
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=00001 name=/u01/app/oracle/oradata/webfly01/system01.dbf
input datafile file number=00003 name=/u01/app/oracle/oradata/webfly01/sysaux01.dbf
input datafile file number=00004 name=/u01/app/oracle/oradata/webfly01/undotbs01.dbf
input datafile file number=00006 name=/u01/app/oracle/oradata/webfly01/users01.dbf
channel ORA_SBT_TAPE_1: starting piece 1 at 11-OCT-16
channel ORA_SBT_TAPE_1: finished piece 1 at 11-OCT-16
piece handle=03ri39j3_1_1 tag=TAG20161011T110923 comment=API Version 2.0,MMS Version 3.16.9.21
channel ORA_SBT_TAPE_1: backup set complete, elapsed time: 00:01:26
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
including current SPFILE in backup set
channel ORA_SBT_TAPE_1: starting piece 1 at 11-OCT-16
channel ORA_SBT_TAPE_1: finished piece 1 at 11-OCT-16
piece handle=04ri39lp_1_1 tag=TAG20161011T110923 comment=API Version 2.0,MMS Version 3.16.9.21
channel ORA_SBT_TAPE_1: backup set complete, elapsed time: 00:00:07
Finished backup at 11-OCT-16
RMAN> list backup summary;

List of Backups
===============
Key     TY LV S Device Type Completion Time #Pieces #Copies Compressed Tag
------- -- -- - ----------- --------------- ------- ------- ---------- ---
1       B  F  A SBT_TAPE    11-OCT-16       1       1       NO         TAG20161011T110042
2       B  F  A SBT_TAPE    11-OCT-16       1       1       NO         TAG20161011T110923
3       B  F  A SBT_TAPE    11-OCT-16       1       1       NO         TAG20161011T110923

Backup - nestast

[root@coracle-fra ~]# netstat | grep http
tcp        0      0 centos-oracle-fra:19348 s3-1-w.amazonaws.c:http TIME_WAIT
tcp        0      0 centos-oracle-fra:29308 s3-1-w.amazonaws.c:http TIME_WAIT
tcp        0 658996 centos-oracle-fra:18841 s3-1-w.amazonaws.c:http ESTABLISHED

List AWS S3: /oracle-data-peter***/file_chunk/3271592580/WEBFLY01/backuppiece/2016-10-11/03ri39j3_1_1/KTVs8w9V0wwD

Posted in Databázy, RMAN on okt 11, 2016