Skip to content

Pythia – An Oracle DB Automation Story – Chapter 2 – Install RDBMS and Database

The most basic Feature of Pythia is, to install an Oracle Database RDBMS on a Linux machine of your choice. The RDBMS Installation will most likely be combined with other Tasks (TAGs) you want to have done by Pythia. Beside the RDBMS, we will build us an Oracle Database in this article. All done by one line of command.

But let’s start where it begins. When you first time use Pythia, you need to setup several things. This is a one-time task, so don’t get scared. By the way, if you haven’t read the first chapter of this series, have a look here.

  1. Clone the Repository to your Ansible Controlserver: git clone https://github.com/theoracleme/pythia.git
  2. Setup a Fileshare, that includes the Oracle Software you want to install and mount it to the Ansible Controlserver.
  3. Configure the Fileshare as “Staging Area” by changing the “local_stage_directory” variable in the vars/main.yml
  4. Configure all Variables fitting your environment. A description for all Variables can be found in the Roles README.md or the vars/main.yml File.
  5. Configure the vars/rdbms_dict.yml, vars/patch_dict.yml and vars/sid_directories.yml to suite your needs. A description for all Variables can be found in the Dictionary File or the README.md. Further informations about what to change, can also be found in the INSTALL.md. There is an EXAMPLE file for every dictionary in the vars folder.
  6. The same applies to the Template Files you can find under the templates folder. When you plan to install an RDBMS, you have to get a templates/<VERSION>_Database.rsp.j2 file configured. If you want to have detailed informations, you can find them in the INSTALL.md as well.
  7. Define your Hosts or Hostgroups in the Ansible Host Inventory. (e.G. hosts)
  8. Place User-Defined SQL Scripts under the files/default directory of the Role.

All done? Great, then let’s move on. You have to know, that Pythia relates on so called Ansible TAGs. I have used TAGs, to differ between the according usecase, you want to have fulfilled by Pythia. So in this article, where we want to have the RDBMS and a Database installed, we will use the rdbms and the db TAG. Because we want to have another Release Update (RU) installed than the base release of Oracle, we also have to specify the patch TAG.

Attention: When you specify the patch TAG for an already installed RDBMS Version, Pythia will do as you ask and implicitly shutdown all running databases on this RDBMS, patch the RDBMS, the database and start it all back up again. But this is a whole other chapter.

Beside the TAGs, you may or may not specify so called “Extra Variables”. Consider an “Extra Variable” as the parameters you can adjust to your needs to get everything installed like you want to have it. You are always able to define the variables also in the vars/main.yml or the defaults/main.yml. I promise you, there is one for everything 🙂 .

But what will Pythia actually do for you when you specify the rdbms and db TAG? Here is a list of all the things, Pythia will take care of.

  • Ensure that OS User and Group exist. If not, Pythia will create them with a random Password
  • Ensure that all needed Directories are created to install the Software in (specified in the vars/rdbms_dict.yml)
  • Ensure that all needed OS Packages are installed. Be aware, you need access to a Repository here!
  • Check and set all needed Kernel Parameter (Shared Memory Configuration and also Hugepages if you specified the TAG hugepage)
  • Restarts the System to disable Transparent Hugepages (when hugepage TAG is specified and you acknowledged the Reboot)
  • Set the Security Limits (ulimit) of the System
  • Setup an Environment Script for the Oracle OS User which will be executed when you su to the Oracle User
  • Install the Database Software in the specified release to the specified location (see the rdbms_dict.yml and sid_directories.yml)
  • Install the specified Release Update (RU) on top of that RDBMS (you need to have the patch_id defined in the patch_dict.yml)
  • Build a database with the specified Parameters on top of that RDBMS (see the template <VERSION>Database.rsp.j2 and the defaults/main.yml + vars/main.yml)

So finally, let’s get started. Let’s say, we want to have Oracle 19c Enterprise Edition with the Release Update 9 installed. On top of this RDBMS, we want to have build up a Database with the name ORA19. We want to have the database with an SGA size of 4GB.

ansible-playbook /etc/ansible/roles/pythia/pythia.yml -e "HOSTS=vmsrvansibletest" --
tags "rdbms, db, patch" -e "oracle_sid=ORA19 oracle_version=19EE install_patch=31771877 sga_max_size=4" -k -K -u username

SSH password:
BECOME password[defaults to SSH password]:
PLAY [vmsrvansibletest] ************************************************************************************************

TASK [Gathering Facts] *************************************************************************************************
[WARNING]: Platform linux on host vmsrvansibletest is using the discovered Python interpreter at /usr/bin/python, but
future installation of another Python interpreter could change this. See
https://docs.ansible.com/ansible/2.9/reference_appendices/interpreter_discovery.html for more information.
ok: [vmsrvansibletest]

TASK [roles/pythia : Include SID Directory Variables] ******************************************************************
ok: [vmsrvansibletest]

TASK [roles/pythia : Include Patch Dictionary] *************************************************************************
ok: [vmsrvansibletest]

TASK [roles/pythia : Include RDBMS Dictionary] *************************************************************************
ok: [vmsrvansibletest]

TASK [roles/pythia : Include RPM Dictionary] ***************************************************************************
ok: [vmsrvansibletest]

TASK [roles/pythia : Include Client Dictionary] ************************************************************************
ok: [vmsrvansibletest]

TASK [roles/pythia : Setting Oracle Password Variables] ****************************************************************
ok: [vmsrvansibletest]

TASK [roles/pythia : Setting Default User Password Variable] ***********************************************************
ok: [vmsrvansibletest]

TASK [roles/pythia : Prechecks] ****************************************************************************************
included: /etc/ansible/roles/pythia/roles/pythia/tasks/precheck.yml for vmsrvansibletest

TASK [roles/pythia : Check if Oracle Version is defined] ***************************************************************
skipping: [vmsrvansibletest]

TASK [roles/pythia : Check if sga_max_size is defined] *****************************************************************
skipping: [vmsrvansibletest]

TASK [roles/pythia : Check if Patch ID is defined] *********************************************************************
skipping: [vmsrvansibletest]

TASK [roles/pythia : Check if Oracle SID is defined] *******************************************************************
skipping: [vmsrvansibletest]

TASK [roles/pythia : Check if EM Express Configuration is valid] *******************************************************
skipping: [vmsrvansibletest]

TASK [roles/pythia : Check if Listener Logging Configuration is valid] *************************************************
skipping: [vmsrvansibletest]

TASK [roles/pythia : Check if Management Pack Access Configuration is valid] *******************************************
skipping: [vmsrvansibletest]

TASK [roles/pythia : Check if specified Patch ID is in Dictionary] *****************************************************
skipping: [vmsrvansibletest]

TASK [roles/pythia : Check if specified RDBMS Version is in Dictionary] ************************************************
skipping: [vmsrvansibletest]

TASK [roles/pythia : Prerequisites] ************************************************************************************
included: /etc/ansible/roles/pythia/roles/pythia/tasks/prerequisites.yml for vmsrvansibletest

TASK [roles/pythia : Check if dba Group exsists] ***********************************************************************
ok: [vmsrvansibletest]

TASK [roles/pythia : Create dba Group] *********************************************************************************
changed: [vmsrvansibletest]

TASK [roles/pythia : Check if oracle User exsists] *********************************************************************
ok: [vmsrvansibletest]

TASK [roles/pythia : Create oracle User] *******************************************************************************
changed: [vmsrvansibletest]

TASK [roles/pythia : New oracle User Password] *************************************************************************
ok: [vmsrvansibletest] => {
    "msg": "User oracle has been created with password J<}ED&rS4BJ+gm_"
}

... LOTS OF MAGIC HAPPENS HERE!

TASK [roles/pythia : Be patient] ***************************************************************************************
ok: [vmsrvansibletest] => {
    "msg": "The next Step will take several Minutes to complete!"
}

TASK [roles/pythia : Copy Oracle Software Archive to Staging Area /oracle/sources] *************************************
changed: [vmsrvansibletest]
TASK [roles/pythia : Unpack Oracle Software to Oracle Home Location] ***************************************************
changed: [vmsrvansibletest]

TASK [roles/pythia : Cleanup Staging Area] *****************************************************************************
changed: [vmsrvansibletest]

TASK [roles/pythia : Setup Oracle DB Software Response File] ***********************************************************
changed: [vmsrvansibletest]

TASK [roles/pythia : Create oraInst.loc] *******************************************************************************
skipping: [vmsrvansibletest]

TASK [roles/pythia : Install Oracle Database Software] *****************************************************************
changed: [vmsrvansibletest]

TASK [roles/pythia : Install Oracle Database Software on RedHat / OEL / CentOS = 8 Releases] ***************************
skipping: [vmsrvansibletest]

TASK [roles/pythia : Execute root Skripts] *****************************************************************************
changed: [vmsrvansibletest] => (item=/bin/sh /oracle/oraInventory/orainstRoot.sh)
changed: [vmsrvansibletest] => (item=/bin/sh /oracle/product/19_ENT/root.sh)

TASK [roles/pythia : Patching RDBMS / DB with Patch 31771877] **********************************************************
included: /etc/ansible/roles/pythia/roles/pythia/tasks/install_patch.yml for vmsrvansibletest

... SOME MORE MAGIC

TASK [roles/pythia : Deploy needed OPATCH Version] *********************************************************************
changed: [vmsrvansibletest]

TASK [roles/pythia : Copy Oracle Patch Archive to Staging Area /oracle/sources] ****************************************
changed: [vmsrvansibletest]

TASK [roles/pythia : Unzip Patch in Remote Stage Directory] ************************************************************
changed: [vmsrvansibletest]

TASK [roles/pythia : Cleanup Staging Area] *****************************************************************************
changed: [vmsrvansibletest]

TASK [roles/pythia : Check if Patch is compatible with installed RDBMS] ************************************************
changed: [vmsrvansibletest]

TASK [roles/pythia : Analyze Opatch prereq result] *********************************************************************
skipping: [vmsrvansibletest]

TASK [roles/pythia : Gather Listeners running on Oracle Home /oracle/product/19_ENT] ***********************************
changed: [vmsrvansibletest]

TASK [roles/pythia : Gather Databases running on Oracle Home /oracle/product/19_ENT] ***********************************
changed: [vmsrvansibletest]

TASK [roles/pythia : Listeners found] **********************************************************************************
skipping: [vmsrvansibletest]

TASK [roles/pythia : Databases found] **********************************************************************************
skipping: [vmsrvansibletest]

TASK [roles/pythia : Stopping all Listeners on Oracle Home /oracle/product/19_ENT] *************************************

TASK [roles/pythia : Stopping all Databases on Oracle Home /oracle/product/19_ENT] *************************************

TASK [roles/pythia : Apply Patch 31771877] *****************************************************************************
changed: [vmsrvansibletest]

... AND ONCE MORE... MAGIC!

TASK [roles/pythia : Create Database ORA19 with dbca] ******************************************************************
changed: [vmsrvansibletest]

TASK [roles/pythia : Setting SYS and SYSTEM Password after Creation] ***************************************************
changed: [vmsrvansibletest] => (item=echo -e "alter user system identified by "e20KfcQ9oMsS6bE";" | /oracle/product/19_ENT/bin/sqlplus -s / as sysdba)
changed: [vmsrvansibletest] => (item=echo -e "alter user system identified by "e20KfcQ9oMsS6bE";" | /oracle/product/19_ENT/bin/sqlplus -s / as sysdba)

TASK [roles/pythia : Print SYS and SYSTEM Users Password] **************************************************************
ok: [vmsrvansibletest] => {
    "msg": [
        "User SYS has been created with password e20KfcQ9oMsS6bE",
        "User SYSTEM has been created with password e20KfcQ9oMsS6bE"
    ]
}

TASK [roles/pythia : Gather Default DB Users for setting Password] *****************************************************
changed: [vmsrvansibletest]

TASK [roles/pythia : Setting Password for Default DB Users] ************************************************************
changed: [vmsrvansibletest] => (item=)
changed: [vmsrvansibletest] => (item=OUTLN)
changed: [vmsrvansibletest] => (item=XS$NULL)
changed: [vmsrvansibletest] => (item=SYS$UMF)
changed: [vmsrvansibletest] => (item=GGSYS)
changed: [vmsrvansibletest] => (item=DBSNMP)
changed: [vmsrvansibletest] => (item=GSMADMIN_INTERNAL)
changed: [vmsrvansibletest] => (item=XDB)
changed: [vmsrvansibletest] => (item=WMSYS)
changed: [vmsrvansibletest] => (item=DBSFWUSER)
changed: [vmsrvansibletest] => (item=APPQOSSYS)
changed: [vmsrvansibletest] => (item=ORACLE_OCM)
changed: [vmsrvansibletest] => (item=GSMCATUSER)
changed: [vmsrvansibletest] => (item=SYSDG)
changed: [vmsrvansibletest] => (item=SYSKM)
changed: [vmsrvansibletest] => (item=REMOTE_SCHEDULER_AGENT)
changed: [vmsrvansibletest] => (item=SYSBACKUP)
changed: [vmsrvansibletest] => (item=DIP)
changed: [vmsrvansibletest] => (item=SYSRAC)
changed: [vmsrvansibletest] => (item=AUDSYS)
changed: [vmsrvansibletest] => (item=GSMUSER)

TASK [roles/pythia : Print Default DB User Password] *******************************************************************
ok: [vmsrvansibletest] => {
    "msg": [
        "All Default DB Users are created with password VnqufuRALzajdOE"
    ]
}

TASK [roles/pythia : Gather Listeners running on Oracle Home /oracle/product/19_ENT] ***********************************
changed: [vmsrvansibletest]

TASK [roles/pythia : Create Listener LSNR_ORA19 on Port 1521] **********************************************************
changed: [vmsrvansibletest]

TASK [roles/pythia : Create Listener LSNR_ORA19 on Port 1521] **********************************************************
skipping: [vmsrvansibletest]

TASK [roles/pythia : Create tnsnames.ora] ******************************************************************************
changed: [vmsrvansibletest]

TASK [roles/pythia : Create tnsnames.ora] ******************************************************************************
skipping: [vmsrvansibletest]

TASK [roles/pythia : Start Listener LSNR_ORA19] ************************************************************************
changed: [vmsrvansibletest]

TASK [roles/pythia : Marking sysctl Configuration as stable] ***********************************************************
changed: [vmsrvansibletest]

TASK [roles/pythia : Finished Pythia] **********************************************************************************
ok: [vmsrvansibletest] => {
    "msg": "Pythia has finished successfully"
}

I haven’t copied the whole output here, it’s way to much that happens under the hood. But as you can see, Pythia will for instance check, if the dba group and the specified oracle user exists. They don’t and therefor, they will get created with a cryptic password. Later, the Oracle software will get copied from our Ansible control host to the host, where we want to install the software on. It will get installed and after that, patched. When all is done, our database is getting build.

Wasn’t that hard to get it running or was it? Let me tell you some more stuff what you can configure when installing the software and build the database. As already mention above, you may combine the db TAG with the hugepage TAG. Then Pythia will do everything, to setup an according amount of hugepages on your system. I strongly recommend you to do so, it’s a performance gift with no effort behind. Also you can specify the PGA size by using the pga_aggregate_target parameter. Also the character set, the Listener port and the EM Express are configurable. You want to use Autoextend? No problem too.

I hope you liked what you have seen, don’t hesitate to raise your questions here.

Philip

1 thought on “Pythia – An Oracle DB Automation Story – Chapter 2 – Install RDBMS and Database”

  1. Pingback: Pythia – An Oracle DB Automation Story – Chapter 1 – The Database Me

Leave a Reply

Your email address will not be published. Required fields are marked *