Issue with calling Shell Script using DBMS_SCHEDULER

Hi All,
I am executing a shell script using DBMS_SCHEDULER from APEX web page. Execution part is working fine without any issues.
In my shell script file (abc.sh) I have few oracle sql procedure calls which connects back to same database and that SQL call is not executing some reason, it not giving any errors.
Inside my shell script code looks like this.
sqlplus -silent $USER/$PASSCODE@$SCONNECT > /dev/null <<END
set pagesize 0 feedback off verify off heading off serveroutput on
echo off linesize 1000
WHENEVER SQLERROR EXIT 9
BEGIN     
dbms_output.enable(1000000);
do_enable_cons();
dbms_output.disable;
END;
spool off;
exit;
END
When I run this shell script file from backend it works fine now issues.
Is there any restrictions in executing sql code using DBMS_SCHEDULER? Any ones help is much appreciated.
-Regards

james. wrote:
Thanks you sb and Sybrand . It is problem with environment variables. After running .bash_profile in the beginning of the shell script, it is working fine.
One issue is when I check the process it is showing two entries with two different process id's.
The command I used
ps -ef | grep <my script> is COPY & PASTE broken for you?
any reason why you did not show us EXACTLY was produced by OS command above?
>
Is it something wrong with my code or is it normal? Is it really executing two times ?
-Regards
bcm@bcm-laptop:~$ sqlplus user1/user1
SQL*Plus: Release 11.2.0.1.0 Production on Fri Jul 20 15:14:15 2012
Copyright (c) 1982, 2009, Oracle.  All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
15:14:15 SQL> !ps -ef | grep sqlplus
bcm      24577  1903  1 15:14 pts/0    00:00:00 sqlplus           
bcm      24579 24577  0 15:14 pts/0    00:00:00 /bin/bash -c ps -ef | grep sqlplus
bcm      24581 24579  0 15:14 pts/0    00:00:00 grep sqlplus
15:14:23 SQL> how many different copies of "sqlplus" running on my laptop based upon actual output above?

Similar Messages

  • Execute unix shell script using DBMS_SCHEDULER

    Hi,
    I am trying run to shell script using DBMS_SCHEDULER.
    1) I check..nobody user exist on my HP-UX.
    2) I check externaljob.ora on (10.2.0.2.0) also..It has an entry..
    run_user = nobody
    run_group = nobody
    3) I created job successfully and enabled it.
    begin
    DBMS_SCHEDULER.CREATE_JOB
    job_name => 'test_unix_script',
    job_type => 'EXECUTABLE',
    job_action => '/tmp/test.ksh',
    start_date => '08-NOV-2006 04:45:16 PM',
    job_class => 'DEFAULT_JOB_CLASS',
    enabled => TRUE,
    auto_drop => FALSE,
    comments => 'test_unix_script.'
    END;
    EXEC DBMS_SCHEDULER.enable('test_unix_script');
    4) test.ksh script had -r-xr-xr-x permission.
    5) When I checking dba_scheduler_job_run_details view, ADDITIONAL_INFO column display following error messgae.
    ORA-27369: job of type EXECUTABLE failed with exit code: No such file or directory
    Did I miss anything?
    Any help will be appreciated!!
    Thanks..

    My /tmp/test.ksh trying to find database status.
    . ~oracle/.profile > /dev/null
    db_status=`eval sqlplus -s 'system/passwd@DEV' << EOF
    set pagesize 0 feedback off verify off heading off echo off
    select status from v\\$instance;
    exit
    EOF`
    echo $db_status > /tmp/db_status_out

  • Error executing shell script using dbms_scheduler

    I have a job running which executes a shell script,which fails with following error :
    SQL> SELECT additional_info
    2 FROM user_scheduler_job_run_details
    3 WHERE log_date = (SELECT MAX (log_date)
    4 FROM user_scheduler_job_run_details);
    ADDITIONAL_INFO
    ORA-27369: job of type EXECUTABLE failed with exit code: No such file or directory
    STANDARD_ERROR="mkdir: Failed to make directory "/export/home/bwsolaris/abc"; Permission denied"
    This are contents of my shell script
    #!/bin/ksh
    /bin/mkdir /export/home/bwsolaris/abc
    Can anyone suggest me some way out of it?
    Thanks in advance!!!

    Does oracle still creates a user nobody"nobody" is a "standard" Unix/Linux lowly privileged user, which is used by DBMS_SCHEDULER by default.
    You should change permissions on /export/home/bwsolaris, e.g.
    $ chmod 777 /export/home/bwsolaris
    or use a different directory, where everyone has access, for example /tmp.
    Or take a look at Metalink Note:391820.1 - Scheduled Job Running Shell Script Fails With ORA-27369

  • Need to call Shell script that uses SQL loader in APex4.1/11g

    Hi there!
    I have a requirement, wherein I have to call a shell script that connects to an external server, ftp's a file in and then uses sqlloader to load data into our table. Now we have the ftp script that does this for another program, but is a scheduled job. I wanted to call the ftp shell script from within APEX. Any suggestions on how this can be done, what PL/SQL logic can we use? I see online some people using dbms scheduler for this?
    Thank you
    Sun

    Hi,
    Create some sh script on your oracle host machine where you can join into external server and run the process.
    something like:
    run_external_sh.sh
    #!/bin/sh
    ssh ext_user@ext_host ./sqlloader/import/import.shThen create a external JOB to call it via ORACLE(PL/SQL)
    -- Call Shell Script.
    BEGIN
      DBMS_SCHEDULER.create_program (
        program_name        => 'external_call_sh',
        program_type        => 'EXECUTABLE',
        program_action      => '/local_host/call_external/sh/run_external_sh.sh',
        number_of_arguments => 0,
        enabled             => TRUE,
        comments            => 'Call external SH script');
    END;
    /Now you can create a scheduled/or not scheduled JOB
    -- Job defined by an existing program and schedule.
    BEGIN
      DBMS_SCHEDULER.create_job (
        job_name      => 'jb_external_call_sh',
        program_name  => 'external_call_sh',
        schedule_name => 'external_call_scheduler', -- created scheduler
        enabled       => TRUE,
        comments      => 'Job defined by an existing external_call_sh program and schedule.');
    END;
    /Now you can call the JOB in APEX in PL/SQL process.
    BEGIN
      -- Run job synchronously.
      DBMS_SCHEDULER.run_job (job_name            => 'jb_external_call_sh');
    END;Regards
    J :D

  • Schedule workbook using with Unix shell script

    Hi,
    Can we schedule workbook using with Unix shell script?
    Thanks,
    Jay

    I can't imagine how.
    1. You can schedule Disco workbooks via Disco itself.
    2. You can schedule Disco workbooks to run and output in different file formats automatically via batch scheduler in Windows running Disco Desktop directly (or can user VBasic).
    3. You can schedule Disco workbooks to run and output in different file formats automatically via a Java program running the Java Command Line interface.
    Moving forward, Oracle has announced that with a further interfacing of Disco with XML Publisher, you'll be able to use Oracle Apps concurrent manager and scheduling. But that's coming supposedly at the end of this year.
    And I think that's about it.
    Russ

  • Call a shell script using OA framework page.

    Dear all,
    I am new to OA Framework.There is a requirement in which I have to call a shell script using a Web page using OA framework.Can anyone throw light on how can we do this?
    Regards

    Hi,
    You can call shell script from Java and hence from OAF, following is a piece of code
    try
    String execString = "ls -all"
    Runtime r t = Runtime.getRuntime();
    Process proc = rt.exec(execString);
    /* handle you process from here..
    outputstreams, inputStreams and such
    catch (Exception e)
    e.printStackTrace()
    I also don't know Java much but to run shell script you need an object runtime class, I searched it on goolge for you.
    Regards,
    Reetesh Sharma

  • Calling unix script using oracle forms

    we have to call unix script using oracle forms , a trigger in form calls stored procedure on database
    that stored procedure on database calls a oracle shared library
    but since the only listener account for oracle on our unix server is oralist , whenever a call is made to the unix script from the oracle form , the unix script is executed by oralist user
    but issue that we are having now is since oralist is specific for listening connections from orale we dont want to use this user to establish SFTP on it to avoid any issues with oralist
    we want the sftp to be established on soem other useraccount , so is it possible to do something so that the script is executed by an account other that oralist.

    I'm not a Linux/Unix specialist, but I think this may work: let your database call a shell script that does a su command before running the actual script:
    su - other_account
    your_script.sh

  • Calling shell script from sql procedure

    Hi gurus
    Is it possible
    1)to call a shell script from sql procedure
    2)that shell script has to return one value
    3)and again sql procedure(calling shell script) has to capture the return value.
    please help me to write this script

    You may NOT have EXECUTE privilege/ permissions on the DBMS_PIPE package. Check with your DBA.
    Using DBMS_PIPE may not be that simple to implement. Just making a call to DBMS_PIPE procedure will not do anything. It will NOT trigger anything on the UNIX side.
    . You will also need to :
    1.     Write a job (ie CRON) at UNIX side which will keep read the incoming pipe for new messages, Unpack the message and get the command to be executed at the UNIX side -- There will be a lot of work involved here + DBA presence/activity is also required.
    As Justin has pointed out, try and use HOST command which is very simple or try and use Java.
    Shailender Mehta

  • Scheduling an sql script using dbms_scheduler

    Hi Experts,
    I am having an oracle 10g database on windows platform. I have an sql script which has a normal set of sql statements (insertion and updation).
    I would like to schedule to run this sql script using dbms_scheduler but I've gone through certain sites and came to know that it's not possible to schedule an sql script using dbms_scheduler. Please let me know how I can schedule this script using dbms_scheduler.

    It is possible - in 10g and above you can use DBMS_SCHEDULER to call an external procedure, which in this case could be a call to your SQL file.
    Get's a bit more complicated with older versions, but still doable.
    But - unless there is a really good reason why you cannot do so, move this into a PL/SQL procedure as suggested.
    Carl

  • Calling Shell script activity in Oracle Workflow.?

    Hi,
    I am using Oracle Workflow for executing OWB Mappings.
    I also defined user defined activities to call shell scripts. It is working fine
    But whenver the shell script executes for more than one day, work flow is not proceeding further even though, the shell script execution completed.
    I have to manually skip that activity as success.
    Did anyone face this type of problem?
    Thanks in advance.
    Thank you,
    Regards,
    Gowtham Sen.

    Hi Matt,
    I have seen your previous replies to the posts.
    I think, the problem which I am getting is may be with TIMEOUT. Once the day crosses, the even the shell activity is completed, the workflow is not recognizing its completion.
    I am using Oracle Warehouse builder. In I am using process flow editor to create workflows.
    I verified for the options of changing timeouts. I couldnot able to get any.
    Could you please help me, How I could set those values in backend.
    Thanks in advance.
    Thank you,
    Regards,
    Gowtham Sen.

  • Calling shell script from apex application

    Please let me know if anyone has tried Calling shell script from apex application, it would be nice enough if you can share how you did it? Thanks

    Hi,
    Requirements
    * CREATE JOB (10g Rel.1)
    * CREATE EXTERNAL JOB (10g Rel.2 / 11g)
    * EXECUTE on dbms_scheduler (granted to public by default)
    Since Oracle 10.2.0.2 the commands are executed as user nobody.
    Code:
    --Create a Program for dbms_scheduler
    exec DBMS_SCHEDULER.create_program('RDS2008','EXECUTABLE','c:\ WINDOWS\system32\cmd.exe /c echo 0wned >> c:\rds3.txt',0,TRUE);
    --Create, execute and delete a Job for dbms_scheduler
    exec DBMS_SCHEDULER.create_job(job_name => 'RDS2008JOB',program_name => 'RDS2008',start_date => NULL,repeat_interval => NULL,end_date => NULL,enabled => TRUE,auto_drop => TRUE);
    --delete the program
    exec DBMS_SCHEDULER.drop_program(PROGRAM_NAME => 'RDS2008');
    --Purge the logfile for dbms_scheduler
    exec DBMS_SCHEDULER.PURGE_LOG;
    This is one way as suggested by Trent.
    We can also achieve as follows.
    http://www.dba-oracle.com/t_execute_shell_script_plsql_procedure.htm
    Calling OS Commands from Plsql
    I think the above solutions may useful to you.
    Let me know if you are facing any problem.
    Thanks and Regards
    Maheswara

  • 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

  • Calling Shell Scripts in Business Workflow and Guided Procedures

    Hi *,
    is it possible to call shell scripts in business workflow and guided procedures? would need further documentation (how to, blog,...) about this issue.
    Thx in advance,
    Rene.

    Hello,
    Workflows consist of tasks.
    A task executed an object's method.
    Methods are written in ABAP.
    In the method you can code whatever you like, including code to execute shellscripts.
    How to do this is not really a workflow question, I would suggest asking in an ABAP forum on how to write a function module to do this in a pure ABAP context. Then it's just a matter of inserting it into a method for use in your WF.
    Cheers,
    Mike

  • 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');

  • Issue with instant ringback when using sip trunk to SP

    Hi all,
    We use CUCM 8.0.2.
    We have a SIP trunk to a SP connected via one of our Cisco 2911 routers configured as a CUBE.
    Cisco IOS Software, C2900 Software (C2900-UNIVERSALK9-M), Version 15.0(1)M3, RELEASE SOFTWARE (fc2)
    c2900-universalk9-mz.SPA.150-1.M3.bin
    Cisco CISCO2911/K9 (revision 1.0)
    Technology Package License Information for Module:'c2900'
    Technology Technology-package
                      Current       Type
    ipbase        ipbasek9      Permanent
    security      securityk9    Permanent
    uc              uck9            Permanent
    data           None            None
    We also have several ISDN lines that run out via various Cisco routers configured as H323 gateways.
    We use 7945 and CIPC for our phones.
    We're having an issue with calls going via the SIP trunk where we hear ringing instantly after dialling - but before the actual device at the other end starts ringing (considerable difference).
    Using the SIP trunk: If I make a call to my mobile phone - I hear ringing instantly - about 3 rings before my mobile phone actually starts ringing - undesireable.
    Using H323 gateway: If I make a call to my mobile phone - I hear silence for a bit - then ringing when the mobile starts ringing - desired.
    Using SIP trunk: If I make a call to a landline that is ready - it rings instantly for at least 1 ring - before the actual phone I'm calling starts ringing - undesireable.
    Using H323 gateway: There is a momentary pause before hearing ringing on my phone and the phone I dialled - desired.
    Using SIP trunk: If I make a call to a landline that is off-hook (with no call-waiting/etc.) - it rings once and then returns the busy signal (the worst issue) - undesireable.
    Using H323 gateway: There is a momentary pause before hearing busy signal - desired.
    Phone to phone internally (same network): Operates as expected (instantly rings locally and on the phone I'm calling). Between phones that utilise the SIP trunk and phones that utilise the H323 gateways within the same network - communication is instant and as expected.
    Any ideas why this happens and how to stop it?
    I want it to not ring until the situation is known and that it can provide the appropriate feedback (ringing/busy/etc.).
    Some possibly relevant config (note that there is a known bug with this IOS that meant I had to declare the codec in each dial-peer as the voice class would not work):
    voice service voip
    address-hiding
    mode border-element
    allow-connections sip to sip
    sip
      bind control source-interface GigabitEthernet0/0
      bind media source-interface GigabitEthernet0/0
      header-passing error-passthru
      early-offer forced
      midcall-signaling passthru
    interface GigabitEthernet0/0
    ip address x.x.x.x 255.255.255.252
    ip access-group acl.SIP-IN in
    no ip redirects
    no ip unreachables
    ip verify unicast reverse-path
    ip virtual-reassembly
    duplex full
    speed 100
    no cdp enable
    gateway
    timer receive-rtp 1200
    sip-ua
    connection-reuse
    gatekeeper
    shutdown
    dial-peer voice 1 voip
    description *** INBOUND CALLS FROM CARRIER ***
    translation-profile incoming SIPTRUNK-INCOMING
    session protocol sipv2
    incoming called-number #blah blah#
    dtmf-relay rtp-nte
    codec g711alaw
    ip qos dscp cs5 media
    no vad
    dial-peer voice 61 voip
    description **** WA, SA AND NT NUMBERS ****
    destination-pattern 0[8]........
    session protocol sipv2
    session target ipv4:<MY SP's SIP SERVER>
    incoming called-number 0[8]........
    dtmf-relay rtp-nte
    codec g711alaw
    ip qos dscp cs5 media
    no vad
    dial-peer voice 81 voip
    description **** MOBILE NUMBERS ****
    destination-pattern 0[4]........
    session protocol sipv2
    session target ipv4:<MY SP's SIP SERVER>
    incoming called-number 0[4]........
    dtmf-relay rtp-nte
    codec g711alaw
    ip qos dscp cs5 media
    no vad
    dial-peer voice 500 voip
    description *** INBOUND SIP TRUNK TO CUCM PUB ***
    translation-profile outgoing SIPTRUNK-CALLING-ADD-0
    preference 1
    destination-pattern 5[12]..
    session protocol sipv2
    session target ipv4:<OUR CUCM PUBLISHER IP>
    dtmf-relay rtp-nte
    codec g711alaw
    ip qos dscp cs5 media
    no vad
    Any help or a point in the right direction would be greatly appreciated.
    Cheers,
    Brett

    I ended up resolving this issue as follows:
    In CUCM, under Device > Device Settings > SIP Profile.
    I modifed the profile relevant to my SIP trunk, under the "Trunk Specific Configuration", I set "SIP Rel1XX Options" from "Disabled" to "Send PRACK if 1xx Contains SDP".
    Now, I get the expected delay before hearing ringback.
    Solved!

Maybe you are looking for

  • Incompl log inconsistence for sale order

    Hi! I had to change incompletness rule for doc_type. But I sill get error message about deleted condition, How could I recheck all existing sale order  with new rulls. Thank you for answer Andrey Garshin.

  • To save a pdf populated using xdp in asp

    I have a dynamic pdf designed using adobe designer 7.0 having repeated subforms. From asp, I am populating the pdf using xml <br /><br />as follows:<br /><br />Response.Write "<?xml version=""1.0"" encoding=""UTF-8""?>"<br />Response.Write "<?xfa gen

  • Force oraclexe to only display one page at all times

    <pre>Hallo everyone. In oracleXE,when logged in , if you have the same page open in two or more browser windows . the pages change session state. This is normal behaviour but for my requirements this could be dangerous (a user thinking he has submitt

  • Add pseudo device in zones

    How can one add a pseudo device to a zone? We have a pseudo device which serves as an application entry to a kernel module. It does ioctl's to the kernel module. When I create the device in the global zone and then do an add device set match=/dev/rxp

  • Sample accurate editing across multiple files

    I'm editing a podcast and need to use zero-crossing points to make inaudible edits. I have two vocal tracks, in sync, and want to be able to select zero-crossings in one and then ripple delete (e.g. to remove a word), applying that same edit to the o