ON CALL DBA SUPPORT

— Database blog

Taking Oracle 12 c R1 Database backup to AWS cloud S3

Posted by ssgottik on 08/01/2018

STEP 01 : CREATE THE REQUIRED DIRECTORIES AND DOWNLOAD THE OSBWS (Oracle Secure Backup Cloud Module) from below URL :

http://www.oracle.com/technetwork/products/secure-backup/secure-backup-s3-484709.html

[oracle@vmlinux1 ~]$ cd /u01/app/oracle
[oracle@vmlinux1 oracle]$ mkdir -p software/osbws

copy the downloaded OSBWS software zip file to the above location :

[oracle@vmlinux1 osbws]$ ls -ltr
total 2668
-rwxrw-rw- 1 oracle oinstall 2728797 Jan 7 13:30 osbws_installer.zip

Unzip the downloaded zip file

[oracle@vmlinux1 osbws]$unzip osbws_installer.zip

[oracle@vmlinux1 osbws]$ ls -ltr
total 5484
-rw-r–r– 1 oracle oinstall 11298 Sep 1 20:27 osbws_readme.txt
-rw-r–r– 1 oracle oinstall 2867360 Nov 28 00:03 osbws_install.jar
-rwxrw-rw- 1 oracle oinstall 2728797 Jan 7 13:30 osbws_installer.zip

STEP 02: Create directory for the secure Oracle wallet. The Oracle wallet will be created by the OSBWS INSTALLER and used to store your AWS S3 credentials.

[oracle@vmlinux1 osbws]$ . oraenv
ORACLE_SID = [orcl] ?
The Oracle base remains unchanged with value /u01/app/oracle
[oracle@vmlinux1 osbws]$ mkdir -p $ORACLE_HOME/dbs/osbws_wallet

STEP 03 : INSTALL ORACLE SECURE BACKUP CLOUD MODULE for S3

You need to have AWS account SID and KEY , along with that you need to have OTN username and password

Create a script that will invoke the OSB Cloud Module for Amazon S3 installer and provide all the inputs

[oracle@vmlinux1 osbws]$ pwd
/u01/app/oracle/software/osbws
[oracle@vmlinux1 osbws]$ vi osbws_install.sh
java -jar osbws_install.jar \
-AWSID ********************************** \
-AWSKey *******************************************************\
-otnUser ********@gmail.com \
-otnPass ************ \
-walletDir $ORACLE_HOME/dbs/osbws_wallet \
-libDir $ORACLE_HOME/lib \
-configFile $ORACLE_HOME/dbs/osbwsorcl.ora

[oracle@vmlinux1 osbws]$ chmod +x osbws_install.sh
[oracle@vmlinux1 osbws]$ ./osbws_install.sh
Oracle Secure Backup Web Service Install Tool, build 12.2.0.1.0DBBKPCSBP_2017-11-28
AWS credentials are valid.
Oracle Secure Backup Web Service wallet created in directory /u01/app/oracle/product/12.1.0/dbhome_1/dbs/osbws_wallet.
Oracle Secure Backup Web Service initialization file /u01/app/oracle/product/12.1.0/dbhome_1/dbs/osbwsorcl.ora created.
Downloading Oracle Secure Backup Web Service Software Library from file osbws_linux64.zip.
Download complete.

STEP 04 : MODIFY RMAN CONFIGURATION

Manually create the following symbolic link for the default media management library before performing backups using the SBT interface.

ln -s $ORACLE_HOME/lib/libosbws.so $ORACLE_HOME/lib/libobk.so

[oracle@vmlinux1 lib]$ rman target /

Recovery Manager: Release 12.1.0.2.0 – Production on Sun Jan 7 22:15:28 2018

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

connected to target database: ORCL (DBID=1492211347)

RMAN> configure channel device type sbt parms
2> ‘SBT_LIBRARY=/u01/app/oracle/product/12.1.0/dbhome_1/lib/libosbws.so SBT_PARMS=(OSB_WS_PFILE=/u01/app/oracle/product/12.1.0/dbhome_1/dbs/osbwsorcl.ora)’;

using target database control file instead of recovery catalog
old RMAN configuration parameters:
CONFIGURE CHANNEL DEVICE TYPE ‘SBT_TAPE’ PARMS ‘SBT_LIBRARY=/u01/app/oracle/product/12.1.0/dbhome_1/lib/libosbws12.so SBT_PARMS=(OSB_WS_PFILE=/u01/app/oracle/product/12.1.0/dbhome_1/dbs/osbwsorcl.ora)’;
new RMAN configuration parameters:
CONFIGURE CHANNEL DEVICE TYPE ‘SBT_TAPE’ PARMS ‘SBT_LIBRARY=/u01/app/oracle/product/12.1.0/dbhome_1/lib/libosbws.so SBT_PARMS=(OSB_WS_PFILE=/u01/app/oracle/product/12.1.0/dbhome_1/dbs/osbwsorcl.ora)’;
new RMAN configuration parameters are successfully stored

STEP 05 : TEST MEDIA MANAGEMENT SOFTWARE

[oracle@vmlinux1 osbws]$ sbttest osbws_readme.txt -dbname orcl
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 12.2.0.1
sbtinit: Media manager supports SBT API version 2.0
sbtinit: allocated sbt context area of 1072 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/oracle-data-gsssat-1
— sbtinfo2 succeeded
— sbtrestore succeeded
file was created by this program:
seed=431998581, blk_size=16384, blk_count=100
read 100 buffers
— sbtread2 succeeded
— sbtclose2 succeeded
— sbtremove2 succeeded
— regular_backup_restore ends …………………………..
— sbtcommand succeeded
proxy copy is not supported
— sbtend succeeded
*** The SBT API test was successful ***
[oracle@vmlinux1 osbws]$

STEP 06: PERFORMA ORACLE DATABASE BACKUP TO AWS CLOUD

Note : To secure the backup in the cloud encrypt the backup before taking the backup :

RMAN > set encryption on for all tablespaces algorithm ‘*******’ identified by myPassword only;

[oracle@vmlinux1 scripts]$ cat rman_testdb1.cmd
run {
allocate channel ch1 type sbt;
allocate channel ch2 type sbt;
allocate channel ch3 type sbt;
allocate channel ch4 type sbt;

backup as compressed backupset database;
sql ‘alter system archive log current’;
backup as compressed backupset archivelog all not backed up;
backup current controlfile;

release channel ch1;
release channel ch2;
release channel ch3;
release channel ch4;
}

[oracle@vmlinux1 scripts]$ rman target /

Recovery Manager: Release 12.1.0.2.0 – Production on Sun Jan 7 22:41:39 2018

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

connected to target database: ORCL (DBID=1492211347)

RMAN> @rman_testdb1.cmd

RMAN> run {
2> allocate channel ch1 type sbt;
3> allocate channel ch2 type sbt;
4> allocate channel ch3 type sbt;
5> allocate channel ch4 type sbt;
6>
7> backup as compressed backupset database;
8> sql ‘alter system archive log current’;
9> backup as compressed backupset archivelog all not backed up;
10> backup current controlfile;
11>
12> release channel ch1;
13> release channel ch2;
14> release channel ch3;
15> release channel ch4;
16> }
using target database control file instead of recovery catalog
allocated channel: ch1
channel ch1: SID=56 device type=SBT_TAPE
channel ch1: Oracle Secure Backup Web Services Library VER=12.2.0.1

allocated channel: ch2
channel ch2: SID=50 device type=SBT_TAPE
channel ch2: Oracle Secure Backup Web Services Library VER=12.2.0.1

allocated channel: ch3
channel ch3: SID=61 device type=SBT_TAPE
channel ch3: Oracle Secure Backup Web Services Library VER=12.2.0.1

allocated channel: ch4
channel ch4: SID=62 device type=SBT_TAPE
channel ch4: Oracle Secure Backup Web Services Library VER=12.2.0.1

Starting backup at 07-JAN-18
channel ch1: starting compressed full datafile backup set
channel ch1: specifying datafile(s) in backup set
input datafile file number=00001 name=+DATA/ORCL/DATAFILE/system.258.964430517
channel ch1: starting piece 1 at 07-JAN-18
channel ch2: starting compressed full datafile backup set
channel ch2: specifying datafile(s) in backup set
input datafile file number=00003 name=+DATA/ORCL/DATAFILE/sysaux.257.964430481
channel ch2: starting piece 1 at 07-JAN-18
channel ch3: starting compressed full datafile backup set
channel ch3: specifying datafile(s) in backup set
input datafile file number=00009 name=+DATA/ORCL/61E1DCBBD0A608ECE053330948361085/DATAFILE/sysaux.271.964430891
channel ch3: starting piece 1 at 07-JAN-18
channel ch4: starting compressed full datafile backup set
channel ch4: specifying datafile(s) in backup set
input datafile file number=00007 name=+DATA/ORCL/FD9AC20F64D244D7E043B6A9E80A2F2F/DATAFILE/sysaux.266.964430619
channel ch4: starting piece 1 at 07-JAN-18
channel ch4: finished piece 1 at 07-JAN-18
piece handle=04so431g_1_1 tag=TAG20180107T224151 comment=API Version 2.0,MMS Version 12.2.0.1
channel ch4: backup set complete, elapsed time: 00:10:35
channel ch4: starting compressed full datafile backup set
channel ch4: specifying datafile(s) in backup set
input datafile file number=00005 name=+DATA/ORCL/FD9AC20F64D244D7E043B6A9E80A2F2F/DATAFILE/system.267.964430619
channel ch4: starting piece 1 at 07-JAN-18
channel ch3: finished piece 1 at 07-JAN-18
piece handle=03so431g_1_1 tag=TAG20180107T224151 comment=API Version 2.0,MMS Version 12.2.0.1
channel ch3: backup set complete, elapsed time: 00:11:00
channel ch3: starting compressed full datafile backup set
channel ch3: specifying datafile(s) in backup set
input datafile file number=00008 name=+DATA/ORCL/61E1DCBBD0A608ECE053330948361085/DATAFILE/system.270.964430891
channel ch3: starting piece 1 at 07-JAN-18
channel ch2: finished piece 1 at 07-JAN-18
piece handle=02so431g_1_1 tag=TAG20180107T224151 comment=API Version 2.0,MMS Version 12.2.0.1
channel ch2: backup set complete, elapsed time: 00:11:36
channel ch2: starting compressed full datafile backup set
channel ch2: specifying datafile(s) in backup set
input datafile file number=00004 name=+DATA/ORCL/DATAFILE/undotbs1.260.964430563
channel ch2: starting piece 1 at 07-JAN-18
channel ch2: finished piece 1 at 07-JAN-18
piece handle=07so43n8_1_1 tag=TAG20180107T224151 comment=API Version 2.0,MMS Version 12.2.0.1
channel ch2: backup set complete, elapsed time: 00:00:25
channel ch2: starting compressed full datafile backup set
channel ch2: specifying datafile(s) in backup set
input datafile file number=00006 name=+DATA/ORCL/DATAFILE/users.259.964430563
channel ch2: starting piece 1 at 07-JAN-18
channel ch2: finished piece 1 at 07-JAN-18
piece handle=08so43o1_1_1 tag=TAG20180107T224151 comment=API Version 2.0,MMS Version 12.2.0.1
channel ch2: backup set complete, elapsed time: 00:00:15
channel ch2: starting compressed full datafile backup set
channel ch2: specifying datafile(s) in backup set
input datafile file number=00010 name=+DATA/ORCL/61E1DCBBD0A608ECE053330948361085/DATAFILE/users.273.964430903
channel ch2: starting piece 1 at 07-JAN-18
channel ch2: finished piece 1 at 07-JAN-18
piece handle=09so43og_1_1 tag=TAG20180107T224151 comment=API Version 2.0,MMS Version 12.2.0.1
channel ch2: backup set complete, elapsed time: 00:00:15
channel ch4: finished piece 1 at 07-JAN-18
piece handle=05so43lb_1_1 tag=TAG20180107T224151 comment=API Version 2.0,MMS Version 12.2.0.1
channel ch4: backup set complete, elapsed time: 00:05:16
channel ch3: finished piece 1 at 07-JAN-18
piece handle=06so43m4_1_1 tag=TAG20180107T224151 comment=API Version 2.0,MMS Version 12.2.0.1
channel ch3: backup set complete, elapsed time: 00:05:21
channel ch1: finished piece 1 at 07-JAN-18
piece handle=01so431g_1_1 tag=TAG20180107T224151 comment=API Version 2.0,MMS Version 12.2.0.1
channel ch1: backup set complete, elapsed time: 00:21:11
Finished backup at 07-JAN-18

Starting Control File and SPFILE Autobackup at 07-JAN-18
piece handle=c-1492211347-20180107-00 comment=API Version 2.0,MMS Version 12.2.0.1
Finished Control File and SPFILE Autobackup at 07-JAN-18

sql statement: alter system archive log current

Starting backup at 07-JAN-18
current log archived
channel ch1: starting compressed archived log backup set
channel ch1: specifying archived log(s) in backup set
input archived log thread=1 sequence=16 RECID=1 STAMP=964825499
channel ch1: starting piece 1 at 07-JAN-18
channel ch2: starting compressed archived log backup set
channel ch2: specifying archived log(s) in backup set
input archived log thread=1 sequence=17 RECID=2 STAMP=964825499
channel ch2: starting piece 1 at 07-JAN-18
channel ch2: finished piece 1 at 07-JAN-18
piece handle=0cso44cr_1_1 tag=TAG20180107T230459 comment=API Version 2.0,MMS Version 12.2.0.1
channel ch2: backup set complete, elapsed time: 00:00:15
channel ch1: finished piece 1 at 07-JAN-18
piece handle=0bso44cr_1_1 tag=TAG20180107T230459 comment=API Version 2.0,MMS Version 12.2.0.1
channel ch1: backup set complete, elapsed time: 00:00:36
Finished backup at 07-JAN-18

Starting backup at 07-JAN-18
channel ch1: starting full datafile backup set
channel ch1: specifying datafile(s) in backup set
including current control file in backup set
channel ch1: starting piece 1 at 07-JAN-18
channel ch1: finished piece 1 at 07-JAN-18
piece handle=0dso44dv_1_1 tag=TAG20180107T230535 comment=API Version 2.0,MMS Version 12.2.0.1
channel ch1: backup set complete, elapsed time: 00:01:45
Finished backup at 07-JAN-18

Starting Control File and SPFILE Autobackup at 07-JAN-18
piece handle=c-1492211347-20180107-01 comment=API Version 2.0,MMS Version 12.2.0.1
Finished Control File and SPFILE Autobackup at 07-JAN-18

released channel: ch1

released channel: ch2

released channel: ch3

released channel: ch4

RMAN> **end-of-file**

RMAN>

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

 
%d bloggers like this: