Friday, April 17, 2015

Rdbms -- Oracle Cloud Backup Service

Recently tested and verified Oracle Cloud backup for an EBS 12.2 environment.
In this work, we have seen that, the Cloud backup is required to be encrypted and it is heavily dependent on the network speed..
Other than these, it uses rman and can use its option like compression.. Using the compression makes cloud backup faster as it requires less data to flow between the machines.

In our tests, we have used a 10Mbit network and we could backup an EBS 12.2 database, which was 138gb in size in 9 hours. It required a long time, altough  we have used compression too.
Ofcourse, the required time for backing up database can be decreased using an incremental backup methodology.. You can take a level 0 backup once a week, and continue with the level 1 backups during the other days..

The list of the cloud backup features;
  • Unlimited Oracle Database backups
  • Automatic three-way data mirroring
  • Regional data isolation
  • Transparent access via Oracle Database Cloud Backup Module and Recovery Manager (RMAN)
  • RMAN encryption and compression
  • Note that: Trial account is limited to 10gbytes.
To start the process , you first need to register to the Oracle Cloud  Database Backup Service with your oracle account. After your confirmation , you receive an email with contains a password.(you use this password in the java command below)
Once you receive the password, you can follow the instructions below..
In general , the action plan consists of ; downloading opc_install.jar, creating required directories, executing java command to download the required files; preparing rman scripts and running those rman scripts.
Check for the details : http://docs.oracle.com/cloud/latest/dbbackup_gs/CSDBB/GUID-4E945356-F5B6-4267-8D33-ADB4C1D5413C.htm

Here is an real life deployment example:

· Before Installation use below queries to see how long will backup taken
· You can also check previous rman backups to see how backup is compress and time to taken for backup.

Check the db size;
select round((a.data_size+b.temp_size+c.redo_size+d.cont_size )/1024/1024/1024,0) "Total Size GB"
from ( select sum(bytes) data_size
from dba_data_files ) a,
( select nvl(sum(bytes),0) temp_size
from dba_temp_files ) b,
( select sum(bytes) redo_size
from sys.v_$logfile lf, sys.v_$log l
where lf.group# = l.group#) c,
( select sum(block_size*file_size_blks) cont_size
from v$controlfile ) d;


or

SELECT ROUND (SUM (used.bytes) / 1024 / 1024 / 1024) || ' GB' "Database Size",
ROUND (free.p / 1024 / 1024 / 1024) || ' GB' "Free space"
FROM (SELECT bytes FROM v$datafile
UNION ALL
SELECT bytes FROM v$tempfile
UNION ALL
SELECT bytes FROM v$log) used,
(SELECT SUM (bytes) AS p FROM dba_free_space) free
GROUP BY free.p


Check the previous Rman backups and their input , output bytes .. Just to get an idea..

SELECT start_time,
end_time,
status,
input_type,
compression_ratio,
input_bytes_display,
output_bytes_display,
time_taken_display
FROM v$rman_backup_job_details
ORDER BY session_key DESC;



1.        Create below directories and upload opc_install.jar file into the server

mkdir $ORACLE_HOME/OPC/lib
mkdir $ORACLE_HOME/OPC/wallet
mkdir $ORACLE_HOME/OPC/script >>> Optional

upload opc_install.jar to $ORACLE_HOME/OPC/

2.        Check permissions of directories, files and set require permissions
Note: To make sure I set chmod –R 777 for lib, wallet and script folders.. ( we used 777 here.. It was just a test instance)

> ll
drwxrwxrwx. 2 oracle oinstall    4096 Mar 30 18:47 lib
-rwxrwxrwx. 1 oracle oinstall 2576642 Sep  4  2014 opc_install.jar
drwxr-xr-x. 2 oracle oinstall    4096 Mar 30 18:49 script
drwxrwxrwx. 2 oracle oinstall    4096 Mar 30 18:47 wallet

3.       Use below java to download lib, wallet and ora files

Usage: java -jar opc_install.jar -serviceName hr -identityDomain abc -opcid joe@abc.com -opcPass 'Oracle$1' -libDir $ORACLE_HOME/lib -walletDir $ORACLE_HOME/dbs/opc_wallet

-- Supply the arguments according to your cloud account. For example serviceName, identityDomain, opcPass and etc.. (you will receive these details after registration.. They will be provided via an email from Oracle)

java -jar opc_install.jar -serviceName shdjısjdıs6757 -identityDomain yuıshfıshfuıos74 -opcId blabla@blala.com -opcPass password -libDir /u01/install/PROD/11.2.0/OPC/lib -walletDir /u01/install/PROD/11.2.0/OPC/wallet

Output of the java command:
Oracle Database Cloud Backup Module Install Tool, build 2014-09-04
Oracle Database Cloud Backup Module credentials are valid.
Oracle Database Cloud Backup Module wallet created in directory /u01/install/PROD/11.2.0/OPC/wallet.
Oracle Database Cloud Backup Module initialization file /u01/install/PROD/11.2.0/dbs/opcORATEST.ora created.

Downloading Oracle Database Cloud Backup Module Software Library from file opc_linux64.zip.
Downloaded 23169388 bytes in 121 seconds. Transfer rate was 191482 bytes/second.
Download complete.

4. Create your backup scripts and configure them running as scheduled job using crontab. 
Set the schedules according to the backup duration of your system.

An example:

crontab –l

00 19 * * 5 sh /u01/install/PROD/11.2.0/OPC/script/cloudbackup_l0
00 19 * * 0,1,2,3,4 sh /u01/install/PROD/11.2.0/OPC/script/cloudbackup_l1


Script_Level0 : cloudbackup_l0

su - oracle -c "/u01/install/PROD/11.2.0/OPC/script/rman_l0.sh" > /u01/install/PROD/11.2.0/OPC/script/cloudbackup_Level0_`date +%d%m%y`.log

Script_Level0 : rman_l0.sh
               
currentdate=`date '+%d%b%Y_%H%M'`
rman target/ <<EOF
configure channel device type sbt parms='SBT_LIBRARY=/u01/install/PROD/11.2.0/OPC/lib/libopc.so, ENV=(OPC_PFILE=/u01/install/PROD/11.2.0/dbs/opcORATEST.ora)';
configure device type sbt parallelism 4;
configure default device type to sbt;
SET encryption on identified by "dfsdfsdf" only;
CONFIGURE COMPRESSION ALGORITHM 'MEDIUM';
show all;
backup as compressed backupset incremental level 0 database plus archivelog delete input;
quit;
EOF


Script_Level1 : cloudbackup_l1

su - oracle -c "/u01/install/PROD/11.2.0/OPC/script/rman_l1.sh" > /u01/install/PROD/11.2.0/OPC/script/cloudbackup_Level1_`date +%d%m%y`.log

Script_Level1: rman_l1.sh

currentdate=`date '+%d%b%Y_%H%M'`
rman target/ <<EOF
configure channel device type sbt parms='SBT_LIBRARY=/u01/install/PROD/11.2.0/OPC/lib/libopc.so, ENV=(OPC_PFILE=/u01/install/PROD/11.2.0/dbs/opcORATEST.ora)';
configure device type sbt parallelism 4;
configure default device type to sbt;
SET encryption on identified by "cdfdfdfd" only;
CONFIGURE COMPRESSION ALGORITHM 'MEDIUM';
show all;
backup as compressed backupset incremental level 1 database plus archivelog delete input;
quit;
EOF

1 comment :

  1. That article is spot on. These days one of the most important things for a business is data backup. If you have your backup in the cloud, you can keep your business going as usual in case of a downtime.

    ReplyDelete

If you will ask a question, please don't comment here..

For your questions, please create an issue into my forum.

Forum Link: http://ermanarslan.blogspot.com.tr/p/forum.html

Register and create an issue in the related category.
I will support you from there.