且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

[20140828]imp exp 使用管道迁移数据(补充)

更新时间:2022-09-11 15:22:51

[20140828]imp exp 使用管道迁移数据(补充).txt

--最近帮别人升级一套数据库,9i到11g.
--那个慢真让人受不了,也许是以前的老机器性能不行.数据量并不大.导出花了时间比较长.

--我很久就知道导出可以管道压缩导出文件,实现一边导出一边压缩的功能,现在硬盘空间都很大,很少考虑这种方式.
--而且现在很少使用这种方式备份数据.

--是否可以使用管道实现一边导出一边导入呢?这样可以节约时间,我做了一个测试:
--全部操作都在目的端进行,主要是exp/imp版本问题(烦),操作系统都是linux。

http://blog.itpub.net/267265/viewspace-1259389/

--上午的测试使用两个管道文件,下午测试使用个管道文件看看。

1.首先测试是否不用管道是否正常使用:

exp system/xxxx file=ticd10.dmp tables=icare.ticd10  buffer=20971520 consistent=y log=ticd10_exp.log direct=y triggers=n
imp scott/btbtms@192.168.100.40/test.com file=ticd10.dmp tables=ticd10 buffer=20971520 commit=y log=ticd10_imp.log fromuser=icare touser=scott

--测试通过!为了后面的验证,改名表,删除索引以及约束等信息。
alter table ticd10 rename to ticd10_org;

2.建立shell脚本:

$ cat ./play_pipe1.sh
#! /bin/bash
mknod exp_pipe p
## mknod imp_pipe p
exp system/xxxx file=exp_pipe tables=icare.ticd10  buffer=20971520 consistent=y log=ticd10_exp.log direct=y triggers=n &
sleep 1
##dd bs=1M if=exp_pipe of=imp_pipe &
sleep 1
imp scott/btbtms@192.168.100.40/test.com file=exp_pipe tables=ticd10 buffer=20971520 commit=y log=ticd10_imp.log fromuser=icare touser=scott &

$ ./play_pipe1.sh >/dev/null 2>&1

--测试也通过。