Automated Oracle Clone Lifecycle on GCNV with ASM
Allen Cao, Niyaz Mohamed, NetApp
The solution provides an Ansible-based automation toolkit for setting up, cloning, and refreshing Oracle clone databases from the physical standby database of Oracle Data Guard hosted in Google cloud on Google Cloud NetApp Volumes storage with ASM configuration.
Purpose
Leveraging the quick clones of the physical standby Oracle database in Oracle Data Guard configuration for other use cases serves multiple purposes. It provides a close to real-time reporting database and also a writable copy of the production database for development or UAT purposes. Thus, it can eliminate expensive Active Data Guard license costs if a short delay (10-15 minutes) of reporting is acceptable. It saves on storage costs particularly when the thin clone of primary data volumes is an option. This Ansible-based automation toolkit empowers users to set up, clone, and refresh cloned Oracle databases on user schedules for streamlined lifecycle management. The toolkit applies to Oracle databases deployed to the Google public cloud using Google Cloud NetApp Volumes (GCNV) storage and Oracle database setup in a Data Guard configuration.
This solution addresses the following use cases:
-
Setup Oracle standby database clone configuration files for Ansible automation.
-
Create or refresh clone Oracle database from Data Guard standby using Ansible playbook on user defined schedule.
Audience
This solution is intended for the following people:
-
A DBA who manages Oracle databases in Google cloud.
-
A storage administrator who manages Google NetApp Volumes storage.
-
An application owner who likes to clone Oracle databases from Data Guard standby for other use cases.
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.
|
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
Oracle servers: Physical standby Oracle servers in Data Guard configuration Clone target Oracle servers with ASM configuration
|
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
https://bitbucket.ngage.netapp.com/projects/NS-BB/repos/na_oracle_clone_gcnv/browse
|
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 source and target hosts file configuration
Details
The toolkit includes a hosts file which define the source and targets Oracle hosts that the Ansible playbook running against. Usually, it includes the standby DB host in Data Guard setup and the target Oracle clone host. Following is an example file. A host entry includes target host IP address as well as ssh key for user access to the host to execute clone or refresh command. The Google Cloud NetApp Volumes storage is accessed and managed via gcloud cli.
[ora_stdby] oras ansible_host=172.179.119.75 ansible_ssh_private_key_file=oras.pem
[ora_clone] orac ansible_host=52.148.142.212 ansible_ssh_private_key_file=orac.pem
[gcp] localhost ansible_connection=local
Global variables configuration
Details
Below is an example of typical global variable file vars.yml which includes variables that are applicable at the global level.
###################################################################### ###### Oracle DB clone on GCNV user configuration variables ###### ###### Consolidate all variables from GCNV, linux and oracle ###### ######################################################################
############################################ ### ONTAP/GCNV specific config variables ### ############################################
# GCNV credential key_file: /home/admin/google-cloud-sdk/service_key.json
# Cloned DB volumes from standby DB project_id: cvs-pm-host-1p location: us-west4 protocol: nfsv3 data_vols: - "{{ groups.ora_stdby[0] }}-u02" - "{{ groups.ora_stdby[0] }}-u03" - "{{ groups.ora_stdby[0] }}-u04" - "{{ groups.ora_stdby[0] }}-u05" - "{{ groups.ora_stdby[0] }}-u06" - "{{ groups.ora_stdby[0] }}-u07" - "{{ groups.ora_stdby[0] }}-u08"
nfs_lifs: - 10.165.128.197 - 10.165.128.196 - 10.165.128.197 - 10.165.128.197 - 10.165.128.197 - 10.165.128.197 - 10.165.128.197
nfs_client: 0.0.0.0/0
########################################### ### Linux env specific config variables ### ###########################################
#################################################### ### DB env specific install and config variables ### ####################################################
# Standby DB configuration oracle_user: oracle oracle_base: /u01/app/oracle oracle_sid: NTAP db_unique_name: NTAP_LA oracle_home: '{{ oracle_base }}/product/19.0.0/{{ oracle_sid }}' spfile: '+DATA/{{ db_unique_name }}/PARAMETERFILE/spfile.289.1198520783' adump: '{{ oracle_base }}/admin/{{ db_unique_name }}/adump' grid_home: /u01/app/oracle/product/19.0.0/grid asm_disk_groups: - DATA - LOGS
# Clond DB configuration clone_sid: NTAPDEV sys_pwd: "XXXXXXXX"
# Data Guard mode - MaxAvailability or MaxPerformance dg_mode: MaxAvailability
|
For a more secure automation deployment, Ansible vault can be employed to encrypt sensitive information such as password, access token or key etc. The solution does not cover Ansible vault implementation but it's well documented in Ansible documentation. Please referred to Protecting sensitive data with Ansible vault for details. |
Host variables configuration
Details
Host variables are defined in host_vars directory named as {{ host_name }}.yml that applies to the particular host only. For this solution, only target clone DB host parameter file is configured. Oracle standby DB parameters are configured in global vars file. Below is an example of target Oracle clone DB host variable file orac.yml that shows typical configuration.
# User configurable Oracle clone host specific parameters
# Database SID - clone DB SID oracle_base: /u01/app/oracle oracle_user: oracle clone_sid: NTAPDEV oracle_home: '{{ oracle_base }}/product/19.0.0/{{ oracle_sid }}' clone_adump: '{{ oracle_base }}/admin/{{ clone_sid }}/adump'
grid_user: oracle grid_home: '{{ oracle_base }}/product/19.0.0/grid' asm_sid: +ASM
Additional clone target Oracle server configuration
Details
Clone target Oracle server should have the same 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. If target ORACLE_HOME setting is different from standby Oracle server configuration, create a symbolic link to work around the differences. 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 GRID_HOME=/u01/app/oracle/product/19.0.0/grid export ORACLE_HOME=/u01/app/oracle/product/19.0.0/NTAP alias asm='export ORACLE_HOME=$GRID_HOME;export PATH=$PATH:$GRID_HOME/bin;export ORACLE_SID=+ASM'
|
Ensure that asm_diskstring configuration parameter at DB clone host includes all cloned volumes NFS mount points and directory paths to the disk devices. |
Playbook execution
Details
There are total of two playbooks to execute Oracle database clone lifecycle. DB clone or refresh can be executed on-demand or scheduled as a crontab job.
-
Install Ansible controller prerequisites - one time only.
ansible-playbook -i hosts ansible_requirements.yml
-
Create and refresh clone database on-demand or regularly from crontab with a shell script to call the clone or refresh playbook.
ansible-playbook -i oracle_clone_asm_gcnv.yml -u admin -e @vars/vars.yml
0 */2 * * * /home/admin/na_oracle_clone_gcnv/oracle_clone_asm_gcnv.sh
To clone any additional databases, create a separate oracle_clone_n_asm_gcnv.yml and oracle_clone_n_asm_gcnv.sh. Configure the Ansible target hosts, global vars.yml, and hostname.yml file in host_vars directory accordingly.
|
The execution of toolkit at various stages pauses to allow a particular task to complete. For example, it pauses for two minutes to allow DB volumes clone to complete. In general, the default should be sufficient but the timing may need adjustment for unique situation or implementation. |
Where to find additional information
To learn more about the NetApp solution automation, review the following website NetApp Solution Automation^