Friday, October 15, 2021

Backup and restore of Oracle tables

If you're a regular developer and don't have access to server side backup facilities on Oracle you might be tempted to use Oracle's SQL Developer.

While testing Keycloak 6.0.1 to 12.0.4 upgrade I had to backup and then restore the original Keycloak tables a few times.

My first naive attempts used CSV or Excel formats so I can inspect the values offline. This however turned out to be a bad idea since blobs in tables (passwords for instance), were left out of the backup.

Finally I ended with the following steps for backup:

  1. Select all tables you need backed up and then "Export ..."
  2. Select the following settings for the expor
    Export DDL is needed to recreate the tables from scratch
    I use Export DDL | Drops to automate the dropping of the tables
    Format: loader allows you to save data blobs as well
    Save As | Separate Directories structures the data nicely  

  3. If you need to do that export multiple times (as I had to) you'd be better off with making this the defaults like that under Tools | Preferences

To restore the backup open the Generated-<timestamp>.sql inside the backup directory and execute it.

No comments:

id_rsa.pub: invalid format, error in libcrypto

After I upgraded my Linux and got Python 3.10 by default, it turned out that Ansible 2.9 will no longer run and is unsupported together with...