How to install Oracle Database Cloud Backup Module

I had the joy of using the Oracle Database Cloud backup module a month ago. Needless to say that things changed since last year and some of the blogs posts I found were not relative anymore.

I used the database cloud backup module to take a backup of a local database and restore it in the cloud.

A good start would be this link to the documentation.

The installation is really simple, download the installation from here, unzip the file and install the module. I've cut most of the output to keep it simple and focus on the actual steps.

Now here's the fun bit, it took me almost than an hour to install it and that's because of the values I had to pass in the host parameter:

java -jar opc_install.jar -host https://em2.storage.oraclecloud.com/v1/Storage-a468785 -opcId 'svetoslav.gyurov@redstk.com' -opcPass 'welcome1' -walletDir $ORACLE_HOME/opc -libDir $ORACLE_HOME/lib

where em2 is EMEA Commecial 2 data centre, a468785 is your indentity domain and then you supply your crentials as well.

That's it, once installed you can now run backups of your database to the cloud:

RMAN> set encryption on identified by welcome1 only;
RMAN> run {
allocate CHANNEL c1 DEVICE TYPE sbt PARMS='SBT_LIBRARY=libopc.so, SBT_PARMS=OPC_PFILE=/u01/app/oracle/product/11.2.0.4/db_1/dbs/opcorcl.ora)';
backup database;
}

Keep in mind that the cloud backup module requires an encryption hence you need to set a password on the backup at least or you'll get the following error:

ORA-27030: skgfwrt: sbtwrite2 returned error
ORA-19511: non RMAN, but media manager or vendor specific failure, error text:
KBHS-01602: backup piece 0qkqgtua_1_1 is not encrypted

Now, on the other host, start a dummy instance and restore the spfile file first:

RMAN> set dencryption on identified by welcome1;
RMAN> set dbid=1000458402;
RMAN> run {
allocate CHANNEL c1 DEVICE TYPE sbt PARMS='SBT_LIBRARY=libopc.so, SBT_PARMS=OPC_PFILE=/u01/app/oracle/product/11.2.0.4/db_1/dbs/opcorcl.ora)';
restore spfile to pfile '/u01/app/oracle/product/11.2.0.4/db_1/dbs/initorcl.ora' from autobackup;
}

Then restart the instance in nomount state with the new spfile and restore the database, as simple as that:

RMAN> set dencryption on identified by welcome1;
RMAN> set dbid=1000458402;
RMAN> run {
allocate CHANNEL c1 DEVICE TYPE sbt PARMS='SBT_LIBRARY=libopc.so, SBT_PARMS=(OPC_PFILE=/u01/app/oracle/product/11.2.0.4/db_1/dbs/opcorcl.ora)';
restore controlfile from autobackup;
alter database mount;
restore database;
}

If you got a relatively small database estate that's a good way to backup your database to offside location. It my case it was a bit slow, it took about 30 minutes to backup 4GB database but the restore within cloud was quicker.