windows操作系统Oracle数据库--删除归档日志

来源:互联网 发布:烟台淘宝招聘 编辑:程序博客网 时间:2024/06/05 17:31

最好在删除日志的时候,做好相应的日志或者数据库备份

windows操作系统

C:\Documents and Settings\admin>rman

恢复管理器: Release 10.2.0.1.0 - Production on 星期五 3月 21 13:07:26 2014

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

RMAN> connect target sys

目标数据库口令:
连接到目标数据库: ORCL (DBID=1353910629)

RMAN>list archivelog all; --查看归档日志的状态


RMAN>crosscheck archivelog all; --命令的作用是将磁盘或者磁带上不存在的日志标记为expired

RMAN>delete expired archivelog all; --删除过期的归档日志

RMAN>DELETE ARCHIVELOG ALL COMPLETED BEFORE 'SYSDATE-7';  --即删除7天前的归档日志

RMAN>report obsolete;  --报告过期备份

RMAN>allocate channel for maintenance type disk; --分配维护通道

RMAN>release channel;--释放通道

------------------------------------------------------
删除所有的归档文件 
run{ 
  allocate channel t1 type disk; 
  delete force noprompt archivelog all; 
  release channel t1; 

  
删除2013年10月01号23点12分22秒以前的所有归档日志 
run{ 
  allocate channel t1 type disk; 
  delete force noprompt archivelog until time "to_date('2013-10-01 23:12:22','yyyy-mm-dd hh24:mi:ss')"; 
  release channel t1; 

  
allocate channel t1 type disk  表示分配通道,通道的名称为t1 
force  表示无论归档日志文件是否物理存在,都要删除在数据库中的记录 
noprompt  表示删除前,不提示用户进行确认 
release channel t1  表示释放通道t1


来源:http://blog.csdn.net/super712/article/details/21710579