When I wrote my last blog on listing the Long Term Backups created by Autonomous Recovery Service, I didn't go through the process of how to dynamically create a new backup.
Below is how you create a long term backup in the console, but most customers want to automate this process.
The oci cli command you would use to create a new backup is "oci db backup create".
In order to create an end-of-month backup with a restore point as of midnight what I recommend customers do is
- Ensure you have a nightly backup that runs late at night (about 22:00) and will finish by midnight on a regular basis.
- Schedule the automatic long term backup creation to occur about 00:45 on the next day. This ensures that a log sweep has occurred. For BaseDB you would wait until after the next hour. If you have enabled the zero data loss feature (real-time redo), you want to make sure that the ARCHIVE_LAG_TARGET is set to 30 minutes or less and forcing a periodic log switch.
Command inputs
The easiest way to determine the input for this command is to use the --generate-full-command-json-input option.
oci db backup create --generate-full-command-json-input
What is returned is the JSON example below showing you what parameters need to be filled in to create the backup.
{
"databaseId": "string",
"displayName": "string",
"maxWaitSeconds": 0,
"retentionDays": 0,
"retentionYears": 0,
"waitForState": [
"CREATING|ACTIVE|DELETING|DELETED|FAILED|RESTORING|UPDATING|CANCELING|CANCELED"
],
"waitIntervalSeconds": 0
}Source database and backup identifying name
- databaseID : This is the OCID for the database that you want to create the long term backup for.
- displayName: This is the name to identify the backup from a listing and would match the name I would put in the GUI.
Wait for state of command (Optional)
- waitForState: Since the backup can take awhile to run, you can have the command wait to return until a specified state (or any one of a list of states) occurs. When creating a new backup the valid states would be
- ACTIVE
- CANCELED
- CANCELING
- CREATING
- FAILED
- maxWaitSeconds: How long to wait between state checks when waiting for a state to occur.
{
"databaseId": "ocid1.database.oc1.phx.anyhqljtbv6267ia2wse63oz7xadpv5lfi2gf233333eomezhadfbdkt2eq",
"displayName": "bsgtest",
"maxWaitSeconds": 0,
"retentionDays": 100
}

No comments:
Post a Comment