title: Oracle dbms_scheduler.run_job invalid username/password
body: <p>I'm trying to set up a scheduled external job using Oracle to call a batch file. I've found a lot of material on the net that talks about this, however I'm missing something. </p>
  
  <p>I'm running my PL/SQL in SQL Developer (but I've tried in in SQLPlus as well). The error I'm getting in the output window is the following.</p>
  
  <pre><code>Error starting at line 7 in command:
  exec dbms_scheduler.run_job('my_job')
  Error report:
  ORA-27369: job of type EXECUTABLE failed with exit code: The storage control blocks were destroyed.
  ORA-06512: at "SYS.DBMS_ISCHED", line 185
  ORA-06512: at "SYS.DBMS_SCHEDULER", line 486
  ORA-06512: at line 1
  27369. 00000 -  "job of type EXECUTABLE failed with exit code: %s"
  *Cause:    A problem was encountered while running a job of type EXECUTABLE.
             The cause of the actual problem is identified by the exit code.
  *Action:   Correct the cause of the exit code and reschedule the job.
  </code></pre>
  
  <p>The error I'm getting in dba_scheduler_job_run_details is the following.</p>
  
  <pre><code>"EXTERNAL_LOG_ID="job_167045_46155",
  ORA-27369: job of type EXECUTABLE failed with exit code: The storage control blocks were destroyed.
  STANDARD_ERROR="Launching external job failed: Invalid username or password""
  </code></pre>
  
  <p>I figure that it's some kind of permission problem either with where my batch file is located or something. I'm trying to run the job as a maintenance account. If I use the Windows cmd line "runas" command and run my batch file directly, everything is fine. If I run through Oracle, it doesn't. I've tried different accounts such as an admin account, however it made no difference. </p>
  
  <p>The code I used to create my credential/job follows. </p>
  
  <pre><code>exec dbms_scheduler.create_credential( credential_name =&gt; 'oracle_cred', username =&gt; 'user', password =&gt; 'password', windows_domain =&gt; 'domain' );
  
  DBMS_SCHEDULER.create_job ('my_job',
                            job_action =&gt; 'C:\WINDOWS\SYSTEM32\CMD.EXE',
                            number_of_arguments =&gt; 2,
                            start_date=&gt; sysdate+1,
                            auto_drop=&gt;FALSE,
                            job_type =&gt; 'executable',
                            enabled =&gt; FALSE
  );   
  
  DBMS_SCHEDULER.set_job_argument_value ('my_job', 1, '/C');
  DBMS_SCHEDULER.set_job_argument_value ('my_job', 2, 'C:\maintenance\audit.bat');
  dbms_scheduler.set_attribute('my_job', 'credential_name', 'oracle_cred');
  DBMS_SCHEDULER.enable('my_job'); 
  </code></pre>
  
  <p>Any suggestions are appreciated,</p>
  
  <p>mj</p>