[20131028]理解archivelog completed,before,after,until-time.txt

本文涉及的产品
日志服务 SLS,月写入数据量 50GB 1个月
简介: [20131028]理解archivelog completed,before,after,until-time.txthttp://www.askmaclean.
[20131028]理解archivelog completed,before,after,until-time.txt

http://www.askmaclean.com/archives/archivelog-completed-before-vs-until-time.html

理解在执行rman的"DELETE ARCHIVELOG ALL COMPLETED BEFORE" 与 "DELETE ARCHIVELOG UNTIL TIME "的区别.

RMAN> list archivelog all ;
...

498     1    555     A 2013-10-25 11:32:09
        Name: /u01/app/oracle11g/archivelog/1_555_798551880.dbf

499     1    556     A 2013-10-25 11:32:15
        Name: /u01/app/oracle11g/archivelog/1_556_798551880.dbf

500     1    557     A 2013-10-28 08:58:36
        Name: /u01/app/oracle11g/archivelog/1_557_798551880.dbf

501     1    558     A 2013-10-28 10:09:22
        Name: /u01/app/oracle11g/archivelog/1_558_798551880.dbf


--删除一些记录:
RMAN> delete archivelog sequence between 1 and 555;


RMAN> list archivelog all ;

List of Archived Log Copies for database with db_unique_name TEST
=====================================================================

Key     Thrd Seq     S Low Time
------- ---- ------- - -------------------
499     1    556     A 2013-10-25 11:32:15
        Name: /u01/app/oracle11g/archivelog/1_556_798551880.dbf

500     1    557     A 2013-10-28 08:58:36
        Name: /u01/app/oracle11g/archivelog/1_557_798551880.dbf

501     1    558     A 2013-10-28 10:09:22
        Name: /u01/app/oracle11g/archivelog/1_558_798551880.dbf


SCOTT@test> SELECT recid, first_time, next_time, completion_time FROM v$archived_log where recid between 499 and 501;
     RECID FIRST_TIME          NEXT_TIME           COMPLETION_TIME
---------- ------------------- ------------------- -------------------
       499 2013-10-25 11:32:15 2013-10-28 08:58:36 2013-10-28 08:58:38
       500 2013-10-28 08:58:36 2013-10-28 10:09:22 2013-10-28 10:09:23
       501 2013-10-28 10:09:22 2013-10-28 16:23:13 2013-10-28 16:23:14

--仅仅保留3个。

摘要:http://www.askmaclean.com/archives/archivelog-completed-before-vs-until-time.html

Summary :

UNTIL TIME的TIME  指的是 ARCHIVELOG的FIRST_TIME ,即归档日志中LOW SCN对应的时间戳;其意思为找出所有LOW SCN TIMESTAMP小于
等于指定的时间变量的归档日志。

COMPLETED BEFORE  指的是ARCHIVELOG的COMPLETION_TIME,即实际归档操作完成的时间;其意思为找出所有归档完成时间小于指定的时
间变量的归档日志。

COMPLETED AFTER   指的是ARCHIVELOG的COMPLETION_TIME,即实际归档操作完成的时间;其意思为找出所有归档完成时间大于等于指定
的时间变量的归档日志。

--我的环境定义如下:
$ env | grep NLS
NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
NLS_TIMESTAMP_TZ_FORMAT=YYYY-MM-DD HH24:MI:SS.FF
NLS_TIMESTAMP_FORMAT=YYYY-MM-DD HH24:MI:SS.FF
NLS_DATE_FORMAT=YYYY-MM-DD HH24:MI:SS
--不然下面的日期时间不能这样写!

RMAN> list archivelog  until time '2013-10-25 11:32:16';

List of Archived Log Copies for database with db_unique_name TEST
=====================================================================

Key     Thrd Seq     S Low Time
------- ---- ------- - -------------------
499     1    556     A 2013-10-25 11:32:15
        Name: /u01/app/oracle11g/archivelog/1_556_798551880.dbf


RMAN> list archivelog all completed before '2013-10-25 11:32:16';

RMAN> list archivelog all completed before '2013-10-28 08:58:36';

RMAN> list archivelog all completed before '2013-10-28 08:58:37';

RMAN> list archivelog all completed before '2013-10-28 08:58:38';

List of Archived Log Copies for database with db_unique_name TEST
=====================================================================

Key     Thrd Seq     S Low Time
------- ---- ------- - -------------------
499     1    556     A 2013-10-25 11:32:15
        Name: /u01/app/oracle11g/archivelog/1_556_798551880.dbf

--before '2013-10-28 08:58:38' 这样seq=556才显示出来。

--这样的话:
delete archivelog  until time '2013-10-25 11:32:16'; =>可以删除seq=556的记录。
delete archivelog all completed before '2013-10-28 08:58:38'; =>可以删除seq=556的记录。

相关实践学习
日志服务之使用Nginx模式采集日志
本文介绍如何通过日志服务控制台创建Nginx模式的Logtail配置快速采集Nginx日志并进行多维度分析。
目录
相关文章
|
7月前
|
数据库 OceanBase
min restore scn of backup set file is greater than restore scn. can't use to restor
min restore scn of backup set file is greater than restore scn. can't use to restor
54 1
|
存储
rman备份失败:ORA-00245: control file backup failed; target is likely on a local file system
rman备份失败:ORA-00245: control file backup failed; target is likely on a local file system
164 0
|
数据库
ORA-01113: file 1 needs media recovery ORA-01110: data file 1:
把下面两个隐含参数加入到pfile中
252 0
|
Oracle 关系型数据库 Linux
[20180228]archivelog backup?log switch?
[20180228]How to prevent RMAN archivelog backup from log switch.txt --//备份归档时有时候避免log switch.
1111 0
|
Oracle 关系型数据库 Linux
20180226alter system archive log current
[20180226]alter system archive log current.txt --//当日志写满以后,切换日志归档大部分由归档进程ARCH负责将在线重做日志归档.
988 0
|
Oracle 关系型数据库 数据库
|
Oracle 关系型数据库
[20170310]V$RMAN_OUTPUT的stamp 2.txt
[20170310]V$RMAN_OUTPUT的stamp 2.txt http://blog.itpub.net/267265/viewspace-1979123/ --//以前写的,今天才发现自己再次犯严重的错误.
938 0
|
Oracle 关系型数据库 Linux
[20160803]关于SNAPSHOT CONTROLFILE.txt
[20160803]关于SNAPSHOT CONTROLFILE.txt --当使用rman备份时,rman会建立一个SNAPSHOT CONTROLFILE,具体位置由参数 RMAN> show SNAPSHOT CONTROLFILE NAME  ; ...
863 0