この項のスクリプトを使用して、Oracle Enterprise Performance Management Cloud環境が6週間のテスト・サイクルを使用して四半期ベースで更新されるように、更新をスキップするセルフサービス・ソリューションを作成します。この場合、本番環境はテスト環境の6週間後に更新されます。
デフォルトでは、EPM Cloudは環境に対して月次更新を適用します。skipUpdateコマンドを使用して、環境に対する月次更新の適用をスキップしたり、現在の更新のスキップ要求を表示します。この項に含まれるスクリプトを使用して、skipUpdate
コマンドの手動実行を自動化できます。これらのスクリプトは、6週間のテスト・サイクルを使用した四半期ベースで更新が適用されるように、更新のスキップ・プロセスを自動化します。
Note:
サンプルのシナリオ: テスト環境の更新サイクルは、2月(24.02更新)、5月(24.05更新)、8月(24.08更新)および11月(24.11更新)の第1金曜日として確立されます。2月(24.02更新)の第1金曜日にテスト環境を更新するのに使用されたバージョンを使用して、本番環境が3月(24.02更新)の第3金曜日に更新されます。本番環境への同様の更新が、6月(24.05更新)、9月(24.08更新)および12月(24.11更新)の第3週に発生します。このシナリオでは、本番環境は現在の更新には更新されませんが、現在テスト環境にある更新を使用して更新されます。
Windowsのサンプル・スクリプト
次のスクリプトをコピーして、skip_update.ps1
を作成します。それをローカル・ディレクトリに保存します。このスクリプトを実行する方法については、スクリプトの実行を参照してください:
# Skip Update PowerShell script $inputproperties = ConvertFrom-StringData(Get-Content ./input.properties -raw) $username="$($inputproperties.username)" $password="$($inputproperties.password)" $url="$($inputproperties.url)" $updateversions="$($inputproperties.updateversions)" $podtype="$($inputproperties.podtype)" $proxyserverusername="$($inputproperties.proxyserverusername)" $proxyserverpassword="$($inputproperties.proxyserverpassword)" $proxyserverdomain="$($inputproperties.proxyserverdomain)" echo "Starting skip_update.ps1 script." $monthsarr = ("01","02","03","04","05","06","07","08","09","10","11","12") $global:monthsarrfromcurrent = @() $global:yearsarrfromcurrent = @() $updateversionsarr = $updateversions.Split(",") $currentyear=Get-Date -Format yy $currentmonth=Get-Date -Format MM $nextyear=[int]$currentyear+1 function populateFromCurrentArrays() { $startposition = 0 for ($i = 0; $i -le ($monthsarr.length - 1); $i++) { if (${currentmonth} -eq $monthsarr[$i]) { if (${podtype} -eq "prod") { if (${updateversionsarr} -contains ${currentmonth}) { $startposition=$i-2 } else { $startposition=$i-1 } } else { if (${updateversionsarr} -contains ${currentmonth}) { $startposition=$i } else { $startposition=$i-1 } } break } } if (${startposition} -lt 0) { $startposition=$startposition+12 } for ($i = 0; $i -le ($monthsarr.length - 1); $i++) { if (${i} -ge ${startposition}) { $global:monthsarrfromcurrent += $monthsarr[$i] $global:yearsarrfromcurrent += $currentyear } } for ($i = 0; $i -le ($monthsarr.length - 1); $i++) { if (${i} -lt ${startposition}) { $global:monthsarrfromcurrent += $monthsarr[$i] $global:yearsarrfromcurrent += $nextyear } } } function skipUpdateAdd($yearnumber, $monthnumber) { echo "Running: epmautomate.bat skipUpdate add version=${yearnumber}.${monthnumber} comment=`"adding skipUpdate`"" epmautomate skipUpdate add version=${yearnumber}.${monthnumber} comment="adding skipUpdate" } function processSkipUpdates() { $addcount = 0 $countlimit = 0 if (${podtype} -eq "prod") { $countlimit = 3 } else { $countlimit = 2 } if ((${proxyserverusername} -eq "") -And (${proxyserverpassword} -eq "") -And (${proxyserverdomain} -eq "")) { echo "Running: epmautomate.bat login ${username} ${password} ${url}" epmautomate login ${username} ${password} ${url} } else { echo "Running: epmautomate.bat login ${username} ${password} ${url} ProxyServerUserName=${proxyserverusername} ProxyServerPassword=${proxyserverpassword} ProxyServerDomain=${proxyserverdomain}" epmautomate login ${username} ${password} ${url} ProxyServerUserName=${proxyserverusername} ProxyServerPassword=${proxyserverpassword} ProxyServerDomain=${proxyserverdomain} } echo "Running: epmautomate.bat skipUpdate remove" epmautomate skipUpdate remove for ($i = 0; $i -le ($global:monthsarrfromcurrent.length - 1); $i++) { $match = 1 if (${addcount} -eq ${countlimit}) { echo "Update calls are completed. No more will be attempted." break } for ($j = 0; $j -le ($updateversionsarr.length - 1); $j++) { if ((${currentmonth} -eq $updateversionsarr[$j]) -And (${addcount} -gt 0)) { $match = 1 break } if (($global:monthsarrfromcurrent[$i] -eq $updateversionsarr[$j]) -And (${addcount} -eq 0)){ $match = 0 break } } if (${match} -eq 1) { skipUpdateAdd $global:yearsarrfromcurrent[$i] $global:monthsarrfromcurrent[$i] $addcount += 1 } } echo "Running: epmautomate.bat skipUpdate list" epmautomate skipUpdate list echo "Running: epmautomate.bat logout" epmautomate logout } function compareUpdateMonths($thismonth, $nextmonth) { $nextmonthorig=${nextmonth} if (${nextmonth} -lt ${thismonth}) { $nextmonth+=12 } $monthdiff = $nextmonth - $thismonth if (${monthdiff} -gt 4) { echo "There are more than 3 versions skipped from version ${thismonth} to version ${nextmonthorig}. Please correct updateversions in input.properties so that there are not more than three versions skipped between each update version. Exiting." exit 1 } } function validateUpdateVersions() { for ($i = 0; $i -le ($updateversionsarr.length - 1); $i++) { $nextint = $i + 1 $thisupdatemonth = $updateversionsarr[$i] $thisupdatemonthint=[int]$thisupdatemonth $nextupdatemonth=$updateversionsarr[$nextint] $nextupdatemonthint=[int]$nextupdatemonth if (${nextupdatemonth} -eq "") { $nextupdatemonth=$updateversionsarr[0] $nextupdatemonthint=[int]$nextupdatemonth } compareUpdateMonths $thisupdatemonthint $nextupdatemonthint } } validateUpdateVersions populateFromCurrentArrays processSkipUpdates
Linux/UNIXのサンプル・スクリプト
次のスクリプトをコピーして、skip_update.sh
を作成します。それをローカル・ディレクトリに保存します。このスクリプトを実行する方法については、スクリプトの実行を参照してください:
#!/bin/sh . ./input.properties echo "Starting skip_update.sh script." export JAVA_HOME=${javahome} declare -a monthsarr=(01 02 03 04 05 06 07 08 09 10 11 12) declare -a monthsarrfromcurrent declare -a yearsarrfromcurrent updateversionsarr=( $(echo "${updateversions}" | sed 's/,/ /g') ) currentyear=$(date +%y) nextyear=$((currentyear+1)) currentmonth=$(date +%m) populateFromCurrentArrays() { local startposition=0 for i in ${!monthsarr[@]} do if [[ "${currentmonth}" == "${monthsarr[$i]}" ]] then if [[ "${podtype}" == "prod" ]] then if [[ ${updateversionsarr[@]} =~ ${currentmonth} ]] then startposition=$((i-2)) else startposition=$((i-1)) fi break else if [[ ${updateversionsarr[@]} =~ ${currentmonth} ]] then startposition=$i else startposition=$((i-1)) fi break fi fi done if [[ ${startposition} -lt 0 ]] then startposition=$((startposition+12)) fi for i in ${!monthsarr[@]} do if [[ ${i} -ge ${startposition} ]] then monthsarrfromcurrent=("${monthsarrfromcurrent[@]}" "${monthsarr[$i]}") yearsarrfromcurrent=("${yearsarrfromcurrent[@]}" "${currentyear}") fi done for i in ${!monthsarr[@]} do if [[ ${i} -lt ${startposition} ]] then monthsarrfromcurrent=("${monthsarrfromcurrent[@]}" "${monthsarr[$i]}") yearsarrfromcurrent=("${yearsarrfromcurrent[@]}" "${nextyear}") fi done } skipUpdateAdd() { local yearnumber="$1" local monthnumber="$2" echo "Running: ${epmautomatescript} skipUpdate add version=${yearnumber}.${monthnumber} comment=\"adding skipUpdate\"" ${epmautomatescript} skipUpdate add version=${yearnumber}.${monthnumber} comment="adding skipUpdate" } processSkipUpdates() { local addcount=0 local countlimit=0 if [[ "${podtype}" == "prod" ]] then countlimit=3 else countlimit=2 fi if [[ "${proxyserverusername}" == "" ]] && [[ "${proxyserverpassword}" == "" ]] && [[ "${proxyserverdomain}" == "" ]] then echo "Running: ${epmautomatescript} login ${username} ${password} ${url}" ${epmautomatescript} login ${username} ${password} ${url} else echo "Running: ${epmautomatescript} login ${username} ${password} ${url} ProxyServerUserName=${proxyserverusername} ProxyServerPassword=${proxyserverpassword} ProxyServerDomain=${proxyserverdomain}" ${epmautomatescript} login ${username} ${password} ${url} ProxyServerUserName=${proxyserverusername} ProxyServerPassword=${proxyserverpassword} ProxyServerDomain=${proxyserverdomain} fi echo "Running: ${epmautomatescript} skipUpdate remove" ${epmautomatescript} skipUpdate remove for i in ${!monthsarrfromcurrent[@]} do local match=1 if [[ ${addcount} -eq ${countlimit} ]] then echo "Update add calls are completed. No more will be attempted." break fi for j in ${!updateversionsarr[@]} do if [[ "${currentmonth}" == "${updateversionsarr[$j]}" ]] && [[ ${addcount} -gt 0 ]] then match=1 break fi if [[ "${monthsarrfromcurrent[$i]}" == "${updateversionsarr[$j]}" ]] && [[ ${addcount} -eq 0 ]] then match=0 break fi done if [[ ${match} -eq 1 ]] then skipUpdateAdd ${yearsarrfromcurrent[$i]} "${monthsarrfromcurrent[$i]}" addcount=$((addcount+1)) fi done echo "Running: ${epmautomatescript} skipUpdate list" ${epmautomatescript} skipUpdate list echo "Running: ${epmautomatescript} logout" ${epmautomatescript} logout } compareUpdateMonths() { local thismonth=$1 local nextmonth=$2 local nextmonthorig=${nextmonth} if [[ ${nextmonth} -lt ${thismonth} ]] then nextmonth=$((nextmonth+12)) fi monthdiff=$((nextmonth-thismonth)) if [[ ${monthdiff} -gt 4 ]] then echo "There are more than 3 versions skipped from version ${thismonth} to version ${nextmonthorig}. Please correct updateversions in input.properties so that there are not more than three versions skipped between each update version. Exiting." exit 1 fi } validateUpdateVersions() { for i in ${!updateversionsarr[@]} do nextint=$((i+1)) thisupdatemonth="${updateversionsarr[$i]}" thisupdatemonthint=${thisupdatemonth#0} nextupdatemonth="${updateversionsarr[$nextint]}" nextupdatemonthint=${nextupdatemonth#0} if [[ ${nextupdatemonth} == "" ]] then nextupdatemonth="${updateversionsarr[0]}" nextupdatemonthint=${nextupdatemonth#0} fi compareUpdateMonths ${thisupdatemonthint} ${nextupdatemonthint} done } validateUpdateVersions populateFromCurrentArrays processSkipUpdates
サーバー側Groovyスクリプト
次のスクリプトをコピーして更新することにより、skip_update.groovy
Groovyスクリプトを作成します。このスクリプトを実行する方法については、スクリプトの実行を参照してください:
このGroovyスクリプトの次の変数を更新します:
username
: 月次以外の更新頻度を設定する環境のサービス管理者のユーザー名。password
: サービス管理者のパスワード、または暗号化されたパスワード・ファイルの名前と場所。url
: 月次以外の更新頻度を設定する環境のURL。updateversions
: url
パラメータで識別される環境に適用されるEPM Cloud更新のカンマ区切りリスト。例: updateversions=02,05,08,11
。
バージョンは2桁で指定する必要があります。更新01から09までは先頭にゼロを付けてください。スクリプトは、updateversions
パラメータ値に含まれない更新に対して、skipUpdateコマンドを実行します。たとえば、updateversions=02,05,08,11
と指定すると、スクリプトは更新のスキップ・フラグを01 (1月)、03 (3月)、04 (4月)、06 (6月)、07 (7月)、09 (9月)、10 (10月)および12 (12月)更新に設定します。この場合、EPM Cloudの更新02 (2月)、05 (5月)、08 (8月)および11 (11月)が環境に適用されます。
podtype
: EPM Cloud環境タイプ。有効な値は、test
およびprod
です。proxyserverusername
: インターネットへのアクセスを制御するプロキシ・サーバーとの安全なセッションを認証するユーザー名。proxyserverpassword
: プロキシ・サーバーに対してユーザーを認証するパスワード。proxyserverdomain
: プロキシ・サーバーに定義されているドメインの名前。Note:
プロキシ・サーバーを使用しない場合は、proxyserverusername
、proxyserverpassword
およびproxyserverdomain
パラメータの値を指定しないでください。import java.text.SimpleDateFormat String username = 'service_administrator' String password = 'examplePWD' String url = 'example_EPM_URL' String updateversions = '01,04,07,10' String podtype = 'test' String proxyserverusername = '' String proxyserverpassword = '' String proxyserverdomain = '' def currentdate = new Date() def yf = new SimpleDateFormat("yy") def mf = new SimpleDateFormat("MM") String[] monthsarr = ["01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12"] List<String> monthsarrfromcurrent = new ArrayList<>() List<String> yearsarrfromcurrent = new ArrayList<>() String currentyear = yf.format(currentdate) String nextyear = (currentyear.toInteger() + 1).toString() String currentmonth = mf.format(currentdate) String[] updateVersionsStringArr = updateversions.split(','); def updateversionsarr = new int[updateVersionsStringArr.length]; for(int i = 0; i < updateVersionsStringArr.length; i++) { updateversionsarr[i] = Integer.parseInt(updateVersionsStringArr[i]); } def LogMessage(String message) { def date = new Date() def sdf = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss") println('[' + sdf.format(date) + '][GROOVY] ' + message); } def LogOperationStatus(EpmAutomateStatus opstatus) { def returncode = opstatus.getStatus() LogMessage(opstatus.getOutput()) LogMessage('return code: ' + returncode) } int CompareUpdateMonths(int thismonth, int nextmonth) { int nextmonthorig = nextmonth if (nextmonth < thismonth) { nextmonth = nextmonth + 12 } int monthdiff = nextmonth - thismonth if (monthdiff > 4) { LogMessage('There are more than 3 versions skipped from version ' + thismonth + ' to version ' + nextmonthorig + '. Please correct updateversions so that there are not more than three versions skipped between each update version. Exiting.') return 1 } return 0 } int ValidateUpdateMonths(int[] updateversionsarr) { for(int i = 0; i < updateversionsarr.length; i++) { int nextint = i + 1 String nextupdatemonth = "" int nextupdatemonthint = 0 String thisupdatemonth = updateversionsarr[i] int thisupdatemonthint = thisupdatemonth.toInteger() if (nextint < updateversionsarr.length) { nextupdatemonth = updateversionsarr[nextint] } else { nextupdatemonth = updateversionsarr[0] } nextupdatemonthint = nextupdatemonth.toInteger() int returncode = CompareUpdateMonths(thisupdatemonthint, nextupdatemonthint) if (returncode > 0) { return 1 } } return 0 } def SkipUpdateAdd(EpmAutomate automate, String yearnumber, String monthnumber) { String yeardotmonth = yearnumber + '.' + monthnumber LogMessage('Running: epmautomate skipUpdate add version=' + yeardotmonth + ' comment=\"adding skipUpdate\"') EpmAutomateStatus status = automate.execute('skipupdate','add','version=' + yeardotmonth,'comment=\"adding skipUpdate\"') LogOperationStatus(status) } LogMessage('Starting skip update processing') EpmAutomate automate = getEpmAutomate() // validate update months int returncode = ValidateUpdateMonths(updateversionsarr) if (returncode != 0) { return 1 } // populate arrays int startposition = 0 for(int i = 0; i < monthsarr.length; i++) { if (currentmonth == monthsarr[i]) { if (podtype.equals("prod")) { if (updateVersionsStringArr.contains(currentmonth)) { startposition = (i-2) } else { startposition = (i-1) } } else { if (updateVersionsStringArr.contains(currentmonth)) { startposition = i } else { startposition = (i-1) } } break } } if (startposition < 0) { startposition = startposition + 12 } for(int i = 0; i < monthsarr.length; i++) { if (i >= startposition) { monthsarrfromcurrent.add(monthsarr[i]) yearsarrfromcurrent.add(currentyear) } } for(int i = 0; i < monthsarr.length; i++) { if (i <= startposition) { monthsarrfromcurrent.add(monthsarr[i]) yearsarrfromcurrent.add(nextyear) } } // process skip updates LogMessage("Operation: encrypt " + password + " oracleKey password.epw") EpmAutomateStatus status = automate.execute('encrypt',password,"oracleKey","password.epw") LogOperationStatus(status) if ((proxyserverusername != null && proxyserverusername != '') && (proxyserverpassword != null && proxyserverpassword != '') && (proxyserverdomain != null && proxyserverdomain != '')) { LogMessage("Operation: login " + username + " password.epw " + url + " ProxyServerUserName=" + proxyserverusername + " ProxyServerPassword=" + proxyserverpassword + " ProxyServerDomain=" + proxyserverdomain) status = automate.execute('login',username,"password.epw",url,"ProxyServerUserName=" + proxyserverusername,"ProxyServerPassword=" + proxyserverpassword,"ProxyServerDomain=" + proxyserverdomain) LogOperationStatus(status) } else { LogMessage("Operation: login " + username + " password.epw " + url) status = automate.execute('login',username,"password.epw",url) LogOperationStatus(status) } LogMessage('Running: epmautomate skipUpdate remove') status = automate.execute('skipupdate','remove') LogOperationStatus(status) int addcount = 0 int countlimit = 0 if (podtype.equals("prod")) { countlimit = 3 } else { countlimit = 2 } for (int i = 0; i < monthsarrfromcurrent.size(); i++) { int match = 1 if (addcount == countlimit){ LogMessage('Update add calls are completed. No more will be attempted.') break } for(int j = 0; j < updateversionsarr.length; j++) { if ((Integer.parseInt(currentmonth) == updateversionsarr[j]) && (addcount > 0)) { match = 1 break } if ((Integer.parseInt(monthsarrfromcurrent.get(i)) == updateversionsarr[j]) && (addcount == 0)) { match = 0 break } } if (match == 1) { SkipUpdateAdd(automate, yearsarrfromcurrent.get(i), monthsarrfromcurrent.get(i)) addcount+=1 } } LogMessage('Running: epmautomate skipUpdate list') status = automate.execute('skipupdate','list') LogOperationStatus(status) println(status.getItemsList()) LogMessage('Running: epmautomate logout') status = automate.execute('logout') LogOperationStatus(status) LogMessage('Skip update processing completed')
skip_update
WindowsおよびLinux/UNIXスクリプトを実行するためのinput.propertiesファイルの作成
skip_update.ps1
またはskip_update.sh
を実行するには、input.properties
ファイルを作成し、環境の情報でファイルを更新します。ファイルをローカル・ディレクトリに保存します。このファイルのコンテンツは、オペレーティング・システムによって異なります。
Windows
username=exampleAdmin password=examplePassword.epw url=exampleURL updateversions=01,04,07,10 podtype=test
Linux/UNIX
javahome=JAVA_HOME epmautomatescript=EPM_AUTOMATE_LOCATION username=exampleAdmin password=examplePassword.epw url=exampleURL updatemonths=02,05,08,11
Table 3-14 input.propertiesのパラメータ
パラメータ | 説明 |
---|---|
javahome |
JAVA_HOME の場所。Linux/UNIXの場合のみ。 |
epmautomatescript |
EPM自動化の実行可能ファイル(epmautomate.sh )の絶対パス。Linux/UNIXの場合のみ。 |
username |
サービス管理者のユーザー名 |
password |
サービス管理者のパスワードまたは暗号化されたパスワード・ファイルの名前と場所。 |
url |
月次以外の更新頻度を設定する環境のURL。 |
updateversions |
updateversions : url パラメータで識別される環境に適用されるEPM Cloud更新のカンマ区切りリスト。例: updateversions=02,05,08,11 。
バージョンは2桁で指定する必要があります。更新01から09までは先頭にゼロを付けてください。スクリプトは、 |
podtype |
EPM Cloud環境タイプ。有効な値は、test およびprod です。 |
スクリプトの実行
skip_update.ps1
またはskip_update.sh
を作成します。input.properties
ファイルを作成して、skip_update
スクリプトが配置されているディレクトリに保存します。このファイルのコンテンツは、オペレーティング・システムによって異なります。skip_update WindowsおよびLinux/UNIXスクリプトを実行するためのinput.propertiesファイルの作成を参照してください。
このディレクトリの書込み権限があることを確認してください。Windowsの場合、スクリプトを実行できるよう、「管理者として実行」オプションを使用してPowerShellを開始する必要があります。
skip_update.ps1
を実行します。./skip_update.sh
を実行します。skip_update.groovy
Groovyスクリプトを作成し、必要に応じて更新します。