Export and Download Metadata and Data

Use these scrips tp to export application metadata and data, and then to download the export files to a local directory.

These scripts complete the following activities:

  • Signs in to an environment.

  • Exports the metadata into a zip file using a specified job.

  • Exports the application data into a zip file using a specified job.

  • Lists the contents of the Inbox/Outbox.

  • Downloads the exported data files to the local computer.

  • Sign out.

Windows Sample Script

Create exportDownloadMetadataAndData.ps1 by copying the following Script. Store it in a local directory.
$inputproperties = ConvertFrom-StringData(Get-Content ./input.properties -raw)
$username="$($inputproperties.username)"
$passwordfile="$($inputproperties.passwordfile)"
$serviceURL="$($inputproperties.serviceURL)"
$exportFile1="$($inputproperties.exportFile1)"
$exportFile2="$($inputproperties.exportFile2)"
$exportMetaDataJobName="$($inputproperties.exportMetaDataJobName)"
$exportDataJobName="$($inputproperties.exportDataJobName)"

epmautomate login ${username} ${passwordfile} ${serviceURL}
epmautomate exportmetadata ${exportMetaDataJobName} ${exportFile1}
epmautomate exportdata ${exportDataJobName} ${exportFile2}
epmautomate listfiles
epmautomate downloadfile ${exportFile1}
epmautomate downloadfile f${exportFile2}
epmautomate logout

Linux/UNIX Sample Script

Create exportDownloadMetadataAndData.sh by copying the following Script. Store it in a local directory.
#!/bin/bash
. ./input.properties
export JAVA_HOME=${javahome}
${epmautomatescript} login "${username}" "${passwordfile}" "${serviceURL}"
${epmautomatescript} exportmetadata "${exportMetaDataJobName}" "${exportFile1}"
${epmautomatescript} exportdata "${exportDataJobName}" "${exportFile2}"
${epmautomatescript} listfiles
${epmautomatescript} downloadfile "${exportFile1}"
${epmautomatescript} downloadfile "${exportFile2}"
${epmautomatescript} logout

Creating the Properties File

Create the input.properties file by copying one of the following and updating it with information for your environment. Save the file in the directory where exportDownloadMetadataAndData.ps1 or exportDownloadMetadataAndData.sh is stored.

Windows

username=exampleAdmin
passwordfile=examplePassword.epw
serviceURL=exampleURL
exportFile1=FILE_NAME1.zip
exportFile2=FILE_NAME2.zip
exportMetaDataJobName=METADATA_EXPORT_JOB_NAME
exportDataJobName=DATA_EXPORT_JOB_NAME

Linux/UNIX

javahome=JAVA_HOME
epmautomatescript=EPM_AUTOMATE_LOCATION
username=exampleAdmin
passwordfile=examplePassword.epw
serviceURL=exampleURL
exportFile1=FILE_NAME1.zip
exportFile2=FILE_NAME2.zip
exportMetaDataJobName=METADATA_EXPORT_JOB_NAME
exportDataJobName=DATA_EXPORT_JOB_NAME

Table 3-18 input.properties Parameters

Parameter Description
javahome JAVA_HOME location. For Linux/UNIX only.
epmautomatescript Absolute path of EPM Automate executable (epmautomate.sh). For Linux/UNIX only.
username User name of a Service Administrator, who also has the Identity Domain Administrator role.
password Password of the Service Administrator or the name and location of the encrypted password file.
serviceURL URL of the environment from which you want to generate the snapshot.
exportFile1 Name of the file to which metadata is to be exported.
exportFile2 Name of the file to which adata is to be exported.
exportDataJobName1 Job to use for exporting the metadata.
exportDataJobName2 Job to use for exporting the data.

Running the Scripts

  1. Create exportDownloadMetadataAndData.ps1 or exportDownloadMetadataAndData.sh by copying the script from a preceding section.
  2. Create the input.properties file and save it in the directory where the exportDownloadMetadataAndData script is located. Contents of this file differs depending on your operating system. See Creating the Properties File.

    Make sure that you have write privileges in this directory. For Windows, you may need to start PowerShell using the Run as Administrator option to be able to run the script.

  3. Launch the script.
    • Windows PowerShell: run exportDownloadMetadataAndData.ps1.
    • Linux/UNIX: run ./exportDownloadMetadataAndData.sh.