Backup Oracle Database to OCI Object Storage using Bck2Cloud – “1-Button” Cloud Backup/Restore Automation Utility
This is a quick ‘How-To’ guide on setting up the Bck2Cloud utility to back up the Oracle Database to OCI object storage. The source Oracle database can be hosted on-prem, ExaCC, or any other third-party Cloud. If you are new to these concepts, I would recommend reading the article written by Anas Darkal on our website.
The Bck2Cloud was developed by Ruggero Citton of Oracle RAC Pack, Cloud Innovation and Solution Engineering Team in 2017. As of February 2022, the latest release available for Linux 6 and 7 is 3.0.1.4. The aim of this tool is to automate Oracle database RMAN backup to Oracle Database Backup Cloud Service with the help of OCI CLI, Oracle Database Cloud Backup Module, and Oracle RMAN. All these technologies are encapsulated into the tool and will be running in the background. Hence, you do not need to know much about how each tool works.
Let’s get started.
I have downloaded Linux 7 compatible binary from the MOS document – Bck2Cloud – “1-Button” Cloud Backup/Restore Automation Utility (Doc ID 2363679.1).
Also, download the Oracle Database Cloud Backup Module. You can download the module from https://www.oracle.com/technetwork/database/availability/oracle-cloud-backup-2162729.html
[root@labvboxasmdb01]# rpm -ivh bck2cloud-3.0.1-4.el7.x86_64.rpm
warning: bck2cloud-3.0.1-4.el7.x86_64.rpm: Header V4 RSA/SHA1 Signature, key ID 939112d6: NOKEY
Preparing... ################################# [100%]
Updating / installing...
1:bck2cloud-3.0.1-4 ################################# [100%]
bck2cloud-3.0.1.4 binary has been installed on /opt/bck2cloud successfully!
Upon successful installation, check the help page. You may see the options that are supported by the tool.
[root@labvboxasmdb01]# cd /opt/bck2cloud
[root@labvboxasmdb01 bck2cloud]# ls -lrt
total 10324
-rwxr-xr-x 1 root root 10571009 Feb 9 2022 bck2cloud.bin
drwxr-xr-x 2 root root 87 Jan 11 11:51 conf
[root@labvboxasmdb01 bck2cloud]# ./bck2cloud.bin --help
│▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒│
bck2cloud - Backup to Cloud Automation Utility
Version: 3.0.1-04
Copyright Oracle, Inc. 2017, 2022
-------------------------------------------------------
Author: Ruggero Citton <ruggero.citton@oracle.com>
RAC Pack, Cloud Innovation and Solution Engineering Team
│▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒│
The command option is missing!
One of the following operations is possible:
Managing OPC Module:
Database Convert Operations:
RMAN Operations:
TDE Wallet Operations:
Oracle Cloud Storage Operations :
Oracle Cloud Storage Objects Operations :
Encrypt password Operations:
Below is a config file that has OCI details such as tenancy OCID, user OCID, private key file, Fingerprint, and Object storage bucket name. If you refer to steps 1 to 5 of the above article, you will further understand the usage of those parameters.
Create the required WALLET_DIR and LIB_DIR directories as specified above. Now run the installer using the config file that you prepared above.
[root@labvboxasmdb01 bck2cloud]# ./bck2cloud.bin install --oci /tmp/opc_installer/oci_installer/oci_install.jar --conf /opt/bck2cloud/conf/oci.conf
INFO: 2023-01-11 12:16:17: Please check the logfile '/opt/bck2cloud/out/log/bck2cloud_7473.log' for more details
│▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒│
bck2cloud - Backup to Cloud Automation Utility
Version: 3.0.1-04
Copyright Oracle, Inc. 2017, 2022
-------------------------------------------------------
Author: Ruggero Citton <ruggero.citton@oracle.com>
RAC Pack, Cloud Innovation and Solution Engineering Team
│▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒│
INFO: 2023-01-11 12:16:17: Installing the Oracle Database Cloud Backup Module for OCI
INFO: 2023-01-11 12:16:17: Reading the configuration file '/opt/bck2cloud/conf/oci.conf'
INFO: 2023-01-11 12:16:17: Executing command:
java -jar /tmp/opc_installer/oci_installer/oci_install.jar -host https://objectstorage.ca-toronto-1.oraclecloud.com -pvtKeyFile /opt/bck2cloud/oci/oracleidentitycloudservice_DinushaR-01-11-03-40_private-pem.pem -pubFingerPrint d7:98: aa: aa: aa: aa: aa: aa: aa: aa: aa:b5:9c -tOCID ocid1.tenancy.oc1..aaaabbbbbbbbbbbbbbbbbbbbbbbbbbbdsbbbbbbbbqt7crdn7a -uOCID ocid1.user.oc1..aaaaaaaaaaaaaaaaaaaaaaaaaalzq -walletDir /opt/bck2cloud/BM/wallet -libDir /opt/bck2cloud/BM/libopc -bucket Oracle-Backups -configFile /opt/bck2cloud/BM/bck2cloud.conf -debug
SUCCESS: 2023-01-11 12:16:21: OPC Backup Module for OCI installed successfully
Bck2Cloud is designed to perform many RMAN operations making them much simpler.
Let’s perform a backup operation. We will be creating a config file that contains the parameters of the database that will be backing up.
BCK_TYPE = full|incremental|differential|cumulative
DELETE= Delete archive logs once backed up (true|false)
QUICK= Restore Validate ‘Header’ (true|false)
Please refer to the Bck2Cloud reference guide for more options.
Let’s run the below command to take the database full backup and archivelog.
[root@labvboxasmdb01 bck2cloud]# ./bck2cloud.bin backup -type archivelog -delete -conf /opt/bck2cloud/conf/cdb1902.bck2cloud.cfg
INFO: 2023-01-11 16:16:38: Please check the logfile '/opt/bck2cloud/out/log/bck2cloud_2522.log' for more details
│▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒│
bck2cloud - Backup to Cloud Automation Utility
Version: 3.0.1-04
Copyright Oracle, Inc. 2017, 2022
-------------------------------------------------------
Author: Ruggero Citton <ruggero.citton@oracle.com>
RAC Pack, Cloud Innovation and Solution Engineering Team
│▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒│
INFO: 2023-01-11 16:16:38: Reading the configuration file '/opt/bck2cloud/conf/cdb1902.bck2cloud.cfg'
INFO: 2023-01-11 16:16:39: Checking if 'cdb1902' is TDE enable
---------------------------------------------------------
- Database Backup
Database Name: cdb1902
DB unique Name: cdb1902
DB TDE Enable : true
Backup Type : full (base)
Backup TAG : BCK2CLOUD
Delete Arch. : false
- Oracle Cloud Storage Info
OPC Host : https://objectstorage.ca-toronto-1.oraclecloud.com/n/yza00k7tuks0
Container: BCK2CLOUD
---------------------------------------------------------
INFO: 2023-01-11 16:16:41: Saving RMAN configuration...
INFO: 2023-01-11 16:16:45: Calculating the section size
INFO: 2023-01-11 16:16:46: Getting max dbfile size for the database 'cdb1902'
INFO: 2023-01-11 16:16:46: Executing database 'cdb1902' full backup
SUCCESS: 2023-01-11 16:31:57: Successfully executed database 'cdb1902' full backup
You may see backups that have been uploaded to the object storage.
You may see the backup report from the dbbckreport command.
One of the advantages of using the Bck2Cloud tool is to perform TDE wallet backup/restore operations as follows:
Use wltbackup and wltlist commands to backup and list the TDE wallet backups.
Sample of output of wltlist command as follows:
[root@labvboxasmdb01 bck2cloud]# ./bck2cloud.bin wltlist -conf /opt/bck2cloud/conf/cdb1902.bck2cloud.cfg
INFO: 2023-01-11 19:50:21: Please check the logfile '/opt/bck2cloud/out/log/bck2cloud_16912.log' for more details
│▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒│
bck2cloud - Backup to Cloud Automation Utility
Version: 3.0.1-04
Copyright Oracle, Inc. 2017, 2022
-------------------------------------------------------
Author: Ruggero Citton <ruggero.citton@oracle.com>
RAC Pack, Cloud Innovation and Solution Engineering Team
│▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒│
INFO: 2023-01-11 19:50:21: Reading the configuration file '/opt/bck2cloud/conf/cdb1902.bck2cloud.cfg'
INFO: 2023-01-11 19:50:21: Getting container 'BCK2CLOUD' Database tde_wallet list using oci-cli
---------------------------------------------------------
- Container name : BCK2CLOUD
---------------------------------------------------------
- Object prefix in use : tde_wallet_cdb1902/
- Object limit in use : All
---------------------------------------------------------
List Database tde_wallet stored into container 'BCK2CLOUD':
{
"data": [
{
"archival-state": null,
"etag": "2955f410-dfaf-4a89-b375-2ab01b9ab5df",
"md5": "7phnz8d7Er1CFoYYm0HfIg==",
"name": "tde_wallet_cdb1902/cwallet.sso",
"size": 15240,
"storage-tier": "Standard",
"time-created": "2023-01-11T21:21:31.118000+00:00",
"time-modified": "2023-01-11T23:48:12.950000+00:00"
},
{
"archival-state": null,
"etag": "6a0badda-60b8-47f2-9b0a-881159f89130",
"md5": "0373JEsnfl+/G05aehEeLQ==",
"name": "tde_wallet_cdb1902/ewallet.p12",
"size": 15179,
"storage-tier": "Standard",
"time-created": "2023-01-11T21:21:31.111000+00:00",
"time-modified": "2023-01-11T23:48:12.867000+00:00"
},
{
"archival-state": null,
"etag": "ddaa2033-f712-44b9-a0ad-56ed388799d2",
"md5": "wUnfHedXK5tpRSglWmEUgw==",
"name": "tde_wallet_cdb1902/ewallet_2023011121175400.p12",
"size": 2555,
"storage-tier": "Standard",
"time-created": "2023-01-11T21:21:31.135000+00:00",
"time-modified": "2023-01-11T23:48:12.966000+00:00"
}
],
"prefixes": []
}
You may observe the same result from the OCI console as well.
Note: – This works when the TDE wallet is on the file system. But I tried migrating the wallet to ASM and ended up with the below error. I assume that the tool does not recognize it when the wallet is in ASM.
“Undefined subroutine &Bck2Cloud_Utils::setHome called at (eval 38) line 865.”
Similarly, you can perform storage container-level and object-level operations using the Bck2Cloud utility. I do not intend to discuss those features in this article. You may refer to the Bck2Cloud reference for more information.
References: Bck2Cloud – “1-Button” Cloud Backup/Restore Automation Utility (Doc ID 2363679.1)