|
|
Re: export a database which has no entry in tnsnames.ora [message #356575 is a reply to message #356571] |
Fri, 31 October 2008 04:38 |
ciri
Messages: 11 Registered: October 2008
|
Junior Member |
|
|
Sorry, I'll rewrite the question, in order to complete the given information.
I want to export a database from java code. So i call exp tool inside java using runtime. This is the code I use for a local database, which has an entry in tnsnames.
import java.io.*;
import java.lang.*;
class ProcessHandler extends Thread {
InputStream inpStr;
String strType;
public ProcessHandler(InputStream inpStr, String strType) {
this.inpStr = inpStr;
this.strType = strType;
}
public void run() {
try {
InputStreamReader inpStrd = new InputStreamReader(inpStr);
BufferedReader buffRd = new BufferedReader(inpStrd);
String line = null;
while((line = buffRd.readLine()) != null) {
System.out.println(strType + " -> " + line);
}
buffRd.close();
} catch(Exception e) {
System.out.println(e);
}
}
}
public class Ejecuta extends Object
{
public static void main(String[] args)
{
Runtime rt = Runtime.getRuntime();
String sentencia = "C:\\oracle\\ora92\\bin\\" + "exp " + "un/pw" +
" file=" + "C:\\xxxx_logs\\fichero.dmp" +
" consistent=Y log=" + "C:\\xxxx_logs\\fichero.log" + " owner=<some owner>";
String rcS = "";
int rc = -1;
try
{
Process p = rt.exec(sentencia);
/* handling the streams so that dead lock situation never occurs.*/
ProcessHandler inputStream =
new ProcessHandler(p.getInputStream(),"INPUT");
ProcessHandler errorStream =
new ProcessHandler(p.getErrorStream(),"ERROR");
/* start the stream threads */
inputStream.start();
errorStream.start();
int bufSize = 8192;
BufferedReader stdInput =
new BufferedReader(new InputStreamReader(p.getInputStream()));
BufferedReader stdError =
new BufferedReader(new InputStreamReader(p.getErrorStream()));
String salida = stdInput.readLine();
System.out.println("Leyendo salida");
while(salida != null)
{
salida = stdInput.readLine();
System.out.println(salida);
}
String salidaError = stdError.readLine();
System.out.println("Leyendo salidaError");
while(salidaError != null)
{
salidaError = stdError.readLine();
System.out.println(salidaError);
}
rc = p.waitFor();
}
catch (Exception e)
{
e.printStackTrace();
rcS = e.getMessage();
System.out.println("Excepcion: "+rcS);
}
}
}
The question is: with a similar code, can i export a database which is located in another machine, and it has no entry in the local tnsnames.ora?
Thanks in advanced,
Ciri
[EDITED by LF: removed certain information as per OP's request]
[Updated on: Mon, 20 July 2009 02:51] by Moderator Report message to a moderator
|
|
|
|
Re: export a database which has no entry in tnsnames.ora [message #356596 is a reply to message #356571] |
Fri, 31 October 2008 06:40 |
ciri
Messages: 11 Registered: October 2008
|
Junior Member |
|
|
Hi,
thanks for the answer.
Just as a test, I've tried the following command execution from the command line,
C:\\oracle\\ora92\\bin\\exp un/pw@(ADDRESS_LIST =(ADDRESS = PROTOCOL = TCP)(HOST = localhost)(PORT = <port number>)))(CONNECT_DATA =(SERVER = DEDICATED)(SID = <some SID>)))
but i get the next error:
LRM-00116: syntax error at 'ADDRESS_LIST' following '('
EXP-00019: failed to process parameters, type 'EXP HELP=Y' for help
EXP-00000: Export terminated unsuccessfully
What shoud i put?
Regards,
[EDITED by LF: removed certain information as per OP's request]
[Updated on: Tue, 14 July 2009 05:47] by Moderator Report message to a moderator
|
|
|
|
|