使用gzip压缩导出Oracle exp的dmp备份

由于Oracle数据日益庞大,动辄备份一个dmp就有20多G,占用了大量备份空间。现在用gzip将备份的dmp做个压缩。
备份脚本如下:

export ORACLE_BASE=/oracle
export ORACLE_HOME=/oracle/product/10.2.0
export ORACLE_OWNER=oracle
export ORACLE_SID=ora123
export NLS_LANG=american_america.ZHS16GBK
date=`date +%Y%m%d`
#通过mknod -p建立Linux pipe管道
su -c "mknod /home/oracle/exppipe p" oracle
#通过exp和gzip导出压缩dmp
su -c "/oracle/product/10.2.0/bin/exp "user_name/passwd" buffer=4096 file=/home/oracle/exppipe & gzip /orabak/backup_$date.dmp.gz" oracle
#导出完成删除pipe管道
rm -rf /home/oracle/exppipe
导入脚本也是同理:

export ORACLE_BASE=/oracle
export ORACLE_HOME=/oracle/product/10.2.0
export ORACLE_OWNER=oracle
export ORACLE_SID=ora123
export NLS_LANG=american_america.ZHS16GBK
su -c "mknod /home/oracle/exppipe p" oracle
su -c "/oracle/product/10.2.0/bin/imp "user_name/passwd" file=/home/oracle/exppipe fromuser=user_name touser=test & gunzip < backup_20110407.dmp.gz > /home/oracle/exppipe" oracle
rm -rf /home/oracle/exppipe

  1. da shang
    donate-alipay
               donate-weixin weixinpay

发表评论↓↓