Oracle Grid Release Update by using Ansible Playbooks

Ansible is a friend in need and a friend indeed for DBAs.

In this blog post, I will mention about Redhat Ansible and show how you can patch your grid infrastructure by using it.

Ansible is an open source, command-line IT automation software application written in Python. It can configure systems, deploy software, and orchestrate advanced workflows to support application deployment, system updates, and more. Ansible's main strengths are simplicity and ease of use. It is a little bit similar to dcli commands in Exadata environments, but much more powerful as you may run playbooks which consist of different tasks.

Ansible stands out from other configuration management tools because it doesn't need agents installed on target hosts. Instead, it leverages SSH for connecting to them and executes commands directly through the shell. This means Ansible communicates with remote hosts securely using SSH, eliminating the need for additional software on the managed machines. It's like having a conversation with someone directly rather than going through intermediaries. This simplicity and efficiency make Ansible easy to deploy and use across a wide range of environments.

Oracle patching using Redhat Ansible

In this post, 

I will use blt01 host as the ansible host. Target environment is a two node cluster. (gns01, gns02). I will patch grid software to 19.22 by using out-of-place methodology with no down time. 

Although, there are lots of useful blog posts about how you may use Ansible for automating tasks, there is not much about a complete Oracle Grid Software patching. 

Ansible is simply installed by "yum install ansible"  from EPEL repository. Add your hosts(gns01, gns02) in the hosts file under /etc/ansible/hosts and create ssh equivalency for oracle and root users.

We need:

    * OPatch -  p6880880_122010_Linux-x86-64.zip

    * 19.22 RU - p35940989_190000_Linux-x86-64.zip (GIRU System Patch)

    * A sample one-off patch (555.1 Recommended) - p34672698_1922000DBRU_Linux-x86-64.zip

    * Grid home Setup - LINUX.X64_193000_grid_home.zip    

Lets start with creating new grid home directory. Here is the first playbook we will run.

As new grid homes are created on target servers, I will unzip 19.3 grid_home.zip and apply Release updates and one off patches on top of it with the below playbook.

Now we will tag new home in Oracle central inventory with the -switchGridHome command, run root.sh from new grid homes and grid software will be started on new grid_home on both nodes. Later we will copy the files we need from old grid_home to the new grid_home and update .bashrc file to use new grid_home values.

It is time to say goodbye to old grid homes. We will remove it by simply running deinstall command. This one is a little bit tricky, we will use expect module for replying prompt questions and here it is.

All grid softeare patching is complete. It is a wonderful example of automate-first approach. With this approach, you decrease chances of human error and increase productivity. 

-----------------------------

Revised on March 21, 2024;

I have incorporated valuable feedback and revised all my playbooks to adhere to some best practices.

Ensured that all tasks consistently refer to the same variables.

Improved the playbook's readability and formatting for better clarity.

Replaced some shell module commands with the cmd module for better compatibility and robustness.

Replaced unzip commands with the unarchive module for better management of archives.

Converted Ansible variables to lowercase for consistency and clarity.

Adopted the ansible.builtin format for built-in modules to ensure compatibility across different Ansible versions, enhance readability, future-proof playbooks, and prevent potential conflicts with custom or user-defined modules.

Also, consolidated all playbooks into a single file and included the playbook to initiate the recovery process (MRP) on standby databases as shown below.

Hope it helps.

Comments

  1. Where to find start_recover_onremote.sh ?

    ReplyDelete
    Replies
    1. I have just added. Also all scripts are available on my github repository.
      https://github.com/dincosman/Insane-DBAs-Backpack/tree/b904262fd322b25d9ba5057bac01b3c4e0941149/Database/Oracle/ansible%20playbooks

      Delete

Post a Comment

Popular posts from this blog

Using table stats hint to force a direct path read but with a rownum predicate surprise

Oracle Database Release Update by Using Ansible Playbooks