[20150902]rman的list archivelog命令.txt

简介: [20150902]rman的list archivelog命令.txt --昨天同事要查询2015/8/13号日志,要确定需要检查日志的范围: RMAN> list archivelog all  completed between '2015-08-13...

[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

相关实践学习
日志服务之使用Nginx模式采集日志
本文介绍如何通过日志服务控制台创建Nginx模式的Logtail配置快速采集Nginx日志并进行多维度分析。
目录
相关文章
|
1月前
|
NoSQL Redis 索引
[Redis]——Redis命令手册set、list、sortedset
[Redis]——Redis命令手册set、list、sortedset
|
2月前
|
JavaScript
npm list -g --depth=0 命令中 --depth 参数讲解
npm list -g --depth=0 命令中 --depth 参数讲解
29 0
|
6月前
|
存储
11Redis - 存储list(命令)
11Redis - 存储list(命令)
35 1
|
8月前
|
存储 NoSQL Redis
Redis 中 List(列表)类型的命令及详解
Redis 中 List(列表)类型的命令及详解
105 0
|
10月前
conda list 与 pip list 命令的区别
conda list 与 pip list 命令的区别
284 0
|
10月前
|
NoSQL Java Redis
Redis 从入门到精通之Redis List数据结构操作命令和示例
使用Jedis和RedisTemplate分别实现Redis列表操作的示例。Redis列表是一个有序的字符串列表,可以在列表的头部或尾部添加、删除元素,还可以截取、查看、修改元素,以及实现阻塞队列等功能。还可以使用其他编程语言的Redis客户端库实现Redis列表操作,如Python的redis模块、Java的Lettuce等。
343 0
Redis 从入门到精通之Redis List数据结构操作命令和示例
|
10月前
为什么有的备份归档日志用list backup of archivelog all查不到,但在第三方备份软件中可以查到
提问:为什么有的备份归档日志用list backup of archivelog all查不到,但在第三方备份软件中可以查到?
MFC应用程序——标签控件_IP控件_时间控件_List Control控件_Tree Control控件_命令按钮_列表框_组合框_图片_滚动控件(下)
MFC应用程序——标签控件_IP控件_时间控件_List Control控件_Tree Control控件_命令按钮_列表框_组合框_图片_滚动控件
139 0
|
API Windows 容器
MFC应用程序——标签控件_IP控件_时间控件_List Control控件_Tree Control控件_命令按钮_列表框_组合框_图片_滚动控件(上)
MFC应用程序——标签控件_IP控件_时间控件_List Control控件_Tree Control控件_命令按钮_列表框_组合框_图片_滚动控件
161 0
MFC应用程序——标签控件_IP控件_时间控件_List Control控件_Tree Control控件_命令按钮_列表框_组合框_图片_滚动控件(上)