0 Replies Latest reply: Jul 27, 2012 7:13 AM by 757840 RSS

    ORA-01031: insufficient privilege while running a batch job

    757840
      Hi Gurus...
      I have created a oracle scheduler job to run a batch file (On WS2k8, Oracle 11.2.0.1) as

      BEGIN
      sys.dbms_scheduler.create_job(

      job_name => 'MY_JOB',

      job_type => 'EXECUTABLE',

      job_action => 'C:\WINDOWS\system32\cmd.exe',

      repeat_interval => 'FREQ=MINUTELY; interval=30; bysecond=0;',

      start_date => systimestamp,

      job_class => 'DEFAULT_JOB_CLASS',

      comments => 'This Job Collect Statas as per Analyze.bat',

      auto_drop => FALSE,

      number_of_arguments => 3,

      enabled => FALSE);

      sys.dbms_scheduler.set_job_argument_value( job_name => 'MY_JOB', argument_position => 1, argument_value => '/q');

      sys.dbms_scheduler.set_job_argument_value( job_name => 'MY_JOB', argument_position => 2, argument_value => '/c');

      sys.dbms_scheduler.set_job_argument_value( job_name => 'MY_JOB', argument_position => 3, argument_value => 'D:\analyze.bat >> d:\as.txt');

      sys.dbms_scheduler.enable( 'MY_JOB' );

      END;
      /

      #########################################################################################################
      REM batch file.....

      set ORACLE_HOME=D:\Oracle\Ora11g
      echo %ORACLE_HOME%
      cd /d %ORACLE_HOME%\BIN
      sqlplus /@ORCL as sysdba
      EXIT

      this pops up an error ORA-01031: insufficient privilege.........
      I am running this job as SYSDBA..What could be the problem
      Moreover when i run this bat file from CMD, its go very smoothly

      Thanks
      Sunil

      Edited by: user9276229 on 27 Jul, 2012 5:12 AM