Oracle Analytics Cloud Service (Essbase) has a handy command line interface that’s useful for remote execution of Essbase and system type functions such as running a backup. This short article is simply a means to share a script that I use to run a simple Lifecycle Manager extract of one Essbase application. This works well for smaller applications, however, you may want to make some changes for larger Essbase applications – specifically with regards to the data export. I have been using this simple batch file for weeks to run a quick backup of our application prior to making a change that could cost me a bunch of time to recover from. When the script completes, you will have a Zip of your application and data on the machine you run this from.
First things first though. Here’s a summary of prerequisites you need to complete before you can run a batch file that uses the Essbase CLI.
- Download and install the latest Oracle Java Development Kit (JDK). I used the default installation path.
- Download and unzip the Essbase CLI.
- Modify this script. I’ll point out with remarks lines that you should change.
::***************************************************************
::* Script Name: backupOACS.bat
::* Author: C Dunn, Perficient, Inc
::* Date: 2017/08/25
::* Description: Exports all artifacts and data from the
::* OACS FinRpt application to the path specified
::* in the variables.
::***************************************************************
:: Set the JAVA_HOME to the path the JDK was installed.
SET JAVA_HOME=C:\Program Files\Java\jdk1.8.0_144
:: Set the CLI_PATH to the location the Essbase CLI was unzipped to.
SET CLI_PATH=C:\MyScripts\CommandLineInterface
:: Output is captured and logged. This path can be changed to the location you want a log file.
SET LOG_PATH=C:\MyScripts\Logs\backupDev.log
SET TODAYSDATE=%date:~10,4%-%date:~4,2%-%date:~7,2%
:: Extracted artifacts and data will zipped on the OACS server then downloaded to the EXPORT_PATH.
Guide to Oracle Cloud: 5 Steps to Ensure a Successful Move to the Cloud
Explore key considerations, integrating the cloud with legacy applications and challenges of current cloud implementations.
SET EXPORT_PATH=C:\MyScripts\Backups
:: Set the file name. I usually include the date in the file name so
:: I can schedule the script to run once per day.
SET ZIP_NAME=FinRpt_%TODAYSDATE%.zip
:: The URL is the URL for the OACS Essbase instance you will be connecting to. Replace <IPADDRESS> with the IP of your instance.
SET URL=https://<IPADDRESS>/essbase
:: Set the USR and PW to an OACS Essbase account and password with administrator privileges.
SET USR=<ADMINISTRATOR>
SET PW=<PASSWORD>
:: Set the name of the application you will be exporting.
SET APP=FinRpt
ECHO %CLI_PATH%>%LOG_PATH%
ECHO %TODAYSDATE%>>%LOG_PATH%
ECHO %EXPORT_PATH%>>%LOG_PATH%
ECHO %ZIP_NAME%>>%LOG_PATH%
ECHO %URL%>>%LOG_PATH%
ECHO %USR%>>%LOG_PATH%
ECHO %APP%>>%LOG_PATH%
ECHO %JAVA_HOME%>>%LOG_PATH%
ECHO .
CD %CLI_PATH%
:: CALL is required because ESSCS prevents further execution in the same process.
:: Use the Essbase CLI to log in to the OACS Essbase instance.
CALL esscs login -user %USR% -password %PW% -url %URL% >>%LOG_PATH%
:: Use the Essbase CLI to execute an LCM export of the application specified. –skipdata false is used to include data in the export. You may want to change the value to true if you have a large application.
esscs lcmexport -application %APP% -skipdata false -zipFileName %ZIP_NAME% -overwrite true -localDirectory %EXPORT_PATH% >>%LOG_PATH%
esscs logout >>%LOG_PATH%