简体   繁体   English

如何从PLSQL程序调用shell脚本

[英]How to call a shell script from PLSQL program

能告诉我如何从PLSQL程序调用shell脚本吗?

You have a couple of options available: 您有几个选择:

  1. Invoke a Java method from within a PL/SQL wrapper. 从PL / SQL包装器中调用Java方法。
  2. Call a C program as an external procedure from within PL/SQL. 从PL / SQL中调用C程序作为外部过程。
  3. Use the new DBMS_SCHEDULER package. 使用新的DBMS_SCHEDULER包。

Here's a link with INFO on them. 这是与INFO的链接。

And a forth way (on top of Pablo's) dbms_pipe 并且第四种方式(在Pablo的顶部) dbms_pipe


http://asktom.oracle.com/pls/apex/f?p=100:11:0::::P11_QUESTION_ID:16212348050 http://asktom.oracle.com/pls/apex/f?p=100:11:0::::P11_QUESTION_ID:16212348050

In Oracle7.0 and up, we can use dbms_pipes to talk to a daemon running outside the database. 在Oracle7.0及更高版本中,我们可以使用dbms_pipes与在数据库外部运行的守护进程通信。 Here is a simple example that uses sqlplus to be the daemon: 这是一个使用sqlplus作为守护进程的简单示例:

create or replace procedure host( cmd in varchar2 )
as
    status number;
begin
    dbms_pipe.pack_message( cmd );
    status := dbms_pipe.send_message( 'HOST_PIPE' );
    if ( status <> 0 ) then raise_application_error( -20001, 'Pipe error' );
    end if;
end;
/

Invoking a shell script from PL/SQL using DBMS_SCHEDULER: Please find the link below 使用DBMS_SCHEDULER从PL / SQL调用shell脚本:请在下面找到链接
http://www.dba-oracle.com/t_execute_shell_script_plsql_procedure.htm http://www.dba-oracle.com/t_execute_shell_script_plsql_procedure.htm

Not listed above, but still applicable: C Code direct library from PL/SQL from Ask Tom . 上面没有列出,但仍然适用: 来自Ask Tom的 PL / SQL的C代码直接库。 Obviously it would be an execution of a C Wrapper to call out to the Shell script. 显然,执行C包装器来调用Shell脚本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM