Oracle data pump impdp to remote server

柔情痞子 提交于 2019-12-10 17:19:24

问题


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

This is what I did:

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 a directory for the dump file:

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

Import the dump file:

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

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

The following error occured:

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

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

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


回答1:


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.

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

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.

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.

From the impdpdocumentation:

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.

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:

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.



来源:https://stackoverflow.com/questions/21412533/oracle-data-pump-impdp-to-remote-server

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!