CDF to run commands / Shell scripts

Hi friends,

I need help serious here regarding the CDF function.

I created a JAR file to run batch/shell scripts via the calculation script.

I tested the JAR file and it works perfectly well that run without the calculation script, but I get errors including in Calc script, I get the error message.

Initially, the error was: error of Machine virtual Java and later, it is class not found.

Here are the steps to register the CDF:

1. place the JAR file in the location: E:\Oracle\Middleware\EPMSystem11R1\products\Essbase\EssbaseServer\java\udf\

2. update the file udf.policy with the following statement:

Grants all permissions to BatEx

give the code "file:${essbase.java.home}/BatEx.jar" {}

permission java.security.AllPermission;

};

3 restart the Essbase services.

4. I am trying to create this function at Global level so no mention is not the name of the Application in the MaxL at registration:

create or replace function '@BatEx' as

"BatEx.

Spec '@BatEx(Complete path in double quotes) '.

Comment "Functions A CDF that runs the batch file in Essbase Server";

5 this is the calc script:

@BatEx 'E:/Oracle/Middleware/EPMSystem11R1/common/utilities/Test.bat '; -It gives an error: error: invalid syntax 1012000 - not a command CALC [@BatEx]

I tried another way:

RUNJAVA @BatEx 'E:/Oracle/Middleware/EPMSystem11R1/common/utilities/Test.bat '; -Gives an error: problem running [@BatEx 'E:/Oracle/Middleware/EPMSystem11R1/common/utilities/Test.bat']: [can't find @BatEx class]

Where I am wrong here? Please help me out here.

Kind regards

RB

Thanks much Amit and Jake! I finally cracked!

Sad thing is that I have found no OTN correct information regarding function Java Custom, rather there was a lot of information about CDFs pre-existing provided by Oracle, so I decided to write a complete solution of CDF, where Java code too was created by the developer of Essbase applications.

The requirement that I had was to trigger the batch file in the calculation script. Here is the detailed requirement:

Update Variable of Substitution by planning web form.

1. the user enters the data in the form of the planning web and saves it.

2. the calc script attached to the web form, extracts data and records the flat file on Essbase server.

3. earlier we were executing the script batch on the web server as the workflow will identify the lots on the web server and not on Essbase server, but after the development of this CDF to run the batch job, the batch files can be run directly Essbase server.

4. the idea is to keep the user limited to the tasks list, so that it does not jump to the to-do list to SubVar web form, workflow and then return to the task list for a simple job to change SubVar.

There were a few challenges that I encountered during the development of this JAVA function, namely:

1 function CDF records do not : I tested JAVA code separately using command line and the executable Jar file will execute the batch, as expected. But I couldn't get why my CDF is not have recorded trace. After a lot of searching on Google and analysis, I found that it was the difference between the Version of JAVA (the JAVA compiler I used to compile and create my JAR file) and JAVA (JVM Essbase) virtual machine. I used JDK 1.7 update 65 to compile and create my POT so that the JVM used in the Essbase Server Update 1.6 is 35. I uninstalled JDK 1.7 of my machine, downloaded Update 1.6 35 archives of the Oracle and recompiled the code. Guess what! My CDF function was recorded first.

So always check the compatibility of the Version of the JDK you used to compile and create the JAR file and JVM on your Essbase server.

You can check the version of the JVM in console EAS-> EssbaseCluster-> right click-> Edit-> properties-> tab environment. There is a line that appears something like:

; JvmModuleLocation $J (EPM_ORACLE_HOME)-...-jdk160_35\jre\bin\server\jvm.dll (the bold is your version of the JVM).

2. "main class not found" error after successful registration of CDF:

I haven't had that one category of Public in my JAVA code and this error took me by surprise. I also checked the "public static void main" section in my code and everything seems to be OK. Please note that JAVA is case sensitive - 'hand' and 'Hand' aren't even in JAVA.

I did some further research and one of John's response to a CDF request, I came to know that I need to include another argument (context) in the main section of my Java code and recompile with classpath "essbase.jar" (I will explain the controls in the next steps). I changed the main section of my JAVA code and included the argument:

Public Shared Sub main (paramContext context, String [] paramArrayOfString)

The following JAVA code to perform the batch in Essbase Server:

import com.hyperion.essbase.calculator.Context;

import java.io.BufferedReader;

import java.io.InputStream;

import java.io.InputStreamReader;

import java.io.OutputStream;

import java.io.PrintStream;

public class BatEx

{

Public Shared Sub main (context, paramContext, String [] paramArrayOfString)

{

Try

{

String str1 = paramArrayOfString [0];

LocalProcess process = Runtime.getRuntime () .exec (str1);

InputStream localInputStream1 = localProcess.getInputStream ();

OutputStream localOutputStream = localProcess.getOutputStream ();

InputStream localInputStream2 = localProcess.getErrorStream ();

BufferedReader in = new BufferedReader (new InputStreamReader (localInputStream1)) localBufferedReader;

String str2;

While ((str2 = localBufferedReader.readLine ())! = null) {}

System.out.println (str2);

}

System.out.println ("package executed successfully.");

}

catch (Exception localException)

{

System.out.println ("error!:" + localException);

localException.printStackTrace ();

}

}

}

Install the (compatible to Essbase JVM) compatible version of the JDK on your machine. Compile the above code by using the following command:

C:\ >javac - classpath essbase.jar BatEx.java - please specify the path to the file "essbase.jar". It generally to the location: : \Oracle\Middleware\EPMSystem11R1\products\Essbase\EssbaseServer\java\

The code should compile without any problem, and a .class file must be created with the same name.

Now is the time to create the JAR file. Use the following command:

C:\ >jar cf BatEx.jar BatEx.class

Now the executable JAR file must also be created.

Place this JAR file: : \Oracle\Middleware\EPMSystem11R1\products\Essbase\EssbaseServer\java\udf\

Restart the service of Essbase and application (the only Application Restarting should work, but I didn't take any chances to restart both).

Check the log of function CDF recording applications. The application log should be at the location:

: \Oracle\Middleware\user_projects\epmsystem3\diagnostics\logs\essbase\essbase\app\-

The CDF enrollment message should be something like:

External function of [GLOBAL] [@BatEx] saved OK

I used the following MaxL to register my function in Essbase:

create or replace function '@BatEx' as

"BatEx.

Spec '@BatEx (StringArray).

Comment "Functions A CDF that runs the batch file in Essbase Server"

I used the following script to calc to run my CDF (fairly simple however):

ESS_LOCALE English_UnitedStates.Latin1@Binary

RUNJAVA BatEx "": / Oracle/Middleware/EPMSystem11R1/common/utilities/Test.bat ";" -Note: please replace with the name of the physical drive.

I went and checked the logs that the Test.bat written and "wallah! The log file had some content and 1 KB in size. I deleted the contents of the log file and checked again, the result was the same.

Hope this answer helps all of us who work on CDF that is clean.

Please like this post if this can help you in some way.

Thanks again to Amit, Jake and John for helping me solve this puzzle.

Kind regards

Amit Kumar Singh

Tags: Business Intelligence

Similar Questions

  • Problem to run the shell script procedure

    Hello

    I wrote a shell script which needs to execute the stored procedure

    The shell script:
    cat bi_loading2.sh
    #!/usr/bin/ksh
    export ORACLE_BASE=/u01/app/oracle
    export ORACLE_HOME=/u01/app/oracle/product/11.2.0/DWH11gR2
    export ORACLE_SID=DWH
    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME/lib
    echo "zero  arg  is  :$0"
    echo "First arg  is  :$1"
    echo "Second arg is  :$2"
    
    
    /u01/app/oracle/product/11.2.0/DWH11gR2/bin/sqlplus  system/xxx@dwh << EOF
    insert into SYSTEM.POC_EXDATA_RESULTS  values($1,'$2',sysdate,null);
    commit;
    
    
    execute system.$2;
         
    update SYSTEM.POC_EXDATA_RESULTS
    set end_date=sysdate
    where id= $1;
    
    commit;
    EOF
    exit 0
    The script gets two parameters: id (1) (2) the procedure that I have to run

    As you can see below oracle is to omit the 'run' command
    Please notice why I can't run the stored procedure.


    $ 83 poc_cf54xbx6cchf2 bi_loading2.sh
    zero  arg  is  :bi_loading2.sh
    First arg  is  :83
    Second arg is  :poc_cf54xbx6cchf2
    
    SQL*Plus: Release 11.2.0.2.0 Production on Thu Dec 15 17:46:37 2011
    Copyright (c) 1982, 2010, Oracle.  All rights reserved.
    Connected to:
    Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
    With the Partitioning, Automatic Storage Management and Real Application Testing options
    
    SQL> 
    1 row created.
    
    SQL> 
    Commit complete.
    
    SQL> SQL> SQL> BEGIN  system.poc_cf54xbx6cchf2; END;
    
                    *
    ERROR at line 1:
    ORA-06550: line 1, column 17:
    PLS-00103: Encountered the symbol "SYSTEM" when expecting one of the following:
    := . ( @ % ;
    The symbol ":=" was substituted for "SYSTEM" to continue.
    
    
    SQL> SQL>   2    3  
    4 rows updated.
    
    SQL> 
    Commit complete.

    Read the error stack.

    ORA-06512: at "SYSTEM.POC_CF54XBX6CCHF2", line 3
    

    The error is on line 3 of the POC_CF54XBX6CCHF2 procedure
    If the procedure is called.

    ----------
    Sybrand Bakker
    Senior Oracle DBA

  • How to run commands from the Terminal from the Finder?

    I would ask a series of Terminal commands in a file, then run the commands by double-clicking on the file in the Finder.  I found a number of sources on how to do on the internet, but most include comments from other users by saying: "this has not worked for me.  I have not found a definitive 'it's how

    I created a test file, use TextEdit, named test.commandand saved to my desktop.  The file contains these commands:

    ! / bin/sh

    chmod + x ~/Desktop/test.command

    echo 'Hi. ' here

    echo 'Hi' once again

    When I double-click the file, however, it sometimes just opened in the Finder.  Other times, I get an error message saying I don't have permission to run the file.  I thought that the chmod command was to manage the authorization, but maybe I'm not using it correctly.

    Can anyone help?

    #! / bin/sh

    You must # follow-up by the! as the very first 2 characters of the file.

    And as bash is the default shell, you should probably actually tell

    #! / bin/bash

    The chmod + x command should be performed after you have created the file test.command, not inside her.

    Another way to run shell commands is via Automator-> run the Shell Script

    Automator has no need to open a Terminal Services session to process orders.  But if you want to have the command display something, it might be simpler to use a .command file, although there are ways to view things in an Automator app as well.

  • Call Shell Script from within PL/SQL - using DBMS_PIPE

    Hi all

    I'm trying to run a shell script inside my PL/SQL using DBMS_PIPE block (not sure if this is the right way or not)

    Pl Sql script

    ==========

    Set serveroutput size 100000

    declare

    cursor c1 is select * from mag_images

    where nom_image like '% comp2.

    v_path varchar2 (100): = ' / home/maguzzi/DOCUMENTS_DIR / ";

    v_result number: = 0;

    v_in_filename varchar2 (100): = v_path | ' test_file.jpg';

    v_out_filename varchar2 (100): = v_path | ' test_file_out.jpg';

    v_script varchar2 (100): = "tst_convert.sh";

    v_command varchar2 (200): = 'sh'. v_path | v_script | » '|| v_in_filename | » '|| v_out_filename;

    Start

    A1 to c1 loop

    dbms_output.put_line ('v_command: ' | v_command);

    write_to_file ('test_file.jpg', 'DOCUMENTS_DIR', a1. Content);

    dbms_output.put_line (' file write result: ' | v_result);

    v_result: = exec_host_command (v_command);

    dbms_output.put_line (' resize result :'|| file v_result);

    end loop;

    end;

    Result DBMS_OUTPUT

    ====================

    v_command: /home/maguzzi/DOCUMENTS_DIR/tst_convert.sh test_file.jpg test_file_out.jpg

    Result of the entry of the file: 0

    Result of resizing the file: 0

    PL/SQL procedure successfully completed.

    Function exec_host_command

    =======================

    FUNCTION to CREATE or REPLACE exec_host_command (lc_cmd IN VARCHAR2)

    RETURN INTEGER IS

    ln_status NUMBER;

    lc_errormsg VARCHAR2 (80);

    lc_pipe_name VARCHAR2 (30);

    BEGIN

    lc_pipe_name: = 'Maguzzi_PIPE ';

    DBMS_PIPE. PACK_MESSAGE (lc_cmd);

    ln_status: = dbms_pipe.send_message (lc_pipe_name);

    RETURN ln_status;

    END;

    /

    The Image of the BLOB is written to the correct location on the server "test_file.jpg", and although the exec_host_command function returns a value of 0, the shell script (tst_convert.sh) is not executed (i.e. no output file is created - outfile.txt and the image is not copied/converted to a new file name "" test_file_out.jpg" )

    Shell script

    ========

    tst_convert.sh

    echo 'Here' > outfile.txt

    Echo $1 > > outfile.txt

    Echo $2 > > outfile.txt

    resizing to convert $1 - $200 2

    Could this be problems with permissions on files?

    test_file1.jpg has permission - rw-rw-r-

    test_convert.sh a permission rwxrwxrwx

    When I run the script manually and pass in 2 parameters ($1 = infilename and $2 = outfilename), it works...

    I'd appreciate if someone can point out my mistake or suggest another method that works.

    Thanks in advance

    How long does it take to create the converted file? Remember that the external Scheduler is running asynchronously, so it is possible that the converted file does not exist yet when the PL/SQL block subsequently tries to open it.

    Try to add some delay seconds to the routine to ensure that the external task is completed:

        begin
          dbms_scheduler.create_job(
              job_name => 'MAG_IMAGE_CONVERT2'
            , job_type => 'EXECUTABLE'
            , job_action => '/home/oracle/DOCUMENTS_DIR/tst_convert2.sh' );--  '/home/oracle/DOCUMENTS_DIR/tst_convert.sh');
          dbms_scheduler.enable('MAG_IMAGE_CONVERT2');
          dbms_lock.sleep(3);
        end;
    

    This probably isn't really a viable solution in the long term if it turns out that this is really the problem.

  • Why the sql statement was extucted twice in shell script?

    I tried to test the rac load balancing using the shell script depending on suse 10 + oracle 10g rac.
    oracle@SZDB:~> more load_balance.sh
    #!/bin/bash
    for i in {1..20}
    do
    echo $i
    sqlplus -S system/oracle@ORA10G <<EOF
    select instance_name from v\$instance;
    /
    EOF
    sleep 1
    done
    exit 0
    After run the shell script, I got the result to follow.
    oracle@SZDB:~> ./load_balance.sh
    1
    
    INSTANCE_NAME
    ----------------
    ora10g2
    
    INSTANCE_NAME
    ----------------
    ora10g2
    
    2
    
    INSTANCE_NAME
    ----------------
    ora10g1
    
    INSTANCE_NAME
    ----------------
    ora10g1
    
    3
    
    INSTANCE_NAME
    ----------------
    ora10g1
    
    INSTANCE_NAME
    ----------------
    ora10g1
    Seem that the sql statement was run twice in each loop. If you help please take a look. Thanks in advance.

    Robinson

    Because you have one; and one.

  • Feedback from shell script?

    I know that you can use app.system () in PS to run a shell script.  Is there a way to capture the information it is out?

    For example:

    Info var = app.system (' / Users/ypml/Desktop-name \"*.jpg\"'");

    Alert (info);

    Returns '0' instead of the list of the files that were found.  Any ideas how to get this information?

    Thank you!

    Use a redirect to save the output to a file. Then read the file info.

  • Unzip the file sys of operation or execute an Oracle stored procedure shell script

    Y at - it a package or something else I can use a procedure stored Oracle to decompress a file of the operating system or run a shell script? Have Oracle 11g 2, Linux Redhat. I am familiar with utl_file to look at properties, open, close, write files, etc., but am looking for a way to decompress a file or run a shell script.

    Without papers, and likely or very likely not supported

    http://technology.AMIS.nl/Blog/5307/Oracle-database-directory-listing-with-ls-function

    There are JVM/Java alternatives to it. Search asktom.oracle.com

    Published by: Marco Gralike on August 23, 2011 22:31

  • Run the automator script in a shell command

    Hello

    I would like to start an automator script in a command shell with the automator command (see automator man).

    I would like to pass an argument to the script (such as a list of files) too much with the i - settings but my syntax has failed. This is my test written in AppleScript script:

    on run
      tell application "Finder"
      set theSelection to selection
      set theFile to theSelection's item 1 as alias
      set thePath to quoted form of POSIX path of theFile
    
      log thePath
    
      set theWorkflow to quoted form of "/Users/conmeubonailleuco/Library/Mobile Documents/com~apple~Automator/Documents/Encode Audio Files.workflow"
      set theAutomatorScript to "automator " & theWorkflow & " -i (" & thePath & ")"
    
      do shell script theAutomatorScript
      end tell
    end run
    

    theAutomatorScript the value "-i «& path & space & theWorkflow» automator

  • How to call commands in script shell written in Applescript in Adobe extended Script or JSX

    The appeal of commands below:

    shell script "curl-L o" and shell script '-i sed ' "equivalent commands in JSX.

    Thank you

    Try to post your questions in the specific forum.

    https://forums.Adobe.com/welcome

  • Run the command line script AfterFX

    Hi all

    I'm trying to run a script from the command line AfterFX.exe and I get the message: "unable to run the script at line 1. Syntax error.

    If I run the same Script AE editor script file, it works perfectly

    Here is the command line that I use:

    "C:\Program Files\Adobe\Adobe after effects CS6\Support Files\AfterFX.exe" indefinite display - noui s 'D:\Product\Watermark\Rendering\WatermarkedSecuritySample.jsx '.

    Someone has an idea of what may cause this error? I tried to run the script directly from the command line like

    "C:\Program Files\Adobe\Adobe after effects CS6\Support Files\AfterFX.exe" indefinite display - noui s 'alert('1') '.

    and it works very well for small script but mine is way big to do

    As you can probably guess with the 'watermark' and 'Security' in the name of the file, I can't post here, the script file, all I can say is that line 1 is:

    {

    projectName = "D:\\Product\\WatermarkTemplate.aep"; var

    I tried to replace the entire script 'alert('1')'; and it causes the same error when running it from the command line

    Also, if anyone knows where I can find the command line arguments AfterFX.exe description, I'd be very happy... everybody talks about aerender.exe, but I need these options to AfterFX.exe

    Thanks for your help

    Have you tried using "-r" instead of "-s"?

    ("-s" argument is a script; and to "-r" argument is a path to the script)

  • Capture to users running sql in shell script after every 10 minutes

    Hi all

    We have a strange problem. crash of database, so decided to check that users make when OS/DB crashes.

    I need your RACE/SCHEDULING of entry into such a script, which includes all active users with SQL running and add to a log file so that we are aware of what has past when DB/OS crashed.

    I can run this race a query V$ SESSION, V$ SQL and V$ PROCESS but I need your ideas in writing a SHELL Script and scheduling can work via CRON.

    Kind regards.

    Or better yet

    sqlplus /some_report_file. 'date + %m-%d - hour %M %Y'

  • Can we not run 2 programs of sqlplus in shell script?

    Hello

    I have 2 coil programs that must be called from a shell script.

    When I try to do, only the first reel program works but not the other. Is their any reason?

    #! / usr/bin/bash
    ORACLE_HOME=/Oracle10g/product/10.2.0/Client_1
    Export ORACLE_HOME

    sqlplus-s abcdata/daddy@DevOra < lit_fac.sh > output.log 2 > & 1
    sqlplus-s abcdata/daddy@DevOra < lit_fac_cat.sh. output_cat.log 2 > & 1

    output

    How to run 2 scripts containing select questions each of sqlplus in another shell script?

    Thanks in advance...

    Without trying the script, the second line

    sqlplus -s abcdata/daddy@DevOra < lit_fac_cat.sh . output_cat.log 2>&1 
    

    seems to have a typo and should probably be:

    sqlplus -s abcdata/daddy@DevOra < lit_fac_cat.sh > output_cat.log 2>&1 
    

    -Andy

  • run a package through shell script

    Hi trying to run a package through shell script.
    But it is failling. Some may point out why?

    Here is the code im with


    ==================

    sqlplus user/pwd s < < EOF
    coil file.log

    START the user. PKG_Name.RUN_job;
    commit; END;
    spool off

    output
    EXPRESSIONS OF FOLKLORE

    ===========================


    I am able to run using the code below Toad.

    'BEGIN user. PKG_Name.RUN_job;
    commit; END; »

    What error do you get? Use
    sqlplus user/pwd s<>
    coil file.log
    START the user. PKG_Name.RUN_job;
    commit; END;
    /
    spool off
    output
    EXPRESSIONS OF FOLKLORE

    Kind regards.

  • How to set property of the command shell (batch) script file comment?

    How a shell script (file "beats") adjustable the comment of a file?

    Hello

    The question you posted would be better suited in the TechNet Forums. I would recommend posting your query in the TechNet Forums:

    https://social.technet.Microsoft.com/forums/scriptcenter/en-us/home?Forum=iTCG

  • How to run the powershell script of command with several parameters

    Is there a way to run a powershell script from the dialog box run with several parameters? In addition, the path to the script contains spaces, for example, c:\powershell scripts\script.ps1.

    Take a look at http://www.powershell.nu/2009/12/16/running-scripts-with-arguments-in-powershell/ which explains how to pass arguments to a script.

    André

Maybe you are looking for

  • Satellite S35DVD PS30DE: Most recent need driver graphic

    I have a * Toshiba S35DVD * from around the year 2000. I want to download the new drivers, especially for video.I have looked through the technical support information on Toshiba.com, but could not find this model. It is probably a model which is pla

  • Impossible to use the local DNS server

    As a home user, I want to have a good DNS for my local network. I decided to install PowerDNS on one of my virtual machines. It works perfectly and does exactly what I need; resolve local names (research as well in the position reversed) and transfer

  • Can we get our data back, please?

    It seems that Motorola has changed available in the csv file that it creates. Becuause of this, data can no longer be imported about any program. Especially if you needed convert online to convert it to a .tcx. As much as I love watching it, I don't

  • EliteBook 8540p: password bios Elitebook 8540p

    Hi - I have not found a solution in the forum, so I type in a new topic. I bought the laptop first owner a few months ago and realized this administration bios is locked. Unfortunately, this type of laptop is well protected against the default reset.

  • Solitaire 6.0 for Vista is doomed to failure

    My spider solitaire works very well but the regular soitaire seems to be virtually doomed to failure.  I won only one game on 50 that would never happen with real cards.  Is this software game corrupted somehow, or was it made to be extremely frustra