Thursday, January 29, 2015

Backing up your database using Oracle Database backup as Service

Oracle Database backup as service is a public cloud service from oracle to store oracle db backups.

This service is typically helpful to store your database backups at an off site location. This service helps you to access the backup over the internet and recover when required.

The backup store in the remote location is replicated across many systems which helps our customers against corruption or failed database etc.

Also with features like encryption  the data is secured too.

The basic steps to user this service is as follows.

Note: I am using Oracle DB as service as my database instance to backup. You can also follow the below steps to backup your local database.

Putty to Cloud Instance using oracle user.
1.      Copy Jar file from your local system to Oracle public cloud instance.
C:\Program Files (x86)\PuTTY>pscp.exe -i D:\Oracle_Cloud\xxxOPC.ppk d:\downloads\opc_installer\opc_install.jar oracle@x.x.x.x:/home/oracle
2.      Login/Putty into Oracle Public Cloud instance using oracle user.

3.      Confirm the environment, by executing the below commands..
a.      echo $ORACLE_HOME -> This has to be set
b.      java -jar version -> Req 1.5+ version
c.      java –jar opc_install.jar -> You can execute this command to see what are the various parameters required to execute this. We will be running this command again with necessary parameters.

4.      Execute bellow command

java -jar opc_install.jar -serviceName serviceName -identityDomain inoracleXXXXX -opcId username -opcPass cloudinstancepassword -walletDir /home/oracle/opc/wallet -libDir /home/oracle/opc/lib

If these directories /wallet or /lib is not created, please create them.

5.      On Executing of the above command, some files like libopc.so, opcSID.ora & cwallet.sso files are created. These files would be used with RMAN for backup/restore of your database. The below is output of command generated at step#4
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 /home/oracle/opc/wallet.
Oracle Database Cloud Backup Module initialization file /u01/app/oracle/product/12.1.0/dbhome_1/dbs/opcORCL.ora created.
Downloading Oracle Database Cloud Backup Module Software Library from file opc_linux64.zip.
Downloaded 23169388 bytes in 0 seconds.
Download complete.


6.      Execute RMAN command on the console

7.      Connect to target database
RMAN> connect target /

8.      Configure RMAN using below command. 

9.      RMAN>
CONFIGURE CHANNEL DEVICE TYPE sbt PARMS='SBT_LIBRARY=/home/oracle/opc/lib/libopc.so, SBT_PARMS=(OPC_PFILE=/u01/app/oracle/product/12.1.0/dbhome_1/dbs/opcORCL.ora)';
Output of the above Command
Using target database control file instead of recovery catalog
Old RMAN configuration parameters:
CONFIGURE CHANNEL DEVICE TYPE 'SBT_TAPE' MAXPIECESIZE 2 G FORMAT   'cloudstorage_%d_%U' PARMS  'SBT_LIBRARY=libopc.so, ENV=(OPC_PFILE=/u01/app/oracle/product/12.1.0/dbhome_1/dbs/opcORCL.ora)';
new RMAN configuration parameters:
CONFIGURE CHANNEL DEVICE TYPE 'SBT_TAPE' PARMS  'SBT_LIBRARY=/home/oracle/opc/lib/libopc.so, SBT_PARMS=(OPC_PFILE=/u01/app/oracle/product/12.1.0/dbhome_1/dbs/opcORCL.ora)';
new RMAN configuration parameters are successfully stored
10.   RMAN> SET ENCRYPTION ON IDENTIFIED BY 'ppwd' Only;
11. RMAN> BACKUP DEVICE TYPE sbt DATABASE;

You should be able to see backup complete command on execution of above command.
The amount of time taken to backup a local database to cloud depends upon size/bandwidth of your database & network connection.

Hope this helps.

You can refer to Oracle Documentation for more details.

No comments: