PL/SQL (MOSC)

MOSC Banner

Using dbms_scheduler to run a lunix script

in PL/SQL (MOSC) 5 commentsAnswered

Hi,

I've got an issue trying to use dbms_scheduler to run liunx shell scripts on the OS

Here's some setup for a script in the DB:


CREATE table bob (a varchar2(100));


Here's a script test_script.sh


#!/bin/bash

echo "TEST"

sqlplus -s <user>/<pass> <<EOF

begin

 insert into bob (a) values ('TESTED');

 COMMIT;

end;

/

exit;

EOF

echo "************************************"



replace <user> and <pass> as appropriate


I created a directory called training_scripts in the oracle user home directory and stuck file in there.


I then tried running the following to run it:


begin

  dbms_scheduler.create_job(

    job_name => 'my_external_job',

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center