1

我的 oracle 数据库称为 IRECSDEV,用户 FTREC 我的 PC 名称是 DEVSERVER1,Windows 用户是 WWLSERVER 我正在尝试使用 Oracle Remote Agent 从 DBMS_SCHEDULER 运行 calc.exe。
我已经安装了 Oracle Remote Agent,我将其命名为 schagent,并将 15021 设置为代理的端口 对于数据库端口,我设置了 16021:

DBMS_XDB.sethttpport(16021);

我注册数据库:

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

schagent.conf 是:

# 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=

所以我创建了凭据

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

然后我创造了一份工作

 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;

test.bat 文件是:

 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  

当我尝试启用或运行作业时,EXE3 正在运行,但它失败并显示错误 255 和附加信息:EXTERNAL_LOG_ID="job_145518_24",USERNAME="WWLSERVER"

任何想法我做错了什么?
Oracle 版本:11.2.0.1.0 操作系统 Windows Server 2008

4

0 回答 0