不同数据库实例不同用户间数据迁移复制

【IMPDP】不同数据库实例不同用户间数据迁移复制——NETWORK_LINK参数
2010-04-08 23:49:02 / 个人分类:备份与恢复

在《【IMPDP】同一数据库实例不同用户间数据迁移复制—— NETWORK_LINK参数》(https://www.360docs.net/doc/1c18537525.html,/519536/viewspace-631571)文章中谈到了使用 NETWORK_LINK参数实现在相同的数据库实例中不同用户的数据复制。

只要深刻理解了NETWORK_LINK参数的含义,实现不同数据库实例不同用户间数据迁移复制功能道理是相同的。

需求:
将ora10g实例中的sec用户数据迁移到secooler实例的housw用户中。

实现流程:
a.在secooler实例所在的数据库中创建指向ora10g数据库实例的DATABASE LINK;
b.使用NETWORK_LINK参数在secooler实例所在数据库服务器完成数据的导入。

这里要特别注意,操作需要在secooler实例所在的数据库服务器上完成。

真实操练胜过千言万语。

1.确认ora10g数据库实例的sec用户下待迁移的数据
sec@ora10g> conn sec/sec
Connected.
sec@ora10g> select * from tab;

TNAME TABTYPE CLUSTERID
------------------------------ ------- ----------
T_SEC TABLE

sec@ora10g> select count(*) from t_sec;

COUNT(*)
----------
11678

2.查看secooler实例的housw用户数据
此步骤的目的是为了后面做对比。
sys@secooler> conn housw/housw
Connected.
housw@secooler> select * from tab;

no rows selected

housw用户中不包含数据。

3.在secooler实例上创建指向ora10g实例的DATABASE LINK
sys@secooler> create public database link dblink_to_ora10g connect to system identified by sys using 'ORA10G';

Database link created.

4.使用NETWORK_LINK参数完成使命
secooler@secDB /expdp$ impdp system/sys directory=impdp_dir network_link=dblink_to_ora10g schemas=sec remap_schema=sec:housw

Import: Release 10.2.0.3.0 - 64bit Production on Thursday, 08 April, 2010 7:15:24

Copyright (c) 2003, 2005, Oracle. All rights reserved.

Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bit Production
With the Partitioning, Oracle Label Security, OLAP and Data Mining Scoring Engine options
Starting "SYSTEM"."SYS_IMPORT_SCHEMA_01": system/******** directory=impdp_dir network_link=dblink_to_ora10g schemas=sec remap_schema=sec:housw
Estimate in progress using BLOCKS method...
Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
Total estimation using BLOCKS method: 2 MB
Processing object type SCHEMA_EXPORT/USER
ORA-31684: Object type USER:"HOUSW" already exists
Processing object type SCHEMA_EXPORT/SYSTEM_GRANT
Processing object type SCHEMA_EXPORT/ROLE_GRANT
Processing object type SCHEMA_EXPORT/DEFAULT_ROLE
Processing object type SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA
Processing object type SCHEMA_EXPORT/TABLE/TABLE
. . imported "HOUSW"."T_SEC" 11678 rows
Job "SY

STEM"."SYS_IMPORT_SCHEMA_01" completed with 1 error(s) at 07:15:30

出现的ORA-31684错误是因为我事先已经创建好了housw用户。

5.最后的确认
sys@secooler> conn housw/housw
Connected.
housw@secooler> select * from tab;

TNAME TABTYPE CLUSTERID
------------------------------ ------- ----------
T_SEC TABLE

housw@secooler> select count(*) from t_sec;

COUNT(*)
----------
11678

OK,使命圆满完成。

6.Oracle官方文档关于IMPDP工具的NETWORK_LINK参数描述参考
https://www.360docs.net/doc/1c18537525.html,/docs/cd/B19306_01/server.102/b14215/dp_import.htm#sthref319

7.小结
IMPDP工具的NETWORK_LINK参数体现了Oracle的进步,慢慢体会吧。

Good luck.

secooler
10.04.08

-- The End --


相关文档
最新文档