This post was originally published on this site

While I a preparing new exercises for an Oracle Cloud Infrastructure training, I ran into an issue while configuring the Oracle Database Backup Service for the Object Storage. The OCI backup module installer returns an error 401.

My Environment

  • Oracle Linux 7 Virtual Box Machine
  • Oracle 19c RDBMS

Backup Service Module Installation Error

The installation was done according the documenation https://docs.oracle.com/en/cloud/paas/db-backup-cloud/csdbb/oracle-database-cloud-backup-module-oci.html

oracle@ocivm01:~/ [ONPREM] java -jar oci_install.jar 
-host https://objectstorage.eu-frankfurt-1.oraclecloud.com 
-pvtKeyFile /home/oracle/.ssh/oci_api_backup_key.pem 
-pubFingerPrint 1c:79:c5:d5:e4:3a:6e:f5:07:xx:xx:xx 
-uOCID ocid1.user.oc1..aaaaaaaanqt5qrcbwwseeud7cjfxqcip123456789abcdefghi 
-tOCID ocid1.tenancy.oc1..aaaaaaaac3gjl7xgpxu3wmmqh2ha123456789abcdefghi 
-walletDir $ORACLE_BASE/opc_wallet 
-libDir $ORACLE_HOME/lib 
-configFile /u01/app/oracle/admin/ONPREM/opc_config/ONPREM.ora 
-bucket db_backup_doag00

Error Message – java.io.IOException: testConnection: 401 Unauthorized

Oracle Database Cloud Backup Module Install Tool, build 12.2.0.1.0DBBKPCSBP_2018-11-09
Error: Could not authenticate to Oracle Database Cloud Backup Module
Exception in thread "main" java.lang.RuntimeException: java.io.IOException: testConnection: 401 Unauthorized.
at oracle.backup.opc.install.BmcConfig.testConnection(BmcConfig.java:305)
at oracle.backup.opc.install.BmcConfig.doBmcConfig(BmcConfig.java:164)
at oracle.backup.opc.install.BmcConfig.main(BmcConfig.java:156)
Caused by: java.io.IOException: testConnection: 401 Unauthorized.
at oracle.backup.opc.install.BmcConfig.testConnection(BmcConfig.java:290)
... 2 more

What I have verified:

  • Private key format and permissions
  • OCIDs
  • FingerPrint

But all of them were correct. There is no My Oracle Support note available about this error together with Oracle Database Backup Service. But after some more investigation, I found this note here: EBSCloudBackup.pl Failed When Performing Database Tier Upload Task (Doc ID 2588278.1) – bingo! This note described exactly my case with the cloud backup. The machine time is wrong!

My actual Machine Time and Date

The timezone CEST is correct. But wait, here in Kestenholz at the famous Jurasüdfuss / Switzerland, we have 14:38 local time. The virtual machine was 2 hours “in the future”. Let’s install the NTP service deamon.

oracle@ocivm01:~/ [ONPREM] timedatectl
      Local time: Fri 2019-10-11 16:38:39 CEST
  Universal time: Fri 2019-10-11 14:38:39 UTC
        RTC time: Fri 2019-10-11 14:38:40
       Time zone: Europe/Zurich (CEST, +0200)
     NTP enabled: no
NTP synchronized: no
 RTC in local TZ: no
      DST active: yes
 Last DST change: DST began at
                  Sun 2019-03-31 01:59:59 CET
                  Sun 2019-03-31 03:00:00 CEST
 Next DST change: DST ends (the clock jumps one hour backwards) at
                  Sun 2019-10-27 02:59:59 CEST
                  Sun 2019-10-27 02:00:00 CET

NTP Installation and Configuration

[root@ocivm01 ~]# yum -y install ntp
[root@ocivm01 ~]# systemctl start ntpd
[root@ocivm01 ~]# systemctl enable ntpd

Now the time is right:

oracle@ocivm01:~/ [ONPREM] timedatectl
Local time: Fri 2019-10-11 14:42:40 CEST
Universal time: Fri 2019-10-11 12:42:40 UTC
RTC time: Fri 2019-10-11 14:42:19
Time zone: Europe/Zurich (CEST, +0200)
NTP enabled: no
NTP synchronized: no
RTC in local TZ: no
DST active: yes
Last DST change: DST began at
Sun 2019-03-31 01:59:59 CET
Sun 2019-03-31 03:00:00 CEST
Next DST change: DST ends (the clock jumps one hour backwards) at
Sun 2019-10-27 02:59:59 CEST
Sun 2019-10-27 02:00:00 CET

OCI Backup Configuration – 2nd Try

Now the oci_installer.jar runs fine and the configuration will be created. Et voilà.

Oracle Database Cloud Backup Module Install Tool, build 12.2.0.1.0DBBKPCSBP_2018-11-09
Oracle Database Cloud Backup Module credentials are valid.
Backups would be sent to bucket db_backup_doag00.
Oracle Database Cloud Backup Module wallet created in directory /u01/app/oracle/opc_wallet.
Oracle Database Cloud Backup Module initialization file /u01/app/oracle/admin/ONPREM/opc_config/ONPREM.ora created.
Downloading Oracle Database Cloud Backup Module Software Library from Oracle Cloud Infrastructure.
Download complete.

Lesson learned

Take care about time and date settings when you build virtual machines for testing purposes. And aways install a time service like NTP or chrony.