DEV Community

CloudDude
CloudDude

Posted on • Originally published at Medium on

Oracle 19c Data Guard builds on Rhel8 /Oracle linux8/Centos8 (Vagrant)

With Tools like Vagrant and virtualbox nowadays , developers can seamlessly re/create different environments for their apps by just checking vagrantfile definition, run a vagrant up, and start designing.

This is more a description of new vagrant builds I’ve been working on lately. They are based on the work that Tim hall started a while now on his Github. So hat tip to Tim, he’s done the hard work, I merely adapted the build to the new Enterprise linux 8 distros (rhel/centos/oracle linux) and made sure nothing bugged during each provisioning.

Oracle 19c database and Data Guard builds on RHEL8/OL8/CENTOS8

After forking his repo on github, I then started to adapt above Oracle 19c buildsto run on Red Hat 8 and Oracle linux 8. Centos 8 being left alone, I decided to include it to the rest of the pack :).

As I didn’t write a blog post for this . I thought it’d be convenient for the reader to have an excerpt of the builds’ descriptions (Readme files) before kicking it off and trying them.

Required Software

Clone Repository

Pick an area on your file system to act as the base for this git repository and issue the following command.

git clone [https://github.com/brokedba/vagrant.git](https://github.com/KoussHD/vagrant.git)
Enter fullscreen mode Exit fullscreen mode

You can also use Git GUI to clone it as shown below

I. Oracle 19c database on RHEL8:

Note: let’s pick rhel_19_gen directory which is a build that uses a generic rhel8 vagrant box. You could, however, choose any of the builds listed above as it works the same.

­­­­­¤¤ rhel_19_gen :README.md ¤¤

Oracle 19c on Red Hat Linux 8

A simple Vagrant build for Oracle Database 19c on Red hat linux 8.

Note: The vagrant box here is generic and will be provisioned with the prerequisite rpm packages for Oracle 19c through a RHEL8 Beta repository (see install_os_packages.sh for details).

Place the software in the “software” directory before calling the vagrant up command.

Directory contents when software is included.

$ tree . 
+--- README.md 
+--- scripts 
| +--- dbora.service 
| +--- install_os_packages.sh 
| +--- oracle_create_database.sh 
| +--- oracle_service_setup.sh 
| +--- oracle_software_installation.sh 
| +--- oracle_user_environment_setup.sh 
| +--- ords_software_installation.sh 
| +--- prepare_u01_u02_disks.sh 
| +--- root_setup.sh 
| +--- server.xml 
| +--- setup.sh 
+--- software 
| +--- apache-tomcat-9.0.22.tar.gz *optional 
| +--- apex_19.1_en.zip *optional 
| +--- LINUX.X64_193000_db_home.zip 
| +--- openjdk-12.0.2_linux-x64_bin.tar.gz *optional 
| +--- ords-19.2.0.199.1647.zip *optional 
| +--- put_software_here.txt 
| +--- sqlcl-19.2.1.206.1649.zip *optional 
+--- Vagrantfile $
Enter fullscreen mode Exit fullscreen mode

Locate the rhel_19_gen directory and the run the below vagrant command.

cd D:\VM\vagrant\database\rhel_19_gen vagrant up ..
Enter fullscreen mode Exit fullscreen mode

II. Oracle 19c Data Guard on CENTOS8:

Note: Here also I just chose one of the builds but they all work the same .

­­­­­¤¤ cent8_19:README.md ¤¤

Vagrant 19c Data Guard Build on Centos 8

Note: The vagrant base box of centos 8 is generic and will be provisioned with the prerequisite rpm packages for Oracle 19c from a centos repository during vagrant start.

The Vagrant scripts here will allow you to build a 19c Data Guard system on Centos 8. by just starting the VMs in the correct order.

This configuration is slightly modified comparing to Tim hall’s original build but the modification merely resides in the below environment variables values (that are easy to adapt to your liking) and two start/stop scripts.

export DOMAIN_NAME=evilcorp.com export NODE1_HOSTNAME=montreal export NODE2_HOSTNAME=toronto export NODE1_PUBLIC_IP=192.168.78.54 export NODE2_PUBLIC_IP=192.168.78.55 export ORACLE_SID=montreal export NODE1_DB_UNIQUE_NAME=montreal export NODE2_DB_UNIQUE_NAME=toronto export ROOT_PASSWORD=racattack export ORACLE_PASSWORD=oracle export SYS_PASSWORD="racattack" export PDB_PASSWORD="PdbPassword1!"
Enter fullscreen mode Exit fullscreen mode

You will also need to download the 19c database software.

Copy the Oracle software under the “dataguard/cent8_19/software” directory. From the “dataguard” subdirectory, the structure should look like this.

tree . 
+--- config 
| +--- install.env 
| +--- vagrant.yml 
+--- node1 
| +--- scripts 
| | +--- oracle_create_database.sh 
| | +--- oracle_user_environment_setup.sh 
| | +--- root_setup.sh 
| | +--- setup.sh 
| +--- Vagrantfile +--- node2 
| +--- scripts 
| | +--- oracle_create_database.sh 
| | +--- oracle_user_environment_setup.sh 
| | +--- root_setup.sh 
| | +--- setup.sh 
| +--- Vagrantfile 
+--- README.md 
+--- shared_scripts 
| +--- configure_chrony.sh 
| +--- configure_hostname.sh 
| +--- configure_hosts_base.sh 
| +--- configure_shared_disks.sh 
| +--- install_os_packages.sh 
| +--- oracle_db_software_installation.sh 
| +--- prepare_u01_disk.sh +--- software 
| +--- LINUX.X64_193000_db_home.zip 
| +--- put_software_here.tx
Enter fullscreen mode Exit fullscreen mode

Build the Data Guard System

The following commands will leave you with a functioning Data Guard installation.

Start the first node and wait for it to complete. This will create the primary database.

cd node1 vagrant up
Enter fullscreen mode Exit fullscreen mode

Start the second node and wait for it to complete. This will create the standby database and configure the broker.

cd ../node2 vagrant up
Enter fullscreen mode Exit fullscreen mode

Turn Off System

Perform the following to turn off the system cleanly. (Stop_all script will set state to apply-off or transport-off according to the role of the node’s DB before db shutdown)

On Node 1

oracle@# /home/oracle/scripts/stop_all.sh cd ../node2 vagrant halt
Enter fullscreen mode Exit fullscreen mode

On Node 2

oracle@# /home/oracle/scripts/stop_all.sh cd ../node1 vagrant halt
Enter fullscreen mode Exit fullscreen mode

Restart the System after first install and shutdown

Perform the following to turn on the system cleanly (start_all.sh script will run a startup if local DB role is Primary or startup mount if the local DB role is Standby).

cd node1 vagrant up oracle@# /home/oracle/scripts/start_all.sh cd node2 vagrant up oracle@# /home/oracle/scripts/start_all.sh
Enter fullscreen mode Exit fullscreen mode

Remove the whole System

The following commands will destroy all VMs and the associated files, so you can run the process again.

cd ../node2 vagrant destroy -f cd ../node1 vagrant destroy -f
Enter fullscreen mode Exit fullscreen mode

Originally published at https://www.linkedin.com.

Top comments (0)