oracle 如何从 PLSQL 程序调用 shell 脚本
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4068816/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to call a shell script from PLSQL program
提问by Chandra Bhushan
Could you please let me know how to call a shell script from PLSQL program?
你能告诉我如何从 PLSQL 程序调用 shell 脚本吗?
采纳答案by Harrison
And a forth way (on top of Pablo's) 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. Here is a simple example that uses sqlplus to be the daemon:
在 Oracle7.0 及更高版本中,我们可以使用 dbms_pipes 与运行在数据库外的守护进程对话。这是一个使用 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;
/
回答by Pablo Santa Cruz
You have a couple of options available:
您有几个选项可用:
- Invoke a Java method from within a PL/SQL wrapper.
- Call a C program as an external procedure from within PL/SQL.
- Use the new DBMS_SCHEDULER package.
- 从 PL/SQL 包装器中调用 Java 方法。
- 从 PL/SQL 中将 C 程序作为外部过程调用。
- 使用新的 DBMS_SCHEDULER 包。
Here'sa link with INFO on them.
这是有关他们的 INFO 的链接。
回答by Sankar R.K
Invoking a shell script from PL/SQL using DBMS_SCHEDULER:
Please find the link below
http://www.dba-oracle.com/t_execute_shell_script_plsql_procedure.htm
使用 DBMS_SCHEDULER 从 PL/SQL 调用 shell 脚本:请找到以下链接
http://www.dba-oracle.com/t_execute_shell_script_plsql_procedure.htm
回答by REW
Not listed above, but still applicable: C Code direct library from PL/SQL from Ask Tom. Obviously it would be an execution of a C Wrapper to call out to the Shell script.
上面没有列出,但仍然适用:来自 Ask Tom 的来自 PL/SQL 的 C 代码直接库。显然,调用 Shell 脚本将是执行 C 包装器。