DM7使用DMRMAN工具檢視備份集

eric0435發表於2020-09-14

使用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個位元組。若檢視完全備份的備份集資訊且指定的備份集路徑為相對路徑可透過設定此引數搜尋備份集;若檢視的為增量備份集資訊,設定該引數除上述功能外還用於搜尋基備份集。

: 指定介質型別和介質引數,介質型別支援DISK和TAPE,預設DISK。

:指定顯示備份集資訊內容,可以組合指定,若未指定,則顯示全部。具體說明如下:
1. DB 表示僅顯示備份集的資料庫資訊;
2. META表示僅顯示備份集的元資訊;
3. FILE表示僅顯示備份集中檔案資訊,如備份資料檔案DBF和備份片檔案;
4. TABLE 表示顯示備份集中表資訊,僅對錶備份集有效。

:SHOW BACKUPSETS可以指定僅顯示指定DB_MAGIC即指定資料庫的備份集資訊。

:指定備份集資訊輸出的目標檔案路徑,若不指定,僅控制檯列印。檔案格式有兩種型別,TXT和XML格式,預設是TXT格式。不支援輸出到DMASM檔案系統中。指定的檔案不能為已經存在的檔案,否則報錯。

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:00system 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_timesystem 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_timesystem 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_timesystem 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_timeshow 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:00system 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_timesystem 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_timesystem 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_timesystem 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_timeshow 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"?>
        
                
                /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
                
                
        
show backupsets successfully.
time used: 7.438(ms)

 


來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/26015009/viewspace-2719246/,如需轉載,請註明出處,否則將追究法律責任。

相關文章