简体   繁体   English

如何从PL / SQL过程中运行批处理文件

[英]How to run batch file from within PL/SQL procedure

I have a batch file which will execute some .exe which do some operations (like connecting to DB, fetching data, insert data etc...) 我有一个批处理文件,它将执行一些执行某些操作的.exe(例如,连接到DB,获取数据,插入数据等)。
All the things are configured in the batch file and when I run it, it works good. 所有的东西都在批处理文件中配置,当我运行它时,它运行良好。

But, I want to invoke this batch file from a PL/SQL procedure . 但是,我想从PL / SQL过程调用此批处理文件
this procedure should invoke this batch file first, and after the execution of the batch file, it will have it's own SQL operations. 此过程应首先调用此批处理文件,并且在执行批处理文件后,它将具有自己的SQL操作。

How can I proceed to do this? 我该怎么做呢?

Set up a job with dbms_scheduler. 使用dbms_scheduler设置作业。 This topic is discussed here (German): http://db-memory.blogspot.ch/2012/12/dbmsscheduler-mit-executable-unter.html The screenshots may be helpful. 此处讨论了这个主题(德语): http : //db-memory.blogspot.ch/2012/12/dbmsscheduler-mit-executable-unter.html屏幕截图可能会有所帮助。

Please remember to enable the dbms_scheduler job, else it won't run. 请记住要启用dbms_scheduler作业,否则它将无法运行。

You can write your own stored java class with a method which implements running an OS executable file. 您可以使用实现运行OS可执行文件的方法来编写自己的存储的Java类。 You should grant to your oracle user java.io.FilePermission and java.lang.RuntimePermission with DBMS_JAVA.GRANT_PERMISSION procedure. 您应该使用DBMS_JAVA.GRANT_PERMISSION过程将oracle用户java.io.FilePermission和java.lang.RuntimePermission授予。 Then you should create a plsql function-wrapper which calls your java method. 然后,您应该创建一个调用SQL方法的plsql函数包装器。 And all you should do for running an OS eecutable is to run your plsql wrapper function. 运行OS eecutable操作系统所需要做的就是运行plsql wrapper函数。

There is an "AskTom" page about it here 有一个关于它的“AskTom”页面点击这里

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

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