Skip to main content
NetApp Solutions

SnapCenter Oracle Clone Lifecycle Automation

Contributors kevin-hoke acao8888

Allen Cao, Niyaz Mohamed, NetApp

The solution provides an Ansible-based automation toolkit for setting up, cloning, and refreshing Oracle clone databases from a primary database. The primary database can be the physical standby DB in Oracle Data Guard configuration. The solution can be applied in a private data center or in the AWS cloud with FSx ONTAP storage in NFS or ASM configuration, or Azure cloud with Azure NetApp Files storage in NFS configuration.

Purpose

Customers love the FlexClone function of NetApp ONTAP storage for quick (mins) large database clones and additional storage savings if the thin clone feature is enabled on the particular storage offering in a private data center or public cloud. This Ansible-based toolkit automates the setup, cloning, and refreshing of cloned Oracle databases on schedule using the NetApp SnapCenter command line utilities for streamlined lifecycle management. The toolkit applies to Oracle databases deployed to ONTAP storage either on-premises or public cloud (AWS or Azure) and managed by the NetApp SnapCenter UI tool.

This solution addresses the following use cases:

  • Setup Oracle database clone-specification configuration file.

  • Create and refresh clone Oracle database on user defined schedule.

Audience

This solution is intended for the following people:

  • A DBA who manages Oracle databases with SnapCenter.

  • A storage administrator who manages ONTAP storage with SnapCenter.

  • An application owner who has access to SnapCenter UI.

License

By accessing, downloading, installing or using the content in this GitHub repository, you agree the terms of the License laid out in License file.

Note There are certain restrictions around producing and/or sharing any derivative works with the content in this GitHub repository. Please make sure you read the terms of the License before using the content. If you do not agree to all of the terms, do not access, download or use the content in this repository.

Solution deployment

Prerequisites for deployment

Details

Deployment requires the following prerequisites.

Ansible controller:
  Ansible v.2.10 and higher
  ONTAP collection 21.19.1
  Python 3
  Python libraries:
    netapp-lib
    xmltodict
    jmespath
SnapCenter server:
  version 5.0 and up, 6.1 for Azure NetApp Files
  backup policy configured
  Source database protected with a backup policy
Oracle servers:
  Source server managed by SnapCenter (In Data Guard, this would be the physical standby serer)
  Target server managed by SnapCenter (clone DB host)
Note For simplification, the clone target Oracle server should be configured identically to standby Oracle server such as Oracle software stack as well as directory layout for Oracle Home etc.

Download the toolkit

Details
git clone https://bitbucket.ngage.netapp.com/scm/ns-bb/na_oracle_clone_lifecycle.git
Cli
Note The toolkit can only be accessed by NetApp internal user with bitbucket access at this moment. For interested external users, please request access from your account team or reach out to NetApp Solutions Engineering team.

Ansible target hosts file configuration

Details

The toolkit includes a hosts file which define the targets that an Ansible playbook is running against. Usually, it is the target Oracle clone hosts. Following is an example file. A host entry includes target host IP address as well as ssh key for an admin user access to the host to execute clone or refresh command.

#Oracle clone hosts

[clone_1]
ora_04.cie.netapp.com ansible_host=10.61.180.29 ansible_ssh_private_key_file=ora_04.pem
[clone_2]
[clone_3]

Global variables configuration

Details

The Ansible playbooks take variable inputs from several variable files. Below is an example global variable file vars.yml.

# ONTAP specific config variables
# SnapCtr specific config variables
snapctr_usr: xxxxxxxx
snapctr_pwd: 'xxxxxxxx'
backup_policy: 'Oracle Full offline Backup'
# Linux specific config variables
# Oracle specific config variables

Host variables configuration

Details

Host variables are defined in host_vars directory named as {{ host_name }}.yml. Below is an example of target Oracle host variable file ora_04.cie.netapp.com.yml that shows typical configuration.

# User configurable Oracle clone db host specific parameters
# Source database to clone from
source_db_sid: NTAP1
source_db_host: ora_03.cie.netapp.com
# Clone database
clone_db_sid: NTAP1DEV
snapctr_obj_id: '{{ source_db_host }}\{{ source_db_sid }}'

Additional clone target Oracle server configuration

Details

Clone target Oracle server should have the identical Oracle software stack as source Oracle server installed and patched. Oracle user .bash_profile has $ORACLE_BASE, and $ORACLE_HOME configured. Also, $ORACLE_HOME variable should match with source Oracle server setting. Following is an example.

# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi
# User specific environment and startup programs
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=/u01/app/oracle/product/19.0.0/NTAP1

Playbook execution

Details

There are total of three playbooks to execute Oracle database clone lifecycle with SnapCenter CLI utilities.

  1. Install Ansible controller prerequisites - one time only.

    ansible-playbook -i hosts ansible_requirements.yml
    Cli
  2. Setup clone specification file - one time only.

    ansible-playbook -i hosts clone_1_setup.yml -u admin -e @vars/vars.yml
    Cli
  3. Create and refresh clone database regularly from crontab with a shell script to call a refresh playbook.

    0 */4 * * * /home/admin/na_oracle_clone_lifecycle/clone_1_refresh.sh
    Cli
Note Change the user name to your sudo user for SnapCenter configuration.

For an additional clone database, create a separate clone_n_setup.yml and clone_n_refresh.yml, and clone_n_refresh.sh. Configure the Ansible target hosts and hostname.yml file in host_vars directory accordingly.

Where to find additional information

To learn more about the NetApp solution automation, review the following website NetApp Solution Automation