1

My oracle database is called IRECSDEV, the user FTREC My PC name is DEVSERVER1 and Windows User is WWLSERVER I am trying to run calc.exe from DBMS_SCHEDULER using Oracle Remote Agent.
I have installed Oracle Remote Agent ,I named it schagent and I set as agent's port the 15021 For the database port I set the 16021:

DBMS_XDB.sethttpport(16021);

I register the database :

 set ORACLE_SID=IRECSDEV
 cd C:\app\WWLSERVER\product\11.2.0\tg_1\bin schagent -registerdatabase DEVSERVER1 16021

schagent.conf is:

# This is the configuration file for the Oracle Scheduler Agent.
#
# The agent will look first for schagent.conf in {EXECUTION_AGENT_DATA} and then
# in {EXECUTION_AGENT_HOME}. It will only use whichever is found first and
# throw an error if none is found.
#
# You can change these values to suit your environment.

# network port to listen on for requests (between 1 and 65536)
PORT=15021

# host name of the host the agent is running on. If this is not specified,
# the resolved name of the local address will be used
HOST_NAME = DEVSERVER1

# if this is set, then databases will use this as the name of the agent
# destination object for this agent. This must be a valid database object name.
# If this is not set then databases will use the first part of the hostname
# (before the first period) or an automatically generated name.
# AGENT_NAME=schagent

# maximum number of jobs to run simultaneously (between 1 and 1000)
MAX_RUNNING_JOBS=5

# if this is set to TRUE, the agent will reject put_file requests   
DISABLE_PUT_FILE=FALSE

# if this is set to TRUE, the agent will reject get_file requests
DISABLE_GET_FILE=FALSE

# if this is set to TRUE, the agent will reject job execution requests
DISABLE_JOB_EXECUTION=FALSE

# the agent will reject any attempt to use any user on this list.
# This list should be comma-separated and is case-insensitive.
DENY_USERS=root,administrator,guest

# if this list is not empty, the agent will only allow use of a user on this
# list. This list should be comma-separated and is case-insensitive.
# ALLOW_USERS=

# if this is set to TRUE, only registered databases will be allowed to submit
# jobs and the agent will only be able to register with database versions 11.2
# or higher. This enforces a higher level of security including encryption of
# job results.
SECURE_DATABASES_ONLY=FALSE

# types of logging to do. Zero or more of the following options:
# OVERVIEW, WARNINGS, ALL, ERROR_STACKS, MILLISECONDS
LOGGING_LEVEL=OVERVIEW,WARNINGS


# There is no need to set these two parameters if you are only using this
# agent to run jobs of type EXECUTABLE.
# If this agent is used to run remote database (PL/SQL block or stored
# procedure) jobs then you can set the following two parameters to
# point to a default database. If a database job is received with no connect
# info, this database will be used to run the job. 
# ORACLE_SID=
# ORACLE_HOME=

So I have created credentials

DBMS_SCHEDULER.CREATE_CREDENTIAL('WWLSERVER','WWLSERVER','myPassword',null,null,null);

and then I created a job

 BEGIN
   DBMS_SCHEDULER.create_job
 (
  job_name => 'EXE3',
  job_type => 'EXECUTABLE',
  number_of_arguments => 2,
  job_action => 'C:\windows\system32\cmd.exe',
  auto_drop => FALSE,
  enabled => FALSE
 );
 DBMS_SCHEDULER.set_job_argument_value('EXE3',1,'/c');
 DBMS_SCHEDULER.set_job_argument_value('EXE3',2,'C:\Users\WWLSERVER\Desktop\test.bat');
 DBMS_SCHEDULER.set_attribute('EXE3', 'credential_name','WWLSERVER');
 DBMS_SCHEDULER.set_attribute('EXE3', 'destination','DEVSERVER1:15021');
 DBMS_SCHEDULER.enable('EXE3');
 END;

The test.bat file is:

 echo off  
 SET ORACLE_HOME=C:\app\WWLSERVER\product\11.2.0\dbhome_1  
 SET ORACLE_SID=IRECSDEV  
 c:\windows\System32\calc.exe  
 echo on  

When I try to enable or to run the job EXE3 is running but it fails with error 255 and additional info : EXTERNAL_LOG_ID="job_145518_24",USERNAME="WWLSERVER"

Any ideas what I have done wrong?
Oracle version:11.2.0.1.0 OS Windows Server 2008

Nianios
  • 1,391
  • 3
  • 20
  • 45
  • Do you really want to launch a GUI from the database? Have you checked "Allow service to interact with desktop" for the relevant services? – Jon Heller Nov 16 '13 at 23:46
  • I don't want to use a service for several reasons. – Nianios Nov 18 '13 at 00:34
  • I don't think it's avoidable, Oracle runs as a service. – Jon Heller Nov 18 '13 at 04:01
  • I have built a service that it works almost fine with a different approach. But I wanted to use some graphic characteristics from a library and with service is impossible. So I want to run an exe. It will not have a visual interface, but it will do exactly what I want – Nianios Nov 18 '13 at 11:54

0 Answers0