Calling unix shell script from oracle stored procedure.. urgent!!!!!!!!!!!!

Hi,
i havea requirement where in i should be able to call my shell script through oracle stored procedure.i tried the following way..but iam unable to get the result.please find the details below.
new.sh - my shell script - lctfile (LCTFILE) is the input pa
v_config_file=`find $FND_TOP -name LCTFILE
FNDLOAD apps/s0ccer@$dxbs1 0 Y DOWNLOAD $v_config_file /home/bir4163/RPT33/bin/menu.ldt MENU MENU_NAME='AR_NAVIGATE_GUI'
if [ $? != 0 ];then
echo "$DATE $0 FNDLOAD DOWNLOAD Failed!" | tee -a $LOG_FILE
else
echo "SUCCESS" | tee -a $LOG_FILE
fi
CREATE OR REPLACE PROCEDURE test_dbms_scheduler
AS
v_text VARCHAR2 (255) := 'AR_NAVIGATE_GUI';
BEGIN
DBMS_OUTPUT.put_line ('I am in Procedure');
DBMS_SCHEDULER.create_job (
job_name => 'test_dbms_scheduler',
job_action => '/home/bir4163/RPT33/bin/new.sh',
number_of_arguments => 1,
job_type => 'executable',
start_date => SYSDATE,
repeat_interval => 'FREQ=SECONDLY; INTERVAL=1',
enabled => FALSE,
auto_drop => FALSE,
comments => 'run shell script'
DBMS_SCHEDULER.set_job_argument_value (job_name => 'test_dbms_scheduler',
argument_position => 1,
argument_value => v_text);
DBMS_SCHEDULER.enable ('test_dbms_scheduler');
DBMS_OUTPUT.put_line ('I am back in Procedure');
EXCEPTION
WHEN OTHERS
THEN
DBMS_OUTPUT.put_line (SQLCODE || SQLERRM);
END;
But iam unable to test it as i do not have permissions to access dbms_scheduler.can anybody tell me how to solve this using DBMS_PIPE with a sample code.
please do help its very urgent
thanks
ramya

Hi,
Register your Shell Script as a concurrent program, Executable execution method "Host", then use fnd_request.submit_request to submit the program.
Regards,
Andries

Similar Messages

  • Need Example on calling a unix shell script from oracle stored procedure

    Hi
    Can anybody give example on how to call unix shell script from an Oracle stored procedure. Please give a small example on how to do this .I need this urgently please.
    Have a nice time.
    Thanks & Regards
    Jogesh

    If you are on 10g you can also use DBMS_SCHEDULER. See Re: Excute Unix command Using PL SQL

  • Can I call host file ( Unix Shell script ) from Oracle 10g trigger

    Hi,
    I am new to Oracle 10g. Can I call host file ( unix shell script ) from Oracle 10g trigger ?. I know it is possible. Pl explain me with small example
    thanks & regards
    parag

    user12009546 wrote:
    Hi,
    I am new to Oracle 10g. Can I call host file ( unix shell script ) from Oracle 10g trigger ?. I know it is possible. Pl explain me with small example
    thanks & regards
    paragIf you are in 10g, you can simple call shell script from DBMS_SCHEDULER:
    BEGIN
    DBMS_SCHEDULER.CREATE_JOB (
    job_name => 'TEST_SCRIPT',
    job_type => 'EXECUTABLE',
    job_action => 'PATH_OF_YOUR_SCRIPT',
    start_date => SYSDATE,
    repeat_interval => 'FREQ=MINUTELY; INTERVAL=1',
    enabled => TRUE,
    comments => 'Shell script from Oracle'
    END;
    /

  • Calling UNIX shell script from ODI package?

    Hi,
    How Can we call UNIX shell script from ODI package?
    I have a ftp_ss.sh script which which ftps a file from remote server to local server, archives the last file and renames new file to the standard (ie file data store)name.
    I want to run the above script and interfaces from a package.
    Any help is greately appreciated.
    Thanks,
    RD

    In the package window, put "OS Command" from the toolbox.
    Provide the command parameters to this tool in form of "/path/to/script/ftp_ss.sh"

  • Calling Unix shell script from PL/sql code

    Hi
    I need to call a shell script from a procdeure which i need to run in toad. Let me kno whow can i do that and connect to unix box with an example.

    Thanks Avinash,
    That on was very useful.
    When I try to execute I got the following error.
    Could you let me now What privileges are required?
    SQL> BEGIN
    dbms_scheduler.create_job(job_name => 'myjob',
    job_type => 'executable',
    job_action => '/home/rananto/a.sh',
    enabled => TRUE,
    auto_drop => TRUE);
    END;
    / 2 3 4 5 6 7 8
    BEGIN
    ERROR at line 1:
    ORA-27486: insufficient privileges
    ORA-06512: at "SYS.DBMS_ISCHED", line 99
    ORA-06512: at "SYS.DBMS_SCHEDULER", line 262
    ORA-06512: at line 2
    SQL> exec dbms_scheduler.run_job('myjob');
    BEGIN dbms_scheduler.run_job('myjob'); END;
    ERROR at line 1:
    ORA-27475: "CRDM.MYJOB" must be a job
    ORA-06512: at "SYS.DBMS_ISCHED", line 150
    ORA-06512: at "SYS.DBMS_SCHEDULER", line 441
    ORA-06512: at line 1

  • Invoking Shell Script from JAVA Stored procedure

    I am trying to invoke shell script using Java Stored procedure.
    When I run my java class outside of oracle using oracle user
    account it works but as soon as i load it into database and try
    to inovoke that class using PL/SQL wrapper it runs java class
    but is not able to invoke the shell script. Any ideas would be
    greatly appreciated.

    Pleass search the forums for "runtime" as there are many threads and examples already posted.

  • Can i call unix shell script from B2B callout.

    Hi,
    We had a requirement to invoke a unix shell script from B2B callout implemented class. Here is the code in implementation class:
    public void execute(CalloutContext context,List input,List output)
    throws CalloutDomainException, CalloutSystemException {
    try {
    CalloutMessage cmIn = (CalloutMessage)input.get(0);
    FileOutputStream fos = null;
    String inputFile = "/home/orasoad/digitalsign/input/test.txt";
    String outputFile = "/home/orasoad/digitalsign/output/test.txt.gpg";
    File outFile = new File(inputFile);
    String str =cmIn.getBodyAsString();
    fos = new FileOutputStream(outFile);
    Writer out = new OutputStreamWriter(fos);
    out.write(str);
    out.close();
    String shellFile = "/home/orasoad/digitalsign/dg.sh";
    String cmd[] = new String[] { shellFile, inputFile, outputFile };
    Runtime rt = Runtime.getRuntime();
    Process pr = rt.exec(cmd);
    int i = pr.waitFor();
    BufferedReader br = new BufferedReader(new InputStreamReader(pr.getInputStream()));
    StringBuffer sb = new StringBuffer();
    String line;
    while ((line = br.readLine()) != null) {              
    sb.append(line);
    CalloutMessage cmOut = new CalloutMessage(sb.toString());
    output.add(cmOut);
    } catch (Exception e) {
    throw new CalloutDomainException(e);
    We were able to execute the unix shell script from standalone java class with same code. But some how it is not working as expected while invoking the B2B java callout.
    Is it possible to invoke unix shell script from B2B callout?
    Please give inputs.
    Regards,

    Though it's not a good idea to invoke shell scripts from java callout but technically it will work.
    But some how it is not working as expected while invoking the B2B java callout.What is not working as expected? Any error in the log (server-diagnostic.log or server.out)?
    Regards,
    Anuj

  • Invoking a UNIX shell command from Java stored procedure

    The program below is suppose do send an email using UNIX mailx program. It works correctly when I compile it in UNIX and invoke it from the command line by sending an email to the given address.
    I need this program to run as a stored procedure, however. I deploy it as such and try to invoke it. It prints the results correctly to the standard output. It does not send any emails, however. One other difference in execution is that when invoked from the command line, the program takes about a minute to return. When invoked as a stored procedure in PL/SQL program or SQL*Plus anonymous block, it returns immediately.
    Why would mailx invocation not work from a stored procedure? Are there other ways to invoke mailx from PL/SQL?
    Thank you.
    Michael
    import java.io.BufferedWriter;
    import java.io.IOException;
    import java.io.OutputStreamWriter;
    public class MailUtility
    public static void main(String[] args)
    System.out.println(mailx("Hey, there", "Hello", "oracle@solaris10ora", 1));
    * Sends a message using UNIX mailx command.
    * @param message message contents
    * @param subject message subject
    * @param addressee message addressee
    * @param display if greater than 0, display the command
    * @return OS process return code
    public static int mailx(String message, String subject,
    String addressee, int display)
    System.out.println("In mailx()");
    try
    String command =
    "echo \"" + message + "\" | mailx -r [email protected]" + " -s \"" + subject + "\" " + addressee;
    if (display > 0)
    System.out.println(command);
    try
    Process process = Runtime.getRuntime().exec("/bin/bash");
    BufferedWriter outCommand =
    new BufferedWriter(new OutputStreamWriter(process.getOutputStream()));
    outCommand.write(command, 0, command.length());
    outCommand.newLine();
    outCommand.write("exit", 0, 4);
    outCommand.newLine();
    outCommand.flush();
    process.waitFor();
    outCommand.close();
    return process.exitValue();
    catch (IOException e)
    e.printStackTrace();
    return -1;
    catch (Exception e)
    e.printStackTrace();
    return -1;

    try adding the full explicit path to "mailx" in the command string that gets sent to Runtime. i would guess that the shell that gets spawned might not have a proper environment and thus mailx might not be found.
    == sfisque

  • Call Unix Shell Script From OBIEE

    Hi All,
    Is it possible to do a call to a Unix Shell Script with the Action Framework from OBIEE.
    Thanks in Advance

    I dont think so but we can go for it instead of BI side. Try to port the same functionality on shell script side, so that the script can identify your report using tail of nqquery log and execute the rest of your lines in shell script.
    This can doable and works as expected. If at all you are going with my suggestion you can go for a small key word to identify your report instead of that lengthy logical query.
    Pls mark if helps

  • How can I call unix shell script from database using triggers

    Hi everyone,
    can anybody help me to solve my problem.
    we have one table and records are getting inserted into table.
    when the record is inserted with 'C',I need to fetch that record-id which is primary key and then by passing that id as an argument I need to execute a shell script which is there in Unix using triggers.
    please note DB and Scripts are in different servers.

    4159efc6-cffb-4496-bd1a-68859f6ce776 wrote:
    Hi everyone,
    can anybody help me to solve my problem.
    we have one table and records are getting inserted into table.
    when the record is inserted with 'C',I need to fetch that record-id which is primary key and then by passing that id as an argument I need to execute a shell script which is there in Unix using triggers.
    please note DB and Scripts are in different servers.
    PL/SQL can only interact with objects on the local DB Server.
    PL/SQL can initiate OS local script via any of the following mechanisms: EXTERNAL PROCEDURE, JAVA, DBMS_SCHEDULER
    The local script then will need to launch the remote script.

  • Calling unix shell script from SAP

    Hi,
    1. i created command in SM69 as Zshell.
    2. i pass this command to FM SXPG_COMMAND_EXECUTE. it is working fine when the file is having read write execute permisson on unix level.
    but the problem is my unix administrator he don't want to give this permission. because of some security reason.
    he want's to execute with ROOT.
    anyone knows how i can handle this situation?
    if the file is doesnot have read write execute permission, then FM give permission error.
    Thanks.

    could i pass like this.
    my script name is ZRECOVERY_RPT.
    p_comm = ZRECOVERY_RPT.
    in the function module i passed like this.
    CALL FUNCTION 'SXPG_COMMAND_EXECUTE'
      EXPORTING
        commandname                         = p_comm
      ADDITIONAL_PARAMETERS               =
        OPERATINGSYSTEM                     = SY-OPSYS
        TARGETSYSTEM                        = p_host
      DESTINATION                         =
       STDOUT                              = 'X'
       STDERR                              = 'X'
       TERMINATIONWAIT                     = 'X'
      TRACE                               =
      DIALOG                              =
    IMPORTING
      STATUS                              =
      EXITCODE                            =
    TABLES
       EXEC_PROTOCOL                       = it_exec_pro
    EXCEPTIONS
       NO_PERMISSION                       = 1
       COMMAND_NOT_FOUND                   = 2
       PARAMETERS_TOO_LONG                 = 3
       SECURITY_RISK                       = 4
       WRONG_CHECK_CALL_INTERFACE          = 5
       PROGRAM_START_ERROR                 = 6
       PROGRAM_TERMINATION_ERROR           = 7
       X_ERROR                             = 8
       PARAMETER_EXPECTED                  = 9
       TOO_MANY_PARAMETERS                 = 10
       ILLEGAL_COMMAND                     = 11
       WRONG_ASYNCHRONOUS_PARAMETERS       = 12
       CANT_ENQ_TBTCO_ENTRY                = 13
       JOBCOUNT_GENERATION_ERROR           = 14
       OTHERS                              = 15
    IF sy-subrc EQ 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    how i can pass along with SH.

  • Calling a Web Service from Oracle Stored procedure

    I am getting the following error when running this example. Does anyone know what did I miss.
    Error: HTTPClient.HTTPConnection java.lang.NoClassDefFoundError: HTTPClient.HTTPConnection at oracle.soap.transport.http.OracleSOAPHTTPConnection.getHTTPConnection(Ljava.net.URL;)LHTTPClient.HTTPConnection;(OracleSOAPHTTPConnection.java:1122) at oracle.soap.transport.http.OracleSOAPHTTPConnection.post(Ljava.net.URL;Lorg.apache.soap.transport.TransportMessage;)Lorg.apache.soap.transport.TransportMessage;(OracleSOAPHTTPConnection.java:877) at oracle.soap.transport.http.OracleSOAPHTTPConnection.send(Ljava.net.URL;Ljava.lang.String;Ljava.util.Hashtable;Lorg.apache.soap.Envelope;Lorg.apache.soap.encoding.SOAPMappingRegistry;Lorg.apache.soap.rpc.SOAPContext;)V(OracleSOAPHTTPConnection.java:713) at org.apache.soap.rpc.Call.invoke(Ljava.net.URL;Ljava.lang.String;)Lorg.apache.soap.rpc.Response;(Call.java:253) at oracle.otnsamples.wsclient.CreditAgencyServiceStub.authorizeCustomer(Ljava.lang.String;)Ljava.lang.String;(Unknown Source) at jsp_servlet.__products._jspService(Ljavax.servlet.http.HttpServletRequest;Ljavax.servlet.http.HttpServletResponse;)V(__products.java:191) at weblogic.servlet.jsp.JspBase.service(Ljavax.servlet.ServletRequest;Ljavax.servlet.ServletResponse;)V(JspBase.java:33) at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run()Ljava.lang.Object;(ServletStubImpl.java:971) at weblogic.servlet.internal.ServletStubImpl.invokeServlet(Ljavax.servlet.ServletRequest;Ljavax.servlet.ServletResponse;Lweblogic.servlet.internal.FilterChainImpl;)V(ServletStubImpl.java:402) at weblogic.servlet.internal.ServletStubImpl.invokeServlet(Ljavax.servlet.ServletRequest;Ljavax.servlet.ServletResponse;)V(ServletStubImpl.java:305) at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run()Ljava.lang.Object;(WebAppServletContext.java:6350) at weblogic.security.acl.internal.AuthenticatedSubject.doAs(Lweblogic.security.subject.AbstractSubject;Ljava.security.PrivilegedAction;)Ljava.lang.Object;(AuthenticatedSubject.java:317) at weblogic.security.service.SecurityManager.runAs(Lweblogic.security.acl.internal.AuthenticatedSubject;Lweblogic.security.acl.internal.AuthenticatedSubject;Ljava.security.PrivilegedAction;)Ljava.lang.Object;(SecurityManager.java:118) at weblogic.servlet.internal.WebAppServletContext.invokeServlet(Lweblogic.servlet.internal.ServletRequestImpl;Lweblogic.servlet.internal.ServletResponseImpl;)V(WebAppServletContext.java:3635) at weblogic.servlet.internal.ServletRequestImpl.execute(Lweblogic.kernel.ExecuteThread;)V(ServletRequestImpl.java:2585) at weblogic.kernel.ExecuteThread.execute(Lweblogic.kernel.ExecuteRequest;)V(ExecuteThread.java:197) at weblogic.kernel.ExecuteThread.run()V(ExecuteThread.java:170) at java.lang.Thread.startThreadFromVM(Ljava.lang.Thread;)V(Unknown Source)
    Thanks
    Sanjeev

    Sanjeev,
    I don't have an answer for you, just a couple of suggestions.
    1. Have you tried the Sample Code?
    2. Use the [ code ] and [ /code ] tags (without the spaces, of-course) to format your stack trace ...
    like this!Good Luck,
    Avi.

  • Can we call shell script from oracle 9i?

    Hi experts,
    I wanted to know can we call shell script from oracle 9i procedures? If yes,how
    Thanks
    Shaan

    No. I can't think of a way to do this...
    If you want you can use DBMS_SCHEDULER to call OS SHELL scripts within.
    For e.g.
    CREATE PROGRAM
    begin
    dbms_scheduler.create_program
    program_name => 'CHECK_TIME',
    program_type => 'EXECUTABLE',
    program_action => '/opt/oracle/chk_date.sh',
    enabled => TRUE,
    comments => 'Check the Time'
    end;
    CREATE A SHELL SCRIPT
    opt/oracle> cat chk_date.sh
    #!/usr/bin/ksh
    echo "The date is :`date`"
    CREATE SCHEDULE
    begin
    dbms_scheduler.create_schedule
    schedule_name => 'EVERY_30_MINS',
    repeat_interval => 'FREQ=MINUTELY; INTERVAL=30',
    comments => 'Every 30-mins'
    end;
    CREATE JOB
    begin
    dbms_scheduler.create_job
    job_name => 'RUN_CHECK_TIME',
    program_name => 'CHECK_TIME',
    schedule_name => 'EVERY_30_MINS',
    comments => 'Run the program CHECK_TIME every 30 minutes',
    enabled => TRUE
    end;
    MANUALLY RUN A JOB
    exec dbms_scheduler.run_job('RUN_CHECK_TIME');

  • Call a UNIX shell script from an oracle stored procedure

    We need to call a UNIX shell script from an oracle stored procedure
    i.e. the control should come back to the procedure once the script completes. Can any body help to achieve this ?

    There are various ways in achieving this.
    For Example, you can call a PRO*C-Library residing on the database server.
    This requires a PL/SQL library to be generated and some changes to the Listener configuration.
    It is also possible to implement a java procedure on the database being invoked by a PL/SQL wrapper class.
    In this way (and if used right) there is also granularity regarding the filestructure permissions given and it may be called during a Forms or other PL/SQL session.
    The article below explains a more generic approach how to invoke shell commands from within an Oracle Instance.
    Be careful with this, because it really works ;)
    Refer to :
    http://www.oracle-base.com/articles/8i/ShellCommandsFromPLSQL.php
    Message was edited by:
    user434854

  • Executing Unix scripts from a stored procedure

    From the sql*plus windows, I am able to execute the host command and '!sh' commands; but I need to ececute Unix scripts from a stored procedure. Hoe can I do this? Where can I get good documentation on this? Any help would be greatly appreciated!
    Thanks..

    Hi,
    U can use external procedure ( newly added feature in 8.0.3 onwards) and call any shared library. From shared library u can execute it.
    One sql command is there HOST(' '). U can run a OS command. But u can not use it in PL/SQL.
    U can call pls sql from shell !!!!!..
    Thanks...
    Boby Jose

Maybe you are looking for

  • Internal Card Reader Driver Will Not Install -- Pavilion g4-1319tu

    1. Product Name and Number: HP Pavilion g4-1319tu 2. Operating System installed: Windows 7 ultimate 64-bit 3. Error message: none 4. Any changes made to your system before the issue occurred: none At first my card reader did not show up at all in Dev

  • How to create a database in SAP DB

    hello sirs, My name is Sudheesh and I am new to SAP WAS. I recently installed SAPNetWeaver04SneakPreviewSlimSP11. I have installed the Max DB also from the CD. But i don't know how to open the database Manager GUI for the same. I want to create a new

  • Compatibility Question

    I am an educator who teaches online courses for a local university and I'd like to use iChat, but I want to make sure iChat is compatible with the different chat software that my students might be using. According to the iChat manual, it says "You ca

  • Performance problem on a table with zero rows

    I queried the v$sqlarea table to find which SQL statement was doing the most disk reads and it turned out to be a query that read 278 Gigabytes from a table which usually has zero rows. This query runs every minute and reads any rows that are in the

  • 32-bit OBDC Driver for a 64-bit Oracle Installation on a 64-bit Machine

    Hi, We got a 64-bit installation of Oracle on a 64-bit Windows Server 2008 machine. I can only view my Oracle 10g home driver from the ODBC screen in the 64-bit control panel and not in the 32-bit control panel. Is there any way to install a 32-bit d