Call Shell Script from PL-SQL

Hello All,
I have been using some well known Java Class and Procedures to execute shell scripts from PL-SQL.
The different environments I was using before were
1)
Operating System (Server) AIX version 5
Oerating System(Client) Microsoft Windows XP Service Pack 2
Oracle Database Version Oracle Database 10g Enterprise Edition Release
10.2.0.1.0
2)
Operating System (Server) Red Hat Linux 3.4.5-2
Oerating System(Client) Microsoft Windows XP Service Pack 2
Oracle Database Version Oracle Database 10g Enterprise Edition Release
10.2.0.1.0
But suddenly I had to drop and recreate the Databases on 1st (AIX) environment
and
reinstall the Operating System (Server) Red Hat 3.4.5-2 on IInd environment stated above (which obviously means the reinstallation of Oracle Database there!)
Now the shell script(through PL-SQL)is executing smoothly for the IInd (Linux) environment[b] but not executing for the Ist (AIX) environment
and I am not getting how to solve the problem.
I have given all the permissions to users, shell scripts and all as they were before.
Can you please help?
Regards,
Abhijit.

Hello All,
I have been using some well known Java Class and Procedures to execute shell scripts from PL-SQL.
The different environments I was using before were
1)
Operating System (Server) AIX version 5
Oerating System(Client) Microsoft Windows XP Service Pack 2
Oracle Database Version Oracle Database 10g Enterprise Edition Release
10.2.0.1.0
2)
Operating System (Server) Red Hat Linux 3.4.5-2
Oerating System(Client) Microsoft Windows XP Service Pack 2
Oracle Database Version Oracle Database 10g Enterprise Edition Release
10.2.0.1.0
But suddenly I had to drop and recreate the Databases on 1st (AIX) environment
and
reinstall the Operating System (Server) Red Hat 3.4.5-2 on IInd environment stated above (which obviously means the reinstallation of Oracle Database there!)
Now the shell script(through PL-SQL)is executing smoothly for the IInd (Linux) environment[b] but not executing for the Ist (AIX) environment
and I am not getting how to solve the problem.
I have given all the permissions to users, shell scripts and all as they were before.
Can you please help?
Regards,
Abhijit.

Similar Messages

  • Can any one tell me how can i call a shell script from pl/sql

    i like to call shell script from pl/sql procedure.
    can any one suggest how can i do this

    Have you not mastered in asking the same kind of question ?
    First do write a script...
    no one will spoon feed you.
    How can i call a shell script from procedure
    How to call Shell Script from pl/sql block
    -Sk

  • How to pass arguments to a Unix shell script from PL/SQL?

    We want to run a Linux shell script from PL/SQL (10g). This is our code to run the script only and it works fine.
    dbms_scheduler.create_job
              job_name=>'RUN_LINUX_SCRIPT_' || v_job_name,
              job_type=>'EXECUTABLE',
              job_action=>'/vol0/FileLoadDir/Bank/DATA_FILES/spell_check.sh',
              enabled=>TRUE,
              auto_drop=>FALSE
            );Now we have a requirement to pass 2 arguments to the .sh file. In the .sh file the 2 arguments are defined as $1 and $2.
    I used this method.
    dbms_scheduler.create_job
              job_name=>'RUN_LINUX_SCRIPT_' || v_job_name,
              job_type=>'EXECUTABLE',
              job_action=>'/vol0/FileLoadDir/Bank/DATA_FILES/spell_check2.sh',
              --job_action=>'/vol0/FileLoadDir/Bank/DATA_FILES/spell_check2.sh /vol0/FileLoadDir/Bank/DATA_FILES/ebill2.fmt_form_strings_.txt /vol0/FileLoadDir/Bank/DATA_FILES/abcdefghij.txt',
              --job_action=>'#!/bin/bash spell /vol0/FileLoadDir/Bank/DATA_FILES/ebill2.fmt_form_strings_.txt > /vol0/FileLoadDir/Bank/DATA_FILES/abcde.txt',
              number_of_arguments => 2,
              enabled=>FALSE,
              auto_drop=>FALSE,
              comments => 'Testing by Channa'
          DBMS_SCHEDULER.SET_JOB_ARGUMENT_VALUE (
            job_name                => 'RUN_LINUX_SCRIPT_' || v_job_name,
            argument_position           => 1,
            argument_value          => '/vol0/FileLoadDir/Bank/DATA_FILES/ebill2.fmt_form_strings_.txt');
          DBMS_SCHEDULER.SET_JOB_ARGUMENT_VALUE (
            job_name                => 'RUN_LINUX_SCRIPT_' || v_job_name,
            argument_position       => 2,
            argument_value          => '/vol0/FileLoadDir/Bank/DATA_FILES/abcdefghij.txt');
          DBMS_SCHEDULER.enable (name => 'RUN_LINUX_SCRIPT_' || v_job_name);But I get an error saying:
    STANDARD_ERROR="/vol0/FileLoadDir/Bank/DATA_FILES/spell_check2.sh: line 4: read: `/vol0/FileLoadDir/Bank/DATA_FILES/ebill2.fmt_form_strings_.txt': not a valid identifier
    /vol0/FileLoadDir/Bank/DATA_FILES/spell_check2"

    Check this post:
    pass parameter from PL/SQL to Unix "as is"

  • 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

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

  • How to call shell script from a pl/sql procedure

    Hi all,
    I am little bit new to plsql programming, i have a small problem as follows
    I have to call a shell script from a pl/sql procedure ..
    Please suggest me some methods in oracle 10g, which i could make use of to achieve my goal. also please tell me what are the constraints for those methods if any.
    I already came across dbms_scheduler, but i have got a problem and its nor executing properly its exiting giving 255 error or saying that permission problem, but i have already given full access to my shell scripts.
    Thanks in advance
    Best Regards
    Satya

    Hi,
    Read this thread, perhaps is there your response :
    Host...
    Nicolas.

  • 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

  • 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

  • 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

  • Calling Shell Script From Java

    Hi i have a shell script which calls the ant command.How do i call this shell script from jdk 1.5. I used p = runtime.exec( filename) but it threw an IOException saying cannot execute. How do i call this from my java program which runs on the redhat linux box.Please Help

    Possibility:
    It does not have execute permissions - Either grant them by chmod or use the command as sh <script-name>
    Rich

  • 11g - calling shell script from trigger

    From what I read so far, starting from 11g onward user credential IS REQUIRED in order to call the shell script from database procedure/trigger.  I am working in a shop where they used SSO (so no password) and having a local user with password is not possible.
    I wonder if anyone used any other method to call the shell scripts from database procedure/trigger?
    Thanks all

    user550338 wrote:
    performance is not going to be a problem for this requirement b/c it ONLY happened after the startup or before the shutdown.
    That still -- even more so --- sounds like a bad idea.  Exactly what does this shell script accomplish that needs to be triggered by database startup/shutdown?

  • Calling shell script from stored procedure.

    Hi Everybody,
    Could anyone tell me how to call a shell script from a stored procedure.
    Thanks,
    Vasu

    You would need to write a Java stored procedure that calls out to the underlying operating system. Tom Kyte has an example of this here
    http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:952229840241
    Make sure that you're very aware of the security implications here, however. Your commands will run as the Oracle user on the host operating system, which makes it possible that a coding error and/or an attacker could do something like delete or corrupt Oracle data files, so you'll probably want to harden the code substantially.
    Justin

  • Calling Pearl script from PL/SQL

    Anyone know how to call a pearl script from PL/SQL?

    Hi Rick,
    I checked all the forums for external procedures. I don't see any examples posted as you mentioned for calling external procedures. I did look into the documentation and it talks mainly about C and JAVA. And it looked like depending on the language, different things need to be done. I would appreciate if you could be more specific on where I could find examples related to calling PERL scripts.

  • Calling shell script from forms9i

    Hi,
    I have a shell script that inserts records in the table. When I run this shell script in Unix, it runs fine and inserts records in the table.
    But when I run it from forms9i by using HOST command it does everything written in the shell script but inserting records in the table.
    Can anyone tell me why it is not inserting records in the table.
    I will really appreciate you response.
    Thanks,
    Kumar

    IMO when you run the shell script from forms it runs in privileges of App server user and in that shell that why its running as oraias when you run it from forms .. I think the SSO is out of picture in this situation.So you need to find a way of connecting to the in the script.
    Check the TNS names environment varaibles etc for doing this,

  • Calling shell scripts from within Oracle PL/SQL codes

    Hello,
    We are migrating from informix to Oracle. In our Informix Stored Procedure we
    were able to call Unix Shell Script by executing a 'SYSTEM' command, such as:
    CREATE PROCEDURE magazine(flag1, flag2)
    SYSTEM '/pics2/informix/mag.sh' || flag1 || flag2;
    END PROCEDURE;
    How can I write this in PL/SQL? Is there a simillar command for 'SYSTEM' in PL/SQL?
    Thanks

    Mike,
    Wrong forum, for this question, suggest you ask it in the PL/SQL forum.
    Jim Stern

Maybe you are looking for

  • Abap -Error while doing with F-90(asset aquisation)

    Hi all when iam  simulate the transaction while using F-90 for asset aquisation, the following error was occured. Plz help me out from this problem very urgent . Its purely ABAP Problem. Error in the ABAP Application Program The current ABAP program

  • Does anyone know how to move ePub ebooks from Adobe digital editions to a Kobo?

    Does anyone know how to move ePub ebooks that I've purchased onto my Kobo eReader?  I've tried everything...help from where I bought the books, surfing the net, etc. but even though the book is in the library of my Adobe Digital Editions I can't drag

  • Variable Speed retiming

    I'm sure this is an exceptionally easy one but time remapping has always befuddled my meager gray matter so I'm staring at my computer screens like a doof trying everything I can think of to solve my task at hand. Take a video clip and play back in R

  • Shuffle shuts down

    My Shuffle, fully charged, music all loaded successfully, seems to think it's got a sleep feature--it automatically shuts itself down after 30-40 minutes of play and cannot be restarted, reset, or otherwise persuaded to play music again. After a coup

  • Custom tag paths

    I have serveral CF servers running. Is it possible to map to custom tags on one server from another server without a share between the servers? Or even with shared drives? What are the security issues if you create a share? Thanks Mark