Hi i'm trying to make a backup using rman from java, im trying using a Runtime from java, im able to open the cmd, access rman but after that any other query i try to submit is executed. im able to access rman from cmd window and sqlplus window i alredy tried using ; and without it here's the code, please help me:
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();
}
And this is the output:
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