匯出與下載應用程式資料

使用這些指令碼匯出應用程式資料,然後將它下載至本機目錄。

這些指令碼會執行下列作業:

  • 登入環境。
  • 使用您指定的工作備份兩組資料。
  • 下載匯出的資料檔案。
  • 登出。

Windows 範例指令碼

透過複製此指令碼以建立 exportDownloadData.ps1。將它儲存至本機目錄。
$inputproperties = ConvertFrom-StringData(Get-Content ./input.properties -raw)
$username="$($inputproperties.username)"
$passwordfile="$($inputproperties.passwordfile)"
$serviceURL="$($inputproperties.serviceURL)"
$exportFile1="$($inputproperties.exportFile1)"
$exportFile2="$($inputproperties.exportFile2)"
$exportDataJobName1="$($inputproperties.exportDataJobName1)"
$exportDataJobName2="$($inputproperties.exportDataJobName2)"

epmautomate login ${username} ${passwordfile} ${serviceURL}
epmautomate exportdata ${exportDataJobName1} ${exportFile1}
epmautomate exportdata ${exportDataJobName2} ${exportFile2}
epmautomate listfiles
epmautomate downloadfile ${exportFile1}
epmautomate downloadfile ${exportFile2}
epmautomate logout

Linux/UNIX 範例指令碼

透過複製此指令碼以建立 exportDownloadData.sh。將它儲存至本機目錄。
#!/bin/bash
. ./input.properties
export JAVA_HOME=${javahome}
${epmautomatescript} login "${username}" "${passwordfile}" "${serviceURL}"
${epmautomatescript} exportdata "${exportDataJobName1}" "${exportFile1}"
${epmautomatescript} exportdata "${exportDataJobName2}" "${exportFile2}"
${epmautomatescript} listfiles
${epmautomatescript} downloadfile "${exportFile1}"
${epmautomatescript} downloadfile "${exportFile2}"
${epmautomatescript} logout

建立 input.properties 檔案

透過複製下列其中之一並根據您的環境資訊予以更新,以建立 input.properties 檔案。將檔案儲存至儲存 exportDownloadData.ps1exportDownloadData.sh 的目錄。

Windows

username=exampleAdmin
passwordfile=examplePassword.epw
serviceURL=exampleURL
exportFile1=FILE_NAME.zip
exportFile2=FILE_NAME.zip
exportDataJobName1=JOB_NAME
exportDataJobName2=FILE_NAME

Linux/UNIX

javahome=JAVA_HOME
epmautomatescript=EPM_AUTOMATE_LOCATION
username=exampleAdmin
passwordfile=examplePassword.epw
serviceURL=exampleURL
exportFile1=FILE_NAME.zip
exportFile2=FILE_NAME.zip
exportDataJobName1=FILE_NAME
exportDataJobName2=FILE_NAME

表格 3-19 input.properties 參數

參數 描述
javahome JAVA_HOME 位置。僅適用於 Linux/UNIX。
epmautomatescript EPM Automate 執行檔 (epmautomate.sh) 的絕對路徑。僅適用於 Linux/UNIX。
username 服務管理員的使用者名稱,該管理員也具備身分識別網域管理員角色。
password 服務管理員的密碼,或加密密碼檔案所在的名稱和位置。
serviceURL 環境的 URL,您會從這個環境產生快照。
exportFile1exportFile2 檔案的名稱,資料會匯出至這個檔案。
exportDataJobName1exportDataJobName2 匯出資料時要使用的工作。

執行指令碼

  1. 透過複製上一節的指令碼以建立 exportDownloadData.ps1exportDownloadData.sh
  2. 建立 input.properties 檔案並將它儲存至 exportDownloadData 指令碼所在的目錄。此檔案的內容因作業系統而異。請參閱表格 3-19

    確保您在此目錄中具有寫入權限。至於 Windows,您可能需要使用以管理員身分執行選項來啟動 PowerShell,才能執行指令碼。

  3. 啟動指令碼。
    • Windows PowerShell:執行 exportDownloadData.ps1
    • Linux/UNIX:執行 ./exportDownloadData.sh