Back Up and Restore a Domain on PV
Oracle recommends that you back up the domain home directory (and the JRF database for the JRF domain) after you have created the initial domain. You can then continue to take periodic backups, ensuring that all the latest changes are backed up.
You may update the domain on PV domain configuration after its initial deployment. For example, you may want to add new applications. However, after the update, the original WDT model files used to create the initial domain may not match the current state of the domain.
Oracle recommends that you periodically back up the domain home with the latest changes. The domain can be restored from the backup copy if you want to revert the changes made to the domain home directory. If the domain home is not properly backed up, there is a possibility of losing existing data if the domain home becomes corrupt or gets deleted.
Topics:
Back Up the Domain
The back up procedure comprises the following steps:
Back Up the Domain Home Directory
/u01/shared
backup location. This script is available in the
/u01/scripts/utils/backup.sh
on the administration
instance.#!/bin/bash -x
if [ -z "$1" ]; then
echo "Usage: backup.sh <domain_name>"
exit 1
fi
domain_name=$1
timestamp=`date '+%Y-%m-%dT%T.%3N'`
domain_dir=/u01/shared/data/domains/$domain_name
domain_uid_dir=${domain_dir}-uid
backup_dir=/u01/shared/data/domains.backup/$domain_name/$timestamp/
mkdir -p $backup_dir
echo backup_dir: $backup_dir
echo "backing up $domain_dir"
cp -r $domain_dir $backup_dir
echo "backing up $domain_uid_dir"
cp -r $domain_uid_dir $backup_dir
echo "backup created: $timestamp"
bash /u01/scripts/utils/backup.sh <domain_name>
$ bash backup.sh pvdomain
backup_dir: /u01/shared/data/domains.backup/pvdomain/2023-12-04T18:53:24.381/
backing up /u01/shared/data/domains/pvdomain
backing up /u01/shared/data/domains/pvdomain-uid
backup created: 2023-12-04T18:53:24.381
The last line of the backup directory path is the backup timestamp (in the above example, it is 2023-12-04T18:53:24.381). The timestamp string is used to restore the backup. See Restore the Domain From the Backup.
Back Up the JRF Domain
A JRF domain has a one-to-one relationship with the RCU schema. After you create a domain using a particular RCU schema, you should back up the JRF database with the RCU schema and the associated wallet. For more information, see JRF Domains.
Back Up the JRF Schema Database
After you create the JRF schema, create a backup of the JRF database. You can use the Oracle Database Backup Cloud Service or any database restore and back up method you prefer. For more information about Oracle Database Backup Cloud Service, see Getting Started with Oracle Database Backup Cloud Service.
Back Up the OPSS Wallet
After you create domain, the WebLogic Kubernetes Operator automatically
exports the OPSS wallet and stores it in an introspector ConfigMap
.
The name of the ConfigMap
follows this pattern:
<domain
uid>-weblogic-domain-introspect-cm
with the key
ewallet.p12
. Save the OPSS wallet file in a safe, backed-up
location immediately after the initial JRF domain gets created. This will allow the
secret to be available when you want to recover the domain.
mkdir -p /u01/shared/data/domains.backup/<domain>/
bash opss-wallet.sh -n <domain>-ns -d <domain> -s -wf /u01/shared/data/domains.backup/<domain>/ewallet.p12
$ mkdir -p /u01/shared/data/domains.backup/pvdomain/
$ bash /u01/scripts/wls-domain-lifecycle/opss-wallet.sh -n pvdomain-ns -d pvdomain -s -wf /u01/shared/data/domains.backup/pvdomain/ewallet.p12
@@ Info: Running 'opss-wallet.sh'.
@@ Info: Saving wallet from from configmap 'pvjrf2-weblogic-domain-introspect-cm' in namespace 'pvjrf2-ns' to file '/u01/shared/data/domains.backup/pvdomain/ewallet.p12'.
Restore the Domain
The restore procedure comprises the following steps:
Restore the Domain From the Backup
To revert the domain updates, or to recover from the lost domain home directory, restore the domain from a backup copy of the domain home directory.
/u01/shared
. The script is available in the
/u01/scripts/utils/restore.sh
on the administration
instance.#!/bin/bash -x
if [[ -z $1 || -z $2 ]]; then
echo "Usage: restore.sh <domain_name> <timestamp>"
exit 1
fi
domain_name=$1
timestamp=$2
domain_dir=/u01/shared/data/domains/$domain_name
domain_uid_dir=${domain_dir}-uid
backup_dir=/u01/shared/data/domains.backup/$domain_name/$timestamp
backup_domain_dir=${backup_dir}/$domain_name
backup_domain_uid_dir=${backup_dir}/${domain_name}-uid
if ! [ -d ${backup_domain_dir} ]; then
echo ${backup_domain_dir} not found !
exit 2
fi
if ! [ -d ${backup_domain_uid_dir} ]; then
echo ${backup_domain_uid_dir} not found !
exit 3
fi
echo "Contents of the domain $domain_name at $domain_dir will be replaced by the backup contents at $backup_domain_dir"
echo "Contents of the domain $domain_name at $domain_uid_dir will be replaced by the backup contents at $backup_domain_uid_dir"
read -r -p "Continue? [y/N] " response
case "$response" in
[yY][eE][sS]|[yY])
:
;;
*)
echo "Aborting. No changes were done"
exit 4
;;
esac
echo "restoring $domain_dir"
cp -r $backup_domain_dir $domain_dir
echo "restoring $domain_uid_dir"
cp -r $backup_domain_uid_dir $domain_uid_dir
echo "Domain Restored: $timestamp"
bash /u01/scripts/utils/restore.sh <domain_name> <backup_timestamp>
$ bash restore.sh pvdomain 2023-12-04T18:53:24.381
Contents of the domain pvdomain at /u01/shared/data/domains/pvdomain will be replaced by the backup contents at /u01/shared/data/domains.backup/pvdomain/2023-12-04T18:53:24.381/pvdomain
Contents of the domain pvdomain at /u01/shared/data/domains/pvdomain-uid will be replaced by the backup contents at /u01/shared/data/domains.backup/pvdomain/2023-12-04T18:53:24.381/pvdomain-uid
Continue? [y/N] y
restoring /u01/shared/data/domains/pvdomain
restoring /u01/shared/data/domains/pvdomain-uid
Domain Restored: 2023-12-04T18:53:24.381