Oracle Data Pump Impdp到远程服务器 [英] Oracle data pump impdp to remote server

查看:567
本文介绍了Oracle Data Pump Impdp到远程服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个要导入到Amazon rds服务器的转储文件.

We have a dump file that we want to import to an Amazon rds server.

这就是我所做的:

创建一个公共数据库链接并验证其是否有效:

Create a public db link and verify it works:

create public database link rdsdblink
connect to dbuser identified by dbpsw
using '(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST='xxx')(PORT=1521)))(CONNECT_DATA=(SID=dbsid)))';

SQL> select * from dual @ rdsdblink;

D
-
X

为转储文件创建目录:

CREATE OR REPLACE DIRECTORY DATA_PUMP_DIR AS 'G:\DB';

导入转储文件:

impdp dbuser/dbpsw@rdsdblink tablespaces=EMP directory=DATA_PUMP_DIR dumpfile=EMP_dump.DMP logfile=EMP_dump.log network_link=rdsdblink

我还将rdsdblink连接字符串添加到tnsnames.ora文件中,并重新启动了oracle服务(立即关闭",然后启动").

I have also added rdsdblink connection string to tnsnames.ora file and restarted oracle service ("shutdown immediate", then "startup").

发生以下错误:

已连接到:Oracle Database 11g 11.2.0.2.0版-64位生产
ORA-39001:无效的参数值
ORA-39200:链接名称"rdsdblink"无效.
ORA-02019:找不到远程数据库的连接描述

Connected to: Oracle Database 11g Release 11.2.0.2.0 - 64bit Production
ORA-39001: invalid argument value
ORA-39200: Link name "rdsdblink" is invalid.
ORA-02019: connection description for remote database not found

我的本​​地oracle版本: Oracle Database 11g Express Edition 11.2.0.2.0版-生产

My local oracle version: Oracle Database 11g Express Edition Release 11.2.0.2.0 - Production

远程oracle版本: Oracle Database 11g版本11.2.0.2.0-64位生产

Remote oracle version: Oracle Database 11g Release 11.2.0.2.0 - 64bit Production

推荐答案

您已经连接到远程数据库(通过dbuser/dbpsw@rdsdblink),但是您的数据库链接是在本地数据库中创建的.目前,您正在尝试在远程DB上运行导入,同时还具有到远程DB的网络链接,并且该网络链接正在尝试使用该远程DB上不存在的DB链接.

You've connected to the remote database (via dbuser/dbpsw@rdsdblink), but your DB link is created in your local database. At the moment you're trying to run the import on the remote DB, with a network link also to the remote DB, and that network link is trying to use a DB link that doesn't exist on that remote DB.

tnsnames.ora条目和DB链接是完全独立的.

The tnsnames.ora entry and the DB link are completely separate things.

您可能需要在本地正常连接-可能使用创建数据库链接所使用的任何凭据.然后,network_link参数将使由impdp启动的本地数据库会话对远程服务器起作用.这样就可以使用您的本地目录.

You need to connect normally locally - using whichever credentials you used to create the DB link, probably. The network_link parameter will then make your local database session, that is started by impdp, act against the remote server; so your local directory can be used.

除了...它不能那样工作.由network_link标识的远程数据库可以用作导入的源,而根本没有转储文件.但它不能成为从文件导入的目标.

Except... it doesn't work like that. The remote database identified by the network_link can be used as the source of the import, without a dump file at all; but it can't be the target for an import from a file.

来自 impdp文档 :

NETWORK_LINK参数通过数据库链接启动导入. 这意味着impdp客户端连接到的系统 联系由 source_database_link ,从中检索数据,并将数据直接写入连接的实例上的数据库.没有转储 涉及的文件.

The NETWORK_LINK parameter initiates an import via a database link. This means that the system to which the impdp client is connected contacts the source database referenced by the source_database_link, retrieves data from it, and writes the data directly to the database on the connected instance. There are no dump files involved.

如果您真的想走这条路,我想您需要一个从远程到本地的链接,并且要对远程运行导入(就像现在一样),但是要直接从架构中拉取-而不是从以前的出口.您仍然需要访问远程服务器上的DIRECTORY对象,因为日志等将被写入其中,即使您没有复制转储文件也是如此.即使使用nologfile,我相信如果您不指定目录或没有目录权限,也会出错.

If you really wanted to go down this route, I think you would need a link from remote to local, and to run the import against the remote (as you are now), but to be pulling directly from your schema - not from a previous export. You'd still need access to a DIRECTORY object on the remote server, as logs etc. would be written there, even if you weren't copying your dump file over. Even with nologfile I believe it will error if you don't specify a directory or don't have permissions on it.

您在之前的文章中链接到的文章问题说了同样的话:

The article you linked to in your previous question said the same thing:

对于导入,NETWORK_LINK参数还标识数据库 指向源服务器的链接.这里的区别是对象 直接从源导入本地服务器,而无需 被写入转储文件.虽然没有必要 DUMPFILE参数,仍然需要目录对象 与操作关联的日志.

For imports, the NETWORK_LINK parameter also identifies the database link pointing to the source server. The difference here is the objects are imported directly from the source into the local server without being written to a dump file. Although there is no need for a DUMPFILE parameter, a directory object is still required for the logs associated with the operation.

这篇关于Oracle Data Pump Impdp到远程服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆