Data Pump with Network import

Datapump  is a server based bulk data movement infrastructure that supersedes the old import and export utilities. The old export/ import tools are still available, but do not support all Oracle 10g and 11g features. The new utilities are named expdp and impdp.

We need to create a directory first!

Create database directories

Execute the following commands to create a database directory. This directory must point to a valid directory on the same server as the database:

SQL>create directory dmpdir as '/opt/oracle';
Directory created.
SQL>grant read, write on directory dmpdir to scott;
Grant succeeded.

PS: Oracle introduced a default directory from 10g R2, called DATA_PUMP_DIR, that can be used:

SQL>select directory_path from dba_directories where directory_name = 'DATA_PUMP_DIR';

DIRECTORY_PATH
--------------------------------------------------------------------------------
/app/oracle/product/10.2.0/rdbms/log/
 

Network import

With network mode imports, one doesn't need any intermediate dump files (GREAT, no more FTP'ing of dump files). Data is exported across a database link and imported directly into the target database.
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.oracle.com';
Database link created.

impdp new_scott/tiger DIRECTORY=dmpdir NETWORK_LINK=old_scott remap_schema=scott:new_scott
All work is performed on the target system. The only reference to the source systems is via the database link.

PS:How to Create database link

远程数据库全局名称可以用以下命令查出:
SELECT * FROM GLOBAL_NAME;
修改可以用以下语句来修改参数值:
ALTER SYSTEM SET GLOBAL_NAME=TRUE/FALSE;
当数据库参数global_name=false时,不要求数据库链接名称跟远端数据库名称一样。

注意:创建数据库链接的帐号必须有CREATE DATABASE LINK或CREATE PUBLIC DATABASE LINK的系统权限,用来登录到远程数据库的帐号必须有CREATE SESSION权限。这两种权限都包含在CONNECT角色中(CREATE PUBLIC DATABASE LINK权限在DBA中)。

如:
sql>create database link old_scott connect to scott identified by tiger
using '主机字符串名';

1)dblink名(old_scott)必须与远程数据库的全局数据库名(global_name)相同;
2)用户名,口令为远程数据库用户名,口令;
3)主机字符串为本机tnsnames.ora中定义的串;
4)两个同名的数据库间不得建立dblink;
然后,你就可以通过dblink访问远程数据库了。
如:
sql>select * from 表名@old_scott;
还可以建立快照(snapshot)通过dblink实现远程数据自动传输.

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/628922/viewspace-714771/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/628922/viewspace-714771/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值