用dblink从源数据库导出expdp文件到目标数据库
2015-11-21 16:07
513 查看
本次演示的是用dblink,直接把expdp文件从源数据库 直接传送到 目标服务器中
源数据库ip:192.168.103.110
目标数据库ip:192.168.103.106
源数据库:
创建测试表,用于导出测试:
目标数据库:
授予scott创建dblink的权限
授予scott创建目录的权限
切换到scott用户
创建dblink
创建接受数据文件的目录
用oracle用户导出expdp文件
查看刚刚导出的文件(dump_dir目录):
再把文件导入到数据库中:
查询,有表和数据
源数据库ip:192.168.103.110
目标数据库ip:192.168.103.106
源数据库:
创建测试表,用于导出测试:
SQL>conn scott/tiger; Connected. SQL>create table tab_test(a int); Tablecreated. SQL>insert into tab_test select 1 from dual; 1 row created. SQL>commit; Commitcomplete. SQL>select * from tab_test; A ---------- 1
目标数据库:
[oracle@rac1dump]$ sqlplus / as sysdba
授予scott创建dblink的权限
SQL>grant create public database link to scott; Grantsucceeded.
授予scott创建目录的权限
SQL>grant create any directory to scott; Grantsucceeded.
切换到scott用户
SQL>conn scott/tiger; Connected.
创建dblink
SQL>create public database link from_110_link connect to scott identified by tiger 2 using '(DESCRIPTION = 3 (ADDRESS_LIST = 4 (ADDRESS = (PROTOCOL =TCP)(HOST = 192.168.103.110)(PORT =1521)) 5 ) 6 (CONNECT_DATA = (SERVICE_NAME =orcl) 7 ) 8 )'; Databaselink created.
创建接受数据文件的目录
SQL>create directory dump_dir as '/u01/app/oracle/dump'; Directory created.
用oracle用户导出expdp文件
[oracle@rac1~]$ expdp scott/tiger tables=tab_test directory=dump_dir network_link=from_110_link dumpfile=exp.dmp logfile=exp.log Export:Release 11.2.0.4.0 - Production on Sat Nov 21 15:08:30 2015 Copyright(c) 1982, 2011, Oracle and/or its affiliates. All rights reserved. Connectedto: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bitProduction With thePartitioning, Real Application Clusters, Automatic Storage Management, OLAP, DataMining and Real Application Testing options Starting"SCOTT"."SYS_EXPORT_TABLE_01": scott/******** tables=tab_testdirectory=dump_dir network_link=from_110_link dumpfile=exp.dmp logfile=exp.log Estimatein progress using BLOCKS method... Processingobject type TABLE_EXPORT/TABLE/TABLE_DATA Totalestimation using BLOCKS method: 64 KB Processingobject type TABLE_EXPORT/TABLE/TABLE . .exported "SCOTT"."TAB_TEST" 5.429 KB 1 rows Mastertable "SCOTT"."SYS_EXPORT_TABLE_01" successfullyloaded/unloaded ****************************************************************************** Dump fileset for SCOTT.SYS_EXPORT_TABLE_01 is: /u01/app/oracle/dump/exp.dmp Job"SCOTT"."SYS_EXPORT_TABLE_01" successfully completed at SatNov 21 15:08:38 2015 elapsed 0 00:00:07
查看刚刚导出的文件(dump_dir目录):
[oracle@rac1~]$ ll /u01/app/oracle/dump total 96 -rw-r-----1 oracle dba 94208 Nov 21 15:08 exp.dmp -rw-r--r--1 oracle dba 1137 Nov 21 15:08 exp.log
再把文件导入到数据库中:
[oracle@rac1~]$ impdp scott/tiger DIRECTORY=dump_dir dumpfile= exp.dmp Import:Release 11.2.0.4.0 - Production on Sat Nov 21 15:12:51 2015 Copyright(c) 1982, 2011, Oracle and/or its affiliates. All rights reserved. Connectedto: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bitProduction With thePartitioning, Real Application Clusters, Automatic Storage Management, OLAP, DataMining and Real Application Testing options Mastertable "SCOTT"."SYS_IMPORT_FULL_01" successfullyloaded/unloaded Starting"SCOTT"."SYS_IMPORT_FULL_01": scott/******** directory= dumpfile= Processingobject type TABLE_EXPORT/TABLE/TABLE Processingobject type TABLE_EXPORT/TABLE/TABLE_DATA . . imported"SCOTT"."TAB_TEST" 5.429 KB 1 rows Job"SCOTT"."SYS_IMPORT_FULL_01" successfully completed at SatNov 21 15:12:58 2015 elapsed 0 00:00:05
查询,有表和数据
SQL> select * from tab_test; A ---------- 1
相关文章推荐
- 删除SQL Server 2008遇到的问题
- ubuntu 下安装mysql,以及配置远程登录
- Oracle数据库中ORDER BY排序和查询按IN条件的顺序输出
- LINQ to SQL 系列 如何使用LINQ to SQL插入、修改、删除数据[转]
- 让数据库变快的10个建议
- oracle 字符串连接聚合函数
- 怎么解决mysql不允许远程连接的错误
- Ubuntu配置Node.js、MongoDB与Express环境
- mysql 批量导入脚本
- mysql用户创建和权限管理
- truncate与delete的区别
- oracle decode函数,取两个日期中的较大值
- JSP中使用mySQL数据库范例
- Spring与Memcached整合
- ORACLE Instant Client 安装
- mysql的jdbc driver的maven依赖
- 1.1.1.10、Oracle Linux
- centos 6.5 64位使用python连接oracle 11g
- 关于kettle 与mysql 连接后 出现错误的问题
- 数据库锁