oracle 如何在没有 tnsnames.ora 文件的情况下使用数据泵实用程序

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2773721/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 02:33:42  来源:igfitidea点击:

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

oraclecommand-linetnsnamesdatapump

提问by Shravan

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

我希望能够运行expdp,并impdp通过直接指定连接参数,而不是TNS名驻留在tnsnames.ora。这可能吗?

回答by David Mann

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...

您可以在命令行上使用连接字符串而不是 TNSName 来指定所有内容。从您用于连接的 TNS 条目中删除空格,这是一个适用于 SQLPLUS 的示例...

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

以下是如何连接到 Windows 上的本地 OracleXE 安装:

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:

在 *Nix 上,您可能需要引用条目,以便括号不会被错误解释:

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

回答by DCookie

You might try an EZCONNECT string:

您可以尝试使用EZCONNECT 字符串

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

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

在包含 EZCONNECT 的客户端,您将需要一个 sqlnet.ora 参数,例如:

NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)