Oracle RMAN Backup to FlashBlade Object Store using the S3 API
Backup of an Oracle database to Amazon S3 using Oracle Recovery Manager (RMAN) has been available for many years now. Pure Storage's FlashBlade™ is the ideal destination for Oracle database backups thanks to its fast backup and restore capabilities. It is common to set up NFS filesystem mounts on the FlashBlade as a RMAN target but increasingly customers are using the FlashBlade's Object Store as a destination for RMAN backups using the S3 API.
This article goes through the steps required for setting up FlashBlade Object Store as an RMAN target using Oracle Secure Backup Cloud Module for Amazon S3. Please note that Oracle Secure Backup needs a separate license from Oracle.
Object Store configuration on the FlashBlade.
Create User
The first step is to create an account on the FlashBlade. Log in to the FlashBlade GUI and go to Storage -> Object Store. On the Accounts panel, click on the plus icon to bring up the Create Account dialog. Enter a name for the account.
After the account is created, click on it to drill down into its details page. On the Users panel, click on the plus icon to bring up the Create User dialog. Specify a User Name and click on Create.
The user gets created and it automatically opens the next dialog - Add Access Policies to user. Select the required permissions for this user and click on the Add button.
After the access policies are added, the Add Access Key to user dialog shows up.
Make sure to save the Access Key ID and the Secret Access Key. This will be required to connect to the S3 bucket.
Create Bucket
Oracle Secure Backup (OSB) configuration
Create OSB wallet directory
[oracle@sn1-r720-e03-03 dbs]$ cd /u01/app/oracle/product/19.0.0/dbhome_1/dbs [oracle@sn1-r720-e03-03 dbs]$ mkdir osbws_wallet
Download OSB jar file
Download osbws_installer.zip
Download Oracle Secure Backup Cloud Module for Amazon S3 from this link.
Unzip osbws_installer.zip. It will create a jar file osbws_install.jar and a readme file.
Create a file osbws_install.sh with the following contents. Replace AWSID and AWSKey with the Access Key ID and Secret Access Key values saved earlier.
#!/bin/bash export AWSID=<AWS ID> export AWSKey=<AWS Secret Key> java -jar osbws_install.jar -AWSID ${AWSID} -AWSKey ${AWSKey} -walletDir ${ORACLE_HOME}/dbs/osbws_wallet -libDir $ORACLE_HOME/lib \ -awsEndpoint 10.21.236.80 -location on-prem -no-import-certificate -debug
Here is how the output of the script looks like.
[oracle@sn1-r720-e03-03 ~]$ sh osbws_install.sh Oracle Secure Backup Web Service Install Tool, build 12.2.0.1.0DBBKPCSBP_2018-06-12 Debug: os.name = Linux Debug: os.arch = amd64 Debug: os.version = 4.1.12-124.36.1.el7uek.x86_64 Debug: file.separator = / Debug: Platform = PLATFORM_LINUX64 Debug: Verifying AWS account using endpoint 10.21.236.80 Debug: Canoical Request: GET / host:10.21.236.80 x-amz-content-sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 x-amz-date:20210921T040405Z host;x-amz-content-sha256;x-amz-date e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 Debug: String to sign: AWS4-HMAC-SHA256 20210921T040405Z 20210921/ora-backup/s3/aws4_request ea26e43bb5b314413f88d697cd29180b8e72a3bed61989edb027dbeec546096c Debug: AWS Success, owner=DefaultDisplayName, id=DefaultID AWS credentials are valid. Oracle Secure Backup Web Service wallet created in directory /u01/app/oracle/product/19.0.0/dbhome_1/dbs/osbws_wallet. Oracle Secure Backup Web Service initialization file /u01/app/oracle/product/19.0.0/dbhome_1/dbs/osbwsoraprd12.ora created. Downloading Oracle Secure Backup Web Service Software Library from file osbws_linux64.zip. Debug: Temp zip file = /tmp/osbws_linux645454337241817877817.zip Debug: Downloaded 27721116 bytes in 6 seconds. Debug: Transfer rate was 4620186 bytes/second. Download complete. Debug: Delete RC = true
A file osbws<ORACLE_SID>.ora will get created in $ORACLE_HOME/dbs. Make sure it has the following contents.
OSB_WS_HOST=http://10.21.236.80
OSB_WS_BUCKET=oracle-bucket
OSB_WS_LOCATION=on-prem
OSB_WS_VIRTUAL_HOST=FALSE
OSB_WS_WALLET='location=file:/u01/app/oracle/product/19.0.0/dbhome_1/dbs/osbws_wallet CREDENTIAL_ALIAS=defaultd_aws'
OSB_WS_LOCATION should be set to the keyword on-prem.
OSB_WS_HOST should be set to the S3 Data VIP, not the management address.
With this the configuration is complete and is ready for RMAN execution.
RMAN Execution
We can now go ahead and run RMAN. Please note that the device type for RMAN will need to be set to sbt.
Here is a sample RMAN Backup script using AWS S3 API.
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default CONFIGURE BACKUP OPTIMIZATION OFF; # default CONFIGURE CONTROLFILE AUTOBACKUP ON; # default CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # 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 '/u01/app/oracle/product/19.0.0/dbhome_1/dbs/snapcf_oraprd12.f'; # default CONFIGURE DEVICE TYPE DISK PARALLELISM 8 BACKUP TYPE TO BACKUPSET; # default run { allocate channel c1 device type sbt parms='SBT_LIBRARY=/u01/app/oracle/product/19.0.0/dbhome_1/lib/libosbws.so,SBT_PARMS=(OSB_WS_PFILE=/u01/app/oracle/product/19.0.0/dbhome_1/dbs/osbwsoraprd12.ora)'; allocate channel c2 device type sbt parms='SBT_LIBRARY=/u01/app/oracle/product/19.0.0/dbhome_1/lib/libosbws.so,SBT_PARMS=(OSB_WS_PFILE=/u01/app/oracle/product/19.0.0/dbhome_1/dbs/osbwsoraprd12.ora)'; allocate channel c3 device type sbt parms='SBT_LIBRARY=/u01/app/oracle/product/19.0.0/dbhome_1/lib/libosbws.so,SBT_PARMS=(OSB_WS_PFILE=/u01/app/oracle/product/19.0.0/dbhome_1/dbs/osbwsoraprd12.ora)'; allocate channel c4 device type sbt parms='SBT_LIBRARY=/u01/app/oracle/product/19.0.0/dbhome_1/lib/libosbws.so,SBT_PARMS=(OSB_WS_PFILE=/u01/app/oracle/product/19.0.0/dbhome_1/dbs/osbwsoraprd12.ora)'; allocate channel c5 device type sbt parms='SBT_LIBRARY=/u01/app/oracle/product/19.0.0/dbhome_1/lib/libosbws.so,SBT_PARMS=(OSB_WS_PFILE=/u01/app/oracle/product/19.0.0/dbhome_1/dbs/osbwsoraprd12.ora)'; allocate channel c6 device type sbt parms='SBT_LIBRARY=/u01/app/oracle/product/19.0.0/dbhome_1/lib/libosbws.so,SBT_PARMS=(OSB_WS_PFILE=/u01/app/oracle/product/19.0.0/dbhome_1/dbs/osbwsoraprd12.ora)'; allocate channel c7 device type sbt parms='SBT_LIBRARY=/u01/app/oracle/product/19.0.0/dbhome_1/lib/libosbws.so,SBT_PARMS=(OSB_WS_PFILE=/u01/app/oracle/product/19.0.0/dbhome_1/dbs/osbwsoraprd12.ora)'; allocate channel c8 device type sbt parms='SBT_LIBRARY=/u01/app/oracle/product/19.0.0/dbhome_1/lib/libosbws.so,SBT_PARMS=(OSB_WS_PFILE=/u01/app/oracle/product/19.0.0/dbhome_1/dbs/osbwsoraprd12.ora)'; backup database section size = 512M TAG backup_s3_110; }
And here is a sample RMAN Restore script
run { select to_char(sysdate,'dd-Mon hh24:mi') "Restore Start TS" from dual; allocate channel c1 device type sbt parms='SBT_LIBRARY=/u01/app/oracle/product/19.0.0/dbhome_1/lib/libosbws.so,SBT_PARMS=(OSB_WS_PFILE=/u01/app/oracle/product/19.0.0/dbhome_1/dbs/osbwsoraprd12.ora)'; allocate channel c2 device type sbt parms='SBT_LIBRARY=/u01/app/oracle/product/19.0.0/dbhome_1/lib/libosbws.so,SBT_PARMS=(OSB_WS_PFILE=/u01/app/oracle/product/19.0.0/dbhome_1/dbs/osbwsoraprd12.ora)'; allocate channel c3 device type sbt parms='SBT_LIBRARY=/u01/app/oracle/product/19.0.0/dbhome_1/lib/libosbws.so,SBT_PARMS=(OSB_WS_PFILE=/u01/app/oracle/product/19.0.0/dbhome_1/dbs/osbwsoraprd12.ora)'; allocate channel c4 device type sbt parms='SBT_LIBRARY=/u01/app/oracle/product/19.0.0/dbhome_1/lib/libosbws.so,SBT_PARMS=(OSB_WS_PFILE=/u01/app/oracle/product/19.0.0/dbhome_1/dbs/osbwsoraprd12.ora)'; allocate channel c5 device type sbt parms='SBT_LIBRARY=/u01/app/oracle/product/19.0.0/dbhome_1/lib/libosbws.so,SBT_PARMS=(OSB_WS_PFILE=/u01/app/oracle/product/19.0.0/dbhome_1/dbs/osbwsoraprd12.ora)'; allocate channel c6 device type sbt parms='SBT_LIBRARY=/u01/app/oracle/product/19.0.0/dbhome_1/lib/libosbws.so,SBT_PARMS=(OSB_WS_PFILE=/u01/app/oracle/product/19.0.0/dbhome_1/dbs/osbwsoraprd12.ora)'; allocate channel c7 device type sbt parms='SBT_LIBRARY=/u01/app/oracle/product/19.0.0/dbhome_1/lib/libosbws.so,SBT_PARMS=(OSB_WS_PFILE=/u01/app/oracle/product/19.0.0/dbhome_1/dbs/osbwsoraprd12.ora)'; allocate channel c8 device type sbt parms='SBT_LIBRARY=/u01/app/oracle/product/19.0.0/dbhome_1/lib/libosbws.so,SBT_PARMS=(OSB_WS_PFILE=/u01/app/oracle/product/19.0.0/dbhome_1/dbs/osbwsoraprd12.ora)'; restore database; select to_char(sysdate,'dd-Mon hh24:mi') "Restore End TS" from dual; recover database; select to_char(sysdate,'dd-Mon hh24:mi') "Recover End TS" from dual; alter database open; select to_char(sysdate,'dd-Mon hh24:mi') from dual; }
Note that if your system has the resources, the number of channels can be increased further for achieving better performance.