Asynchronous Backup of Databases


As of Jedox 6.0 SR3, it is possible to use IDatabase.backup method inside a Jedox Integrator Server job of type Groovy to execute a backup of databases. Such a job can then be triggered or scheduled to be run on a regular basis to produce a database backups without the need to shutdown any of the services. Backup itself runs asynchronously in non-blocking mode, hence regular work should not be impacted provided enough system resources are available. For every database, a separate ZIP archive will be produced containing the database itself plus the System database. Both of these are in a committed state – all journals are processed and no archives are present in a zip file which, when used, speeds up startup times of the database server. Use the zip-backup OLAP parameter to influence the compression level used.

Assuming there is a connection of type Jedox called localhost_demo which points to database Demo, a bare minimum groovy script which backups Demo database to a file inside Data directory could look like this:

IDatabase db = OLAP.getDatabase("localhost_demo");

A more comprehensive script which backups all the databases for a specific connection and adds timestamp suffix to archive name is included in the Integrator Sample project “ETLTasks” in the setup, and looks similar to the code below:

// path to backup directory - data directory will be used if empty
String backupDirPath = "${BackupDirPath}";
// definition of helper function for backing up single DB
def backupDb(db, backupDirPath){
      // get current date/time
    Date dateNow = new Date();
    String newDate = dateNow.format( 'yyyyMMdd_HHmm' );
    // get suffix for backup file
    String suffix = "_" + newDate + ".zip";
      String dbN = db.getName();
      String fileName = backupDirPath + dbN + suffix; 
      if (dbN != "System")
      {"Starting backup of database: '" + dbN + "'.");"Trying to write filename: '" + fileName + "'.");
    "Finished backup of database: '" + dbN + "'.");
        catch (pExc)

IConnection conn = OLAP.getConnection("OlapTarget");
if (conn != null)
  for(IDatabase db:conn.getDatabases())
    backupDb (db, backupDirPath);
  LOG.error("No connection defined.");

It relies on at least the JedoxGlobal connection OlapTarget being properly set. By default, if the backupDirPath variable is not set, the backup job will write a ZIP file in the data directory of Jedox OLAP server; otherwise, the directory specified as a value for the backupDirPath variable is used. For this variable, forward slashes must be used as separators between directory names; backslashes are not allowed. The format of the archive name is <DB_NAME>_<DATE_TIME>.zip, e.g. Please note that the user running the Jedox OLAP Server service/process must have write access to the target directory to be able to create the output file.

Was this post helpful?
NoYes (+4 rating, 4 votes)