Take away ! on unix script mail output

SET HEADING OFF
SET TRIMOUT OFF
SET SERVEROUTPUT OFF
SET ECHO OFF
SET FEEDBACK on
SET PAGESIZE 0
SET LINESIZE 1975
set wrap off
SPOOL my_error_report.csv
COLUMN ID FORMAT A50
COLUMN NAME FORMAT A45
COLUMN STATUS FORMAT A8
COLUMN NID FORMAT A45
select ID, NID,STATUS from test1 where STATUS='ERROR';
select ID, NAME, STATUS from test2 where STATUS='ERROR';
My output
<<<<<<<<<<<<
4b28c550-1dd2-11b2-b3c8-tfea3d2daea sqlbacup_REPORT_CREATE.VERSION_2 ERROR
how can i take away the !

hi,
try this ..
SET HEADING OFF
SET TRIMOUT OFF
SET SERVEROUTPUT OFF
SET ECHO OFF
SET FEEDBACK on
SET PAGESIZE 0
SET LINESIZE 1975
SET wrap off
SPOOL my_error_report.csv
COLUMN ID FORMAT A50
COLUMN NAME FORMAT A45
COLUMN STATUS FORMAT A8
COLUMN NID FORMAT A45
SELECT REPLACE (ID, '!') AS ID, REPLACE (nid, '!') AS nid,
       REPLACE (status, '!') AS status
  FROM test1
WHERE status = 'ERROR';
Are you getting ! out of running the following query ?
SELECT ID, nid, status
  FROM test1
WHERE status = 'ERROR';Thanks,
P Prakash
Edited by: prakash on Mar 4, 2012 11:12 PM

Similar Messages

  • Unix script error while mail the pdf file.

    Hi all,
    I want to do a mail in pdf format via a unix script. for that i used the following query:
    # Verplichte variabelen
    inputname="dago130r.rdf"
    outputname="$DATOUT/dago130rDC.pdf"
    mailto="$MAIL_INKOOP_DC"
    subject="Opgeloste PV's per Category Manager"
    params="p_datum_1='08-08-2006' p_ind_dc_of_rz='D'"
    # Opgeloste PV's per Category Manager
    # Start script.
    # Vanaf hier hoeft in principe niets gewijzigd te worden.
    mymail () {
         local tmp=$DATTMP/$$.txt
         cat "$mailbody" > $tmp 2>/dev/null
         do_unix "uuencode $outputname $(basename $outputname) >> $tmp"
         check_success
         do_unix "mailx -s '$subject' -c '$mailcc' -r '$replyto' '$mailto' < $tmp"
         check_success
    header
    perform "$inputname R DESFORMAT=PDF DESTYPE=FILE DESNAME=$outputname $params"
    check_success exit
    mymail
    footer
    exit_check "$total_success"
    When i execute this query it will make the pdf file in the output folder as well as in the tmp folder as a text file. but after that it will give me error in the log file as follows.:
    09/08/06-11:13:19 [  25178] -- perform: Successful completion of dago130r.rdf R DESFORMAT=PDF DESTYPE=FILE DESNAME=/appl/tst/ah01/dago/dat/out/dago130rDC.pdf p_datum_1='08-08-2006' p_ind_dc_of_rz='D'
    09/08/06-11:13:19 [  25178] -- do_unix: Successful completion of uuencode /appl/tst/ah01/dago/dat/out/dago130rDC.pdf dago130rDC.pdf >> /appl/tst/ah01/dago/dat/tmp/25178.txt
    [  25178] ,/appl/tst/ah01/dago/dat/tmp/25178.txt,: No such file or directory
    [  25178] "/appl/tst/ah01/dago/home/dead.letter" 1/1
    [  25178]
    09/08/06-11:13:19 [  25178] -- ERROR do_unix: mailx -s 'Opgeloste PV's per Category Manager' -c '' -r '' '[email protected]' < /appl/tst/ah01/dago/dat/tmp/25178.txt returned 1
    09/08/06-11:13:19 [  25178] --
    I am not getting why this script not taking the file from the tmp folder and why this error comes??
    please help me to go out of this problem.

    Hi Bhavik,
    Please can you tell how you are executing this script. ?
    ./scritpname or sh scriptname
    Can you try the script removing local while declaring the tmp variable ?
    naghu

  • Unix script output sql result to terminal

    Hi,
    I run the script below within a unix script. the query runs but only outputs the first line. I need the whole results output to the terminal.. please let me know if I am doing something wrong. thanks
    ORACLE_SID=orcl
    export ORACLE_SID
    SHELL=/bin/sh
    db="username/password"
    sqlplus -s $db <<xxx
    set serveroutput on
    define yy=100
    whenever sqlerror exit yy
    begin
    declare
    Dyn_table_name VARCHAR2(100);
    Dyn_query_string VARCHAR2(4000);
    Type csr_dyn IS REF CURSOR;
    csr_dyn1 csr_dyn;
    col1 varchar2(200);
    col2 varchar2(200);
    col3 varchar2(200);
    col4 varchar2(200);
    col5 varchar2(200);
    begin
    Dyn_table_name :='''my_table''';
    Dyn_query_string :='SELECT b.session_id ,s.serial#,NVL(b.oracle_username,''(oracle)'') AS username,'
    ||'a.object_name,b.os_user_name FROM dba_objects a,v\$locked_object b,v\$session s'
    ||' WHERE a.object_id =Upper(b.object_id)and b.session_id=s.sid and a.object_name='||Dyn_table_name;
    /*dbms_output.put_line(Dyn_query_string);*/
    dbms_output.put_line('SID'||' '|| 'serial#' || ' '||'USERNAME'||' '||'OBJECT_NAME'||' '||'OS_USER_NAME');
    dbms_output.put_line('------------------------------------------------------------------------------------');
    OPEN csr_dyn1 FOR dyn_query_string;
    LOOP
    FETCH csr_dyn1 INTO col1,col2,col3,col4,col5;
    EXIT WHEN csr_dyn1%NOTFOUND;
    dbms_output.put_line(col1||' '|| col2||' '|| col3 || ' ' || col4 ||' '|| col5);
    END LOOP;
    EXCEPTION WHEN OTHERS THEN
    dbms_output.put_line(to_char(sqlcode)|| ' '|| sqlerrm);
    end;
    end;
    set serveroutput off
    exit
    xxx

    Sorry all your suggestion did not work ( the log file had this error message
    Usage 1: sqlplus -H | -V
    -H Displays the SQL*Plus version and the
    usage help.
    -V Displays the SQL*Plus version.
    Usage 2: sqlplus [ [<option>] [<logon>] [<start>] ]
    <option> is: [-C <version>] [-L] [-M "<options>"] [-R <level>] [-S]
    ... I know its possible to login into sqlplus and run the querry, but I want it as a script which would output this kind of result to the screen
    SESSION_ID SERIAL# USERNAME OBJECT_NAME      OS_USER_NAME
    251     30330     PRD my table     oracle
    335     11624     PRD     my table     oracle
    469     2592     PRD     my table     oracle
    849     8619     PRD     my table     oracle
    934     40211     PRD     my table     oracle
    955     15043     PRD     my table     oracle
    is it possible or am I asking for the impossible...!!! I appreciate your suggestion... you can alter the script I put up and paste the correction so that I can see cleary how you made it work for you.

  • Configuring cronie for mailing output [solved]

    Hi,
    I am having a hard time setting up cronie for mailing output. Jump to the last sentence for the actual question.
    From man 8 cron, I read that the -m option "allows you to specify a shell command to use for sending Cron mail output instead of using sendmail(8). This command must accept a fully formatted mail message (with headers) on standard input and send it as a mail message to the recipients specified in the mail headers". I do have msmtp installed. I can do this and receive email successfully:
    $ msmtp -t << eof
    > To: <my address>@gmail.com
    >
    > test
    > eof
    Thus I know that msmtp -t is the command I must provide with the -m option.
    Then, I followed these instructions and created /etc/systemd/system/cronie.service.d/mailing.conf which contains:
    [Service]
    ExecStart=
    ExecStart=/usr/bin/crond -n -m 'msmtp -t'
    Note: the first, empty ExecStart cancels the former one from the original .service file.
    After starting cronie.service, this is the result of systemctl status cronie.service:
    cronie.service - Periodic Command Scheduler
    Loaded: loaded (/usr/lib/systemd/system/cronie.service; enabled)
    Drop-In: /etc/systemd/system/cronie.service.d
    └─mailing.conf
    Active: active (running) since Mon 2013-06-24 22:58:24 EDT; 2s ago
    Main PID: 1457 (crond)
    CGroup: name=systemd:/system/cronie.service
    └─1457 /usr/bin/crond -n -m msmtp -t
    Jun 24 22:58:24 electron systemd[1]: Started Periodic Command Scheduler.
    Jun 24 22:58:24 electron crond[1457]: (CRON) INFO (Syslog will be used instead of sendmail.)
    Jun 24 22:58:24 electron crond[1457]: (CRON) INFO (running with inotify support)
    Jun 24 22:58:24 electron crond[1457]: (CRON) INFO (@reboot jobs will be run at computer's startup.)
    It seems that systemd drops the single quotes and takes -t as it's own parameter instead of passing it to msmtp. You can also see that crond logged "Syslog will be used instead of sendmail". I can actually see the output of my commands in /var/log/crond.log. How should I quote the space between msmtp and -t in the ExecStart line of my .service file?
    Last edited by a_neutrino (2013-06-30 21:54:53)

    Hi,
    Thanks a lot for your help. The issue is [solved].
    dif wrote:You have to create a file /etc/aliases that holds the addresses where e-mail notifications will be sent to when a user's cronjob creates an output.
    It seems unnecessary. The MAILTO variable set in the crontab accepts a complete email address.
    dif wrote:Contrary to Wiki, there are no commas separating e-mail addresses if there are a few in a line.
    The msmtp man page also says to put commas.
    dif wrote:
    There is a special script distributed with Arch that is able to scan /etc/aliases for a valid domain address and then calls msmtp. Here is its path
    /usr/share/doc/msmtp/find_alias/find_alias_for_msmtp.sh
    Copy it to /usr/bin/ and create a simlink:
    sudo cp /usr/share/doc/msmtp/find_alias/find_alias_for_msmtp.sh /usr/bin/find_alias_for_msmtp.sh
    sudo ln -s /usr/bin/find_alias_for_msmtp.sh /usr/bin/sendmail
    Why didn't you just :
    chmod +x /usr/share/doc/msmtp/find_alias/find_alias_for_msmtp.sh
    ln -s /usr/share/doc/msmtp/find_alias/find_alias_for_msmtp.sh /usr/bin/sendmail
    Also, I had to modify the find_alias_for_msmtp.sh script a little because cronie calls sendmail without any parameters:
    diff --git a/scripts/find_alias/find_alias_for_msmtp.sh b/scripts/find_alias/find_alias_for_msmtp.sh
    index fb485dd..346f313 100644
    --- a/scripts/find_alias/find_alias_for_msmtp.sh
    +++ b/scripts/find_alias/find_alias_for_msmtp.sh
    @@ -16,15 +16,18 @@ MSMTP=`which msmtp || echo "/usr/local/bin/msmtp"`
    if [ "$1" = '-i' ] ; then
    v_recipient=$2 # mailx calls sendmail with -i as the 1st param and the recipient as the second param
    -elif [ "$1" = '-t' ] ; then # most other programs call sendmail with a -t option
    +elif [ "$1" = '-t' -o $# = 0 ] ; then
    + # Most other programs call sendmail with a -t option.
    + # cronie calls sendmail without parameters and
    + # expects sendmail to find the recipient in the mail headers.
    v_to=`echo "$v_msg" | grep -m 1 'To: '`
    v_recipient=${v_to:4:50}
    else
    - v_recipient=$1 # no parameter, sendmail was called with the recipient as parameter
    + v_recipient=$1 # sendmail was called with the recipient as parameter
    fi
    -if [ $v_recipient != 0 ] ; then
    +if [ "$v_recipient" != 0 ] ; then
    # trim spaces from recipient email address
    v_recipient="${v_recipient// /}"
    Or maybe I missed something. I submitted the patch upstream to see if they think it's relevant.
    dif wrote:Hope this helps.
    Yes, it did! Thank you so much.

  • Problem executing Unix script from Java...

    Hi there, I'm having trouble executing a unix script from a java program. The script receives multiple parameters and it seems that one of them ( or more ) is not well interpreted. When I run the script directly from a shell, the script executes without any errors. But, when I run the exact same script with the exact same parameters, it does not work.
    Here is the command to execute the script with all the parameters that is executed from the shell ( with success ) and also from the java program ( with errors ):
    /z/opus/dcap/intfu001.csh 'NODEBUG^NOTKPROF^NOSTACK' opus dcap JACQUES JACQUES '2625781' 'ORA$PIPE$001D00D70001' JOB^DEBUG^SINISIMU^STATPROD^DECTIDANC^81^503^4080^86^87^151^97^98^99 BUT^N^N^SPRI^0^13^24^3^J^05^N^19^19^19 >> /tmp/switcher8.999.null.pgm.test
    And here is my portion of code that executes the script:
    Runtime wShell = Runtime.getRuntime();
    Process wProc = wShell.exec(cmd_unix_final);
    wProc.waitFor();
    return wProc.exitValue();
    Please give me your thoughts on this!
    Thanks in advance!

    Ok.
    Let's proceed surgically, else we'll never solve or overcome anything.
    In the last your reply you wrote:
    the normal output is what I get when the script runs successfully, the script first prints a few things
    and then does stuff that takes at least 2 or 3 secondsWhat do you mean?
    -Finally have you got your script correctly executed?
    The stuffs you spoke of are really performed?
    If this is the case I can't see the prob.
    Is your concern only about exitValue() for it doesn't let you distinguish programmatically
    the success or failure of the script execution?
    Of course you surely already have a routine in your java code to handle
    exceptional situations of errors from the script.
    And the "normal output" is just what you must parse to detect those errors.
    Then who cares about exitValue() in this case?
    Don't invoke it, relay on the stdout and stderr of the script.
    -Or you get only a deceiving standard output
    that let you think the script execution went alright, while instead it didn't.
    In this case we have to investigate some other thing.
    I can't still exclude that the problem isn't related with the buffer size of the stdout
    allocated by the environment to the subprocess. You spoke of few things printed out.
    Be explicit. What's the size of the output you get?
    And is the "normal output" complete till the very last char
    or is it truncated from somewhere on?
    Also it's important that you hit a ps command after the java main process terminates
    (or simply when waitFor() returns) and see if the script subprocess hung up.
    As an alternative approach directly call your pro*C code from Java through JNI, instead of translating it.
    1. Exec.java
    public class Exec{
         static{
              System.loadLibrary("Exec");
         public static native void proCFunct();
         public static void main( String[] args){
              proCFunct();
    }2. javac Exec.java
    3. javah Exec
    4.Exec.c
    #include "Exec.h"
    JNIEXPORT void JNICALL Java_Exec_proCFunct(JNIEnv * a, jclass b){
         //here call the function that executes the script
    5. cc -G -I$JAVA_HOME/include -I$JAVA_HOME/include/solaris -I$YOUR_INCLUDES Exec.c -o libExec.so
    6. setenv LD_LIBRARY_PATH .
    7. java Exec

  • UNIX Scripts ?

    We have a notification application which sends all the mails to some sort of queue, then the UNIX scripts sends
    these mails to mobile applications,but some of the mobile devices when they receive any message sent with From Address as [email protected],is interpreting as
    [email protected](with server name),
    Any help with this that would be really greatful,
    Thanks
    KM

    We have a notification application which sends all
    the mails to some sort of queue, then the UNIX
    scripts sends
    these mails to mobile applications,but some of the
    mobile devices when they receive any message sent
    with From Address as [email protected],is
    interpreting as
    [email protected](with server name),
    Any help with this that would be really greatful,If it was me then the fact that some of them do work would suggest the following to me...
    1. It has nothing to do with java.
    2. It is one of the following.
    ......A. The header in the messages are different.
    ......B. The email client on the mobile device is doing it itself (which you might or might not be able to fix by sending something else in the header.)
    And finally it is really unlikely that anyone here or perhaps anywhere is going to be able to provide a solution. What you need to do is get the mobile devices and then experiment by sending different things to them using an email source where you control all the headers (and I doubt that is true for your'queue'.)
    Moreover if you don't understand in general what I am talking about in the above then you can either expect to spend a very long time (at least months) figuring it out or you should ask someone else at work/school to help. If there is no one and you must take the time then you need to start by getting the spec for email (SMTP-Simple Mail Transport Protocol, to start) and get/create an email client that you can experiment with. And of course you will need access to the mobile devices as well.
    And of course all of this is pointless unless you can actually readily access the mobile devices.

  • 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

  • File port query  File transfer from SAP R/3 to Webmethods using Unix Script

    SAP drops the files in the /sapio/ directory and triggers an unix script using File port partner destination.
    Unix script will perform a secure copy of files to Webmethods server.
    If in unix script, error occurs then an RFC function will be called to send an error notification to a person.
    Queries
    1) How is the unix script triggered using the File port partner destination ?
    2) What is the unix command to invoke a report which sends the error notification mail ?
    3) Does SCP command to copy files to webmethods work , if the unix script is placed in /sapio/ directory ? Or whether
    any connection need to be established between SAP and Webmethods server ?

    Hello,
    Since you want to transfer Article Master, it should be a Retail System. So you should use Message Type ARTMAS. For fullbuild, you can use transaction WDBM and for changes, you can use WDBU.  For changes, you can enable change pointers for required fields using BD64.
    Thanks,
    Venu

  • How to submit a batch compare job using a unix script and cron?

    I understand I can setup a unix script to be used to schedule a database compare job. I'm not sure how to get past the popup log in window tho... When I use the command line and include the -id<myid> the OMS login window pops up requesting login password and service. This won't do if I do not want to run this interactive. I cannot find any syntax for the command line other than --id<adminid>  How to I include the password and service?
    Thanks ;)
    Laurie

    I had the same problem.
    My shell looks like (baseline_ELITE.sh):
    ocm login -idsysman
    ocm capture -l BL_ELITE -idsysman
    I don't have the ocm logout.
    First, run the baseline_ELITE.sh, it will ask you about the password. The next times, it never ask again for the password, but take in account don't use the ocm logout.
    Humberto Gomez
    OCP Dev2k, 8i, 9i
    [email protected]

  • Configure e-mail output

    Hi Gurus
    Can somebody send me informaton on how to configure e-mail output for a sales order/delivery document/invoice. I know how to do it for a printer but I want for e-mail.
    My e-mail is: [email protected]
    thanks all
    Srini

    Hi
    If your SD output configuration is set up correctly, an e-mail from SAP using medium 5 should go through just fine via SAPconnect (transaction SCOT). When it works, the external recipient should receive an e-mail with a PDF attachment containing the form image, regardless of whether it has been created via SAPscript or Smart Forms. Depending on your output determination settings, this even can happen in the background, without any interaction with the SAP front end (e.g. for invoices created automatically by a batch job).
    Typically, a failed send will be flagged in the message control table (NAST), and this table should be monitored closely. However, there are many reasons why a document hasn't gone through, and this can be the case with both outgoing faxes and e-mails from SAP. The solution to both is the same: After identifying the failed document, re-send it manually by going inside it in change mode and repeating the appropriate output. If an obsolete customer e-mail address was the culprit, a customer master change would also be required, along with an audit of any docs recently created for this customer.
    If any underlying data has changed since initial issuance, a re-sent document may not appear identical to the (failed) original. Sometimes, as when address info has been corrected, this can be a good thing. After all, the new document is more accurate than the old one.
    In other cases, such as when pricing info has changed, it might be a cause for serious concern. There are several ways to deal with this concern:
    1) Limit the types of changes allowed on certain docs after creation
    2) Set up a doc image archive via ArchiveLink and re-issue output from there instead of from the current doc; or
    3) For highly sensitive docs, consider a more secure delivery method.
    <b>sending  smart form</b>
    You didn't specify the nature of the form or print program, but I suspect we are discussing application-driven output.
    In any case, I suggest you take a close look at the print program. If it is a standard one provided by SAP, it is quite possible that hooks already exist to send your Smart Form output via e-mail as a PDF attachment.
    See for example the call to function 'LF_FM_NAME' in standard print program RLB_INVOICE. Notice the preceding call to function WFMC_PREPARE_SMART_FORM? This function does the heavy lifting for you; here, no additional work is needed in either the form or the print program. To generate e-mail output, the remaining work essentially is:
    1) SD output configuration (e.g. mapping the relevant billing output type to transmission medium 5 - 'External send' - via the IMG)
    2) SAPconnect configuration (txn SCOT -- there are several notes in the SAP Service Marketplace discussing this component, such as 152474 and 312690).
    3) Setting up the sender and recipient e-mail addresses (e.g. sender = txn SU3 data; recipient = bill-to party's txn XD02 data).
    Hopefully, the print program at issue has the hooks you need. If not, you may need to explore the possibility of (a) changing it, (b) cloning it and changing the cloned version, or (c) manipulating the values directly within the form itself via field-symbols (which may or may not work). Whichever approach you take, I wish you luck.

  • Changing the filenames using unix script

    Hi,
    I have a scenario where I have to change the file names on the Receiver CC using a unix script and add date and timestamp to the file name
    this is what I'll be writing to filename_01.xml I need to change that to newfilename_01_MMDDYYYY_HHMISS.xml
    the 01 in the file name is the counter, so I might having more than one file where 01,02, etc will represent the counter on the filename.
    Any help is really appreciated.
    Thanks,
    Joe.P

    you can try this
    create the field called filename in target
    use a costant and concat it with the out out of UDF( or some functon avaleiable counter) which will genereate numbers like 1,2,3,4,5,6 and send this filename_01 to the output field and use this in the variable substution to genreate the filename by the CC
    if you dnt want to send this fieldin output file then specify that fieldname in CC length as 0

  • 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

  • Calling Unix-Script from within Oracle and store stdout/stderr in table

    Hi,
    What I want to do is:
    1. Calling a UNIX script (e.g. hello.sh) (from inside the Database)
    hello.sh
    echo “Hello World!“
    2. and get the stdout/stderr output back in my Database in a table (e.g. temp_back)
    table temp_back
    ID     stdout          stderr
    1     Hello World!
    I think Number 1 isn’t a big problem, but how to get stdout back in DB?
    Any solution?
    I searched a bit in this Forum and found this Post.
    re:Calling Host Command Through Database  Procedures or Triggers
    This may be what I am searching for, but can’t access the Link
    Since I am not really fit with UNIX and packages/procedures in Oracle it would be nice if you could post a very detailed answer.
    (Please no java)
    -What packages do I need? (heard DBMS_OUTPUT would be useful)
    -example PL/SQL script
    Thanks a lot!
    Marcus
    Environment:
    Oracle 9.2.0 DB

    Marcus, if you opened the Java sandbox to access any o/s file, you can call any Unix command, shell script, or program, that the Oracle o/s user has exec privs on.
    Just remember that there's a very basic Unix environment when you make the call - the settings in the .profile does not apply. Thus PATH for example is not set. When making the call make sure that the complete path is given. As for the environment, that is a problem as you cannot set that and make the call at the same time.
    In that case it is much simpler to rather write a Unix shell script that does all for you. Set the environment. Run the command(s). Format output. Etc.
    Then you call that Unix script, via Java, from SQL or PL/SQL. Treat the Unix scripts like the Unix-version of stored procedures for your Oracle application.
    Some technical details. When you connect to Oracle, a Unix process services you. This can be either a dedicated server process (servicing only your Oracle session) or a shared server process (from the shared service pool of processes).
    In either case, it is a Unix process running as a background process (thus detached from any tty device). PL/SQL and SQL are executed by this process. The Oracle JVM created by your session also lives in this process. When you therefore make o/s calls, these calls are made by this process.
    Therefore you are limited to what this process can and can't do. E.g. it runs as the oracle o/s user and will fail on accessing paths and commands does the oracle user does not have privs on. Etc.

  • Running an Unix Script from Informatica Mapping/workflow.

    Hi ,
    I have a need to start /stop service to a remote server (away from the DAC server ,which is on UNIX os)
    how could this be done in a best way?
    I am planning to do this through Informatica Workflow,and need help (technical steps Please) to do this.
    1) workflow will call the Unix Script
    2) Unix Script logins to the remote server
    3) Unix scripts navigates to particular folder
    4) Unix script executes a command to Start/Stop the server.
    5) Unix Script logs out.
    6) if everything done success ,Workflow will success else fail with the error code.
    Regards

    Hi ,
    I have a need to start /stop service to a remote server (away from the DAC server ,which is on UNIX os)
    how could this be done in a best way?
    I am planning to do this through Informatica Workflow,and need help (technical steps Please) to do this.
    1) workflow will call the Unix Script
    2) Unix Script logins to the remote server
    3) Unix scripts navigates to particular folder
    4) Unix script executes a command to Start/Stop the server.
    5) Unix Script logs out.
    6) if everything done success ,Workflow will success else fail with the error code.
    Regards

  • Run a UNIX Script from java

    Hi,
    how can i run a unix script from java application. This java application is on windows.
    How can i do this.
    thanks,

    Hi,
    how can i run a unix script from java application.
    This java application is on windows.
    So I think it's safe to assume that the target script is on a remote unix server.
    Take a look at http://sourceforge.net/projects/sshtools/

Maybe you are looking for