oracle 如何使用 dblink 或网络链接从远程数据库导入模式
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/34738784/
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
How to import schema from remote database using dblink or network link
提问by Satyadev
I have created a network link as follows:
我创建了一个网络链接,如下所示:
CREATE PUBLIC DATABASE LINK "remote_lab2"
CONNECT TO system
IDENTIFIED BY itl
USING '(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS =
(PROTOCOL = TCP)
(Host = 192.168.5.43)
(Port = 1521)
)
)
(CONNECT_DATA = (SID = orcl)
)
)';
And I am able to query on the remote database using the following query:
我可以使用以下查询在远程数据库上进行查询:
select * from bill@remote_lab; //fetches rows in the table 'bill'
But I want to import all the schema as a DUMP file. For that I have created a directory called mydump
in my D: drive. but I am not sure how to import all the schema as dump file from remote database to my local system?
但我想将所有模式导入为 DUMP 文件。为此,我mydump
在 D: 驱动器中创建了一个名为的目录。但我不确定如何将所有模式作为转储文件从远程数据库导入到我的本地系统?
Update: After creating the network link, I am able to create a dump file in default directory DATA_PUMP_DIR
on remote system using:
更新:创建网络链接后,我可以DATA_PUMP_DIR
使用以下命令在远程系统的默认目录中创建转储文件:
expdp VTMOLAP2/vtmolap2 schemas=VTMOLAP2 network_link=remote_lab directory=DATA_PUMP_DIR dumpfile=vtm.dmp logfile=vtm.log;
Now I need to import the dump file in to my local system. How to I go about it?
现在我需要将转储文件导入到我的本地系统中。我该怎么做?
回答by Lalit Kumar B
You need to use Network import.
您需要使用网络导入。
With network mode imports, one doesn't need any intermediate dump files. Data is exported across a database linkand imported directly into the target database.
使用网络模式导入,不需要任何中间转储文件。数据通过数据库链接导出并直接导入目标数据库。
For example,
例如,
SQL> create user new_scott identified by tiger;
User created.
SQL> grant connect, resource to new_scott;
Grant succeeded.
SQL> grant read, write on directory dmpdir to new_scott;
Grant succeeded.
SQL> grant create database link to new_scott;
Grant succeeded.
SQL> conn new_Scott/tiger
Connected.
SQL> create database link old_scott connect to scott identified by tiger using 'orcl';
Database link created.
impdp new_scott/tiger DIRECTORY=dmpdir NETWORK_LINK=old_scott remap_schema=scott:new_scott