DM7 DMRMAN备份管理

DMRMAN备份管理:查看(show)、检验(check)、删除(remove)、导入(load)

 

1.DMRMAN备份集查看 show

包括:备份集数据库信息(DB)、元信息(META)、备份文件信息(FILE)、表信息(仅对表备份集有效)

 

1.1.语法

DM7 DMRMAN备份管理_第1张图片

 

区别:show backupset 查看单个备份集信息,show backupsets 查看多个备份集或某备份目录中多个备份集信息。

 

:

DM7 DMRMAN备份管理_第2张图片

 

:

DM7 DMRMAN备份管理_第3张图片

 

:

DM7 DMRMAN备份管理_第4张图片

 

:

 

1.2.案例与实操

 

1.2.1.查看指定备份集的信息 show

//分别显示备份集的数据库信息、元数据、文件信息

//语法:show backupset '备份集名' ;

[dmdba@DM04 bin]$ ./dmrman
RMAN> show backupset '/home/dmdba/dmdbms/data/DAMENG/bak/DBFULL2020';



system path:           /home/dmdba/dmdbms/data/DAMENG
db magic:              3684671160
permanent magic:       1432632398
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.6.0.142-Build(2019.03.12-103811)ENT 
enable policy:         0
archive flag:          1
blank_pad_mode:        0
crc_check:             TRUE


backupset sig:         BA
backupset version:     4009
database name:         DAMENG
backup name:           DB_FULL_DAMENG_20200506_092103_000460
backupset description: 
backupset ID :         2736933120
parent backupset ID:     4294967295
META file size :       90624
compressed level:      0
encrypt type:          0
parallel num:          1
backup range:          database
mpp_timestamp:         1588728063
ddl_clone:             FALSE
mpp_flag:              FALSE
backup level:          online
backup type:           full
without log:           FALSE
START_LSN:             548093
START_SEQ:             44874
END_LSN:               548340
END_SEQ:               45162
base START_LSN:        -1
base END_LSN:          -1
base name:             
base backupset:        
backup time:           2020-05-06 09:21:07
min trx start lsn:     541889
min exec ver:          0x0701060C
pkg size:              0x02000000


backupset directory: /home/dmdba/dmdbms/data/DAMENG/bak/DBFULL2020
backupset name:        DBFULL2020
backup data file num:  8
backup piece num:      2


$file_seq |$size(KB) |$pos_desc                                               |$content_type
0         |64544     |DBFULL2020.bak                                          |DATA      
1         |149       |DBFULL2020_1.bak                                        |LOG       


$file_seq |$group_id |$group_name                      |$file_id  |$file_path                       |$mirror_path                     |$file_len           
1         |0         |SYSTEM                           |0         |/home/dmdba/dmdbms/data/DAMENG/SYSTEM.DBF|                                 |23068672            
2         |1         |ROLL                             |0         |/home/dmdba/dmdbms/data/DAMENG/ROLL.DBF|                                 |134217728           
3         |4         |MAIN                             |0         |/home/dmdba/dmdbms/data/DAMENG/MAIN.DBF|                                 |134217728           
4         |5         |DMHR                             |0         |/home/dmdba/dmdbms/data/DAMENG/DMHR.DBF|                                 |134217728           
5         |6         |TB40                             |0         |/home/dmdba/tbs4_011.dbf         |                                 |53477376            
6         |6         |TB40                             |1         |/home/dmdba/tbs4_02.dbf          |                                 |52428800            
7         |7         |SYSAUX                           |0         |/home/dmdba/dmdbms/data/DAMENG/SYSAWR.DBF|                                 |134217728           


$file_seq |$file_path                       |$file_len           |$begin_lsn          |$begin_seqno        |$begin_rpag_off     |$end_lsn            |$end_seqno          |$create_time        |$close_time         
8         |                                 |147968              |548092              |44874               |8                   |548340              |45162               |0000-00-00 00:00:00 |0000-00-00 00:00:00 


show backupsets successfully.
time used: 530.757(ms)
RMAN>

 

1.2.2.批量显示备份集信息

//批量显示多个备份集或者某备份目录中多个备份集信息

//语法:show backupsets with backupdir ['备份集1','备份集2'...'备份集N'] |'备份目录' ;

RMAN> show backupsets with backupdir '/home/dmdba/dmdbms/data/DAMENG/bak';
show backupsets with backupdir '/home/dmdba/dmdbms/data/DAMENG/bak';
CMD END.CODE:[0]








system path:           /home/dmdba/dmdbms/data/DAMENG
db magic:              1281614678
permanent magic:       1432632398
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.6.0.142-Build(2019.03.12-103811)ENT 
enable policy:         0
archive flag:          1
blank_pad_mode:        0
crc_check:             TRUE


backupset sig:         BA
backupset version:     4009
database name:         DAMENG
backup name:           DB_FULL_DAMENG_20200505_033131_000477
backupset description: 
backupset ID :         3191970236
parent backupset ID:     4294967295
META file size :       86528
compressed level:      0
encrypt type:          0
parallel num:          1
backup range:          database
mpp_timestamp:         1588620686
ddl_clone:             FALSE
mpp_flag:              FALSE
backup level:          offline
backup type:           full
without log:           FALSE
START_LSN:             457668
START_SEQ:             159254
END_LSN:               457667
END_SEQ:               159253
base START_LSN:        -1
base END_LSN:          -1
base name:             
base backupset:        
backup time:           2020-05-05 03:31:33
min trx start lsn:     457668
min exec ver:          0x0701060C
pkg size:              0x02000000


backupset directory: /home/dmdba/dmdbms/data/DAMENG/bak/DB_DAMENG_FULL_20200505_033131_000477
backupset name:        DB_DAMENG_FULL_20200505_033131_000477
backup data file num:  7
backup piece num:      1


$file_seq |$size(KB) |$pos_desc                                               |$content_type
0         |31168     |DB_DAMENG_FULL_20200505_033131_000477.bak               |DATA      


$file_seq |$group_id |$group_name                      |$file_id  |$file_path                       |$mirror_path                     |$file_len           
1         |0         |SYSTEM                           |0         |/home/dmdba/dmdbms/data/DAMENG/SYSTEM.DBF|                                 |23068672            
2         |1         |ROLL                             |0         |/home/dmdba/dmdbms/data/DAMENG/ROLL.DBF|                                 |134217728           
3         |4         |MAIN                             |0         |/home/dmdba/dmdbms/data/DAMENG/MAIN.DBF|                                 |134217728           
4         |5         |DMHR                             |0         |/home/dmdba/dmdbms/data/DAMENG/DMHR.DBF|                                 |134217728           
5         |6         |TB40                             |0         |/home/dmdba/tbs4_011.dbf         |                                 |53477376            
6         |6         |TB40                             |1         |/home/dmdba/tbs4_02.dbf          |                                 |52428800            
7         |7         |SYSAUX                           |0         |/home/dmdba/dmdbms/data/DAMENG/SYSAWR.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: 920.301(ms)
RMAN> 

 

1.2.3.查看指定数据库的所有备份信息

提示报错

[dmdba@DM04 ~]$ disql SYSDBA/SYSDBA@localhost:5236
服务器[localhost:5236]:处于普通打开状态
登录使用时间: 10.639(毫秒)
disql V7.6.0.142-Build(2019.03.12-103811)ENT 
SQL> select db_magic ;

行号     DB_MAGIC            
---------- --------------------
1          3684671160
已用时间: 2.149(毫秒). 执行号:16.
SQL> 

 

1.2.4.查看备份集的元数据信息

//语法:show backupset '备份集名' info meta ;

或show backupsets with backupdir '备份目录' info meta ;

//还可以接 info db 、info file

RMAN> show backupset '/home/dmdba/dmdbms/data/DAMENG/bak/DB_DAMENG_FULL_20200505_043433_000506' info meta ;
show backupset '/home/dmdba/dmdbms/data/DAMENG/bak/DB_DAMENG_FULL_20200505_043433_000506' info meta;




backupset sig:         BA
backupset version:     4009
database name:         DAMENG
backup name:           DB_FULL_DAMENG_20200505_043433_000506
backupset description: 
backupset ID :         3763028402
parent backupset ID:     4294967295
META file size :       82432
compressed level:      0
encrypt type:          0
parallel num:          1
backup range:          database
mpp_timestamp:         1588624468
ddl_clone:             FALSE
mpp_flag:              FALSE
backup level:          offline
backup type:           full
without log:           FALSE
START_LSN:             376660
START_SEQ:             0
END_LSN:               376659
END_SEQ:               -1
base START_LSN:        -1
base END_LSN:          -1
base name:             
base backupset:        
backup time:           2020-05-05 04:34:35
min trx start lsn:     376660
min exec ver:          0x0701060C
pkg size:              0x02000000


show backupsets successfully.
time used: 5.734(ms)
RMAN> 

 

1.2.5.导出备份集信息

//导出备份集信息到TXT或xml,默认是TXT

//语法:show backupset '备份集' to '/home/dmdba/db0905.txt' ;

或 show backupsets with backupdir '备份目录' to '/home/dmdba/db090501.xml' format xml ;

RMAN> show backupset '/home/dmdba/dmdbms/data/DAMENG/bak/DB_DAMENG_FULL_20200505_043433_000506' to '/home/dmdba/db0509.txt' ;
[dmdba@DM04 ~]$ cd /home/dmdba/
[dmdba@DM04 ~]$ more db0509.txt




system path:           /home/dmdba/dmdbms/data/DAMENG
db magic:              3684671160
permanent magic:       1432632398
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.6.0.142-Build(2019.03.12-103811)ENT 
enable policy:         0
archive flag:          1
blank_pad_mode:        0
crc_check:             TRUE


backupset sig:         BA
backupset version:     4009
database name:         DAMENG
backup name:           DB_FULL_DAMENG_20200505_043433_000506
backupset description: 
backupset ID :         3763028402
parent backupset ID:     4294967295
META file size :       82432
compressed level:      0
encrypt type:          0
parallel num:          1
backup range:          database
mpp_timestamp:         1588624468
ddl_clone:             FALSE
mpp_flag:              FALSE
backup level:          offline
backup type:           full
without log:           FALSE
START_LSN:             376660
START_SEQ:             0
END_LSN:               376659
END_SEQ:               -1
base START_LSN:        -1
base END_LSN:          -1
base name:             
base backupset:        
backup time:           2020-05-05 04:34:35
min trx start lsn:     376660
min exec ver:          0x0701060C
pkg size:              0x02000000


backupset directory: /home/dmdba/dmdbms/data/DAMENG/bak/DB_DAMENG_FULL_20200505_043433_000506
backupset name:        DB_DAMENG_FULL_20200505_043433_000506
backup data file num:  7
backup piece num:      1


$file_seq |$size(KB) |$pos_desc                                               |$content_type
0         |68264     |DB_DAMENG_FULL_20200505_043433_000506.bak               |DATA      


$file_seq |$group_id |$group_name                      |$file_id  |$file_path                       |$mirror_path                     |$file_len           
1         |0         |SYSTEM                           |0         |/home/dmdba/dmdbms/data/DAMENG/SYSTEM.DBF|                                 |23068672            
2         |1         |ROLL                             |0         |/home/dmdba/dmdbms/data/DAMENG/ROLL.DBF|                                 |134217728           
3         |4         |MAIN                             |0         |/home/dmdba/dmdbms/data/DAMENG/MAIN.DBF|                                 |134217728           
4         |5         |DMHR                             |0         |/home/dmdba/dmdbms/data/DAMENG/DMHR.DBF|                                 |134217728           
5         |6         |TB40                             |0         |/home/dmdba/tbs4_011.dbf         |                                 |53477376            
6         |6         |TB40                             |1         |/home/dmdba/tbs4_02.dbf          |                                 |52428800            
7         |7         |SYSAUX                           |0         |/home/dmdba/dmdbms/data/DAMENG/SYSAWR.DBF|                                 |134217728           


$file_seq |$file_path                       |$file_len           |$begin_lsn          |$begin_seqno        |$begin_rpag_off     |$end_lsn            |$end_seqno          |$create_time        
|$close_time         


[dmdba@DM04 ~]$

 

2.备份集校验 (check)

 

2.1.校验备份集语法

//只能校验一个备份集

DM7 DMRMAN备份管理_第5张图片

 

2.2.案例及实操

//检验备份集是否存在及合法

//语法:check backupset '备份集';

RMAN> check backupset '/home/dmdba/dmdbms/data/DAMENG/bak/DBFULL2020' ; 
check backupset '/home/dmdba/dmdbms/data/DAMENG/bak/DBFULL2020';
CMD END.CODE:[0]
check backupset successfully.
time used: 60.505(ms)
RMAN> 

 

3.备份集删除 (remove)

 

3.1.语法

DM7 DMRMAN备份管理_第6张图片

DM7 DMRMAN备份管理_第7张图片

:

DM7 DMRMAN备份管理_第8张图片

 

3.2.删除备份集

//删除特定的备份集、批量删除所有备份集、批量删除指定时间前的备份集

 

3.2.1.删除特定的备份集

//每次只能删除一个备份集,若该备份集被作为其它备份集的基备份,则 需要指定为CACASE删除

//语法:remove backupset '备份集';

RMAN> remove backupset '/home/dmdba/dmdbms/data/DAMENG/bak/DBFULL2020' ;
remove backupset '/home/dmdba/dmdbms/data/DAMENG/bak/DBFULL2020';
CMD END.CODE:[0]
remove backupset successfully.
time used: 63.624(ms)
RMAN> 

 

3.2.2.批量删除指定时间之前的备份

//语法:remove backupsets with backupdir '备份目录' until time '2020-04-29 00:00:00' ;

RMAN> remove backupsets with backupdir '/home/dmdba/dmdbms/data/DAMENG/bak/' until time '2020-04-29 00:00:00' ;
remove backupsets with backupdir '/home/dmdba/dmdbms/data/DAMENG/bak/' until time '2020-04-29 00:00:00';
CMD END.CODE:[-10000],DESC:[备份恢复时MML层出错(-10000)]
CMD END.CODE:[0]
remove backupset successfully.
time used: 1122.085(ms)
RMAN> 

 

3.2.3.批量删除距离当前时间前 n 天产生的备份集

//语法:remove backupsets with backupdir '备份目录' before n ; #n取值,0-365天

RMAN> remove backupsets with backupdir '/home/dmdba/dmdbms/data/DAMENG/bak/' before 5 ; 
remove backupsets with backupdir '/home/dmdba/dmdbms/data/DAMENG/bak/' before 5;
CMD END.CODE:[-10000],DESC:[备份恢复时MML层出错(-10000)]
CMD END.CODE:[0]
remove backupset successfully.
time used: 1208.919(ms)
RMAN> 

[dmdba@DM04 bak]$ pwd
/home/dmdba/dmdbms/data/DAMENG/bak
[dmdba@DM04 bak]$ ls -ltr
总用量 44
-rw-r--r-- 1 dmdba dinstall   61  4月 27 11:14 dmsql.buf1587957037824364.buf
-rw-r--r-- 1 dmdba dinstall    8  4月 27 15:19 dmsql.buf1587970312095088.buf
drwxr-xr-x 2 dmdba dinstall 4096  4月 29 07:41 TAB_DMHR_CITY_2020_04_30_14_36_41
drwxr-xr-x 2 dmdba dinstall 4096  4月 29 07:46 DB_DAMENG_FULL_2020_04_30_14_41_29
drwxr-xr-x 2 dmdba dinstall 4096  4月 29 07:57 DB_DAMENG_INCRE_2020_04_30_14_52_13
drwxr-xr-x 2 dmdba dinstall 4096  4月 29 08:42 TS_DMHR_FULL_2020_04_30_15_38_03
drwxr-xr-x 2 dmdba dinstall 4096  5月  5 03:05 DB_DAMENG_FULL_20200505_030555_000638
drwxr-xr-x 2 dmdba dinstall 4096  5月  5 03:36 DB_DAMENG_FULL_2020_04_30_15_32_34
drwxr-xr-x 2 dmdba dinstall 4096  5月  5 04:34 DB_DAMENG_FULL_20200505_043433_000506
drwxr-xr-x 2 dmdba dinstall 4096  5月  6 03:41 DB_DAMENG_FULL_20200505_033131_000477
-rw-r--r-- 1 dmdba dinstall   50  5月  6 10:00 dmsql.buf1588730372953070.buf
[dmdba@DM04 bak]$ date
2020年 05月 08日 星期五 08:51:46 CST
[dmdba@DM04 bak]$ ls -ltr
总用量 24
-rw-r--r-- 1 dmdba dinstall   61  4月 27 11:14 dmsql.buf1587957037824364.buf
-rw-r--r-- 1 dmdba dinstall    8  4月 27 15:19 dmsql.buf1587970312095088.buf
drwxr-xr-x 2 dmdba dinstall 4096  5月  5 03:05 DB_DAMENG_FULL_20200505_030555_000638
drwxr-xr-x 2 dmdba dinstall 4096  5月  5 04:34 DB_DAMENG_FULL_20200505_043433_000506
drwxr-xr-x 2 dmdba dinstall 4096  5月  6 03:41 DB_DAMENG_FULL_20200505_033131_000477
-rw-r--r-- 1 dmdba dinstall   50  5月  6 10:00 dmsql.buf1588730372953070.buf
[dmdba@DM04 bak]$ 

 

3.2.4批量删除所有备份集

//语法:remove backupsets with backupdir '备份目录' ;

RMAN> remove backupsets with backupdir '/home/dmdba/dmdbms/data/DAMENG/bak/' ;
remove backupsets with backupdir '/home/dmdba/dmdbms/data/DAMENG/bak/';
CMD END.CODE:[-10000],DESC:[备份恢复时MML层出错(-10000)]
CMD END.CODE:[0]
remove backupset successfully.
time used: 1212.461(ms)
RMAN> 

 

你可能感兴趣的:(DM7 DMRMAN备份管理)