Introduction
- We have automatic backup in DBCS which is managed by Oracle. The customer does not have any control over the bucket and we dont have enough flexibility.
- we can schedule the custom backup using dbcli to our bucket in our tenancy
- This will give more control over the backup and we can do replication to another region also for that bucket
High-Level steps
- Create an object store on the DB system by using the dbcli create-objectstoreswift command.
- Create a backup configuration that refers to the object store ID and the bucket name by using the dbcli create-backupconfig command.
- Associate the backup configuration with the database by using the dbcli update-database command.
- create the db backup
Steps to Backup Database To Cloud Object Storage Using DBCLI
Create the object store on the DB system
We need the information below before we create an object store
- Bucket Name
- Object Storage Namespace
- User have full privs on the bucket
- Authtoken for the user
Login to the server as OPC and sudo to root
dbcli create-objectstoreswift -n <object_store_name> -t <object_storage_namespace> -u <user_name> -e https://swiftobjectstorage.<region_name>.oraclecloud.com/v1 -p [-h] [-j]
This will prompt for the auth token and a job will be submitted to create the object store
Once the job is completed, you should be able to see the object store on DB system
dbcli list-objectstoreswifts
Create a backup configuration
Create the backup configuration
dbcli create-backupconfig -d {DISK|OBJECTSTORE|NONE} -c <bucket> -o <object_store_swift_id> -on <object_store_swift_name> -w <n> -n <name> [-cr|-no-cr] [-h] [-j]
A job will be submitted. Once the Job is completed, You should be able to see the backup config
dbcli list-backupconfigs
Associate the backup configuration with the database
Do and note down the Database ID
dbcli list-databases
Now attach the backup config to the database id
dbcli update-database --backupconfigid <BackupConfig_ID> --dbid <dbid>
Create the DB backup
dbcli create-backup -in <db_name> -i <db_id> [-bt {Regular-L0|Regular-L1|Longterm|ArchiveLog}] [-c {Database|TdeWallet}] [-k <n>] [-t <tag>] [-h] [-j]
Example
dbcli create-backup -i <dbid> -bt Regular-L0 dbcli create-backup -i <dbid> -bt longterm -k 366
Conclusion
By following these steps, you can set up a Backup on Oracle Database Cloud Service using DBCLI, providing a reliable and efficient way to handle your database backups in the cloud. Remember to regularly review and adjust your backup strategy to align with your evolving data protection needs.
Related Articles
How to configure Automatic Managed backup on DBCS
How to configure Automatic Managed Backup on ExaCS
Troubleshooting backup Failures in ExaCS
Oracle Database Cloud Backup Module
DBCLI commands