原 【DB宝59】 空间不足怎么办?别怕,数据泵之NETWORK_LINK来帮你!
Tags: Oracle原创升级迁移NETWORK_LINK跨平台
👉 背景:
近期公司有个项目,需要将一套AIX上的rac 11g,迁移到华为云上,数据量大概4T,停机时间2小时,目前最大问题是本地磁盘空间不足。起初,想到的是OGG或XTTS,XTTS没啥问题,最适合做这类迁移了。对于OGG来说,OGG初始化需要导出和导入,仍然需要临时的本地磁盘空间,当时把该方案直接pass掉了,后来回头想想,似乎可以使用network_link来解决这个问题。使用impdp+network_link导入完成后,再配置OGG实时同步,即可实现AIX到Linux的迁移。
一、数据泵之NETWORK_LINK
1、环境介绍
SOURCE DB(虚拟机) | TARGET DB(虚拟机) | CLIENT(笔记本) | |
---|---|---|---|
EXP/IMP | 11.2.0.3.0 | 11.2.0.1.0 | 11.2.0.1.0 |
EXPDP/IMPDP | 11.2.0.3.0 | 11.2.0.1.0 | 11.2.0.1.0 |
HOST IP | 192.168.59.130 | 192.168.59.128 | 192.168.59.1 |
host 平台和内存 | RHEL 6.5 MemTotal: 2.6g | windows XP MemTotal: 2g | windows 8.1 MemTotal: 20g |
DB VERSION | 11.2.0.3.0 | 11.2.0.1.0 | 无 |
ORACLE_SID | orclasm | orcl | 无 |
tnsname | orclasm | orclxp |
注意: 本实验所有的代码无特殊说明均在client客户端执行
图形如下:
2、imp和exp
👉 expdp属于服务端工具,而exp属于客户端工具,expdp生成的文件默认是存放在服务端的,而exp生成的文件是存放在客户端的 。
来验证exp和imp:
我们在client客户端执行:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | C:\Users\Administrator>exp lhr/lhr@orclasm tables=xb_log_lhr file=e:\e1.dmp log=E:\exp_table.log buffer=41943040 Export: Release 11.2.0.1.0 - Production on 星期二 2月 10 15:55:25 2015 Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved. 连接到: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production With the Partitioning, Automatic Storage Management, OLAP, Data Mining and Real Application Testing options 已导出 ZHS16GBK 字符集和 AL16UTF16 NCHAR 字符集 即将导出指定的表通过常规路径... . . 正在导出表 XB_LOG_LHR导出了 56 行 成功终止导出, 没有出现警告。 C:\Users\Administrator>imp lhr/lhr@orclxp tables=xb_log_lhr file=e:\e1.dmp log=E:\exp_table.log buffer=41943040 Import: Release 11.2.0.1.0 - Production on 星期二 2月 10 15:59:42 2015 Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved. 连接到: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production With the Partitioning, OLAP, Data Mining and Real Application Testing options 经由常规路径由 EXPORT:V11.02.00 创建的导出文件 已经完成 ZHS16GBK 字符集和 AL16UTF16 NCHAR 字符集中的导入 . 正在将 LHR 的对象导入到 LHR . 正在将 LHR 的对象导入到 LHR . . 正在导入表 "XB_LOG_LHR"导入了 56 行 成功终止导入, 没有出现警告。 |
3、expdp不使用network_link
根据expdp的语法,我们执行如下脚本:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | C:\Users\Administrator>expdp lhr/lhr@orclasm directory=DATA_PUMP_DIR dumpfile=exptable.dmp TABLES=xb_log_lhr LOGFILE=expdp_table.log Export: Release 11.2.0.1.0 - Production on 星期二 2月 10 16:37:40 2015 Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved. 连接到: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production With the Partitioning, Automatic Storage Management, OLAP, Data Mining and Real Application Testing options 启动 "LHR"."SYS_EXPORT_TABLE_01": lhr/****@orclasm directory=DATA_PUMP_DIR dumpfile=exptable.dmp TABLES=xb_log_lhr LOGFILE=expdp_table.log 正在使用 BLOCKS 方法进行估计... 处理对象类型 TABLE_EXPORT/TABLE/TABLE_DATA 使用 BLOCKS 方法的总估计: 64 KB 处理对象类型 TABLE_EXPORT/TABLE/TABLE 处理对象类型 TABLE_EXPORT/TABLE/COMMENT 处理对象类型 TABLE_EXPORT/TABLE/INDEX/INDEX 处理对象类型 TABLE_EXPORT/TABLE/INDEX/FUNCTIONAL_INDEX/INDEX 处理对象类型 TABLE_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS 处理对象类型 TABLE_EXPORT/TABLE/INDEX/STATISTICS/FUNCTIONAL_INDEX/INDEX_STATISTICS 处理对象类型 TABLE_EXPORT/TABLE/TRIGGER 处理对象类型 TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS . . 导出了 "LHR"."XB_LOG_LHR" 18.75 KB 56 行 已成功加载/卸载了主表 "LHR"."SYS_EXPORT_TABLE_01" --- LHR.SYS_EXPORT_TABLE_01 的转储文件集为: /u01/app/oracle/admin/orclasm/dpdump/exptable.dmp 作业 "LHR"."SYS_EXPORT_TABLE_01" 已于 16:38:00 成功完成 C:\Users\Administrator> |
在服务器端查看可知,文件是存放在linux服务器端的:
1 2 3 4 5 6 7 | [oracle@rhel6_lhr dpdump]$ ll total 156 -rw-r--r-- 1 oracle asmadmin 1391 Feb 10 16:38 expdp_table.log -rw-r----- 1 oracle asmadmin 151552 Feb 10 16:38 exptable.dmp [oracle@rhel6_lhr dpdump]$ pwd /u01/app/oracle/admin/orclasm/dpdump [oracle@rhel6_lhr dpdump]$ |