嗨,我正在尝试使用来自 java 的 rman 进行备份,我正在尝试使用来自 java 的运行时,我能够打开 cmd,访问 rman,但之后我尝试提交的任何其他查询都将被执行。我能够从我已经尝试使用的 cmd 窗口和 sqlplus 窗口访问 rman;没有它这里的代码,请帮助我:
public void execute(JobExecutionContext context) throws JobExecutionException {
command[0] = "cmd";
command[1] = "/c";
command[2] = "rman target / catalog rman/rman@xe;";
command[3] = "backup as backupset database plus archivelog;";
command[4] = "exit;";
command[5] = "sqlplus.exe;";
try {
Process p = Runtime.getRuntime().exec(command);
BufferedReader reader = new BufferedReader(new InputStreamReader(p.getInputStream()));
String line = reader.readLine();
while (line != null) {
System.out.println(line);
line = reader.readLine();
}
这是输出:
Recovery Manager: Release 11.2.0.2.0 - Production on Lun Nov 11 22:11:12 2013
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
connected to target database: XE (DBID=2711152663)
connected to recovery catalog database