Oracle命令--删除归档日志

oracle@linux144:~/db/oradata/archlog> l
total 22185212
drwxr-xr-x 2 oracle oinstall     12288 2012-11-28 09:31 ./
drwxr-xr-x 3 oracle oinstall      4096 2012-09-19 14:59 ../
-rw-r----- 1 oracle oinstall 286395904 2012-09-27 08:10 archivelog_1_100_787665209.log
-rw-r----- 1 oracle oinstall 286682624 2012-09-27 15:01 archivelog_1_101_787665209.log
-rw-r----- 1 oracle oinstall 286693376 2012-09-28 00:17 archivelog_1_102_787665209.log
-rw-r----- 1 oracle oinstall 286434816 2012-09-28 14:57 archivelog_1_103_787665209.log
-rw-r----- 1 oracle oinstall 286408704 2012-09-29 04:40 archivelog_1_104_787665209.log
-rw-r----- 1 oracle oinstall 286529024 2012-09-29 19:12 archivelog_1_105_787665209.log
-rw-r----- 1 oracle oinstall  33399808 2012-10-09 09:10 archivelog_1_106_787665209.log
-rw-r----- 1 oracle oinstall 286209024 2012-10-09 09:40 archivelog_1_107_787665209.log
-rw-r----- 1 oracle oinstall 286181888 2012-10-09 09:40 archivelog_1_108_787665209.log
-rw-r----- 1 oracle oinstall 286545920 2012-10-09 19:18 archivelog_1_109_787665209.log
-rw-r----- 1 oracle oinstall 286497280 2012-10-10 09:44 archivelog_1_110_787665209.log
-rw-r----- 1 oracle oinstall 286447104 2012-10-10 12:20 archivelog_1_111_787665209.log
-rw-r----- 1 oracle oinstall 286963200 2012-10-10 14:30 archivelog_1_112_787665209.log
-rw-r----- 1 oracle oinstall 286672896 2012-10-11 00:06 archivelog_1_113_787665209.log
-rw-r----- 1 oracle oinstall 286452224 2012-10-11 14:39 archivelog_1_114_787665209.log
-rw-r----- 1 oracle oinstall 286494720 2012-10-12 01:44 archivelog_1_115_787665209.log

该目录下积攒了大量的归档日志,占满了磁盘空间,需要删除。以下介绍删除的正确方法。

su - oracle
rman
connect target /
//以下进行命令行操作
RMAN> list archivelog all;

RMAN> delete archivelog before time 'sysdate-1' ;  //删除一天前的归档日志

注:
是有些旧的删不了
比如
1、2、3、4、5、6、7、8、9
删除了5、6、7
余下1、2、3、4、8、9
8、9留下是对的
1、2、3、4留下就不对了 。1.2.3.4用手动删除就行了。

 

------------------------------------------------------
删除所有的归档文件
  run{
  allocate channel t1 type disk;
  delete force noprompt archivelog all;
  release channel t1;
  }
 
  删除2006年9月15号23点12分22秒以前的所有归档日志
  run{
  allocate channel t1 type disk;
  delete force noprompt archivelog until time "to_date('2006-9-15 23:12:22','yyyy-mm-dd hh24:mi:ss')";
  release channel t1;
  }
 
allocate channel t1 type disk  表示分配通道,通道的名称为t1
                                     force  表示无论归档日志文件是否物理存在,都要删除在数据库中的记录
                             noprompt  表示删除前,不提示用户进行确认
               release channel t1  表示释放通道t1

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值