how can I use "impdp" command importing .dmp data with port number?

leon picture leon · Mar 23, 2012 · Viewed 25k times · Source

I am trying to import data to an Oracle database. I have ".imp" and ".dmp" files for importing data. The database is using port 1521 and database name is "DB". I have tried the following command, but doesn't work.

impdp root/[email protected]:1521:DB 
    dumpfile=transmart.dmp
    logfile=transmart.imp
    schemas=i2b2hive,i2b2metadata,i2b2sampledata,i2b2demodata,i2b2workdata
             ,biomart,biomart_user,deapp,searchapp,tm_cz,tm_lz,tm_wz

ERROR: either ORA-12504: TNS:listener was not given the SERVICE_NAME in CONNECT_DATA or ORA-12545: Connect failed because target host or object does not exist

I can telnet the IP and port with no problem.

Can anyone suggest please?

Thanks!

Answer

DCookie picture DCookie · Mar 23, 2012

You have a syntax error in your EZConnect string.

Try this instead (no need to fuss with tnsnames.ora this way):

impdp root/[email protected]:1521/DB

Notice the replacement of the ":" with a "/" between port and service name.

As a side note, I long ago got out of the habit of putting passwords in command lines, where they may be easily snooped while the command is running. Let the program prompt you for the password:

impdp [email protected]:1521/DB

Especially if you're going to use root for your commands ;-)