Home » RDBMS Server » Server Utilities » export a database which has no entry in tnsnames.ora (oracle,9.2.0.1.0,SunOs 5.8)
export a database which has no entry in tnsnames.ora [message #356571] Fri, 31 October 2008 04:18 Go to next message
ciri
Messages: 11
Registered: October 2008
Junior Member
Hi,

Is it possible to export a database which has no entry in tnsnames.ora file?. How?

Thanks in advanced

Ciri
Re: export a database which has no entry in tnsnames.ora [message #356573 is a reply to message #356571] Fri, 31 October 2008 04:20 Go to previous messageGo to next message
Michel Cadot
Messages: 68647
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Yes. Locally.

Regards
Michel
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 Go to previous messageGo to next message
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 #356581 is a reply to message #356575] Fri, 31 October 2008 05:19 Go to previous messageGo to next message
Michel Cadot
Messages: 68647
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Use the full description for remote instance in the connexion string.

Regards
Michel
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 Go to previous messageGo to next message
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

Re: export a database which has no entry in tnsnames.ora [message #356604 is a reply to message #356596] Fri, 31 October 2008 08:01 Go to previous messageGo to next message
Michel Cadot
Messages: 68647
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Add quotes.

Regards
Michel
Re: export a database which has no entry in tnsnames.ora [message #356976 is a reply to message #356604] Mon, 03 November 2008 06:46 Go to previous message
ciri
Messages: 11
Registered: October 2008
Junior Member
Hello,

I've added quotes and it works for sqlplus tool. However, it doesn't work for exp tool.

This is why I think exp tool doesn't work with full description as a connect string.

What do you think?


Regards,

Ciri
Previous Topic: External table
Next Topic: Exp/Imp - Move objects between tablespaces
Goto Forum:
  


Current Time: Wed May 01 00:44:23 CDT 2024