Home » SQL & PL/SQL » SQL & PL/SQL » Job Scheduing (Oracle 10g R2)
Job Scheduing [message #629068] Wed, 03 December 2014 01:33 Go to next message
Mayuresh Kumar
Messages: 7
Registered: December 2014
Location: India
Junior Member
Hello Everyone,

I am trying to call an executable through a scheduled job. However, when I run the job, I get the following errors:

i.) ORA-27370: job slave failed to launch a job of type EXECUTABLE

ii.) ORA-27300: OS system dependent operation:accessing execution agent failed with status: 2

iii.) ORA-27301: OS failure message: The system cannot find the file specified.

I was trying to call the notepad from the job and I am pretty sure that the path is correct.

This seems to be some OS Level permissions issues. Any help on this will be warmly welcomed.

Regards
Mayuresh Kumar
Re: Job Scheduing [message #629069 is a reply to message #629068] Wed, 03 December 2014 01:55 Go to previous messageGo to next message
John Watson
Messages: 8931
Registered: January 2010
Location: Global Village
Senior Member
Welcome to the forum. Please read our OraFAQ Forum Guide and please read How to use [code] tags and make your code easier to read

You need to show what code you are running. And, since you suspect an OS issue, you do need to mention what OS it is.
Re: Job Scheduing [message #629070 is a reply to message #629068] Wed, 03 December 2014 02:01 Go to previous messageGo to next message
Michel Cadot
Messages: 68645
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

The error is simple: "The system cannot find the file specified."
Either the file does not exist or Oracle has no access rights to it.

Remember the file must be on the db server not on a client workstation.

Re: Job Scheduing [message #629073 is a reply to message #629069] Wed, 03 December 2014 02:30 Go to previous messageGo to next message
Mayuresh Kumar
Messages: 7
Registered: December 2014
Location: India
Junior Member
Hi Watson,

The code is quite simple:

BEGIN
DBMS_SCHEDULER.CREATE_JOB(
job_name => 'Test_Exec',
job_type => 'Executable',
job_action => 'C:\WINDOWS\system32\notepad.exe',
start_date => SYSTIMESTAMP);
END;

BEGIN
DBMS_SCHEDULER.RUN_JOB(
job_name => 'Test_Exec',
use_current_session => TRUE);
END;

When I use "use_current_session => FALSE", the job runs but nothing happens. As expected, a notepad should pop up.

When I use "use_current_session => TRUE", the job hangs.

I am using Windows XP. I have my JobScheduler_ocrl service started.
Re: Job Scheduing [message #629075 is a reply to message #629073] Wed, 03 December 2014 02:31 Go to previous messageGo to next message
Michel Cadot
Messages: 68645
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

Michel Cadot wrote on Wed, 03 December 2014 09:01

...
Remember the file must be on the db server not on a client workstation.

Re: Job Scheduing [message #629076 is a reply to message #629070] Wed, 03 December 2014 02:34 Go to previous messageGo to next message
Mayuresh Kumar
Messages: 7
Registered: December 2014
Location: India
Junior Member
Hi Michael,

The path that I have given is correct. I can use that path on CMD to run notepad. There is probably some OS Level permission that I don't know about. The file is on the db server. In fact both client and db server are on the same machine. Please suggest me if I can create a DIRECTORY and use it. If possible give me an example how I can use a Directory in DBMS_SCHEDULER.

Thanks & Regards
Mayuresh Kumar
Re: Job Scheduing [message #629077 is a reply to message #629073] Wed, 03 December 2014 02:37 Go to previous messageGo to next message
John Watson
Messages: 8931
Registered: January 2010
Location: Global Village
Senior Member
You have not used the [code] tags to format your code, as I asked you to. Please do so next time.

However, your method is wrong. You can't call a program that needs user inut. Think it through: on what device do you want the window appear? Your client machine, I suppose. How can a server process open a window there? What is the Scheduler supposed to do while you are working in the notepad?
Re: Job Scheduing [message #629079 is a reply to message #629077] Wed, 03 December 2014 02:46 Go to previous messageGo to next message
ThomasG
Messages: 3211
Registered: April 2005
Location: Heilbronn, Germany
Senior Member
Also: Has anybody actually ever managed to open "Notepad" on the DB Server?

I actually ran into a phenomenon with an old cobbled together (Non-Oracle) application that Windows Services (and Oracle runs as a Window Service) can interact with the network OR the desktop, not with both at the same time. That was made impossible by Microsoft as a consequence of the Shatter Attack

So basically, a service shouldn't be able to open notepad at all.
Re: Job Scheduing [message #629080 is a reply to message #629077] Wed, 03 December 2014 02:50 Go to previous messageGo to next message
Mayuresh Kumar
Messages: 7
Registered: December 2014
Location: India
Junior Member
Hi Watson,

I am extremely sorry, I did not follow your instructions.

The notepad is supposed to be opened on the db server itself. In fact, the app server and the db server are on the same machine and the same machine is being used as a client machine as well. As far as user input is concerned, I guess we do not require a user input to call a notepad exe. When the job runs, all it is supposed to do is open a notepad. After that even if the user writes on it, he can use the normal Windows controls like "ALT+F"..etc.. to save the file or to perform any other operation.

Even on various websites, similar examples have been used to demonstrate how we can call executables from DBMS_SCHEDULER.

Re: Job Scheduing [message #629081 is a reply to message #629080] Wed, 03 December 2014 02:53 Go to previous messageGo to next message
Michel Cadot
Messages: 68645
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

Which ones? Post the links.

Open your Services box, Click right on the Oracle database serrvice (OracleService<SID>), then on Connection tab, then see if a checkbox like "Allow the service to interact with the desktop" (translated from French) is checked or not.
Generally it is not and so Oracle can't open Notepad, anyway.
Re: Job Scheduing [message #629082 is a reply to message #629080] Wed, 03 December 2014 02:54 Go to previous messageGo to next message
John Watson
Messages: 8931
Registered: January 2010
Location: Global Village
Senior Member
And how many of those examples called an executable that requires user input?
Re: Job Scheduing [message #629084 is a reply to message #629082] Wed, 03 December 2014 03:10 Go to previous messageGo to next message
Mayuresh Kumar
Messages: 7
Registered: December 2014
Location: India
Junior Member
A few do and a few don't. One of the links is:

http://oracle-base.com/articles/11g/scheduler-enhancements-11gr1.php

On some I am even getting an option to create_program instead of create_job. I am trying to follow your instruction regarding the services of Oracle. Lets see if it works.

Thanks & Regards
Mayuresh Kumar
Re: Job Scheduing [message #629085 is a reply to message #629084] Wed, 03 December 2014 03:13 Go to previous messageGo to next message
John Watson
Messages: 8931
Registered: January 2010
Location: Global Village
Senior Member
None of the examples run a program which requires user input.

Good bye.

Re: Job Scheduing [message #629087 is a reply to message #629081] Wed, 03 December 2014 03:17 Go to previous messageGo to next message
Mayuresh Kumar
Messages: 7
Registered: December 2014
Location: India
Junior Member
Hi Watson,

I am really appreciate you immediate response and I am thankful for your time. I just made the required change in the service of Oracle. However, it is still not working.

Smile
Smile

Thanks & Regards
Mayuresh Kumar
Re: Job Scheduing [message #629088 is a reply to message #629087] Wed, 03 December 2014 03:20 Go to previous messageGo to next message
Michel Cadot
Messages: 68645
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

Quote:
However, it is still not working.


It was a necessary condition, not a sufficient one. Smile

Re: Job Scheduing [message #629091 is a reply to message #629085] Wed, 03 December 2014 03:29 Go to previous messageGo to next message
Mayuresh Kumar
Messages: 7
Registered: December 2014
Location: India
Junior Member
Hi Watson,

If by user input, you mean user entering data into the program at runtime, I guess that is not possible as you mentioned in an earlier post.

The number of arguments are defined at the time of creating the job and the arguments are implicitly set the by the programmer later on. The user cannot directly interact with the program I suppose.

An example is there on this url:

http://oracle-base.com/articles/11g/scheduler-enhancements-11gr1.php

Regards
Mayuresh Kumar

[Updated on: Wed, 03 December 2014 03:35]

Report message to a moderator

Re: Job Scheduing [message #629097 is a reply to message #629091] Wed, 03 December 2014 04:07 Go to previous message
ThomasG
Messages: 3211
Registered: April 2005
Location: Heilbronn, Germany
Senior Member
I now remember more clearly: Once the "Allow the service to interact with the desktop" was checked in the service configuration (it was a Windows 2008 server in a domain) that service could no longer interact with the network in my case, and when it was unchecked it could interact with the network again, but no longer with the desktop.

Previous Topic: Failed to execute target procedure ORA-20002: ORA-29279: SMTP permanent error: 550 5.1.1
Next Topic: Order by clause
Goto Forum:
  


Current Time: Fri Apr 26 05:44:29 CDT 2024