问题描述
- DB2备份脚本如何指定备份文件路径
-
查了些资料,找到如下java代码,自己也尝试了一下,是可以备份的,代码如下:
import java.util.Date;
public class BAK {
public static void main(String[] args) throws Exception{
Runtime runtime = Runtime.getRuntime();
Process proc = runtime.exec("db2cmd /c db2 force application all");
Thread.currentThread().sleep(5000);
proc = runtime.exec("db2cmd /c db2 backup db TEST );
WITHOUT PROMPTING; ");
runtime.exit(0);
}
}
但是有个问题:如何指定备份路径呢?我尝试改了如下代码
proc = runtime.exec("db2cmd /c db2 backup db TEST );
改为:
proc = runtime.exec("db2cmd /c db2 backup db TEST to e:db2autuobak");
但是执行的时候报错,求各位老师指点迷津
时间: 2025-01-27 01:32:59