Skip to main content
NetApp Solutions

EC2 and FSx Oracle database management

Contributors banum-netapp

In addition to the AWS EC2 and FSx management console, the Ansible control node and the SnapCenter UI tool are deployed for database management in this Oracle environment.

An Ansible control node can be used to manage Oracle environment configuration, with parallel updates that keep primary and standby instances in sync for kernel or patch updates. Failover, resync, and failback can be automated with the NetApp Automation Toolkit to archive fast application recovery and availability with Ansible. Some repeatable database management tasks can be executed using a playbook to reduce human errors.

The SnapCenter UI tool can perform database snapshot backup, point-in-time recovery, database cloning, and so on with the SnapCenter plugin for Oracle databases. For more information about Oracle plugin features, see the SnapCenter Plug-in for Oracle Database overview.

The following sections provide details on how key functions of Oracle database management are fulfilled with the SnapCenter UI:

  • Database snapshot backups

  • Database point-in-time restore

  • Database clone creation

Database cloning creates a replica of a primary database on a separate EC2 host for data recovery in the event of logical data error or corruption, and clones can also be used for application testing, debugging, patch validation, and so on.

Taking a snapshot

An EC2/FSx Oracle database is regularly backed up at intervals configured by the user. A user can also take a one-off snapshot backup at any time. This applies to both full-database snapshot backups as well as archive-log-only snapshot backups.

Taking a full database snapshot

A full database snapshot includes all Oracle files, including data files, control files, and archive log files.

  1. Log into the SnapCenter UI and click Resources in the left-side menu. From the View dropdown, change to the Resource Group view.

    Error: Missing Graphic Image

  2. Click the full backup resource name, and then click the Backup Now icon to initiate an add-hoc backup.

    Error: Missing Graphic Image

  3. Click Backup and then confirm the backup to start a full database backup.

    Error: Missing Graphic Image

    From the Resource view for the database, open the database Managed Backup Copies page to verify that the one-off backup completed successfully. A full database backup creates two snapshots: one for the data volume and one for the log volume.

    Error: Missing Graphic Image

Taking an archive log snapshot

An archive log snapshot is only taken for the Oracle archive log volume.

  1. Log into the SnapCenter UI and click the Resources tab in the left-side menu bar. From the View dropdown, change to the Resource Group view.

    Error: Missing Graphic Image

  2. Click the log backup resource name, and then click the Backup Now icon to initiate an add-hoc backup for archive logs.

    Error: Missing Graphic Image

  3. Click Backup and then confirm the backup to start an archive log backup.

    Error: Missing Graphic Image

    From the Resource view for the database, open the database Managed Backup Copies page to verify that the one-off archive log backup completed successfully. An archive log backup creates one snapshot for the log volume.

    Error: Missing Graphic Image

Restoring to a point in time

SnapCenter-based restore to a point in time is executed on the same EC2 instance host. Complete the following steps to perform the restore:

  1. From the SnapCenter Resources tab > Database view, click the database name to open the database backup.

    Error: Missing Graphic Image

  2. Select the database backup copy and the desired point in time to be restored. Also mark down the corresponding SCN number for the point in time. The point-in-time restore can be performed using either the time or the SCN.

    Error: Missing Graphic Image

  3. Highlight the log volume snapshot and click the Mount button to mount the volume.

    Error: Missing Graphic Image

  4. Choose the primary EC2 instance to mount the log volume.

    Error: Missing Graphic Image

  5. Verify that the mount job completes successfully. Also check on the EC2 instance host to see the that log volume mounted and also the mount point path.

    Error: Missing Graphic Image
    Error: Missing Graphic Image

  6. Copy the archive logs from the mounted log volume to the current archive log directory.

    [ec2-user@ip-10-0-0-151 ~]$ cp /var/opt/snapcenter/sco/backup_mount/ip-10-0-0-151_03-25-2022_11.15.01.1503_1/ORCL/1/db/ORCL_A/arch/*.arc /ora_nfs_log/db/ORCL_A/arch/
  7. Return to the SnapCenter Resource tab > database backup page, highlight the data snapshot copy, and click the Restore button to start the database restore workflow.

    Error: Missing Graphic Image

  8. Check "All Datafiles" and "Change database state if needed for restore and recovery", and click Next.

    Error: Missing Graphic Image

  9. Choose a desired recovery scope using either SCN or time. Rather than copying the mounted archive logs to the current log directory as demonstrated in step 6, the mounted archive log path can be listed in "Specify external archive log files locations" for recovery.

    Error: Missing Graphic Image

  10. Specify an optional prescript to run if necessary.

    Error: Missing Graphic Image

  11. Specify an optional afterscript to run if necessary. Check the open database after recovery.

    Error: Missing Graphic Image

  12. Provide an SMTP server and email address if a job notification is needed.

    Error: Missing Graphic Image

  13. Restore the job summary. Click finish to launch the restore job.

    Error: Missing Graphic Image

  14. Validate the restore from SnapCenter.

    Error: Missing Graphic Image

  15. Validate the restore from the EC2 instance host.

    Error: Missing Graphic Image

  16. To unmount the restore log volume, reverse the steps in step 4.

Creating a database clone

The following section demonstrates how to use the SnapCenter clone workflow to create a database clone from a primary database to a standby EC2 instance.

  1. Take a full snapshot backup of the primary database from SnapCenter using the full backup resource group.

    Error: Missing Graphic Image

  2. From the SnapCenter Resource tab > Database view, open the Database Backup Management page for the primary database that the replica is to be created from.

    Error: Missing Graphic Image

  3. Mount the log volume snapshot taken in step 4 to the standby EC2 instance host.

    Error: Missing Graphic Image
    Error: Missing Graphic Image

  4. Highlight the snapshot copy to be cloned for the replica, and click the Clone button to start the clone procedure.

    Error: Missing Graphic Image

  5. Change the replica copy name so that it is different from the primary database name. Click Next.

    Error: Missing Graphic Image

  6. Change the clone host to the standby EC2 host, accept the default naming, and click Next.

    Error: Missing Graphic Image

  7. Change your Oracle home settings to match those configured for the target Oracle server host, and click Next.

    Error: Missing Graphic Image

  8. Specify a recovery point using either time or the SCN and mounted archive log path.

    Error: Missing Graphic Image

  9. Send the SMTP email settings if needed.

    Error: Missing Graphic Image

  10. Clone the job summary, and click Finish to launch the clone job.

    Error: Missing Graphic Image

  11. Validate the replica clone by reviewing the clone job log.

    Error: Missing Graphic Image

    The cloned database is registered in SnapCenter immediately.

    Error: Missing Graphic Image

  12. Turn off Oracle archive log mode. Log into the EC2 instance as oracle user and execute following command:

    sqlplus / as sysdba
    shutdown immediate;
    startup mount;
    alter database noarchivelog;
    alter database open;
Note Instead primary Oracle backup copies, a clone can also be created from replicated secondary backup copies on target FSx cluster with same procedures.

HA failover to standby and resync

The standby Oracle HA cluster provides high availability in the event of failure in the primary site, either in the compute layer or in the storage layer. One significant benefit of the solution is that a user can test and validate the infrastructure at any time or with any frequency. Failover can be user simulated or triggered by real failure. The failover processes are identical and can be automated for fast application recovery.

See the following list of failover procedures:

  1. For a simulated failover, run a log snapshot backup to flush the latest transactions to the standby site, as demonstrated in the section Taking an archive log snapshot. For a failover triggered by an actual failure, the last recoverable data is replicated to the standby site with the last successful scheduled log volume backup.

  2. Break the SnapMirror between primary and standby FSx cluster.

  3. Mount the replicated standby database volumes at the standby EC2 instance host.

  4. Relink the Oracle binary if the replicated Oracle binary is used for Oracle recovery.

  5. Recover the standby Oracle database to the last available archive log.

  6. Open the standby Oracle database for application and user access.

  7. For an actual primary site failure, the standby Oracle database now takes the role of the new primary site and database volumes can be used to rebuild the failed primary site as a new standby site with the reverse SnapMirror method.

  8. For a simulated primary site failure for testing or validation, shut down the standby Oracle database after the completion of testing exercises. Then unmount the standby database volumes from the standby EC2 instance host and resync replication from the primary site to the standby site.

These procedures can be performed with the NetApp Automation Toolkit available for download at the public NetApp GitHub site.

git clone https://github.com/NetApp-Automation/na_ora_hadr_failover_resync.git

Read the README instruction carefully before attempting setup and failover testing.