如何从PL / SQL运行操作系统命令,如CHMOD?

时间:2015-12-29 05:50:25

标签: unix plsql

如何从PL / SQL块运行chmod命令?

1 个答案:

答案 0 :(得分:6)

dbms_scheduler方式:

begin    
    dbms_scheduler.create_job (
       job_name    => 'ext_tasks_job',
       job_type    => 'executable',
       job_action  => '/bin/sh',
       number_of_arguments => 2,
       auto_drop   => true);    
    dbms_scheduler.set_job_argument_value ('ext_tasks_job', 1, '-c');
    dbms_scheduler.set_job_argument_value ('ext_tasks_job', 2, 'chmod 777 /somedir/some.file');
    dbms_scheduler.run_job ('ext_tasks_job'); 
end; 

source