Windows PowerShell and Oracle Hyperion

Windows PowerShell and Oracle Hyperion

Suppose you are upgrading Oracle Hyperion from 11.1.1.x, 9.3.x or even 7.x to one of the newer releases, such as 11.1.2.3 or 11.1.2.4.  Now imagine that you have exported security provisioning from the older release and need to convert it to the Life Cycle Management format for 11.1.2.x.

Here are some common issues with this type of migration:

1. The Essbase server's Shared Services project in the older release is named something other than "EssbaseCluster-1".

2. Your external security provider in the older release is named something other than "MSAD" or whatever your integration partner chose to name it in 11.1.2.x's instance of Shared Services.

In either of the above 2 cases, you may need to perform edit->replace operations within multiple files contained with multiple folders.

Or do you???

A UNIX nerd like myself would tell you to fire off a "find -exec sed" command, but of course Microsoft Windows will just laugh and ignore this command.  You, however, WILL get the last laugh if you copy & paste the script provided below! 

Microsoft Windows Server 2008 R2 and 2012 R2 and provide a built-in component called Windows PowerShell that can do many of the things UNIX Korn/Bash Shell can do!  The script provided below instructs PowerShell to recursively perform an edit->replace operation within any directory you specify.  This saves you from having to manually inspect and edit each file.

By the way, this trick also lets you do recursive edit->replace operations for environments which haven't updated their Hyperion Essbase calculation scripts to use server substitution variables, and are still hard-coding Scenario names, Fiscal Years, or other values.

# RecursiveReplace.ps1
#
# This Powershell script recursively replaces all references of text within
# a directory hierarchy.  If the specified directory contains subdirectories,
# it will recursively descend into all subdirectories and repeat the process.
#
# Syntax:  powershell D:\Scripts\RecursiveReplace.ps1 -editDir <directory name> -old '<old text>' -new '<new text>'
# Example: powershell D:\Scripts\RecursiveReplace.ps1 -editDir D:\import_export\ExportSharedServices -old EssbaseCluster-1 -new 'Prod Essbase'
#
# If the values supplied to either -old or -new must contain spaces,
# then those values should be enclosed with single quote (') characters.
#
# If you receive a security policy error about “unsigned” Powershell scripts when
# running this process, open a command prompt and type:
# powershell.exe Set-ExecutionPolicy Unrestricted
#
#  Written on 04/09/2015 by Dave Shay (AdvancedEPM Consulting, Inc.)
# Modified on MM/DD/YYYY by Your Name - Briefly describe changes

param($editDir, $old, $new)

$editFiles=Get-ChildItem $editDir -Recurse | Where-Object{!($_.PSIsContainer)}

foreach ($file in $editFiles)
{
    if(Select-String $file.PSPath -pattern "$old")
    {
        Write-Host Found matching text within $file.FullName
        
        (Get-Content $file.PSPath) |
        Foreach-Object {$_ -replace "$old", "$new"} |
        Set-Content $file.PSPath
    }
}

 

Nailed it man. This is very handy in DRM batch migration where we hardcore the ever name for each instance in the configuration file

Like
Reply

To view or add a comment, sign in

Others also viewed

Explore content categories