使用split,gzip和pipe可以方便,快速的进行exp imp

本文介绍了一种利用Pipe、Split及Compress工具优化Oracle数据库备份的方法。通过创建操作系统管道并在后台设置读取该管道内容的过程,可以实现数据的高效导出与导入。此外,文章还提供了一个示例脚本,演示如何将大型备份文件分割为多个可管理的小文件,并进行压缩。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

http://dbaoracle.itpub.net/post/901/17276

 

使用split,compress和pipe可以方便,快速的进行exp imp

 

script from akstom:

You would export to a device that does not support seeking such as a tape (not
recommended, really slow) or a pipe.

Why not using compression?  it'll considerably cut down on the size? 

I myself use both compression AND split to make my export be in many managable
sized file (500meg is my chosen size).  You could just use split and not
compress if you want.

Basically, you would create a pipe in the OS via:

$ mknod somefilename p

and then export to that pipe.  you would set up another process in the
background that 'eats' the contents of this pipe and puts it somewhere.  I use
split, you could use 'cat' to just put it into another file (if cat supports
files >2 gig -- thats the problem here, most utilities do not, you need to use a
special file io api to 2 gig file support).

Here is a script you can use as a template.  Yes, it uses compression but you
can take that out.  Its here to show you one method of doing this.


------------------------------
#!/bin/csh -vx
setenv UID /
setenv FN  exp.`date +%j_%Y`.dmp
setenv PIPE /tmp/exp_tmp_ora8i.dmp
setenv MAXSIZE 500m
setenv EXPORT_WHAT "full=y COMPRESS=n"
echo $FN
cd /nfs/atc-netapp1/expbkup_ora8i
ls -l
rm expbkup.log export.test exp.*.dmp* $PIPE
mknod $PIPE p
date > expbkup.log
( gzip <  PIPE   split -b MAXSIZE - FN strong>
 
# uncomment this to just SPLIT the file, not compress and split
#split -b $MAXSIZE $PIPE $FN. &
exp userid=$UID buffer=20000000 file=$PIPE $EXPORT_WHAT >>& expbkup.log
date >> expbkup.log
date > export.test
cat `echo $FN.* | sort` | gunzip > $PIPE &
# uncomment this to just SPLIT the file, not compress and split
#cat `echo $FN.* | sort` > $PIPE &
imp userid=sys/o8isgr8 file=$PIPE show=y full=y >>& export.test
date >> export.test
tail expbkup.log
tail export.test
ls -l
rm -f $PIPE
--------------------------------------------------

--------------------------------------------------

This also always does an 'integrity' check of the export right after it is done
with an import show=y, that shows how to use these split files with import.

 

How to use split,compress,Pipe is very simple.

Or your exp writes to a PIPE and imp reads directly from the PIPE at the same time

IF exp.exe imp.exr at same computer...

It's quite fast .

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值