Run exe from DBMS_SCHEDULER

2019-07-20 12:53发布

I am kind of new in DMBS_SCHEDULER and I face some problems.
I want to run an .exe
So I created a Job:

begin
   sys.dbms_scheduler.create_job(job_name            => 'FTREC.EXE_1',
                            job_type            => 'EXECUTABLE',
                            job_action          => 'C:\Windows\System32\calc.exe',
                            start_date          => to_date(null),
                            repeat_interval     => '',
                            end_date            => to_date(null),
                            job_class           => 'IRECS_JOB_CLASS',
                            enabled             => false,
                            auto_drop           => false,
                            comments            => '');
end;

I have also created credentials :

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

And I applied the credentials to my job

dbms_scheduler.set_attribute('FTREC.EXE_1', 'credential_name', 'WWLSERVER');

But when I try to run my Job I get this error:

EXTERNAL_LOG_ID="job_255737_183883",
ORA-27369: job of type EXECUTABLE failed with exit code: The extended attributes are inconsistent.

What I am doing wrong?

1条回答
The star\"
2楼-- · 2019-07-20 13:28

Credentials were not available in 10g. There are no mentions of the word "credential" in the DBMS_SCHEDULER documentation.

I was able to run your code in 12c. But running calc.exe created an un-killable session, I had to restart the database. Things went much better when I used a simple .bat file for testing.

This thread on the Oracle Forums has methods for running an external program on 10g.

查看更多
登录 后发表回答