5.19.2.3 Method 3: Back up a User Domain from Inside the User Domain

You can take a snapshot-based backup of a user domain from inside the user domain, which can then be used to restore the user domain to a workable state.

All steps are performed from inside the user domain.

Note:

This method of backing up a user domain from inside the user domain using LVM snapshots will have limited usage in terms of recovery. Such a backup can only be used for recovery purposes when the user domain is still bootable and allows login as the root user. This means the damage is such that some files have been lost or damaged but can be restored from the backup after the user domain has booted up and the / (root) partition and the boot partitions are mounted. If that is not the case and the damage is such that the user domain does not boot, then you need a backup taken using methods 1 or 2 above to recover the user domain, and you need to perform the recovery procedure at the user domain level using the recovery procedure described below.

This procedure backs up the following:

  • LVDbSys1
  • LVDbOra1
  • /boot partition
  • Grid Infrastructure home
  • RDBMS home

All steps must be performed as the root user.

  1. Prepare a destination to hold the backup.

    In the following example, ip_address is the IP address of the NFS server, and nfs_location is the NFS location holding the backups.

    # mkdir -p /remote_FS
    
    # mount -t nfs -o rw,intr,soft,proto=tcp,nolock ip_address:/nfs_location/ /remote_FS
  2. Take a snapshot-based backup of the file systems containing / (root) and the /u01 directories, as follows:
    1. Create a snapshot named LVDbSys1_snap for the file system containing the root directory.
      The volume group must have at least 1 GB of free space for the command to succeed.
      # lvcreate -L1G -s -n LVDbSys1_snap /dev/VGExaDb/LVDbSys1
    2. Label the snapshot.
      # e2label /dev/VGExaDb/LVDbSys1_snap DBSYS_SNAP
    3. Mount the snapshot.
      # mkdir /root/mnt
      
      # mount /dev/VGExaDb/LVDbSys1_snap /root/mnt -t ext4
    4. Create a snapshot named u01_snap for the /u01 directory.
      # lvcreate -L256M -s -n u01_snap /dev/VGExaDb/LVDbOra1
    5. Label the snapshot.
      # e2label /dev/VGExaDb/u01_snap DBORA_SNAP
    6. Mount the snapshot.
      # mkdir -p /root/mnt/u01
      
      # mount /dev/VGExaDb/u01_snap /root/mnt/u01 -t ext4
    7. Change to the directory for the backup.
      # cd /root/mnt
    8. Create the backup file to back up the two snapshots taken above, the /boot partition, the Oracle Database home directory, and the Oracle Grid Infrastructure home directory.

      In the following example: Grid_home is the location of the Oracle Grid Infrastructure home, for example, /u01/app/18.1.0/grid; DB_home is the location of the Oracle Database home, for example, /u01/app/oracle/product/18.1.0/dbhome_1.

      # tar -pjcvf /remote_FS/mybackup.tar.bz2 * /boot Grid_home 
      DB_home > /tmp/backup_tar.stdout 2> /tmp/backup_tar.stderr
      
    9. Check the /tmp/backup_tar.stderr file for any significant errors.

      Errors about failing to archive open sockets, and other similar errors, can be ignored.

  3. Unmount and remove the snapshots for the file system containing the root directories.
    # cd /
    # umount /root/mnt/u01
    # umount /root/mnt
    # /bin/rmdir /root/mnt
    # lvremove /dev/VGExaDb/u01_snap
    # lvremove /dev/VGExaDb/LVDbSys1_snap
  4. Unmount the NFS share.
    # umount /remote_FS