导入数据、运行计算脚本并将数据从块存储数据库复制到聚合存储数据库

使用这些脚本可从文件导入数据,刷新多维数据集,运行对多维数据集进行计算的业务规则,然后将数据推送到 ASO 多维数据集。

这些脚本执行以下操作:

  • 登录环境。
  • 上传文件 data.csv
  • 使用作业 loadingq1data 将数据从 data.csv 导入到应用程序中。
  • 刷新多维数据集。
  • 运行用于转换数据的业务规则。
  • 使用作业将数据推送到聚合存储数据库。
  • 注销。

Windows 示例脚本

通过复制以下脚本来创建 importDataPlus.ps1。将其保存到本地目录。
$inputproperties = ConvertFrom-StringData(Get-Content ./input.properties -raw)
$username="$($inputproperties.username)"
$passwordfile="$($inputproperties.passwordfile)"
$serviceURL="$($inputproperties.serviceURL)"
$importDataJobName="$($inputproperties.importDataJobName)"
$businessRuleName="$($inputproperties.businessRuleName)"
$planTypeMapName="$($inputproperties.planTypeMapName)"
$param1Key="$($inputproperties.param1Key)"
$param1Value="$($inputproperties.param1Value)"
$param2Key="$($inputproperties.param2Key)"
$param2Value="$($inputproperties.param2Value)"
$clearData="$($inputproperties.clearData)"

epmautomate login ${username} ${passwordfile} ${serviceURL}
epmautomate uploadfile ${file1}
epmautomate importdata ${importDataJobName} ${file1}
epmautomate refreshcube
epmautomate runbusinessrule ${businessRuleName} ${param1Key}=${param1Value} ${param2Key}=${param2Value}
epmautomate runplantypemap ${planTypeMapName} clearData=${clearData}
epmautomate logout

Linux/UNIX 示例脚本

通过复制以下脚本来创建 importDataPlus.ps1。将其保存到本地目录。
#!/bin/bash
. ./input.properties
export JAVA_HOME=${javahome}
${epmautomatescript} login "${username}" "${passwordfile}" "${serviceURL}"
${epmautomatescript} uploadfile "${file1}"
${epmautomatescript} importdata "${importDataJobName}" "${file1}"
${epmautomatescript} refreshcube
${epmautomatescript} runbusinessrule "${businessRuleName}" "${param1Key}=${param1Value}" "${param2Key}=${param2Value}"
${epmautomatescript} runplantypemap "${planTypeMapName}" clearData=${clearData}
${epmautomatescript} logout

创建 input.properties 文件

Windows

username=exampleAdmin
passwordfile=examplePassword.epw
serviceURL=exampleURL
File1=FILE_NAME.csv
importDataJobName=FILE_NAME
businessRuleName=RULE_NAME
planTypeMapName=PLAN_TYPE_MAP_NAME
param1Key=RUN-TIME PARAMETER_1
param1Value=RUN-TIME PARAMETER_1_VALUE
param2Key=RUN-TIME PARAMETER_2
param2Value=RUN-TIME PARAMETER_2_VALUE
clearData=true
Linux/UNIX
javahome=JAVA_HOME
epmautomatescript=EPM_AUTOMATE_LOCATION
username=exampleAdmin
passwordfile=examplePassword.epw
serviceURL=exampleURL
File1=FILE_NAME.csv
importDataJobName=FILE_NAME
businessRuleName=RULE_NAME
planTypeMapName=PLAN_TYPE_MAP_NAME
param1Key=RUN-TIME PARAMETER_1
param1Value=RUN-TIME PARAMETER_1_VALUE
param2Key=RUN-TIME PARAMETER_2
param2Value=RUN-TIME PARAMETER_2_VALUE
clearData=true

表 3-17 input.properties 参数

参数 说明
javahome JAVA_HOME 位置。仅限 Linux/UNIX。
epmautomatescript EPM Automate 可执行文件 (epmautomate.sh) 的绝对路径。仅限 Linux/UNIX。
username 同时具有身份域管理员角色的服务管理员的用户名。
password 服务管理员的密码或加密密码文件的名称和位置。
serviceURL 要从其生成快照的环境的 URL。
File1 要将数据从其加载到应用程序中的导入文件。
iimportDataJobName 用于导入数据的作业的名称。
businessRuleName 要对导入的数据运行的业务规则
planTypeMapName 用于将数据从 BSO 数据库复制到 ASO 数据库或从 BSO 数据库复制到另一个 BSO 数据库的规划类型映射。
param1Key 要运行业务规则的运行时提示 1。
param1Value 运行时提示 1 的值。
param2Key 要运行业务规则的运行时提示 2。
param2Value 运行时提示 2 的值。
clearData 指示是否要删除接收数据库中的数据。指定 false 将保留数据。

运行脚本

  1. 通过复制上一节的脚本来创建 importDataPlus.ps1importDataPlus.sh
  2. 创建 input.properties 文件,并将其保存在 importDataPlus 脚本所在的目录中。此文件的内容因操作系统的不同而异。请参阅“创建 input.properties 文件”。

    请确保您对此目录具有写权限。对于 Windows,您可能需要使用以管理员身份运行选项启动 PowerShell,以便能够运行脚本。

  3. 启动脚本。
    • Windows PowerShell:运行 importDataPlus.ps1
    • Linux/UNIX:运行 ./importDataPlus.sh