DevOps Series: Automate Of Oracle 19c RAC Release Update from 19.3 to 19.4 Using Ansible — Part IV
By: Monowar Mukul
Tags: Databas, DevOps, Oracledevs, Oracle, Ansible

DevOps Series: Automate Of Oracle 19c RAC Release Update from 19.3 to 19.4 Using Ansible — Part IV

GITHUB Link: https://github.com/asiandevs/GI_19cSoftInstall

Introduction

As part of a series of articles on RAC with ansible, In this article, we will see how to automate the Oracle 19c RAC release update from 19.3 to 19.4 which is the latest release update using Ansible.

What is an RU?

An RU is a Release Update which initially introduced in Oracle 12.2 In 2017 as an alternate or new name of Bundle patch and where proactive bundle patch named Release Update Revisions.

(Example Oracle Database Patch 29708769 — GI Release Update 19.4.0.0.190716)

Assume that we have already covered the below topics prior to release an update.

There are three main sections for the master playbook ru_1903_1904.yml

Figure: role racdb_patch_apply

The tree structure for this role is as below — [root@oel75 ansible]# tree roles/racdb_patch_apply

roles/racdb_patch_apply

├── defaults

│ └── main.yml

├── files

│ └── sqlpatchinfo.sql

├── tasks

│ ├── compile_inv_obj.yml

│ ├── create_dirs.yml

│ ├── datapatch_dbs.yml

│ ├── list_dbs.yml

│ ├── main.yml

│ ├── opatch_conflict_check.yml

│ ├── opatch_inventory_check.yml

│ ├── opatch_lspatches_beforeapply.yml

│ ├── opatch_systemspace_check.yml

│ ├── postpatch_apply.yml

│ ├── prepatch_apply.yml

│ ├── restsrt_cluster_frstnode.yml

│ ├── restsrt_cluster_secnode.yml

│ ├── ru_frstnode_gindb.yml

│ ├── ru_secnode_gindb.yml

│ ├── start_db_withcrs.yml

│ ├── start_db_withsqlplus.yml

│ ├── unzip_patch.yml

│ ├── update_opatch.yml

│ └── verify_patch_apply.yml

├── templates

│ ├── patch_list_dbhome.txt.j2

│ └── patch_list_gihome.txt.j2

└── vars

└── main.yml 5 directories, 25 files

For this article, the variables are used as below —

[root@oel75 ansible]# cat roles/racdb_patch_apply/vars/main.yml

— - oracle_user: “oracle”

oracle_install_group: “oinstall”

oraInventory: /u02/app/oraInventory

patch_unzipdir: “/u01/patches”

patch_dir: “/u01/patches/{{ patchid }}”

patcha_dir: “/u01/patches/{{ patchid }}/{{ gipatchid }}”

patchid: “29699097”

gipatchid: “29708769”

tmp_dir: “/u02/app/temp”

logdir: “/tmp/{{ patchid }}”

oracle_home: “/u02/app/oracle/product/19.4/db300”

grid_home: “/u02/app/19.4/grid”

patch_stage_dir: “/u01/stage”

stage_dir: “/u02/stage”

root_user: “root”

grid_user: “grid”

date: “{{ lookup(‘pipe’, ‘date +%Y%m%d-%H%M’) }}”

The main paybook for this role is as below —

[root@oel75 ansible]# cat roles/racdb_patch_apply/tasks/main.yml

— -

######################################################################################

# Summary Steps:

# Assumption:

# — required patches are downloaded and staged [ex: this case patch stage directory]

# — This case we are patching non-rolling and GI home and RAC home separately

# 1) execute pre-patch apply tasks

# 2) Apply GI RU

#######################################################################################

— name: display pre GI RU message

debug:

msg:

— ‘This playbook is for Oracle Database Patch — GI Release Update of Oracle 19.3 to 19.4 started at {{ansible_date_time.iso8601}}:’ - name: Run pre-tasks before apply

include: prepatch_apply.yml

tags: pre_tasks_before_apply - name: RAC Patching | RU to grid home and db home on first node (opatchauto)

include_tasks: ru_frstnode_gindb.yml - name: Restart cluster first node after applying RU

include_tasks: restsrt_cluster_frstnode.yml - name: RAC Patching | Pause after GI patching completion on first node

pause: prompt=”Verify First Node — Everything running OK or NOT.” minutes=10 - name: RAC Patching | RU to grid home and db home on second node (opatchauto)

include_tasks: ru_secnode_gindb.yml - name: Restart cluster second node after applying RU

include_tasks: restsrt_cluster_secnode.yml - name: Run post-tasks after patch

include: postpatch_apply.yml

tags: post_tasks_after_apply - name: Remove stage directory

remote_user: “{{ root_user }}”

file:

path: “{{ item }}”

state: absent

with_items:

— “{{ stage_dir }}” - name: display post GI RU message

debug:

msg:

— ‘This completed below task for RAC database at {{ansible_date_time.iso8601}}:’

— ‘Oracle Database Patch — GI Release Update of Oracle 19.3 to 19.4 task completed successfully’

— ‘END OF ALL: git repository of “gi_ru_1903_1904” will be shared’

We separated three main sections, first prerequisite tasks, the second section is mainly for applying a patch and the third section is for the datapatch and post patch validation.

First section:

This section includes all the Prerequisites tasks for Installing Oracle Database Patch.

Prerequisites:

i) Ensure you have downloaded the latest OPatch as per the readme file and the required database patch ( for this article — we used Oracle Database Patch 29708769 — GI Release Update 19.4.0.0.190716).

ii) Confirm the Oracle inventory is OK.

iii) Unzip the downloaded patch zip file.

iv) Execute Conflict Checker to detect and resolve any conflicts.

[root@oel75 tasks]# cat prepatch_apply.yml

— -

######################################################################################

# Summary Steps:

# Assumption:

# — required patches are downloaded and staged [ex: this case patch stage directory]

# — This case we are patching non-rolling and GI home and RAC home separately

# i) Update OPatch utility version

# ii) Validation of Oracle Inventory

# iii) Unzip the patch zip file

# iv) OPatch Conflict Check

# v) OPatch SystemSpace Check

#######################################################################################

- name: Preparation tasks for apply Oracle GI RU

block:

— import_tasks: create_dirs.yml

— import_tasks: update_opatch.yml

— import_tasks: unzip_patch.yml

— import_tasks: opatch_conflict_check.yml

— import_tasks: opatch_systemspace_check.yml

— import_tasks: opatch_inventory_check.yml

— import_tasks: opatch_lspatches_beforeapply.yml

become: yes

become_user: root

tags:

— ru_prepatch

Please read the README.html file which is in each top-level sub dir that identifies type (DB or OJVM).