This is the fourth and final post of a multi-part blog series walking through how to copy your TDE encrypted on premise Oracle Database to an OCI instance in the oracle cloud. This blog post will focus on how to restore your database from the object store, when the backup pieces are not available from your controlfile.
There a few reasons why this might be the case.
- The backups were written to the ZDLRA directly.
- You are using an RMAN catalog, and they have aged off the controlfile.
- They are "keep" backups which will be stored in the RMAN catalog.
- You had to rebuild the controlfile, and lost history of backups.
Whatever the reason, there is way to find out what backups are in the Object for your database, and you will be able to catalog them.
NOTE: You can use this same script to delete old backups directly if you've lost your catalog entries.
When you download the Oracle Cloud Backup installation zip file, and execute the "oci_install.jar" command to download the library you will find 5 extra files in the /lib directory with the "libopc.so" file that is used by the RMAN channel. The 2 we are going to use are
- odbsrmt.py --> python script to manage the contents of the object store bucket
- python_readme.txt --> Documentation for how to use the above python script.
Step #1 Execute odbsrmt.py to get a listing of your backup pieces.
NOTE: The python script uses python 2.x and will not work with python 3.x. Python 3.x is typically the default version in your path, and you might have to find the 2.x version on your system. For my system this means executing "python2" rather than "python"
If I execute the script without any parameters, I can see what parameters are expected.
[oracle@oracle-19c-test-tde lib]$ python2 odbsrmt.py
usage: odbsrmt.py [-h] --mode
{report,rman-listfile,garbage-collection,delete,recall}
[--ocitype {classic,swift,bmc,archive}]
[--credential CREDENTIAL] [--token TOKEN] --host HOST
[--base BASE] [--forcename FORCENAME]
[--format {text,xml,json}] [--dbid DBID]
[--container CONTAINER] [--dir DIR] [--prefix PREFIX]
[--untildate UNTILDATE] [--exclude_deferred]
[--thread THREAD] [--proxyhost PROXYHOST]
[--proxyport PROXYPORT] [--tocid TOCID] [--uocid UOCID]
[--pubfingerprint PUBFINGERPRINT] [--pvtkeyfile PVTKEYFILE]
[--skip_check_status] [--debug]
odbsrmt.py: error: argument --mode is required
Now let's go through the most common parameters I am going to use to report on my backups
python2 odbsrmt.py --mode report --ocitype bmc --host https://objectstorage.us-ashburn-1.oraclecloud.com --dir /home/oracle/ocicloud/report --base mydbreport --pvtkeyfile /home/oracle/ocicloud/myprivatekey.ppk --pubfingerprint 6d:f9:57:d5:ff:b1:c0:98:81:90:1e:6e:08:0f:d0:69 --tocid ocid1.tenancy.oc1..aaaaaaaanz4trskw6jm57cz2fztoasatto3i6z4h33gzfb3pmei5vvnoq --uocid ocid1.user.oc1..aaaaaaaae2mlwyke4gvd7kzxv5zxgg3k2dlcwvubv7vjy6jvbgsaouxq --container migest_backups --dbid 301925655
And this will give me the following output in my report file.
FileName
Container Dbname Dbid FileSize LastModified BackupType Incremental Compressed Encrypted
220h9q5f_66_1_1
migest_backups OCITEST 301925655 72876032 2021-12-21 19:37:33 ArchivedLog false true true
230h9q5g_67_1_1
migest_backups OCITEST 301925655 75759616 2021-12-21 19:37:32 ArchivedLog false true true
240h9q5g_68_1_1
migest_backups OCITEST 301925655 54263808 2021-12-21 19:37:12 ArchivedLog false true true
250h9q5g_69_1_1
migest_backups OCITEST 301925655 48496640 2021-12-21 19:36:58 ArchivedLog false true true
260h9q9n_70_1_1
migest_backups OCITEST 301925655 159645696 2021-12-21 19:42:46 Datafile true true true
270h9q9n_71_1_1
migest_backups OCITEST 301925655 408682496 2021-12-21 19:47:04 Datafile true true true
280h9q9n_72_1_1
migest_backups OCITEST 301925655 524288 2021-12-21 19:37:46 Datafile true true true
290h9q9n_73_1_1
migest_backups OCITEST 301925655 56885248 2021-12-21 19:39:37 Datafile true true true
2a0h9q9v_74_1_1
migest_backups OCITEST 301925655 235667456 2021-12-21 19:45:05 Datafile true true true
2b0h9qdi_75_1_1
migest_backups OCITEST 301925655 233832448 2021-12-21 19:46:18 Datafile true true true
2c0h9qjb_76_1_1
migest_backups OCITEST 301925655 52166656 2021-12-21 19:44:31 Datafile true true true
2d0h9qmk_77_1_1
migest_backups OCITEST 301925655 1572864 2021-12-21 19:44:43 Datafile true true true
2e0h9qn3_78_1_1
migest_backups OCITEST 301925655 34865152 2021-12-21 19:45:41 Datafile true true true
2f0h9qns_79_1_1
migest_backups OCITEST 301925655 524288 2021-12-21 19:45:20 Datafile true true true
2g0h9qrg_80_1_1
migest_backups OCITEST 301925655 262144 2021-12-21 19:47:14 ArchivedLog false true true
c-301925655-20211221-00
migest_backups OCITEST 301925655 524288 2021-12-21 19:47:22 ControlFile SPFILE false true true
Total Storage: 1.34 GB
You can see that this report contains the backup pieces I need.
I am going to use the script (below) and pass it the report name to create the commands to catalog the backup pieces.
And when I execute the above script passing my report file, it produces my commands to catalog the backup pieces.
report file used for catalog scripts : mydbreport4701.lst
catalog device type 'sbt_tape' backuppiece '220h9q5f_66_1_1';
catalog device type 'sbt_tape' backuppiece '230h9q5g_67_1_1';
catalog device type 'sbt_tape' backuppiece '240h9q5g_68_1_1';
catalog device type 'sbt_tape' backuppiece '250h9q5g_69_1_1';
catalog device type 'sbt_tape' backuppiece '260h9q9n_70_1_1';
catalog device type 'sbt_tape' backuppiece '270h9q9n_71_1_1';
catalog device type 'sbt_tape' backuppiece '280h9q9n_72_1_1';
catalog device type 'sbt_tape' backuppiece '290h9q9n_73_1_1';
catalog device type 'sbt_tape' backuppiece '2a0h9q9v_74_1_1';
catalog device type 'sbt_tape' backuppiece '2b0h9qdi_75_1_1';
catalog device type 'sbt_tape' backuppiece '2c0h9qjb_76_1_1';
catalog device type 'sbt_tape' backuppiece '2d0h9qmk_77_1_1';
catalog device type 'sbt_tape' backuppiece '2e0h9qn3_78_1_1';
catalog device type 'sbt_tape' backuppiece '2f0h9qns_79_1_1';
catalog device type 'sbt_tape' backuppiece '2g0h9qrg_80_1_1';
catalog device type 'sbt_tape' backuppiece 'c-301925655-20211221-00';
Now in RMAN I can execute these commands to catalog the backup pieces from the OCI bucket.
Note : By using "untildate" you can control the dates that will be reported on.
No comments:
Post a Comment