Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

run an external OS script in Oracle 10g

88 views
Skip to first unread message

Michele Campagni

unread,
Apr 22, 2006, 11:40:44 AM4/22/06
to
I've difficult in executing an external OS script like this:
vmstat.sh: "/usr/bin/vmstat >> /tmp/vmstat.LST"
which have this permission:
-rwxr-xr-x 1 oracle other 47 Apr 3 05:13
/export/home/oracle/vmstat.sh

I try with this:

BEGIN
dbms_scheduler.create_job(job_name => 'myjob',
job_type => 'executable',
job_action => '/oracle/vmstat.sh',
enabled => TRUE,
auto_drop => TRUE);
END;
/

but oracle responds:
SQL> exec dbms_scheduler.run_job('VMSTAT_JOB');
BEGIN dbms_scheduler.run_job('VMSTAT_JOB'); END;

*
ERROR at line 1:
ORA-27369: job of type EXECUTABLE failed with exit code: Not owner
ORA-06512: at "SYS.DBMS_ISCHED", line 150
ORA-06512: at "SYS.DBMS_SCHEDULER", line 441
ORA-06512: at line 1

I'm using Solaris 10/Sparc and Oracle 10g.
what's the problem?
thanks

Sybrand Bakker

unread,
Apr 22, 2006, 1:59:26 PM4/22/06
to

/oracle/vmstat.sh doesn't look exactly like to be the same file as
/usr/bin/vmstat.sh
Other than that: why on earth are you running vmstat in a *database*.

--
Sybrand Bakker, Senior Oracle DBA

Michele Campagni

unread,
Apr 22, 2006, 3:25:32 PM4/22/06
to
sorry, I've make a mistake, I would to say:

>>I've difficult in executing an external OS script like this:
>>vmstat.sh: "/usr/bin/vmstat >> /tmp/vmstat.LST"
>>which have this permission:
>>-rwxr-xr-x 1 oracle other 47 Apr 3 05:13

>>/oracle/vmstat.sh
^^^^^^^^^^^^^^^^


>>
>>I try with this:
>>
>>BEGIN
>> dbms_scheduler.create_job(job_name => 'myjob',
>> job_type => 'executable',
>> job_action => '/oracle/vmstat.sh',

^^^^^^^^^^^^^^^

Mladen Gogala

unread,
Apr 22, 2006, 5:46:32 PM4/22/06
to
On Sat, 22 Apr 2006 19:59:26 +0200, Sybrand Bakker wrote:

> /oracle/vmstat.sh doesn't look exactly like to be the same file as
> /usr/bin/vmstat.sh
> Other than that: why on earth are you running vmstat in a *database*.

Database scheduler has a lovely GUI interface and is much more convenient
and user friendly then cron. The problem is the user used to run the job.
After a small bug in security, discovered by Peter Finnigan and the
exploit code published by some bozo on this very newsgroup, oracle changed
the user which executes the jobs. As of 10.1.0.4, external executable jobs
executed by Oracle scheduler should be owned by the user "nobody", not
user "oracle".
To save you the trouble of googling, yes, I was the bozo that has
published the exploit code for the scheduler bug. A friend of mine
was very angry with me because he had to stay late and patch his databases
to plug the hole, then easily exploitable thanks to yours truly.

--
http://www.mgogala.com

Mladen Gogala

unread,
Apr 22, 2006, 6:00:09 PM4/22/06
to
On Sat, 22 Apr 2006 17:40:44 +0200, Michele Campagni wrote:

> ERROR at line 1:
> ORA-27369: job of type EXECUTABLE failed with exit code: Not owner

There is a note about that on Metalink:
Note:337005.1

Please, let me know if you need help with searching on Metalink.


--
http://www.mgogala.com

Michele Campagni

unread,
Apr 24, 2006, 1:53:51 PM4/24/06
to
"Mladen Gogala" <gog...@sbcglobal.net> ha scritto nel messaggio
news:pan.2006.04.22....@sbcglobal.net...

> executed by Oracle scheduler should be owned by the user "nobody", not
> user "oracle".

ok, now script run but oracle reports:
ORA-27369: job of type EXECUTABLE failed with exit code: Unknown error


ORA-06512: at "SYS.DBMS_ISCHED", line 150
ORA-06512: at "SYS.DBMS_SCHEDULER", line 441
ORA-06512: at line 1

I repeat: script run and works, but I still have this warning...


Mladen Gogala

unread,
Apr 25, 2006, 12:46:37 AM4/25/06
to


How about contacting Oracle support?


--
http://www.mgogala.com

Michele Campagni

unread,
Apr 25, 2006, 3:38:53 AM4/25/06
to
"Mladen Gogala" <gog...@sbcglobal.net> ha scritto nel messaggio
news:pan.2006.04.25...@sbcglobal.net...

> How about contacting Oracle support?

I don't think they can help me... I run Oracle from Simics (a computer
architecture simulator) for my thesis on alternative cache systems, so I
can't access to Oracle support (I think). I try access Metalink but I need
an account that I have not.
This also explains why I can't use GUI interface or other useful toys, I'm
emulating a Sparc Enterprise 6500 with serial console on ttya.
By the way I have tried giving "other" owner to my script and it has
worked...


Ronald Rood

unread,
Apr 25, 2006, 10:50:16 AM4/25/06
to
On Mon, 24 Apr 2006 19:53:51 +0200, Michele Campagni wrote
(in article <444d10b0$0$29096$5fc...@news.tiscali.it>):

Could it be that the script just returns an exit code (or none at all) ? The
oracle scheduler has funny reactions on them.
Try with explicit exit 0.

--
With kind regards / met vriendelijke groeten,
Ronald

http://ciber.nl
http://homepage.mac.com/ik_zelf/oracle

Michele Campagni

unread,
Apr 25, 2006, 4:57:30 PM4/25/06
to
"Ronald Rood" <dev...@ronr.nl> ha scritto nel messaggio
news:0001HW.C07403C8...@news.individual.net...

> Try with explicit exit 0.

GREAT! It works!
Thanks!!!


0 new messages