匯出與下載中繼資料及資料

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

這些指令碼會完成下列活動:

  • 登入環境。

  • 使用指定的工作,將中繼資料匯出至 zip 檔案。

  • 使用指定的工作,將應用程式資料匯出至 zip 檔案。

  • 列出「收件匣/寄件匣」的內容。

  • 將匯出的資料檔案下載到本機電腦。

  • 登出。

Windows 範例指令碼

透過複製下列指令碼以建立 exportDownloadMetadataAndData.ps1。將它儲存至本機目錄。
$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 範例指令碼

透過複製下列指令碼以建立 exportDownloadMetadataAndData.sh。將它儲存至本機目錄。
#!/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

建立特性檔案

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

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

表格 3-18 input.properties 參數

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

執行指令碼

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

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

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