Mar 17, 2021 No Comments ORACLE 查看RMAN的备份信息总结 关于Oracle数据库的RMAN备份,除了邮件外,是否能通过其它方式检查RMAN备份的成功与失败呢?其实我们可以通过下面SQL脚本来检查某个时间段备份失败的记录: ``` SELECT * FROM V$RMAN_STATUS WHERE START_TIME >= TO_DATE(&START_TIME,'YYYY-MM-DD HH24:MI:SS') AND END_TIME <= TO_DATE(&END_TIME ,'YYYY-MM-DD HH24:MI:SS') AND OPERATION ='BACKUP' AND STATUS !='COMPLETED' AND STATUS NOT LIKE 'RUNNING%' ``` 查看备份成功的历史记录: ``` SELECT * FROM V$RMAN_STATUS WHERE START_TIME >= TO_DATE(&START_TIME,'YYYY-MM-DD HH24:MI:SS') AND END_TIME <= TO_DATE(&END_TIME ,'YYYY-MM-DD HH24:MI:SS') AND OPERATION ='BACKUP' AND STATUS ='COMPLETED' ``` 可以从V$RMAN_BACKUP_JOB_DETAILS中查看RMAN备份更详细的信息 ``` SELECT START_TIME, END_TIME, OUTPUT_DEVICE_TYPE, STATUS, ELAPSED_SECONDS, COMPRESSION_RATIO, INPUT_BYTES_DISPLAY, OUTPUT_BYTES_DISPLAY FROM V$RMAN_BACKUP_JOB_DETAILS ORDER BY START_TIME DESC ; ``` 查看所有备份集详细信息: ``` SELECT A.RECID "BACKUP SET", A.SET_STAMP, DECODE (B.INCREMENTAL_LEVEL, '', DECODE (BACKUP_TYPE, 'L', 'Archivelog', 'Full'), 1, 'Incr-1级', 0, 'Incr-0级', B.INCREMENTAL_LEVEL) "Type LV", B.CONTROLFILE_INCLUDED "包含CTL", DECODE (A.STATUS, 'A', 'AVAILABLE', 'D', 'DELETED', 'X', 'EXPIRED', 'ERROR') "STATUS", A.DEVICE_TYPE "Device Type", A.START_TIME "Start Time", A.COMPLETION_TIME "Completion Time", A.ELAPSED_SECONDS "Elapsed Seconds", A.BYTES/1024/1024/1024 "Size(G)", A.COMPRESSED, A.TAG "Tag", A.HANDLE "Path" FROM GV$BACKUP_PIECE A, GV$BACKUP_SET B WHERE A.SET_STAMP = B.SET_STAMP AND A.DELETED = 'NO' RDER BY A.COMPLETION_TIME DESC; ``` 查找某个备份集中包含数据文件 ``` SELECT DISTINCT c.file#,A.SET_STAMP, D.NAME, C.CHECKPOINT_CHANGE#, C.CHECKPOINT_TIME FROM V$BACKUP_DATAFILE C, V$BACKUP_PIECE A, V$DATAFILE D WHERE A.SET_STAMP = C.SET_STAMP AND D.FILE# = C.FILE# AND A.DELETED='NO' AND c.set_stamp=&set_stamp ORDER BY C.FILE#; ``` 查询某个备份集中控制文件 ``` SELECT DISTINCT A.SET_STAMP, D.NAME, C.CHECKPOINT_CHANGE#, C.CHECKPOINT_TIME FROM V$BACKUP_DATAFILE C, V$BACKUP_PIECE A, V$CONTROLFILE D WHERE A.SET_STAMP = C.SET_STAMP AND C.FILE# = 0 AND A.DELETED = 'NO' AND C.SET_STAMP = &SET_STAMP; ``` 查看某个备份集中归档日志: ``` SELECT DISTINCT B.SET_STAMP, B.THREAD#, B.SEQUENCE#, B.FIRST_TIME, B.FIRST_CHANGE#, B.NEXT_TIME, B.NEXT_CHANGE# FROM V$BACKUP_REDOLOG B, V$BACKUP_PIECE A WHERE A.SET_STAMP = B.SET_STAMP AND A.DELETED = 'NO' AND B.SET_STAMP = &SET_STAMP ORDER BY THREAD#, SEQUENCE#; ``` 查看某个备份集SPFILE ``` SELECT DISTINCT A.SET_STAMP, B.COMPLETION_TIME, HANDLE FROM V$BACKUP_SPFILE B, V$BACKUP_PIECE A WHERE A.SET_STAMP = B.SET_STAMP AND A.DELETED = 'NO' AND B.SET_STAMP = &SET_STAMP; ``` 查看RMAN的配置信息 ``` SELECT NAME,VALUE FROM V$RMAN_CONFIGURATION; ``` 最后更新于 2021-03-17 15:35:51 并被添加「」标签,已有 3108 位童鞋阅读过。 本站使用「署名 4.0 国际」创作共享协议,可自由转载、引用,但需署名作者且注明文章出处
此处评论已关闭