How ro run unix script freom pl/sql - dbms_scheduler 11.2.0.3

Hi,
Using 11.2.0.3 and have a unix script which works fine.
Want to run this unix script every time a piece of pl/sql runs
have put below in but doesn't actually run it.
How can we achieve this?
Many Thanks
idea is that file we create locqally on server is copied to another via the unix script caled form pl/sql
DBMS_SCHEDULER.create_program (
   program_name => 'test_executable_prog',
   program_type => 'EXECUTABLE',
   program_action => '/oracle/jm/data/dataout/copy_tcfile',
   number_of_arguments => 0,
   enabled => TRUE,
   comments => 'CREATE_PROGRAM test using a schell script.');Tried below but no joy
-- Shell Script (OS executable file).
/*DBMS_SCHEDULER.drop_program(program_name => 'por_copy_files');
DBMS_SCHEDULER.create_program (
   program_name => 'por_copy_files',
   program_type => 'EXECUTABLE',
   program_action => ' /oracle/jm/data/dataout/copy_tcfile',
   number_of_arguments => 0,
   enabled => TRUE,
   comments => 'CREATE_PROGRAM test using a schell script.');
DBMS_SCHEDULER.create_job (
    job_name        => 'por_copy_files_job',
    program_name    => 'por_copy_files',
    start_date      => null,--SYSTIMESTAMP,
    repeat_interval => null,--'freq=hourly; byminute=0',
    end_date        => NULL,
    enabled         => TRUE,
    comments        => 'Job defined by existing program and inline schedule.');Edited by: user5716448 on 03-Oct-2012 08:35
Getting message when look in all_scheduler_job_run_details
ORA-27369: job of type EXECUTABLE failed with exit code: No such file or directory
even thoug hfile exists
Edited by: user5716448 on 03-Oct-2012 08:50

When run for unix command line which o.k
get
AUTHSTATE=files
A__z=! LOGNAME
COLUMNS=132
EDITOR=vi
ENV=/home/oracle/.kshrc
HOME=/home/oracle
LANG=en_US
LC__FASTMSG=true
LOCPATH=/usr/lib/nls/loc
LOGIN=oracle
LOGNAME=oracle
MAIL=/usr/spool/mail/oracle
MAILMSG=[YOU HAVE NEW MAIL]
MAIL_HOST=prdikw01
NLSPATH=/usr/lib/nls/msg/%L/%N:/usr/lib/nls/msg/%L/%N.cat
ODMDIR=/etc/objrepos
ORACLE_BASE=/oracle/app/oracle
ORACLE_HOME=/oracle/app/oracle/product/11.2.0/dbhome_1
ORACLE_SID=IKW
ORACLE_TERM=vt100
ORATAB_PATH=/etc
PATH=/usr/bin:/etc:/usr/sbin:/usr/ucb:/usr/bin/X11:/sbin:/usr/java5/jre/bin:/usr/java5/bin:/usr/local/bin:/etc:/usr/sbin:/usr/ucb:/h
ome/oracle/bin:/usr/bin/X11:/sbin:/oracle/app/oracle/product/11.2.0/dbhome_1/bin:/oracle/app/oracle/product/11.2.0/dbhome_1/OPatch
PS1=[$ORACLE_SID]$PWD $
PWD=/oracle/jm/data
SHELL=/usr/bin/ksh
TERM=xterm
TMPDIR=/tmp
TZ=GMT0BST,M3.5.0,M10.5.0
USER=oracle
_=/usr/bin/env
dba=/home/oracle/dbaWhen run from pl/sql
get
ORA-27369: job of type EXECUTABLE failed with exit code: 255
STANDARD_ERROR="execve: Exec format error"when try
dbms_scheduler.create_job(
job_name => 'POR_JOB',
job_type => 'EXECUTABLE',
job_action => '/oracle/jm/data/copy_tcfile',
start_date => SYSTIMESTAMP,
number_of_arguments=>0,
enabled => true,
auto_Drop => true,
comments => 'Demo');Above code in pl/sql where create job and schedule job separately gives file not found message even though give full path

Similar Messages

  • How can i run unix script from my apex page

    how can i run unix script from my apex page and take the output of unix script as a hidden variable and display it on the report region of that page

    I had a requirement to run a Fortran program against some data that woudl be extracted from the database after the user set up their filtering criteria and made some additional input. SInce the program was to complex to conver to PL/SQL, we decided to try and invoke it from Apex. This is how I did it.
    1. I followed the steps in Tim Archer's excellent article "Oracle External Procedure to Run Host Commands" (http://www.timarcher.com/?q=node/9). If the link does nto work, google the article's title.
    Using this steps I created a function which accepts any OS command, including calling my own shell scripts, and runs them. I called my PL/SQL function "shell" instead of "USF_RUN_HOST_CMD " as Tim did in his example (step 9).
    2. In Apex,
    a. I created a button to run my shell command. (I named it P2_RUN_SHELL)
    b. I created a PL/SQL process whose source looks as follows:
    shell('/home/ackness/scripts/cr_xcf_file.sh > /tmp/cr_scfp_file.log');
    and which was conditioned on the the button P2_RUN_SHELL.
    It works like a charm.
    Note: since you can run your own scripts using this method, you can encapsulate a series of commands in a UNIX shell script and invoke that script from Apex. This allows you to be able to test or run you commands from the command line as well as Apex and makes it easier to develop/debug/enhance the scripts in the future.
    Ackness

  • Unix Scripts and PL/SQL

    I want to run a UNIX script via PL/SQL. I want the script to be run with no assistance from an outside source. The script contains a 'ls'. Is this possible and if so, how.

    <BLOCKQUOTE><font size="1" face="Verdana, Arial, Helvetica">quote:</font><HR>Originally posted by Christopher Racicot ([email protected]):
    You can use an "external procedure", written in C, which then uses the C runtime library to access the UNIX shell. This features is
    also known as "callouts".
    We will likely add better native support
    in PL/SQL for various operating system
    activities in a future release.<HR></BLOCKQUOTE>
    Can you invoke Perl from within PLSQL?

  • How to run a script on Oracle server from isqlplus

    Hi I am trying to run a script on my workstation from Oracle server through isqlplus workarea. I entered following command and get the following error. i have enabled isqlplus URL by editing web.xml file already. Can please someone help how to run the script?
    @http://myaixserver.com:5560/scripts/Databasestartupstages.sql;
    SP2-0920: HTTP error 'page not found (505)' on attempt to open URL

    So far, you haven't specified your rdbms version and isqlplus behaved differently on a 9iR1, 9iR2 from the one release on 10gR1/R2. on 9i it was a servlet based on a JServ servlet executor machine, meanwhile on 10g it is a J2EE compliant application deployed on an OC4J container, so configuration is different.
    You may want to take a look at these references -->
    * Starting iSQL*Plus from a URL
    * Creating Reports using iSQL*Plus
    ~ Madrid

  • Call a unix script from pl/sql package

    Hi,
    Using 11.2.0.3 on AIX.
    Is it possible to call unix script from pl/sql package?
    I am cretaing a file in a directory but would like this to automatically be written to an archive directory as well.
    Could either use 2 utl_file.put_lines to 2 separate directories or 1 utl_file and cal script to archive file in another directory.?
    Thoughts?
    Thanks

    user5716448 wrote:
    What am I doing wrong?think how file name will look like:
    SQL> select 'file_name' || to_char(sysdate,'DD/MM/YYYY HH24:MI:SS') from dual;
    'FILE_NAME'||TO_CHAR(SYSDATE
    file_name15/08/2012 11:47:51Will AIX swallow such name? Obviously not. And, unfortunately, UTL_FILE.FCOPY doesn't raise an error in such case. So use someting like:
    UTL_FILE.FCOPY ('SOURCE_DIR',v_FILE_NAME,'DEST_DIR',v_file_name||to_char(sysdate,'DD_MM_YYYY_HH24_MI_SS'));SY.

  • How to call unix script/command in ODI

    Hello Gurus,
    Please let me know how to call unix script/command in ODI?
    Thanks
    Shridhar

    you can call shell script using the OS command found in Package.
    Step 1. Drag the OS Command in the Packgae
    Step 2. In the Text mentiond call the script say for ex sh /opt/path/script.sh
    Step 3. Execute.
    Note : Make sure the User through which ODI is triggering does have the required permission to execute shellscript , also always provide the full path , since scripts are execute from the oracldi/bin folder so its necessary to provide the complete path of the script location.
    Hope this helps.

  • How to run a script from Calculation Manager

    Hi All,
    I would like to know how to run a script made by using Calculation Manager. I have converted a simple rule script which has just one statement(HS.EXP "A#Sales = 100") in "Sub Calculate()" by using FMRulesMigrator.exe and then imported, deployed to an application. when I execute "Calculate" from a Data Grid, the rule didn't take effect to application data. If I load the script by using classic rule editor, it works fine.
    Is there anything I have to know to run a rule script which is made by using Calculation Manager?
    Thanks in advance.
    CY.

    Hi,
    Refer the following the link for calling logic from new custom buttons using VBA.
    https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/f085dd92-a40c-2c10-dcb1-a7c24476b23a
    hpe this ll help.
    thnks.

  • How to run multiple scripts in sql*plus?

    I would like to run 2 scripts in sql*plus, how do I do this? I tried the following, but it won't run.
    create table student_new
    AS
    select *
    from student
    insert into student_new
    (last_name, first_name
    values
    (Crop, Jenny)
    The above are the two scripts I want to run, what am I doing wrong.
    Thanks

    Do you have a solution to run multiple scripts continuosly, one after the other as one script.
    Say I have file1.sql file2.sql, file3.sql.
    I want to create a script run.sql, where this will run file1.sql,file2.sql,file3.sql one after other without any one running one after the other like follows:
    run.sql should have
    begin
    @file1.sql
    @file2.sql
    @file3.sql
    dbms_output.put_line(select sysdate from dual);
    end;
    If I run run.sql all the three scripts should be executed successfully and then display the current time . All these files have update statements(50,000 updates each file).
    Very urgetn. Can some one hlpe, please.
    Thanks in advance.

  • How to run unix shell script from java web applet

    hi all
    i have created one java applet. my apache web server is on unix server.
    i have created one shell script in same directory where my .class and .htm files reside...
    how to run this shell script from applet? it should search this .sh file on server and not on the client browser machine...
    thanks in advance

    I suppose you could make the shell script into a CGI, configure the server to execute CGIs, and then make the applet open the URL of that CGI.

  • How to run Unix Shell Scripts

    I hope someone knows Unix better me. I created a shell script to run some ap comp sci classes, and whenever I want to run the script, I'm forced to type:
    "./runMBS", while I want to just type "runMBS". Any suggestions will be nice.
    Thanks

    If you only type the name of a command (or script) the Unix shell only looks for those commands in the directories specified in the $PATH variable. If you provide a full or partial path to the command then the shell will run the command at that location... that's why including "./" in front of your shell script works... it tells the shell to run the command in the current directory (ie "./").
    You can either:
    - move your shell script to one of the directories specified in your $PATH variable
    or
    - add the directory containing your shell script to your $PATH
    To modify the $PATH so that it includes the directory your script resides in use something like this in your .bash_profile:
    <pre>
    PATH=$PATH:/path/to/scriptdir
    export PATH
    </pre>
    Although it's possible to include "./" in your PATH, it's not advisable and can present security problems. Read this explanation for more information.
    Steve

  • How do run unix command in java

    hi
    All unix command working fine in our java program.
    but i want change user in linux by using java. it's not working.
    "su root" This command onely not working.
    anybody know help me
    This is my ID [email protected]
    This my code
    <% String s = null;
    try{
    Process p = Runtime.getRuntime().exec("su root");
    BufferedReader stdInput = new BufferedReader(new
    InputStreamReader(p.getInputStream()));
    BufferedReader stdError = new BufferedReader(new
    InputStreamReader(p.getErrorStream()));
    out.println("Here is the standard output of the command:\n");
    while ((s = stdInput.readLine()) != null)
    out.println(s);
    catch(Exception e) {}
    %>

    I don't have further info to add to your first post, but think your guess seems quite reasonable. I thought of starting a new thread on the same topic, but think this (question) fits in here, too.
    I have Java code (freeware, not opensoure), intended for Unix, which basically provides the graphical interface and relies on an I/O layer (C + shell scripts) to do most of the work. I have access to the C+shell scripts which are opensource. I ported it to Cygwin and want to use it under Windows (there is no Cygwin native Java VM).
    My problem now boils down to " how to run commands under Unix and what differences are there with Windows". What are the variants?
    I have to guess what the program is doing when I get an IOException at some point. E.g.: a call to shell script may be made in a different way as to a compiled exe in Unix?. I found a way to bypass path problems because forward slashes are also accepted and /cygdrive/c construct can be replace by c:/; shell scripts can be compiled into exes using shc and they work; if symbolic links are replaced by duplication of exe files, they work. What will happen in an instance whereby a process runs a shell script dynamically, through a pipe (the shell script is compiled in the Cygwin/win version and receives parameters) in a construct like:
    pipefp = epopen(cmdbuf,"w"); /* (cmbuf is "makehdr par1 par2 ... ") (makehdr was a shell script and is now compiled exe for Cygwin/Windows) */?.
    Thanks.
    LT

  • Running Unix script from stored procedure

    At present, I run a unix script to export my data for backup using telnet. I would like my users to run the commands on their own without my help. My users do not know telnet (they have no IT knowledge). So, I plan to create a form using Developer/2000 and let them run the procedure thru a stored procedure.But, my problem is how can a stored procedure call a unix script?

    Hi,
    solution, used by me.
    Create a stored procedure that produces a text file with utl_file. The content of the file is the script you want to execute on your Unix box.
    On your Unix Box write a shell script that scans the utl_file_dir for Files. If a file is in, chmod 744 to grnt execute rights to it and execute it.
    I have a example if you want.
    Start the script with crontab or let it loop with a sleep inside.
    HTH
    Detlev

  • How to run shell script using External Process in Process Flow?

    Hi,
    We can run external process using Process flow.
    I would like to run shell script as external process in Process flow.
    Could any one please explain it?
    Thanks and regards
    Gowtham Sen.

    HI,
    As you said I tried this case. I got the following error. The script is running successfully while I tested at unix command prompt.
    The error is as follows..
    tarting Execution PFPS_SMPL_RUNSHELL
    Starting Task PFPS_SMPL_RUNSHELL
    Starting Task PFPS_SMPL_RUNSHELL:EXTERNALPROCESS
    /SOURCE_FILES/CollectFiles.sh: line 1: ls: command not found
    /SOURCE_FILES/CollectFiles.sh: line 1: wc: command not found
    /SOURCE_FILES/CollectFiles.sh: line 1: ls: command not found
    Completing Task PFPS_SMPL_RUNSHELL:EXTERNALPROCESS
    Starting Task PFPS_SMPL_RUNSHELL:EXTERNALPROCESS_1
    SQL*Plus: Release 10.1.0.2.0 - Production on Fri Sep 29 22:57:39 2006
    Copyright (c) 1982, 2004, Oracle. All rights reserved.
    ERROR:
    ORA-12545: Connect failed because target host or object does not exist
    Enter user-name: SP2-0306: Invalid option.
    Usage: CONN[ECT] [logon] [AS {SYSDBA|SYSOPER}]
    where <logon> ::= <username>[<password>][@<connect_identifier>] | /
    Enter user-name: SP2-0306: Invalid option.
    Usage: CONN[ECT] [logon] [AS {SYSDBA|SYSOPER}]
    where <logon> ::= <username>[<password>][@<connect_identifier>] | /
    SP2-0157: unable to CONNECT to ORACLE after 3 attempts, exiting SQL*Plus
    Completing Task PFPS_SMPL_RUNSHELL:EXTERNALPROCESS_1
    Completing Task PFPS_SMPL_RUNSHELL
    Completing Execution PFPS_SMPL_RUNSHELL
    My scenario is---
    I am trying to return a file name from one shell script. I created a external process for that. After completion of this process, I am running another script which takes that file name and trying to create a external table. The both scripts are runnning successfully. But while I am trying to run using process flow, its not coming.
    And I am not getting the way to catch the output of external process and pass it as parameter as another external process.
    Any suggestions are welcome.
    Thanks and regards
    Gowtham Sen.

  • Unix script in PL/SQL

    I am building a txt file using UTL_FILE in PL/SQL and need to email it using a Unix script. How can I add the Unix script to the end of the PL/SQL?

    Well, on the UNIX side of things I have simply used mail -s <subject> <email_address> < <text or file> to send mail inside of a UNIX script and it works fine.
    or you can use cat <some text> | mail -s <subject> <email_address>
    UTL_SMTP works well if you want to have less moving parts and have one script compiled inside the database. I guess if you already have the UTL_FILE working, it would be less work to just add in the code to mail from the UNIX script.
    HTH
    ReedK

  • Issue with running Unix Script during post processing

    Dear all,
    In one of the requirement, we need a execute a UNIX script in the post procesing steps of file channel.
    When the script is run independently on the UNIX prompt, it executes very well.
    But when the same script is kept in the post processing steps of the file channel, it doesn't give the desired results.
    In the channel log, it says the script is executed but we are not able to see the output. (in this case, ist writing some dummy text in a new file). The script has all the permissions for all the users, read write and execute.
    If anyone has a similar issue, kindly respond with the resolutions.
    Regards,
    Younus

    HI Younus
    How you are running the script. Could be a problem with the command you are trying to execute from channel. Let us know the way you are doing
    Check whether installed and executed on XI server properly then again check with channel.
    Check with these for reference
    http://help.sap.com/saphelp_nw70/helpdata/EN/e3/94007075cae04f930cc4c034e411e1/content.htm
    The specified item was not found.
    Executing Unix shell script using Operating System Command in XI
    Thanks
    Gaurav

Maybe you are looking for

  • Unbounded task flow with pageflowscope

    Hi, In my application, I have create unbounded task flow for each menu. For each menu task flow I have created a pageFlowscope bean. When I try to use this bean in any request scoped bean called from within the UTF, I get the pageFlowSCoped bean inst

  • How do i get my videos to be full screen when editing and viewing on ipad 2

    How do i get my videos to be full screen when editing and viewing on ipad 2. When editing videos in imovie the video isnt zoomed in all the way, this is with imported videos as well as ipad videos... Please help!!

  • How do I get spellcheck to work with my gmail?

    Hi - I've been having stability problems with my Gmail on Chrome and so have returned to FF. Enjoying it too! However, the spellchecker does not work with Gmail - the tool I use most where a spellchecker is vital! Actually I cant be sure it's working

  • Schedule Approval of Updates

    I have WSUS 3.2.7600.226. Is there a way to schedule the approval of updates for a specific group? For example, I want certain updates approved at 10:30pm on a certain date for a specific computer group. Please let me know if this is possible and tha

  • Checking multiple IF conditions

    I'm working on a stored procedure and having issues.  I want to check two conditions and is none of them are met, Insert a new record. In the first 2 checks, If I find a match I will hold that value and update later in the script.  If I can't find a