Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Executing OS Commands with DBMS_SCHEDULER

gerhard2001Nov 25 2013 — edited Dec 16 2013

Hallo!

I have a Oracle XE 11g DB running on Debian.

On /tmp/ I create a Script called mdtest.sh and a file called test.

This script is quiet easy and only for testing:

#!/bin/bash

mv test test2

The rights of the files are:

-rwxrwxrwx 1 oracle dba      26 Nov 25 15:00 mdtest.sh
-rwxrwxrwx 1 oracle dba       0 Nov 25 15:01 test

I looked in the Internet how to configure dbms_scheduler.

So I create a file on my Debian OS called /u01/app/oracle/product/11.2.0/xe/rdbms/admin/externaljob.ora (didn't exist)

with the following rights:

-rw-r----- 1 root dba 35 Nov 18 14:47 externaljob.ora

and I added the following content:

run_user = oracle

run_group = dba

The file /u01/app/oracle/product/11.2.0/xe/bin/extjob has the following rights:

-rwsr-x--- 1 root dba 608048 Aug 29  2011 extjob

On my DB I created the user pdb a granted to him 'dba' rights.

Then I connected as this user with SQL Developer to the DB.

Then I executed the following statement:

BEGIN

  DBMS_SCHEDULER.CREATE_JOB (

     job_name           => 'my_job',

     job_type           => 'EXECUTABLE',

     job_action         => '/tmp/mdtest.sh',

     enabled            => TRUE

  );

END;

whith the following message:

'anonymous block completed'

Then when I execute the following statement:

SELECT * FROM user_scheduler_jobs WHERE job_name = 'MY_JOB';

But it shows no row.

There is something going wrong.

Have I an error in my configuration?

Thanks for any help!

Gerhard

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 13 2014
Added on Nov 25 2013
10 comments
1,773 views