使用DMRMAN工具查看备份集
1. 概述
DMRMAN中使用SHOW命令可以查看备份集的信息,包括:
1. 备份集的数据库信息
2. 备份集的元信息
3. 备份集中文件信息(如备份数据文件DBF和备份片文件)
4. 备份集中表信息(仅对表备份集有效)
若指定具体备份集目录,则会生成相应的备份集链表信息。
语法如下:
SHOW BACKUPSET '< 备份集目录>' [][RECURSIVE] [ ] [ ] [ ]; |SHOW BACKUPSETS [ ] [ ] [ ] [ ]; ::= DATABASE ' ' | WITH BACKUPDIR '< 备份集搜索目录>'{,'< 备份集搜索目录>'} | DATABASE ' ' WITH BACKUPDIR '< 备份集搜索目录>'{, '< 备份集搜索目录>'} ::= DEVICE TYPE DISK|TAPE [PARMS '< 介质参数>'] ::= INFO DB[,META][,FILE] [,TABLE] ::= USE DB_MAGIC ::= TO '< 输出文件路径>' [FORMAT TXT | FORMAT XML]
BACKUPSET:指定显示目标备份集信息,若同时指定RECURSIVE,则显示以该备份集为最新备份集递归显示完整的备份集链表;否则,仅显示指定备份集本身信息。若为完全备份,则仅显示该备份集自身信息。
DATABASE:指定数据库dm.ini文件路径,若指定,则该数据库的默认备份目录作为备份集搜索目录之一。
WITH BACKUPDIR:备份集搜索目录,最大长度为256个字节。若查看完全备份的备份集信息且指定的备份集路径为相对路径可通过设置此参数搜索备份集;若查看的为增量备份集信息,设置该参数除上述功能外还用于搜索基备份集。
1. DB 表示仅显示备份集的数据库信息;
2. META表示仅显示备份集的元信息;
3. FILE表示仅显示备份集中文件信息,如备份数据文件DBF和备份片文件;
4. TABLE 表示显示备份集中表信息,仅对表备份集有效。
2. 备份信息查看
SHOW命令支持查看单个备份集信息也支持批量查看多个备份集的信息。本节主要举例说明如何执行简单的常用的查看备份集信息操作,包括:
1. 查看指定的备份集信息
2. 批量显示备份集信息
3. 查看指定数据库所有备份集的信息
4. 指定显示部分备份集信息
5. 以xml格式输出备份信息到文件
1.查看指定的备份集信息
SHOW BACKUPSET…命令用于显示特定的备份集信息,每次只能显示一个备份集。当仅需要查看某个特定备份集信息时可以使用此命令。执行
步骤如下:
[dmdba@dmrac1 bin]$ dmrman dmrman V7.1.6.46-Build(2018.02.08-89107)ENT RMAN> show backupset '/dm7/backup/db_rac_bak'; show backupset '/dm7/backup/db_rac_bak';system path: +DMDATA/data/rac db magic: -991931850 permanent magic: 450923536 rac node: 2 page check: 0 rlog encrypt: 0 external cipher[id/name]: 0/ external hash[id/name]: 0/ length in char: 0 use new hash: 1 page size: 8 KB extent size: 16 case sensitive: 1 log page size: 512 B unicode_flag/charset: 0 data version: 0x7000A sys version: V7.1.6.46-Build(2018.02.08-89107)ENT enable policy: 0 archive flag: 1 blank_pad_mode: 0 crc_check: TRUE backupset sig: BA backupset version: 4009 database name: rac backup name: DB_RAC_BAK backupset description: backupset ID : 1109894076 parent backupset ID: -1 META file size : 293376 compressed level: 0 encrypt type: 0 parallel num: 4 backup range: database mpp_timestamp: 1590824489 ddl_clone: FALSE mpp_flag: FALSE backup level: online backup type: full without log: FALSE START_LSN: 51236 START_SEQ: 1870 END_LSN: 51298 END_SEQ: 15673 base START_LSN: -1 base END_LSN: -1 base name: base backupset: backup time: 2020-05-30 15:41:35 min trx start lsn: 49398 min exec ver: 0x0701060C pkg size: 0x02000000 RAC EP: 0 RAC status: OK RAC begin lsn: 51287 RAC begin seq: 15668 RAC end lsn: 51298 RAC end seq: 15673 RAC base begin lsn: -1 RAC base begin seq: -1 RAC base end lsn: -1 RAC base end seq: -1 RAC EP: 1 RAC status: OK RAC begin lsn: 51236 RAC begin seq: 1870 RAC end lsn: 51235 RAC end seq: 1869 RAC base begin lsn: -1 RAC base begin seq: -1 RAC base end lsn: -1 RAC base end seq: -1 backupset directory: /dm7/backup/db_rac_bak backupset name: db_rac_bak backup data file num: 1 backup piece num: 1 $file_seq |$size(KB) |$pos_desc |$content_type 0 |8 |db_rac_bak.bak |LOG $file_seq |$group_id |$group_name |$file_id |$file_path |$mirror_path |$file_len $file_seq |$file_path |$file_len |$begin_lsn |$begin_seqno |$begin_rpag_off |$end_lsn |$end_seqno |$create_time |$close_time 1 | |3072 |51286 |15668 |8 |51298 |15673 |0000-00-00 00:00:00 |0000-00-00 00:00:00 system path: +DMDATA/data/rac db magic: -991931850 permanent magic: 450923536 rac node: 2 page check: 0 rlog encrypt: 0 external cipher[id/name]: 0/ external hash[id/name]: 0/ length in char: 0 use new hash: 1 page size: 8 KB extent size: 16 case sensitive: 1 log page size: 512 B unicode_flag/charset: 0 data version: 0x7000A sys version: V7.1.6.46-Build(2018.02.08-89107)ENT enable policy: 0 archive flag: 1 blank_pad_mode: 0 crc_check: TRUE backupset sig: BA backupset version: 4009 database name: rac backup name: DB_RAC_BAK_2 backupset description: backupset ID : 66095816 parent backupset ID: 1109894076 META file size : 57856 compressed level: 0 encrypt type: 0 parallel num: 1 backup range: database mpp_timestamp: 1590824489 ddl_clone: FALSE mpp_flag: FALSE backup level: online backup type: full without log: FALSE START_LSN: 51236 START_SEQ: 1870 END_LSN: 51235 END_SEQ: 1869 base START_LSN: -1 base END_LSN: -1 base name: base backupset: backup time: 2020-05-30 15:41:35 min trx start lsn: 49398 min exec ver: 0x0701060C pkg size: 0x02000000 RAC EP: 0 RAC status: OK RAC begin lsn: 51287 RAC begin seq: 15668 RAC end lsn: -1 RAC end seq: -1 RAC base begin lsn: -1 RAC base begin seq: -1 RAC base end lsn: -1 RAC base end seq: -1 RAC EP: 1 RAC status: OK RAC begin lsn: 51236 RAC begin seq: 1870 RAC end lsn: -1 RAC end seq: -1 RAC base begin lsn: -1 RAC base begin seq: -1 RAC base end lsn: -1 RAC base end seq: -1 backupset directory: /dm7/backup/db_rac_bak/db_rac_bak_2 backupset name: db_rac_bak_2 backup data file num: 1 backup piece num: 1 $file_seq |$size(KB) |$pos_desc |$content_type 0 |85 |db_rac_bak_2.bak |DATA $file_seq |$group_id |$group_name |$file_id |$file_path |$mirror_path |$file_len 3 |4 |MAIN |0 |+DMDATA/data/rac/main.dbf | |134217728 $file_seq |$file_path |$file_len |$begin_lsn |$begin_seqno |$begin_rpag_off |$end_lsn |$end_seqno |$create_time |$close_time system path: +DMDATA/data/rac db magic: -991931850 permanent magic: 450923536 rac node: 2 page check: 0 rlog encrypt: 0 external cipher[id/name]: 0/ external hash[id/name]: 0/ length in char: 0 use new hash: 1 page size: 8 KB extent size: 16 case sensitive: 1 log page size: 512 B unicode_flag/charset: 0 data version: 0x7000A sys version: V7.1.6.46-Build(2018.02.08-89107)ENT enable policy: 0 archive flag: 1 blank_pad_mode: 0 crc_check: TRUE backupset sig: BA backupset version: 4009 database name: rac backup name: DB_RAC_BAK_3 backupset description: backupset ID : -1127735780 parent backupset ID: 1109894076 META file size : 57856 compressed level: 0 encrypt type: 0 parallel num: 1 backup range: database mpp_timestamp: 1590824489 ddl_clone: FALSE mpp_flag: FALSE backup level: online backup type: full without log: FALSE START_LSN: 51236 START_SEQ: 1870 END_LSN: 51235 END_SEQ: 1869 base START_LSN: -1 base END_LSN: -1 base name: base backupset: backup time: 2020-05-30 15:41:35 min trx start lsn: 49398 min exec ver: 0x0701060C pkg size: 0x02000000 RAC EP: 0 RAC status: OK RAC begin lsn: 51287 RAC begin seq: 15668 RAC end lsn: -1 RAC end seq: -1 RAC base begin lsn: -1 RAC base begin seq: -1 RAC base end lsn: -1 RAC base end seq: -1 RAC EP: 1 RAC status: OK RAC begin lsn: 51236 RAC begin seq: 1870 RAC end lsn: -1 RAC end seq: -1 RAC base begin lsn: -1 RAC base begin seq: -1 RAC base end lsn: -1 RAC base end seq: -1 backupset directory: /dm7/backup/db_rac_bak/db_rac_bak_3 backupset name: db_rac_bak_3 backup data file num: 1 backup piece num: 1 $file_seq |$size(KB) |$pos_desc |$content_type 0 |13 |db_rac_bak_3.bak |DATA $file_seq |$group_id |$group_name |$file_id |$file_path |$mirror_path |$file_len 4 |5 |TS_FOR_DBF |0 |+DMDATA/data/rac/ts_for_dbf_01.dbf| |134217728 $file_seq |$file_path |$file_len |$begin_lsn |$begin_seqno |$begin_rpag_off |$end_lsn |$end_seqno |$create_time |$close_time system path: +DMDATA/data/rac db magic: -991931850 permanent magic: 450923536 rac node: 2 page check: 0 rlog encrypt: 0 external cipher[id/name]: 0/ external hash[id/name]: 0/ length in char: 0 use new hash: 1 page size: 8 KB extent size: 16 case sensitive: 1 log page size: 512 B unicode_flag/charset: 0 data version: 0x7000A sys version: V7.1.6.46-Build(2018.02.08-89107)ENT enable policy: 0 archive flag: 1 blank_pad_mode: 0 crc_check: TRUE backupset sig: BA backupset version: 4009 database name: rac backup name: DB_RAC_BAK_0 backupset description: backupset ID : -287144791 parent backupset ID: 1109894076 META file size : 61952 compressed level: 0 encrypt type: 0 parallel num: 1 backup range: database mpp_timestamp: 1590824489 ddl_clone: FALSE mpp_flag: FALSE backup level: online backup type: full without log: FALSE START_LSN: 51236 START_SEQ: 1870 END_LSN: 51235 END_SEQ: 1869 base START_LSN: -1 base END_LSN: -1 base name: base backupset: backup time: 2020-05-30 15:41:35 min trx start lsn: 49398 min exec ver: 0x0701060C pkg size: 0x02000000 RAC EP: 0 RAC status: OK RAC begin lsn: 51287 RAC begin seq: 15668 RAC end lsn: -1 RAC end seq: -1 RAC base begin lsn: -1 RAC base begin seq: -1 RAC base end lsn: -1 RAC base end seq: -1 RAC EP: 1 RAC status: OK RAC begin lsn: 51236 RAC begin seq: 1870 RAC end lsn: -1 RAC end seq: -1 RAC base begin lsn: -1 RAC base begin seq: -1 RAC base end lsn: -1 RAC base end seq: -1 backupset directory: /dm7/backup/db_rac_bak/db_rac_bak_0 backupset name: db_rac_bak_0 backup data file num: 2 backup piece num: 1 $file_seq |$size(KB) |$pos_desc |$content_type 0 |5005 |db_rac_bak_0.bak |DATA $file_seq |$group_id |$group_name |$file_id |$file_path |$mirror_path |$file_len 1 |0 |SYSTEM |0 |+DMDATA/data/rac/system.dbf | |134217728 5 |5 |TS_FOR_DBF |1 |+DMDATA/data/rac/ts_for_dbf_02.dbf| |134217728 $file_seq |$file_path |$file_len |$begin_lsn |$begin_seqno |$begin_rpag_off |$end_lsn |$end_seqno |$create_time |$close_time system path: +DMDATA/data/rac db magic: -991931850 permanent magic: 450923536 rac node: 2 page check: 0 rlog encrypt: 0 external cipher[id/name]: 0/ external hash[id/name]: 0/ length in char: 0 use new hash: 1 page size: 8 KB extent size: 16 case sensitive: 1 log page size: 512 B unicode_flag/charset: 0 data version: 0x7000A sys version: V7.1.6.46-Build(2018.02.08-89107)ENT enable policy: 0 archive flag: 1 blank_pad_mode: 0 crc_check: TRUE backupset sig: BA backupset version: 4009 database name: rac backup name: DB_RAC_BAK_1 backupset description: backupset ID : -1045365472 parent backupset ID: 1109894076 META file size : 57856 compressed level: 0 encrypt type: 0 parallel num: 1 backup range: database mpp_timestamp: 1590824489 ddl_clone: FALSE mpp_flag: FALSE backup level: online backup type: full without log: FALSE START_LSN: 51236 START_SEQ: 1870 END_LSN: 51235 END_SEQ: 1869 base START_LSN: -1 base END_LSN: -1 base name: base backupset: backup time: 2020-05-30 15:41:35 min trx start lsn: 49398 min exec ver: 0x0701060C pkg size: 0x02000000 RAC EP: 0 RAC status: OK RAC begin lsn: 51287 RAC begin seq: 15668 RAC end lsn: -1 RAC end seq: -1 RAC base begin lsn: -1 RAC base begin seq: -1 RAC base end lsn: -1 RAC base end seq: -1 RAC EP: 1 RAC status: OK RAC begin lsn: 51236 RAC begin seq: 1870 RAC end lsn: -1 RAC end seq: -1 RAC base begin lsn: -1 RAC base begin seq: -1 RAC base end lsn: -1 RAC base end seq: -1 backupset directory: /dm7/backup/db_rac_bak/db_rac_bak_1 backupset name: db_rac_bak_1 backup data file num: 1 backup piece num: 1 $file_seq |$size(KB) |$pos_desc |$content_type 0 |20997 |db_rac_bak_1.bak |DATA $file_seq |$group_id |$group_name |$file_id |$file_path |$mirror_path |$file_len 2 |1 |ROLL |0 |+DMDATA/data/rac/roll.dbf | |134217728 $file_seq |$file_path |$file_len |$begin_lsn |$begin_seqno |$begin_rpag_off |$end_lsn |$end_seqno |$create_time |$close_time show backupsets successfully. time used: 14.325(ms)
显示的备份集信息分为三类,依次是元数据信息(META INFO)、文件信息(FILE INFO)和数据库信息(DB INFO)。用户可根据自身需要只显示部分备份集信息,本节下文中会有介绍。
2.批量显示备份集信息
SHOW BACKUPSETS…命令用于批量显示指定搜索目录下的备份集信息。如需要查看的多个备份集不在同一个目录下,可通过多次指定WITH BACKUPDIR参数同时查看所有的备份集。操作如下:
RMAN> backup database '/dm7/data/rac0_config/dm.ini'; backup database '/dm7/data/rac0_config/dm.ini'; checking if the RAC database under system path [+DMDATA/data/rac] is running.... EP [0] is checking.... EP [1] is checking.... EP[0] max_lsn: 58852 EP[0] adjust cur_lsn from [58852] to [58867] BACKUP DATABASE [rac], execute...... CMD CHECK LSN...... BACKUP DATABASE [rac], collect dbf...... CMD CHECK ...... DBF BACKUP SUBS...... total 1 packages processed... total 2 packages processed... total 3 packages processed... total 4 packages processed... total 5 packages processed... DBF BACKUP MAIN...... BACKUPSET [+DMDATA/data/rac/bak/DB_rac_FULL_20200608_160009_000828] END, CODE [0]...... META GENERATING...... total 9 packages processed... total 9 packages processed! CMD END.CODE:[0] backup successfully! time used: 16303.415(ms) RMAN> backup database '/dm7/data/rac0_config/dm.ini' full backupset '/dm7/backup/db_rac_full_bak_2020060801'; backup database '/dm7/data/rac0_config/dm.ini' full backupset '/dm7/backup/db_rac_full_bak_2020060801'; checking if the RAC database under system path [+DMDATA/data/rac] is running.... EP [0] is checking.... EP [1] is checking.... EP[0] max_lsn: 58852 EP[0] adjust cur_lsn from [58852] to [58867] BACKUP DATABASE [rac], execute...... CMD CHECK LSN...... BACKUP DATABASE [rac], collect dbf...... CMD CHECK ...... DBF BACKUP SUBS...... total 1 packages processed... total 2 packages processed... total 3 packages processed... total 4 packages processed... total 5 packages processed... DBF BACKUP MAIN...... BACKUPSET [/dm7/backup/db_rac_full_bak_2020060801] END, CODE [0]...... META GENERATING...... total 9 packages processed... total 9 packages processed! CMD END.CODE:[0] backup successfully! time used: 3570.343(ms) RMAN> show backupsets with backupdir '+DMDATA/data/rac/bak','/dm7/backup'; show backupsets with backupdir '+DMDATA/data/rac/bak' , '/dm7/backup'; CMD END.CODE:[0]system path: +DMDATA/data/rac db magic: -991931850 permanent magic: 450923536 rac node: 2 page check: 0 rlog encrypt: 0 external cipher[id/name]: 0/ external hash[id/name]: 0/ length in char: 0 use new hash: 1 page size: 8 KB extent size: 16 case sensitive: 1 log page size: 512 B unicode_flag/charset: 0 data version: 0x7000A sys version: V7.1.6.46-Build(2018.02.08-89107)ENT enable policy: 0 archive flag: 1 blank_pad_mode: 0 crc_check: TRUE backupset sig: BA backupset version: 4009 database name: rac backup name: DB_FULL_rac_20200608_160623_000096 backupset description: backupset ID : 186522112 parent backupset ID: -1 META file size : 74240 compressed level: 0 encrypt type: 0 parallel num: 1 backup range: database mpp_timestamp: 1591603580 ddl_clone: FALSE mpp_flag: FALSE backup level: offline backup type: full without log: FALSE START_LSN: 58853 START_SEQ: 16611 END_LSN: 58867 END_SEQ: 16610 base START_LSN: -1 base END_LSN: -1 base name: base backupset: backup time: 2020-06-08 16:06:24 min trx start lsn: 58853 min exec ver: 0x0701060C pkg size: 0x02000000 RAC EP: 0 RAC status: OK RAC begin lsn: 58853 RAC begin seq: 16611 RAC end lsn: 58867 RAC end seq: 16610 RAC base begin lsn: -1 RAC base begin seq: -1 RAC base end lsn: -1 RAC base end seq: -1 RAC EP: 1 RAC status: OK RAC begin lsn: 58868 RAC begin seq: 2492 RAC end lsn: 58867 RAC end seq: 2491 RAC base begin lsn: -1 RAC base begin seq: -1 RAC base end lsn: -1 RAC base end seq: -1 backupset directory: /dm7/backup/db_rac_full_bak_2020060801 backupset name: db_rac_full_bak_2020060801 backup data file num: 5 backup piece num: 1 $file_seq |$size(KB) |$pos_desc |$content_type 0 |26103 |db_rac_full_bak_2020060801.bak |DATA $file_seq |$group_id |$group_name |$file_id |$file_path |$mirror_path |$file_len 1 |0 |SYSTEM |0 |+DMDATA/data/rac/system.dbf | |134217728 2 |1 |ROLL |0 |+DMDATA/data/rac/roll.dbf | |134217728 3 |4 |MAIN |0 |+DMDATA/data/rac/main.dbf | |134217728 4 |5 |TS_FOR_DBF |0 |+DMDATA/data/rac/ts_for_dbf_01.dbf| |134217728 5 |5 |TS_FOR_DBF |1 |+DMDATA/data/rac/ts_for_dbf_02.dbf| |134217728 $file_seq |$file_path |$file_len |$begin_lsn |$begin_seqno |$begin_rpag_off |$end_lsn |$end_seqno |$create_time |$close_time system path: +DMDATA/data/rac db magic: -991931850 permanent magic: 450923536 rac node: 2 page check: 0 rlog encrypt: 0 external cipher[id/name]: 0/ external hash[id/name]: 0/ length in char: 0 use new hash: 1 page size: 8 KB extent size: 16 case sensitive: 1 log page size: 512 B unicode_flag/charset: 0 data version: 0x7000A sys version: V7.1.6.46-Build(2018.02.08-89107)ENT enable policy: 0 archive flag: 1 blank_pad_mode: 0 crc_check: TRUE backupset sig: BA backupset version: 4009 database name: rac backup name: DB_FULL_rac_20200608_160009_000828 backupset description: backupset ID : 1835676274 parent backupset ID: -1 META file size : 74240 compressed level: 0 encrypt type: 0 parallel num: 1 backup range: database mpp_timestamp: 1591603207 ddl_clone: FALSE mpp_flag: FALSE backup level: offline backup type: full without log: FALSE START_LSN: 58853 START_SEQ: 16611 END_LSN: 58867 END_SEQ: 16610 base START_LSN: -1 base END_LSN: -1 base name: base backupset: backup time: 2020-06-08 16:00:17 min trx start lsn: 58853 min exec ver: 0x0701060C pkg size: 0x02000000 RAC EP: 0 RAC status: OK RAC begin lsn: 58853 RAC begin seq: 16611 RAC end lsn: 58867 RAC end seq: 16610 RAC base begin lsn: -1 RAC base begin seq: -1 RAC base end lsn: -1 RAC base end seq: -1 RAC EP: 1 RAC status: OK RAC begin lsn: 58868 RAC begin seq: 2492 RAC end lsn: 58867 RAC end seq: 2491 RAC base begin lsn: -1 RAC base begin seq: -1 RAC base end lsn: -1 RAC base end seq: -1 backupset directory: +DMDATA/data/rac/bak/DB_rac_FULL_20200608_160009_000828 backupset name: DB_rac_FULL_20200608_160009_000828 backup data file num: 5 backup piece num: 1 $file_seq |$size(KB) |$pos_desc |$content_type 0 |26103 |DB_rac_FULL_20200608_160009_000828.bak |DATA $file_seq |$group_id |$group_name |$file_id |$file_path |$mirror_path |$file_len 1 |0 |SYSTEM |0 |+DMDATA/data/rac/system.dbf | |134217728 2 |1 |ROLL |0 |+DMDATA/data/rac/roll.dbf | |134217728 3 |4 |MAIN |0 |+DMDATA/data/rac/main.dbf | |134217728 4 |5 |TS_FOR_DBF |0 |+DMDATA/data/rac/ts_for_dbf_01.dbf| |134217728 5 |5 |TS_FOR_DBF |1 |+DMDATA/data/rac/ts_for_dbf_02.dbf| |134217728 $file_seq |$file_path |$file_len |$begin_lsn |$begin_seqno |$begin_rpag_off |$end_lsn |$end_seqno |$create_time |$close_time system path: +DMDATA/data/rac db magic: -991931850 permanent magic: 450923536 rac node: 2 page check: 0 rlog encrypt: 0 external cipher[id/name]: 0/ external hash[id/name]: 0/ length in char: 0 use new hash: 1 page size: 8 KB extent size: 16 case sensitive: 1 log page size: 512 B unicode_flag/charset: 0 data version: 0x7000A sys version: V7.1.6.46-Build(2018.02.08-89107)ENT enable policy: 0 archive flag: 1 blank_pad_mode: 0 crc_check: TRUE backupset sig: BA backupset version: 4009 database name: rac backup name: DB_RAC_BAK backupset description: backupset ID : 1109894076 parent backupset ID: -1 META file size : 293376 compressed level: 0 encrypt type: 0 parallel num: 4 backup range: database mpp_timestamp: 1590824489 ddl_clone: FALSE mpp_flag: FALSE backup level: online backup type: full without log: FALSE START_LSN: 51236 START_SEQ: 1870 END_LSN: 51298 END_SEQ: 15673 base START_LSN: -1 base END_LSN: -1 base name: base backupset: backup time: 2020-05-30 15:41:35 min trx start lsn: 49398 min exec ver: 0x0701060C pkg size: 0x02000000 RAC EP: 0 RAC status: OK RAC begin lsn: 51287 RAC begin seq: 15668 RAC end lsn: 51298 RAC end seq: 15673 RAC base begin lsn: -1 RAC base begin seq: -1 RAC base end lsn: -1 RAC base end seq: -1 RAC EP: 1 RAC status: OK RAC begin lsn: 51236 RAC begin seq: 1870 RAC end lsn: 51235 RAC end seq: 1869 RAC base begin lsn: -1 RAC base begin seq: -1 RAC base end lsn: -1 RAC base end seq: -1 backupset directory: /dm7/backup/db_rac_bak backupset name: db_rac_bak backup data file num: 1 backup piece num: 1 $file_seq |$size(KB) |$pos_desc |$content_type 0 |8 |db_rac_bak.bak |LOG $file_seq |$group_id |$group_name |$file_id |$file_path |$mirror_path |$file_len $file_seq |$file_path |$file_len |$begin_lsn |$begin_seqno |$begin_rpag_off |$end_lsn |$end_seqno |$create_time |$close_time 1 | |3072 |51286 |15668 |8 |51298 |15673 |0000-00-00 00:00:00 |0000-00-00 00:00:00 system path: +DMDATA/data/rac db magic: -991931850 permanent magic: 450923536 rac node: 2 page check: 0 rlog encrypt: 0 external cipher[id/name]: 0/ external hash[id/name]: 0/ length in char: 0 use new hash: 1 page size: 8 KB extent size: 16 case sensitive: 1 log page size: 512 B unicode_flag/charset: 0 data version: 0x7000A sys version: V7.1.6.46-Build(2018.02.08-89107)ENT enable policy: 0 archive flag: 1 blank_pad_mode: 0 crc_check: TRUE backupset sig: BA backupset version: 4009 database name: rac backup name: DB_RAC_BAK_2 backupset description: backupset ID : 66095816 parent backupset ID: 1109894076 META file size : 57856 compressed level: 0 encrypt type: 0 parallel num: 1 backup range: database mpp_timestamp: 1590824489 ddl_clone: FALSE mpp_flag: FALSE backup level: online backup type: full without log: FALSE START_LSN: 51236 START_SEQ: 1870 END_LSN: 51235 END_SEQ: 1869 base START_LSN: -1 base END_LSN: -1 base name: base backupset: backup time: 2020-05-30 15:41:35 min trx start lsn: 49398 min exec ver: 0x0701060C pkg size: 0x02000000 RAC EP: 0 RAC status: OK RAC begin lsn: 51287 RAC begin seq: 15668 RAC end lsn: -1 RAC end seq: -1 RAC base begin lsn: -1 RAC base begin seq: -1 RAC base end lsn: -1 RAC base end seq: -1 RAC EP: 1 RAC status: OK RAC begin lsn: 51236 RAC begin seq: 1870 RAC end lsn: -1 RAC end seq: -1 RAC base begin lsn: -1 RAC base begin seq: -1 RAC base end lsn: -1 RAC base end seq: -1 backupset directory: /dm7/backup/db_rac_bak/db_rac_bak_2 backupset name: db_rac_bak_2 backup data file num: 1 backup piece num: 1 $file_seq |$size(KB) |$pos_desc |$content_type 0 |85 |db_rac_bak_2.bak |DATA $file_seq |$group_id |$group_name |$file_id |$file_path |$mirror_path |$file_len 3 |4 |MAIN |0 |+DMDATA/data/rac/main.dbf | |134217728 $file_seq |$file_path |$file_len |$begin_lsn |$begin_seqno |$begin_rpag_off |$end_lsn |$end_seqno |$create_time |$close_time system path: +DMDATA/data/rac db magic: -991931850 permanent magic: 450923536 rac node: 2 page check: 0 rlog encrypt: 0 external cipher[id/name]: 0/ external hash[id/name]: 0/ length in char: 0 use new hash: 1 page size: 8 KB extent size: 16 case sensitive: 1 log page size: 512 B unicode_flag/charset: 0 data version: 0x7000A sys version: V7.1.6.46-Build(2018.02.08-89107)ENT enable policy: 0 archive flag: 1 blank_pad_mode: 0 crc_check: TRUE backupset sig: BA backupset version: 4009 database name: rac backup name: DB_RAC_BAK_3 backupset description: backupset ID : -1127735780 parent backupset ID: 1109894076 META file size : 57856 compressed level: 0 encrypt type: 0 parallel num: 1 backup range: database mpp_timestamp: 1590824489 ddl_clone: FALSE mpp_flag: FALSE backup level: online backup type: full without log: FALSE START_LSN: 51236 START_SEQ: 1870 END_LSN: 51235 END_SEQ: 1869 base START_LSN: -1 base END_LSN: -1 base name: base backupset: backup time: 2020-05-30 15:41:35 min trx start lsn: 49398 min exec ver: 0x0701060C pkg size: 0x02000000 RAC EP: 0 RAC status: OK RAC begin lsn: 51287 RAC begin seq: 15668 RAC end lsn: -1 RAC end seq: -1 RAC base begin lsn: -1 RAC base begin seq: -1 RAC base end lsn: -1 RAC base end seq: -1 RAC EP: 1 RAC status: OK RAC begin lsn: 51236 RAC begin seq: 1870 RAC end lsn: -1 RAC end seq: -1 RAC base begin lsn: -1 RAC base begin seq: -1 RAC base end lsn: -1 RAC base end seq: -1 backupset directory: /dm7/backup/db_rac_bak/db_rac_bak_3 backupset name: db_rac_bak_3 backup data file num: 1 backup piece num: 1 $file_seq |$size(KB) |$pos_desc |$content_type 0 |13 |db_rac_bak_3.bak |DATA $file_seq |$group_id |$group_name |$file_id |$file_path |$mirror_path |$file_len 4 |5 |TS_FOR_DBF |0 |+DMDATA/data/rac/ts_for_dbf_01.dbf| |134217728 $file_seq |$file_path |$file_len |$begin_lsn |$begin_seqno |$begin_rpag_off |$end_lsn |$end_seqno |$create_time |$close_time system path: +DMDATA/data/rac db magic: -991931850 permanent magic: 450923536 rac node: 2 page check: 0 rlog encrypt: 0 external cipher[id/name]: 0/ external hash[id/name]: 0/ length in char: 0 use new hash: 1 page size: 8 KB extent size: 16 case sensitive: 1 log page size: 512 B unicode_flag/charset: 0 data version: 0x7000A sys version: V7.1.6.46-Build(2018.02.08-89107)ENT enable policy: 0 archive flag: 1 blank_pad_mode: 0 crc_check: TRUE backupset sig: BA backupset version: 4009 database name: rac backup name: DB_RAC_BAK_0 backupset description: backupset ID : -287144791 parent backupset ID: 1109894076 META file size : 61952 compressed level: 0 encrypt type: 0 parallel num: 1 backup range: database mpp_timestamp: 1590824489 ddl_clone: FALSE mpp_flag: FALSE backup level: online backup type: full without log: FALSE START_LSN: 51236 START_SEQ: 1870 END_LSN: 51235 END_SEQ: 1869 base START_LSN: -1 base END_LSN: -1 base name: base backupset: backup time: 2020-05-30 15:41:35 min trx start lsn: 49398 min exec ver: 0x0701060C pkg size: 0x02000000 RAC EP: 0 RAC status: OK RAC begin lsn: 51287 RAC begin seq: 15668 RAC end lsn: -1 RAC end seq: -1 RAC base begin lsn: -1 RAC base begin seq: -1 RAC base end lsn: -1 RAC base end seq: -1 RAC EP: 1 RAC status: OK RAC begin lsn: 51236 RAC begin seq: 1870 RAC end lsn: -1 RAC end seq: -1 RAC base begin lsn: -1 RAC base begin seq: -1 RAC base end lsn: -1 RAC base end seq: -1 backupset directory: /dm7/backup/db_rac_bak/db_rac_bak_0 backupset name: db_rac_bak_0 backup data file num: 2 backup piece num: 1 $file_seq |$size(KB) |$pos_desc |$content_type 0 |5005 |db_rac_bak_0.bak |DATA $file_seq |$group_id |$group_name |$file_id |$file_path |$mirror_path |$file_len 1 |0 |SYSTEM |0 |+DMDATA/data/rac/system.dbf | |134217728 5 |5 |TS_FOR_DBF |1 |+DMDATA/data/rac/ts_for_dbf_02.dbf| |134217728 $file_seq |$file_path |$file_len |$begin_lsn |$begin_seqno |$begin_rpag_off |$end_lsn |$end_seqno |$create_time |$close_time system path: +DMDATA/data/rac db magic: -991931850 permanent magic: 450923536 rac node: 2 page check: 0 rlog encrypt: 0 external cipher[id/name]: 0/ external hash[id/name]: 0/ length in char: 0 use new hash: 1 page size: 8 KB extent size: 16 case sensitive: 1 log page size: 512 B unicode_flag/charset: 0 data version: 0x7000A sys version: V7.1.6.46-Build(2018.02.08-89107)ENT enable policy: 0 archive flag: 1 blank_pad_mode: 0 crc_check: TRUE backupset sig: BA backupset version: 4009 database name: rac backup name: DB_RAC_BAK_1 backupset description: backupset ID : -1045365472 parent backupset ID: 1109894076 META file size : 57856 compressed level: 0 encrypt type: 0 parallel num: 1 backup range: database mpp_timestamp: 1590824489 ddl_clone: FALSE mpp_flag: FALSE backup level: online backup type: full without log: FALSE START_LSN: 51236 START_SEQ: 1870 END_LSN: 51235 END_SEQ: 1869 base START_LSN: -1 base END_LSN: -1 base name: base backupset: backup time: 2020-05-30 15:41:35 min trx start lsn: 49398 min exec ver: 0x0701060C pkg size: 0x02000000 RAC EP: 0 RAC status: OK RAC begin lsn: 51287 RAC begin seq: 15668 RAC end lsn: -1 RAC end seq: -1 RAC base begin lsn: -1 RAC base begin seq: -1 RAC base end lsn: -1 RAC base end seq: -1 RAC EP: 1 RAC status: OK RAC begin lsn: 51236 RAC begin seq: 1870 RAC end lsn: -1 RAC end seq: -1 RAC base begin lsn: -1 RAC base begin seq: -1 RAC base end lsn: -1 RAC base end seq: -1 backupset directory: /dm7/backup/db_rac_bak/db_rac_bak_1 backupset name: db_rac_bak_1 backup data file num: 1 backup piece num: 1 $file_seq |$size(KB) |$pos_desc |$content_type 0 |20997 |db_rac_bak_1.bak |DATA $file_seq |$group_id |$group_name |$file_id |$file_path |$mirror_path |$file_len 2 |1 |ROLL |0 |+DMDATA/data/rac/roll.dbf | |134217728 $file_seq |$file_path |$file_len |$begin_lsn |$begin_seqno |$begin_rpag_off |$end_lsn |$end_seqno |$create_time |$close_time show backupsets successfully. time used: 18.070(ms)
3.查看指定数据库所有备份集的信息
如果指定的备份搜索目录下包含不同数据库的备份集,而我们只想查看某个特定数据库的所有备份集信息,此时可以使用SHOW BACKUPSETS…USE DB_MAGIC命令实现。具体操作如下:
1)备份不同的数据库到不同的目录下。
RMAN> backup database '/dm_home/dmdbms/data/dmks1/dm.ini' backupset '/dm_home/dmdbms/data/bak/db_dmks1_bak_2020060801'; backup database '/dm_home/dmdbms/data/dmks1/dm.ini' backupset '/dm_home/dmdbms/data/bak/db_dmks1_bak_2020060801'; file dm.key not found, use default license! checking if the database under system path [/dm_home/dmdbms/data/dmks1] is running...[4]. checking if the database under system path [/dm_home/dmdbms/data/dmks1] is running...[3]. checking if the database under system path [/dm_home/dmdbms/data/dmks1] is running...[2]. checking if the database under system path [/dm_home/dmdbms/data/dmks1] is running...[1]. checking if the database under system path [/dm_home/dmdbms/data/dmks1] is running...[0]. checking if the database under system path [/dm_home/dmdbms/data/dmks1] is running, write dmrman info. EP[0] max_lsn: 61665 BACKUP DATABASE [dmks1], execute...... CMD CHECK LSN...... BACKUP DATABASE [dmks1], collect dbf...... CMD CHECK ...... DBF BACKUP SUBS...... total 1 packages processed... total 2 packages processed... total 3 packages processed... DBF BACKUP MAIN...... BACKUPSET [/dm_home/dmdbms/data/bak/db_dmks1_bak_2020060801] END, CODE [0]...... META GENERATING...... total 7 packages processed... total 7 packages processed! CMD END.CODE:[0] backup successfully! time used: 8043.221(ms) RMAN> backup database '/dm_home/dmdbms/data/dmks2/dm.ini' backupset '/dm_home/dmdbms/backup/db_dmks2_bak_2020060801'; backup database '/dm_home/dmdbms/data/dmks2/dm.ini' backupset '/dm_home/dmdbms/backup/db_dmks2_bak_2020060801'; checking if the database under system path [/dm_home/dmdbms/data/dmks2] is running...[4]. checking if the database under system path [/dm_home/dmdbms/data/dmks2] is running...[3]. checking if the database under system path [/dm_home/dmdbms/data/dmks2] is running...[2]. checking if the database under system path [/dm_home/dmdbms/data/dmks2] is running...[1]. checking if the database under system path [/dm_home/dmdbms/data/dmks2] is running...[0]. checking if the database under system path [/dm_home/dmdbms/data/dmks2] is running, write dmrman info. EP[0] max_lsn: 33904 BACKUP DATABASE [dmks2], execute...... CMD CHECK LSN...... BACKUP DATABASE [dmks2], collect dbf...... CMD CHECK ...... DBF BACKUP SUBS...... total 1 packages processed... total 2 packages processed... total 3 packages processed... DBF BACKUP MAIN...... BACKUPSET [/dm_home/dmdbms/backup/db_dmks2_bak_2020060801] END, CODE [0]...... META GENERATING...... total 7 packages processed... total 7 packages processed! CMD END.CODE:[0] backup successfully! time used: 8047.711(ms)
2) 查看指定数据库备份集的信息,获取DB_MAGIC信息。
RMAN> show backupset '/dm_home/dmdbms/backup/db_dmks2_bak_2020060801'; show backupset '/dm_home/dmdbms/backup/db_dmks2_bak_2020060801';system path: /dm_home/dmdbms/data/dmks2 db magic: 1486708862 permanent magic: 1155586847 rac node: 1 page check: 0 rlog encrypt: 0 external cipher[id/name]: 0/ external hash[id/name]: 0/ length in char: 0 use new hash: 1 page size: 8 KB extent size: 16 case sensitive: 1 log page size: 512 B unicode_flag/charset: 0 data version: 0x7000A sys version: V7.1.6.46-Build(2018.02.08-89107)ENT enable policy: 0 archive flag: 0 blank_pad_mode: 0 crc_check: TRUE backupset sig: BA backupset version: 4009 database name: dmks2 backup name: DB_FULL_dmks2_20200608_165451_000348 backupset description: backupset ID : -479813328 parent backupset ID: -1 META file size : 66048 compressed level: 0 encrypt type: 0 parallel num: 1 backup range: database mpp_timestamp: 1591606486 ddl_clone: FALSE mpp_flag: FALSE backup level: offline backup type: full without log: FALSE START_LSN: 33905 START_SEQ: 14010 END_LSN: 33904 END_SEQ: 14009 base START_LSN: -1 base END_LSN: -1 base name: base backupset: backup time: 2020-06-08 16:54:53 min trx start lsn: 33905 min exec ver: 0x0701060C pkg size: 0x02000000 backupset directory: /dm_home/dmdbms/backup/db_dmks2_bak_2020060801 backupset name: db_dmks2_bak_2020060801 backup data file num: 3 backup piece num: 1 $file_seq |$size(KB) |$pos_desc |$content_type 0 |5606 |db_dmks2_bak_2020060801.bak |DATA $file_seq |$group_id |$group_name |$file_id |$file_path |$mirror_path |$file_len 1 |0 |SYSTEM |0 |/dm_home/dmdbms/data/dmks2/SYSTEM.DBF| |22020096 2 |1 |ROLL |0 |/dm_home/dmdbms/data/dmks2/ROLL.DBF| |134217728 3 |4 |MAIN |0 |/dm_home/dmdbms/data/dmks2/MAIN.DBF| |134217728 $file_seq |$file_path |$file_len |$begin_lsn |$begin_seqno |$begin_rpag_off |$end_lsn |$end_seqno |$create_time |$close_time show backupsets successfully. time used: 6.251(ms)
通过查看备份集信息可知,数据库/dm_home/dmdbms/data/dmks2的DB_MAGIC值为-1486708862
3) 查看指定目录下数据库/dm_home/dmdbms/data/dmks2的所有备份集信息。
RMAN> show backupsets with backupdir '/dm_home/dmdbms/backup' use db_magic 1486708862; show backupsets with backupdir '/dm_home/dmdbms/backup' use db_magic 1486708862; CMD END.CODE:[0] [602]:no backupsets searched in specified directories
4.指定查看备份集的元数据信息
SHOW BACKUPSET...INFO META命令用于查看备份集的元数据信息。操作步骤如下: RMAN> show backupset '/dm_home/dmdbms/backup/db_dmks2_bak_2020060801' info meta; show backupset '/dm_home/dmdbms/backup/db_dmks2_bak_2020060801' info meta;backupset sig: BA backupset version: 4009 database name: dmks2 backup name: DB_FULL_dmks2_20200608_165451_000348 backupset description: backupset ID : -479813328 parent backupset ID: -1 META file size : 66048 compressed level: 0 encrypt type: 0 parallel num: 1 backup range: database mpp_timestamp: 1591606486 ddl_clone: FALSE mpp_flag: FALSE backup level: offline backup type: full without log: FALSE START_LSN: 33905 START_SEQ: 14010 END_LSN: 33904 END_SEQ: 14009 base START_LSN: -1 base END_LSN: -1 base name: base backupset: backup time: 2020-06-08 16:54:53 min trx start lsn: 33905 min exec ver: 0x0701060C pkg size: 0x02000000 show backupsets successfully. time used: 5.915(ms)
这里获取的是单个备份集的元数据信息,也可以使用SHOW BACKUPSETS…INFO META命令批量获取元数据信息。同样地,我们可以使用类似的命令指定获取备份集的数据库信息、文件信息和表信息,或这些信息的任意组合。
5.以xml格式输出备份信息到文件
DMRMAN可以将显示的备份集信息输出到文件,目前支持的格式包括TXT和XML,默认为TXT文件格式。使用SHOW BACKUPSETS…TO ‘file_path’ FORMAT XML命令可将备份信息以XML格式显示并输出到文件,如下所示:
RMAN> show backupset '/dm_home/dmdbms/backup/db_dmks2_bak_2020060801' to '/home/dmdba/db_dmks2.txt' format xml; show backupset '/dm_home/dmdbms/backup/db_dmks2_bak_2020060801' to '/home/dmdba/db_dmks2.txt' format xml; < ?xml version="1.0" encoding="UTF-8"?>show backupsets successfully. time used: 7.438(ms) /dm_home/dmdbms/backup/db_dmks2_bak_2020060801 DISK BA 4009 dmks2 DB_FULL_dmks2_20200608_165451_000348 -479813328 -1 66048 0 0 1 database 1591606486 FALSE FALSE offline full FALSE 33905 14010 33904 14009 -1 -1 2020-06-08 16:54:53 33905 0x0701060C 0x02000000 /dm_home/dmdbms/backup/db_dmks2_bak_2020060801 db_dmks2_bak_2020060801 3 1 0 5740032 db_dmks2_bak_2020060801.bak DATA 1 0 SYSTEM 0 /dm_home/dmdbms/data/dmks2/SYSTEM.DBF 22020096 2 1 ROLL 0 /dm_home/dmdbms/data/dmks2/ROLL.DBF 134217728 3 4 MAIN 0 /dm_home/dmdbms/data/dmks2/MAIN.DBF 134217728 /dm_home/dmdbms/data/dmks2 -1486708862 -1155586847 1 0 0 0 0 0 1 8192 16 TRUE 512 0 0 0x7000A V7.1.6.46-Build(2018.02.08-89107)ENT FALSE FALSE 0 TRUE