SQL>exec dbms_java.grant_permission('TEST','SYS:java.io.FilePermission','<<ALL FILES>>','read,write,execute,delete')
SQL>exec dbms_java.grant_permission('TEST','java.lang.RuntimePermission','*','writeFileDescriptor' )
2. 建立java source
CREATE OR REPLACE AND RESOLVE JAVA SOURCE NAMED "bb" as import java.io.*
import java.lang.*
import java.util.*
import java.sql.*
import oracle.sql.*
public class bb
{
public static void invoke_exe() throws IOException
{
Process p=Runtime.getRuntime().exec("d:/exp_74.bat")--注意/符号
try
{
p.waitFor()
}catch(InterruptedException ie){System.out.println(ie)}
}
}
/
3. 建立调用java source的存储过程CALL_BB
create or replace procedure CALL_BB
as
language java
name 'bb.invoke_exe()'
/
4. 执行CALL_BB即可;
1:先创建SQL 文件spool.sql内容:
set head off
spool c:\select.txt
select * from tbl
spool off
2:然后创建一test.bat文件
文件内容:
cd c:\
sqlplus "test/test" @c:\spool.sql
这时候直接运行test.bat会再c:\盘下生成select.txt文件,
3:在windows
start->programs->Accessories->System Tools->Scheduled Tasks里面定义每天运行一次
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)