zoukankan      html  css  js  c++  java
  • 在Unix上使用管道压缩exp导出文件

    exp导出文件大到文件系统放不下怎么办? 在Unix上一种行之有效的解决方法是创建一个命名管道,因为exp的导出dumpfile的内容是顺序的,可以将其内容重定向到管道并对该管道实施压缩操作,从而实现其直接的导出文件就是压缩过的。下面我们举出一个使用该中管道压缩的例子:
    [oracle@vrh1 exp]$ exp system/oracle  file=maclean.dmp tables=maclean.tv
    
    Export: Release 10.2.0.4.0 - Production on Fri Apr 1 17:03:09 2011
    Copyright (c) 1982, 2007, Oracle.  All rights reserved.
    Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production
    With the Partitioning, Real Application Clusters, OLAP, Data Mining
    and Real Application Testing options
    Export done in US7ASCII character set and AL16UTF16 NCHAR character set
    server uses WE8ISO8859P1 character set (possible charset conversion)
    About to export specified tables via Conventional Path ...
    Current user changed to MACLEAN
    . . exporting table                             TV      19988 rows exported
    Export terminated successfully without warnings.
    
    /* 不压缩情况下本例中的dumpfile大小为2MB  */
    
    [oracle@vrh1 exp]$ ls -lh maclean.dmp 
    -rw-r--r-- 1 oracle oinstall 2.0M Apr  1 17:03 maclean.dmp
    
    /* 首先使用mknod命令创建命名管道 */
    
    [oracle@vrh1 exp]$ mknod macleanpipe p
    
    /*使用nohup命令在后台执行对macleanpipe管道的内容进行gzip压缩,
       之后重定向到maclean_compress.dmp.gz压缩文件                 */
    
    
    [oracle@vrh1 exp]$ nohup  gzip maclean_compress.dmp.gz &
    [1] 27686
    
    
    [oracle@vrh1 exp]$ exp system/oracle file=macleanpipe tables=maclean.tv
    
    
    Export: Release 10.2.0.4.0 - Production on Fri Apr 1 17:13:50 2011
    Copyright (c) 1982, 2007, Oracle.  All rights reserved.
    Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production
    With the Partitioning, Real Application Clusters, OLAP, Data Mining
    and Real Application Testing options
    Export done in US7ASCII character set and AL16UTF16 NCHAR character set
    server uses WE8ISO8859P1 character set (possible charset conversion)
    About to export specified tables via Conventional Path ...
    Current user changed to MACLEAN
    . . exporting table                             TV      19988 rows exported
    Export terminated successfully without warnings.
    
    
    [1]+  Done                    nohup gzip < macleanpipe > maclean_compress.dmp.gz
    
    /* 以上当压缩进程gzip接收到exp输出的EOF文件终结符后,
        该压缩进程会自行结束                 * / 
    
    /* 可以看到这里的压缩比还是很高的 */
    
    [oracle@vrh1 exp]$ ls -lh maclean_compress.dmp.gz 
    -rw-r--r-- 1 oracle oinstall 225K Apr  1 17:13 maclean_compress.dmp.gz
    
    /* 使用gzip -d命令解压以上gz文件就可以得到普通的dumpfile用以imp导入 */
    
    [oracle@vrh1 exp]$ gzip -d maclean_compress.dmp.gz 
    
    [oracle@vrh1 exp]$ ls -lh maclean_compress.dmp 
    -rw-r--r-- 1 oracle oinstall 2.0M Apr  1 17:13 maclean_compress.dmp
    
    
    在Oracle 10g中引入了速度更快的DataPump Server-side Expdp/Impdp导入导出工具,与exp不同的是,Expdp导出的dumpfile中信息不遵循某种顺序规则,这导致传统的顺序设备如磁带和管道不支持expdp或impdp;换而言之我们无法使用expdp工具将导出结果直接输出到磁带设备或命名管道中,这也造成上述介绍的管道压缩方法对expdp命令是不适用的。 所幸在Oracle Database 11g中对Expdp的压缩选项添加了all和dataonly选项,虽然目前Datapump压缩的性能仍比gzip压缩要差一些,但2者间的差别几乎可以忽略不计。一般在11g中,Oracle推荐使用DataPump压缩来彻底代替Unix管道压缩。
  • 相关阅读:
    Linux网络编程一站式学习
    quick-cocos2d-x教程8:程序框架内lib文件夹分析
    petshop4.0 具体解释之中的一个(系统架构设计)
    LNK快捷方式漏洞利用方式 exp制作教程
    Serializable 作用
    0 1背包模板
    跟着辛星认识一下PHP的自己主动载入
    海茶3 らぶデス3 入门经典教程
    win下vm10+mac os 10.9安装遇到问题
    enum 在c中的使用
  • 原文地址:https://www.cnblogs.com/macleanoracle/p/2967724.html
Copyright © 2011-2022 走看看