ITPub博客

首页 > 数据库 > Oracle > 【人在运维囧途_09】秒删海量数据文件的方法

【人在运维囧途_09】秒删海量数据文件的方法

原创 Oracle 作者:幕南风 时间:2014-07-03 13:57:10 0 删除 编辑
     此篇是人在囧途之运维的 NO.9 了、更新实在太慢鸟、愧疚、、
     在运维的工作中、有时我们需要去删除大文件、或者 N (N 取正无穷哟~~)多小文件
     那么、rm 次奥咯、
     这里、Rocky 介绍 Linux 史上最可爱、最温柔、最成熟、最善良、最.....槽糕、找不到形容词、囧
     那便是 rsync 的另外一种用法
     
     
        
        ① 语法:
           
            # rsync --delete-before -avH --progress --stats DEST SRC
            
            解释:
            当SRC和DEST性质都为文件【f】时,意思是清空文件内容而不是删除文件

            当SRC和DEST性质都为目录【d】时,意思是删除该目录下的所有文件,使其变为空目录

            PS:其实该命令顶好记的哦、av -_-#、H$_$、男人很少不懂的、骚年、此时你的硬盘都有谁来着、、

            
           
        ② 原理:
            
            rsync实际上用的就是替换原理
            
            
        
        ③ 优点:
        
            
            处理速度相当快,处理几个G的文件也就是秒级的事、比rm要快很多倍
            
            
            
        ④ 缺点:
            
            对磁盘io的占用较高、业务高峰或要暂避
            
           
        

        ⑤ 测试:


[root@localhost log]# ls
rhel-server-5.8-i386-dvd.iso
[root@localhost log]# pwd
/tmp/test/log
[root@localhost ~]# mkdir empty
[root@localhost ~]# rsync --delete-before -avH --progress --stats /root/empty/ /tmp/test/log/
building file list ... 
1 file to consider
deleting rhel-server-5.8-i386-dvd.iso
./

Number of files: 1
Number of files transferred: 0
Total file size: 0 bytes
Total transferred file size: 0 bytes
Literal data: 0 bytes
Matched data: 0 bytes
File list size: 19
File list generation time: 0.001 seconds
File list transfer time: 0.000 seconds
Total bytes sent: 29
Total bytes received: 15

sent 29 bytes  received 15 bytes  6.77 bytes/sec
total size is 0  speedup is 0.00


<!-- Baidu Button BEGIN -->

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/26515977/viewspace-1208087/ ,如需转载,请注明出处,否则将追究法律责任。

上一篇: 【程序员练级】提高英语阅读水平经验分享上篇
下一篇: 深入理解Oracle索引(8):如何进行索引监控分析和优化
请登录后发表评论 登录
全部评论
腾讯数据库工程师

注册时间:2012-05-10

最新文章