Automating JDA WMS Environment DevOps — database refresh

Working on JDA WMS for the last 4 years has taught me a lot. Once you understand the architecture of JDA WMS Application, some tasks become menial and repetitive. So why not write scripts around it and spend time in automating such tasks?

Some examples can be:

  1. You are working on developing a cumulative rollout for a client or distribution site or database conversion for an upgrade and would like to rollback the entire database and application. Though the rollout process in itself is automated and takes only a couple of minutes at the most. But if you ever have to rollback from a rollout, it takes time — especially when there are database changes. While this cannot be done easily in Production systems unless you have Oracle Enterprise Edition with flashback enabled, but it is very easy to do for a lower environment like Unit Test.
  2. You need to set up a new environment for testing — Cloning an environment.
  3. Refresh a lower environment from Production
  4. Cloning a database in SQL Server or Schema in Oracle.
  5. Stopping/Starting MOCA and Portal Services

Today, I will give you a simple example of refreshing a database in SQL Server 201x. In larger organizations, you generally have to raise a ticket in ServiceNow (or any other ticketing tool), get approval and then the relevant resource or team performs the task. At a minimum, this task that takes a maximum of 5–10 minutes to perform will now take 2–3 days for a developer — depending on the workload of the database team. To me, that is 2–3 days wasted. So why not automate such processes and make life easier for developers and technical consultants?

Initially, the script validates if the WM and Portal services are running before dropping and restoring the database from backup.

Then the script drops the database, restores from backup.

In the end, the script catches any errors and report to the user.

You can even go a step ahead with this script and add the stop/start MOCA and Portal services functionality to fully automate it. This script took me less than a day to create from start to end, but now saves developers a lot of time during their testing. Hopefully, I have intrigued you enough to do something similar.