{"id":21526395,"url":"https://github.com/netapp/na_ora_hadr_failover_resync","last_synced_at":"2025-03-17T18:34:22.813Z","repository":{"id":110130508,"uuid":"501292130","full_name":"NetApp/na_ora_hadr_failover_resync","owner":"NetApp","description":"This toolkit automate Oracle database failover from primary to standby or resync between primary and standby after HA or DR exercise","archived":false,"fork":false,"pushed_at":"2022-06-08T15:57:22.000Z","size":135,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-24T05:41:47.433Z","etag":null,"topics":["netapp-public"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/NetApp.png","metadata":{"files":{"readme":"READme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.TXT","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2022-06-08T14:44:13.000Z","updated_at":"2024-01-29T17:39:51.000Z","dependencies_parsed_at":"2023-04-18T04:17:50.634Z","dependency_job_id":null,"html_url":"https://github.com/NetApp/na_ora_hadr_failover_resync","commit_stats":null,"previous_names":["netapp/na_ora_hadr_failover_resync"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NetApp%2Fna_ora_hadr_failover_resync","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NetApp%2Fna_ora_hadr_failover_resync/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NetApp%2Fna_ora_hadr_failover_resync/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NetApp%2Fna_ora_hadr_failover_resync/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NetApp","download_url":"https://codeload.github.com/NetApp/na_ora_hadr_failover_resync/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244089403,"owners_count":20396246,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["netapp-public"],"created_at":"2024-11-24T01:44:48.844Z","updated_at":"2025-03-17T18:34:22.793Z","avatar_url":"https://github.com/NetApp.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"na_ora_hadr_failover_resync\r\n=========\r\n\r\nThis toolkit is developed to automate the tasks of setting up and managing a HR/DR environment for Oracle database deployed in AWS public cloud with FSx storage and EC2 compute instance. The toolkit delivers the following key functions:\r\n\r\n- Setup HA/Dr target host: kernal configuration, Oracle configuration to match up with source server host\r\n\r\n- Setup ONTAP: cluster peering, vserver peering, Oracle volumes snapmirror setup from Primary to DR\r\n\r\n- Backup Oracle database data via snapshot: execute off crontab\r\n\r\n- Backup Oracle database archive log via snapshot: execute off crontab\r\n\r\n- Run failover and recovery on HA/DR host: test and validate HA/DR \r\n\r\n- Run resync after failover test: re-establish database volumes snapmirror in HA/DR mode\r\n\r\nLicense\r\n-------\r\n\r\nBy accessing, downloading, installing or using the content in this repository, you agree the terms of the License laid out in [License](LICENSE.TXT) file.\r\n\r\nNote that there are certain restrictions around producing and/or sharing any derivative works with the content in this repository. Please make sure you read the terms of the [License](LICENSE.TXT) 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.\r\n\r\nRequirements\r\n------------\r\n\r\n    Ansible v.2.10 and higher\r\n    ONTAP collection 21.19.1\r\n    Python 3\r\n    Python libraries:\r\n      netapp-lib\r\n      xmltodict\r\n      jmespath\r\n  \r\n    AWS FSx storage as is available\r\n  \r\n    AWS EC2 Instnace\r\n      RHEL 7/8, Oracle Linux 7/8\r\n      Network interfaces for NFS, public (internet) and optional management\r\n      Existing Oracle environment on source, and the equivalent Linux operating system at the destination (DR or HA)\r\n  \r\nGlobal variables configuration\r\n------------ \r\n\r\nThe Ansible playbooks are variable driven. An example global variable file fsx_vars_example.yml is included to demonstrate typical configuration. Following are key considerations: \r\n\r\n    ONTAP - retrieve FSx storage parameters using AWS FSx console when both source and target FSx cluster are deployed.\r\n      cluster name: source/destination\r\n      cluster management IP: source/destination\r\n      inter-cluster IP: source/destination\r\n      vserver name: source/destination\r\n      vserver management IP: source/destination\r\n      NFS lifs: source/destination\r\n      cluster credentials: fsxadmin and vsadmin pwd to be updated in roles/ontap_setup/defaults/main.yml file\r\n  \r\n    Oracle database volumes - they should have been created from AWS FSx console, volume naming should follow strictly with following standard: \r\n      Oracle binary: {{ host_name }}_bin, generally one lun/volume\r\n      Oracle data: {{ host_name }}_data, can be multiple luns/volume, add additonal line for each additional lun/volume in variable such as {{ host_name }}_data_01, {{ host_name }}_data_02 ..., the code can handle multiple data lun/volume without change\r\n      Oracle log: {{ host_name }}_log, can be multiple luns/volume, add additonal line for each additional lun/volume in variable such as {{ host_name }}_log_01, {{ host_name }}_log_02 ..., the code can handle multiple data lun/volume without change\r\n  \t  host_name: as defined in hosts file in root directory, the code is written to be specifically matched up with host name defined in host file.\r\n      \r\n    Linux and DB specific global variables - keep as it is.\r\n      Enter redhat subscription if you have one, otherwise leave it black.\r\n       \r\nHost variables configuration\r\n---------\r\n\r\nHost variables are defined in host_vars directory named as {{ host_name }}.yml\r\n\r\n    Oracle - define host specific variables when deploying Oracle in multiple hosts concurrently\r\n      ansible_host: IP address of database server host\r\n      log_archive_mode: enable archive log archiving (true) or not (false)\r\n      oracle_sid: Oracle instance identifier\r\n      pdb: default deployment of Oracle in containerized configuration, name pdb_name string and number of pdbs (Oracle allow 3 pdbs free of multitenant license fee)\r\n      listener_port: Oracle listener port, default 1521\r\n      memory_limit: set Oracle SGA size, normally up to 75% RAM\r\n      host_datastores_nfs: combining of all Oracle volumes (binary, data, and log) as defined in global vars file. If multi luns/volumes, keep exactly the same number of luns/volumes in host_var file\r\n    \r\n    Linux:\r\n      hugepages_nr: set hugepage for large DB with large SGA for performance\r\n      swap_blocks: AWS EC2 instance specific, add swap space to EC2 instance. If swap exist, it will be ignored.\r\n      \r\nDB server host configuration\r\n---------\r\n\r\n    Server name - AWS EC2 instance use IP address as host naming by default. If you use different name in hosts file for Ansible, setup host naming resolution in /etc/hosts file for both source and target server\r\n      127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4\r\n      ::1         localhost localhost.localdomain localhost6 localhost6.localdomain6\r\n      172.30.15.96 db1\r\n      172.30.15.107 db2\r\n      \r\nPlaybook Execution - executed in sequence\r\n---------\r\n\r\n    Install Ansible controller prerequsites:\r\n    \r\n      ansible-playbook -i hosts requirements.yml -u ec2-user --private-key db1.pem -e @vars/fsx_vars.yml\r\n      ansible-galaxy collection install -r collections/requirements.yml --force\r\n      \r\n    Setup HA/Dr target host:\r\n     \r\n      ansible-playbook -i hosts ora_dr_setup.yml -u ec2-user --private-key db2.pem -e @vars/fsx_vars.yml\r\n      \r\n    Setup ONTAP:\r\n    \r\n      ansible-playbook -i hosts ontap_setup.yml -u ec2-user --private-key db2.pem -e @vars/fsx_vars.yml\r\n      \r\n    Backup Oracle database data via snapshot:\r\n      \r\n      10 * * * * cd /home/admin/na_ora_hadr_failover_resync \u0026\u0026 /usr/bin/ansible-playbook -i hosts ora_replication_cg.yml -u ec2-user --private-key db1.pem -e @vars/fsx_vars.yml \u003e\u003e logs/snap_data_`date +\"%Y-%m%d-%H%M%S\"`.log 2\u003e\u00261\r\n    \r\n    Backup Oracle database archive log via snapshot:\r\n    \r\n      0,20,30,40,50 * * * * cd /home/admin/na_ora_hadr_failover_resync \u0026\u0026 /usr/bin/ansible-playbook -i hosts ora_replication_logs.yml -u ec2-user --private-key db1.pem -e @vars/fsx_vars.yml \u003e\u003e logs/snap_log_`date +\"%Y-%m%d-%H%M%S\"`.log 2\u003e\u00261\r\n    \r\n    Run failover and recovery on HA/DR host: test and validate HA/DR:\r\n    \r\n      ansible-playbook -i hosts ora_recovery.yml -u ec2-user --private-key db2.pem -e @vars/fsx_vars.yml\r\n    \r\n    Run resync after failover test: re-establish database volumes snapmirror in HA/DR mode\r\n    \r\n      ansible-playbook -i hosts ontap_ora_resync.yml -u ec2-user --private-key db2.pem -e @vars/fsx_vars.yml\r\n          \r\nHelp\r\n---------\r\n\r\nIf you need help with this solution and use cases, please join the [NetApp Solution Automation community support Slack channel](https://netapppub.slack.com/archives/C021R4WC0LC) and look for the solution-automation channel to post your questions or inquires.\r\n      \r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnetapp%2Fna_ora_hadr_failover_resync","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnetapp%2Fna_ora_hadr_failover_resync","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnetapp%2Fna_ora_hadr_failover_resync/lists"}