How to use Data Pump utilities without a tnsnames.ora file
Asked Answered
F

2

9

I want to be able to run expdp and impdp by directly specifying the connection parameters instead of a TNS name that resides in tnsnames.ora. Is this possible?

Flinty answered 5/5, 2010 at 13:44 Comment(0)
M
10

You may be able to specify it all on the command line with a Connection String instead of a TNSName. Remove the whitespace from your TNS entry you would have used to connect, here is an example that works with SQLPLUS...

Here is how to connect to a local OracleXE install on Windows:

sqlplus scott/tiger@(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost.localdomain)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SID=xe)))

On *Nix you may need to quote the entry so the parens aren't interpreted incorrectly:

sqlplus 'scott/tiger@(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost.localdomain)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SID=xe)))'
Mammon answered 5/5, 2010 at 14:18 Comment(3)
While this works as given for sqlplus, it does not seem to work for expdp - I'm getting LRM-00116: syntax error at 'ADDRESS_LIST' following '(' using Oracle 12.1.0.2.0.Nerte
@Nerte were you able to fix that? asking as facing the same issue.Photoemission
@Photoemission That's too long ago, but judging from my comment on the other answer, the EZCONNECT way seems to have done it.Nerte
R
5

You might try an EZCONNECT string:

expdp userid=user/pw@//host:port/service-name

You will need a sqlnet.ora parameter on the client side that includes EZCONNECT, e.g.:

NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)
Regina answered 5/5, 2010 at 16:18 Comment(1)
This works great! Note that the // is optional. Also, I didn't need to configure anything on the client side for it to work.Nerte

© 2022 - 2024 — McMap. All rights reserved.