ITPub博客

首页 > 数据库 > Oracle > [20150902]rman的list archivelog命令.txt

[20150902]rman的list archivelog命令.txt

原创 Oracle 作者:lfree 时间:2015-09-02 17:10:37 0 删除 编辑

[20150902]rman的list archivelog命令.txt

--昨天同事要查询2015/8/13号日志,要确定需要检查日志的范围:

RMAN> list archivelog all  completed between '2015-08-13' and '2015-08-13 18:00:00';

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

Key     Thrd Seq     S Low Time
------- ---- ------- - -------------------
2497    1    1421    A 2015-08-13 07:12:52
        Name: /u01/app/oracle/oradata/xxxxxx/archivelog/1_1421_862160568.dbf

--很奇怪!仅仅看见一个实例有文件。另外的实例呢?增加一点时间:

RMAN> list archivelog all  completed between '2015-08-13' and '2015-08-14 00:00:00';

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

Key     Thrd Seq     S Low Time
------- ---- ------- - -------------------
2497    1    1421    A 2015-08-13 07:12:52
        Name: /u01/app/oracle/oradata/xxxxxx/archivelog/1_1421_862160568.dbf

2499    1    1422    A 2015-08-13 16:09:00
        Name: /u01/app/oracle/oradata/xxxxxx/archivelog/1_1422_862160568.dbf

2498    2    1237    A 2015-08-13 07:12:50
        Name: /u01/app/oracle/oradata/xxxxxx/archivelog/2_1237_862160568.dbf


--终于明白为什么?主要是要理解rman命令list archivelog命令里面的completed,表示完成的时间。而它显示的Low Time。
--我上面的查询实际上指在'2015-08-13' and '2015-08-13 18:00:00'这个时间段完成的日志。主要是单个日志文件设置太大。

RMAN> list archivelog all  completed between '2015-08-13' and '2015-08-14 06:00:00';

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

Key     Thrd Seq     S Low Time
------- ---- ------- - -------------------
2497    1    1421    A 2015-08-13 07:12:52
        Name: /u01/app/oracle/oradata/xxxxxx/archivelog/1_1421_862160568.dbf

2499    1    1422    A 2015-08-13 16:09:00
        Name: /u01/app/oracle/oradata/xxxxxx/archivelog/1_1422_862160568.dbf

2501    1    1423    A 2015-08-13 20:44:16
        Name: /u01/app/oracle/oradata/xxxxxx/archivelog/1_1423_862160568.dbf

2503    1    1424    A 2015-08-14 05:27:04
        Name: /u01/app/oracle/oradata/xxxxxx/archivelog/1_1424_862160568.dbf

2498    2    1237    A 2015-08-13 07:12:50
        Name: /u01/app/oracle/oradata/xxxxxx/archivelog/2_1237_862160568.dbf

2500    2    1238    A 2015-08-13 20:44:18
        Name: /u01/app/oracle/oradata/xxxxxx/archivelog/2_1238_862160568.dbf

2502    2    1239    A 2015-08-14 05:27:03
        Name: /u01/app/oracle/oradata/xxxxxx/archivelog/2_1239_862160568.dbf


--可以发现实例1需要'2015-08-13' and '2015-08-13 18:00:00'时间范围内,实际需要文件
--Name: /u01/app/oracle/oradata/xxxxxx/archivelog/1_1421_862160568.dbf
--Name: /u01/app/oracle/oradata/xxxxxx/archivelog/1_1422_862160568.dbf
--Name: /u01/app/oracle/oradata/xxxxxx/archivelog/2_1237_862160568.dbf

--如果要真正这样查询,上面的命令自己还要做1点点判断,如何写rman命令直接显示需要的结果呢?自己测试以下,应该写成如下。

RMAN> list archivelog time between '2015-08-13' and '2015-08-13 18:00:00';

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

Key     Thrd Seq     S Low Time
------- ---- ------- - -------------------
2497    1    1421    A 2015-08-13 07:12:52
        Name: /u01/app/oracle/oradata/xxxxxx/archivelog/1_1421_862160568.dbf

2499    1    1422    A 2015-08-13 16:09:00
        Name: /u01/app/oracle/oradata/xxxxxx/archivelog/1_1422_862160568.dbf

2498    2    1237    A 2015-08-13 07:12:50
        Name: /u01/app/oracle/oradata/xxxxxx/archivelog/2_1237_862160568.dbf


--顺便写一个rman小技巧,查手册太慢。可以输入list archivelog,加两次回车这样会出现命令的一些解析,不断猜出可以完成命令的拼写。
--例子:

RMAN> list archivelog
2>
3>

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-00558: error encountered while parsing input commands
RMAN-01009: syntax error: found "end-of-file": expecting one of: "all, from, high, like, low, scn, sequence, time, until, double-quoted-string, integer, single-quoted-string"
RMAN-01007: at line 3 column 1 file: standard input

RMAN> list archivelog time
2>
3>

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-00558: error encountered while parsing input commands
RMAN-01009: syntax error: found "end-of-file": expecting one of: "between"
RMAN-01007: at line 3 column 1 file: standard input

RMAN> list archivelog time between '2015-08-13' and '2015-08-13 18:00:00';

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

Key     Thrd Seq     S Low Time
------- ---- ------- - -------------------
2497    1    1421    A 2015-08-13 07:12:52
        Name: /u01/app/oracle/oradata/xxxxxx/archivelog/1_1421_862160568.dbf

2499    1    1422    A 2015-08-13 16:09:00
        Name: /u01/app/oracle/oradata/xxxxxx/archivelog/1_1422_862160568.dbf

2498    2    1237    A 2015-08-13 07:12:50
        Name: /u01/app/oracle/oradata/xxxxxx/archivelog/2_1237_862160568.dbf

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

下一篇: [20150904]exp slow.txt
请登录后发表评论 登录
全部评论
熟悉oracle相关技术,擅长sql优化,rman备份与恢复,熟悉linux shell编程。

注册时间:2008-01-03

  • 博文量
    2470
  • 访问量
    6277365