oracle10g - Run exe using trigger from Oracle database -
i trying run exe oracle database. want fire trigger on insert or updation of table. once table updated have run exe in d drive.
i have tried scheduler gives error. code follows:
begin dbms_scheduler.create_program ( program_name => 'program_name', program_type => 'executable', program_action => 'd:/myproc.exe', enabled => true, comments => 'run exe' ); end; /
i getting following error
ora-27486: insufficient privileges ora-06512: @ "sys.dbms_isched", line 5 ora-06512: @ "sys.dbms_scheduler", line 36 ora-06512: @ line 2
i have 1 more question.
which best method run exe? database or code?
thanks in advance
you schedule script using dbms_scheduler.
depending on os(below example in windows) this:
begin dbms_scheduler.create_job('my_job', job_action=>'c:\windows\system32\cmd.exe', number_of_arguments=>3, job_type=>'executable', start_date => systimestamp, repeat_interval => 'freq=hourly; byminute=0,30; bysecond=0;', end_date => null, enabled=> false); dbms_scheduler.set_job_argument_value('my_job',1,'/q'); dbms_scheduler.set_job_argument_value('my_job',2,'/c'); dbms_scheduler.set_job_argument_value('my_job',3, 'd:/my_sql.bat.bat'); dbms_scheduler.enable('my_job'); end; /
now my_sql.bat like:
sqlplus user@sid/password @d:\scripts\script.sql exit
Comments
Post a Comment