Set  Substitution Variables automaticaly with system time? - Developer Tools & APIs(Archived)

does anyone know of a utility or a method to automatically update substitution variables with the system time? 

Hi,One way to do that is to create a bacth file that gets time from the system, launch an esscmd script with that parameter to set a substitution variable. You can then schedule this batch.For the script syntax, and scheduler option, are you under unix or nt?Eric BelmonPartake 

Check out this Sub Var tool from the olapunderground 

Hi, another solution with maxl under NT, using environment variables:create a file test.msh:spool on to c:\test.out;login $1 $2 on $3; alter database $4 set variable $5 $6;echo "variable altered";spool off;exit;and launch via the command prompt:essmsh test.msh admin password localhost Demo.Basic datetime '%TIME%'for the date for instance:essmsh test.msh admin password localhost Demo.Basic datetime '\""%DATE%\""'Eric BelmonPartake Consulting.


AutoMaxl script

I have login Maxl script like below for login in to the system.
login user05 'pass123' on Server09;
Here i am using my password directly ,I dont want to keep the password in the maxl script as it is , I want to use some varible in place of passowrd.
Can any help me on this , how to do ? 
You could pass the password into the maxl script
e.g. in a batch script call the script passing in the password
essmsh loginscript.mxl passwordhere
Then in the maxl script use.
login user05 $1 on Server09;
passwordhere will be passed in the maxl script and using $1 will retrieve it, if you pass anymore variables in then you would pick them up depending on the order they were passed in e.g. $2 $3 ....
If you want to read further information have a look at :-
You could also encrypt the password, example available :- Encrypting passowrd in maxl
Hi john,
If i want to run manual that is ok.
what if i want to run through the Scheduled batch script? How can i do that? 
You can schedule the MAXL script, both in windows and unix, based on whatever OS you are on.
1. Windows: --
Create a batch script, xxx.bat and give command as "essmsh xxx.msh" in the file. Then schedule the batch script using Windows scheduler or any other schedule manager.
2. Unix: --
Create a shell wrapper (.sh file) and give the command as "essmsh xxx.msh" in the file. Then schedule the shell wrapper in crontab.
Let me know if it helps.
I think the best way would be to encrypt the id and password with the public/private key (see the reference that John referred you to). If you don't want that, you could set up environemnt variables to pass to the script or put the id and password in the batch script to pass to it.

Need Windows bat script help

Apparently I've been in Unix land a little too long, because I'm trying to do something in a windows .bat scirpt that i know is possible in a Kornshell. I just don't know for sure if it is possible on windows.
I am trying to assign a variable the value of a command. More specifically, I'm trying to assign the variable as the contents of a file.
So in a Kornshell I would do something like this...
DBS_NAME=$(cat DBS_NAME.txt)
echo $DBS_NAME
So I have gotten this far in the .bat script...
set DBS_NAME=type DBS_NAME.txt
echo %DBS_NAME%
but everything I've tried to resolve the "type" command (to display the contents of the file) is not working, I keep ending up with the text of what is after "set DBS_NAME=" on the output.
Does anybody know if this is possible in windows?
If I understand correctly what you are trying to do, try this:
set DBS_NAME=type DBS_NAME.txt
type %DBS_NAME% 
When I try what you suggest (which is where I've started from) and
echo %DBS_NAME%, what i get as output is..
type DBS_NAME.txt
when what I need is the contents of DBS_NAME.txt, or the result of the command 'type DBS_NAME.txt'. 
Don't include the echo.
type %DBS_NAME% 
The echo is there to display the value of DBS_NAME for testing.
I'm actually trying to read this in so I can pass it to a maxl command line, and instead of the variable passing the App.DBname (contents of the file), it is passing 'type C:\DBS_NAME.txt' to my maxl script, and so it is failing.
Here is the test bat script...
set DB=type C:\DBS_NAME.txt
essmsh C:\Test.mxl %DB%
and its maxl output below...
(I overwrote the user, password and server below)
Notice that it is failing on the word 'type'. This should be the App.DB being passed (the contents of the file), but instead it is still only passing the text of the command.
MAXL> login <user> <password> on <server>;
OK/INFO - 1051034 - Logging in user [000694098].
OK/INFO - 1051035 - Last login on Friday, November 05, 2010 2:08:03 PM.
OK/INFO - 1241001 - Logged in to Essbase.
MAXL> display variable on database type;
ERROR - 1242021 - (1) Syntax error near ['type'].
MaxL Shell completed 
Try this:
for /f %i in (DBS_NAME.txt) do set DBS_NAME=%i 
Ok, now I see what you want.
Try something like this:
for /f "tokens=1" %a in ( %DB% ) do set DBname=%a 
Holy Cow!
Apparently DOS bat files don't appreciate new-lines and formatting for easy reading.
I was trying your suggestions as
FOR /f %%i in (C:\DBS_NAME.txt)
IF %%i NEQ " "
essmsh C:\Test.mxl %%i
but couldn't get it to work. But, put it all on one line and it worked.
FOR /f %%i in (C:\DBS_NAME.txt) DO IF %%i NEQ " " essmsh C:\Test.mxl %%i
Thanks all,

Executing MaxL using startMaxL.cmd similar to ESSMSH in 11.1.1.x

Prior to 11.1.2.x, it was possible to read in values (for example server name, username and password) and then pipe dynamically-generated MaxL straight to ESSMSH and execute, all within a batch script. For example:
Batch Script (cut-down example):
FOR /F "eol=; tokens=1,2,3 delims=, " %%i in (\\<servername>\Folder1\Folder2\File.txt) do SET SERVER=%%~i & SET USER=%%~j & SET PASS=%%~k
( #echo login %USER% identified by %PASS% on %SERVER%; & #echo display variable all; & #echo exit; ) | essmsh
However, one now has to use "startMaxL.cmd", by calling it and passing the MaxL as a saved script as a paramter. This relies on the script being in a fixed state (i.e. not dynamically generated):
c:\Oracle\Middleware\EPMSystem11R1\products\Essbase\EssbaseClient\bin\startMaxl.cmd c:\MaxLScript.mxl
It there a way to return to something more like the previous example? I would like to continue to read in values (for example server name, username and password) from a separate text file, and to dynamically-generate the MaxL before executing ESSMSH as before, but I haven't yet found a way to do this. Any suggestions would be greatly appreciated. 
Hi James,
There are a number of different ways of doing this, if you want to stick to way you are going about then you can still call essmsh, all that startMaxl.bat is doing is setting environment variables before calling essmsh, just edit it and have a look.
So you could take the variables out of the startMaxl.bat and put them in your script or call a script with them in e.g.
set ESSBASEPATH=C:\Oracle\Middleware\EPMSystem11R1\common\EssbaseRTC-64\
set PATH=C:\Oracle\Middleware\EPMSystem11R1\bin;%ESSBASEPATH%;%ESSBASEPATH%\BIN;%PATH%
FOR /F "eol=; tokens=1,2,3 delims=, " %%i in (\\<servername>\Folder1\Folder2\File.txt) do SET SERVER=%%~i & SET USER=%%~j & SET PASS=%%~k
( #echo login %USER% identified by %PASS% on %SERVER%; & #echo display variable all; & #echo exit; ) | essmsh
I added %ESSBASEPATH%\bin to the set PATH instead of using %ESSBASEPATH%\bin\essmsh.exe like in startMaxl.bat but it doesn't have to be like that.
Thanks John,
This is exactly what I wanted to achieve, many thanks!

How to run .scr script in esscmd

Hi Essbase experts,              I am new to esscmd in essbase. I have created a simple script in my essbase server using vi editor.             The script is             LOGIN "localhost" "admin" "admin";           SELECT "ruletest" "plan1";           GETDBSTATE           EXIT;            I saved the script in .scr format.             Now how to run this script?            I selected a database and gave RUNCALC command to the script file. but i get the error as  //Name too long (getdbstate;) in ESSAPI function EssCalcFile//sts = 1030009 CalcObject = getdbstate;//Command Failed. Return Status = 1030009      Is this the correct way to run the file . I don't know exactly.And also help me in using the script file in esscmd.Please help me with your suggestions.  Thanks in advancePragadeesh.j
You don't need to start ESSCMD first; instead you invoke it with the name of your script: ESSCMD MyScript.scr See
Actually, my bad - on recent versions you'd use startEsscmd.cmd in place of ESSCMD in that example.  Otherwise identical. Unless you want to manage environment variables (you can see for yourself what startEsscmd.cmd does on your system).

Environment objects not being set for discoverer

I'm new to linux.I need to apply a patch for discoverer, in order to do so I need to set up my environment. I run the following script as follows:I navigate to the directory on linux box and then sh ./  i've also tried  . ./ The script appears to run fine but the paths and the system variables are not added to or changed. I've added some printenv to the script to see if anything is getting updated and it appears its not. I'm logged in as the oracle user and not root. I don't understand why this is not working any ideas are much appreciated. This is the script  ------------------------------------------------------------#!/bin/ksh  echo Press enter to continue; read dummy;  OH=/programs/app/oracle/Middleware/disco1ORACLE_HOME=/programs/app/oracle/Middleware/disco1ORACLE_INSTANCE=/programs/app/oracle/Middleware/asinst_1DC10_REG=$ORACLE_INSTANCE/config/PreferenceServer/Discoverer_asinst_1DISCO_COMP_NAME=Discoverer_asinst_1OHS_COMP_NAME=ohs1OPMN_COMP_NAME=opmnWLS_DISCO_NAME=WLS_DISCOWLS_DISCO_HOME=/programs/app/oracle/Middleware/user_projects/domains/ClassicDomain/servers/WLS_DISCOWLS_DISCO_STAGE=/programs/app/oracle/Middleware/user_projects/domains/ClassicDomain/servers/WLS_DISCO/stage/discoverer/$ORACLE_INSTANCE/Discoverer/Discoverer_asinst_1/util/log#FND_TOP=$OH/discovererFND_SECURE=$ORACLE_INSTANCE/config/Discoverer/Discoverer_asinst_1TNS_ADMIN=$ORACLE_INSTANCE/config  #needs to be properly setNLS_LANG="AMERICAN_AMERICA.UTF8"  echo Press enter to continue; read dummy;  export ORACLE_HOME ORACLE_INSTANCE DC10_REG NLS_LANG export DISCO_COMP_NAME WLS_DISCO_NAME WLS_DISCO_HOME WLS_DISCO_STAGEexport WL_HOME OHS_COMP_NAME export FND_SECURE TNS_ADMIN  PLATFORM=`uname -s`LIB_PATH=$OH/discoverer/lib:$OH/lib:/usr/lib:$OH/lib32  case $PLATFORM in"SunOS")        export LD_LIBRARY_PATH=$LIB_PATH:$LD_LIBRARY_PATH     ;;"HP-UX")     export SHLIB_PATH=$LIB_PATH:$SHLIB_PATH     ;;"AIX")     export LIBPATH=$LIB_PATH:$LIBPATH     ;;  *)     export LD_LIBRARY_PATH=$LIB_PATH:$LD_LIBRARY_PATH     ;;  esac  PATH=.:$OH/jdk/jre/bin:$OH/discoverer/bin:$OH/bin:$OH/OPatch:${PATH}export PATHumask 026ulimit -c 0  printenv PATH  echo Press enter to continue; read dummy;  #This Helper function is used by start/stop scripts.#First argument is process name and the second is pidfindprocess(){  pids=`ps -ea | awk '/'"$1"'/ { print $1}'`  for pid in $pids  do        if [ $pid -eq $2 ]        then                return 0        fi  done  return 1}  printenv PATHprintenv ORACLE_HOME  echo Press enter to continue; read dummy;---------------------------------------------end script
I don't think I fully understand your error. Are you getting any errors that you can post back?
No there is no error. The script is to run and during the script set the Oracle_home path, opatch path, tns_admin etc. and change the path variable to include the paths specified in the script. When the script finishes none of the variables are set. The path is not changed. I then cannot apply the patch because the appropriate environment variables are not set.
Finally resolved. Discussed with another admin and we used a different account here. thanks
I see. You could manually set your env variable first then run your script after. Since you script depends on the variables being set, that might work. Then again - my question to you is ...why is it necessary to include the setting of the variables as part of your script?
jmaag wrote: Finally resolved. Discussed with another admin and we used a different account here. thanks What different account? Generally, setting environment variables only apply to the current shell and need to be exported to be available in a sub-shell. There is no option to set variables affecting the parent shell. When you execute script, it is executed in a sub-shell, unless you source execute the script using dot space or source command. To my knowledge, Linux does not employ a logic of setting or altering system-wide or kernel variables.