欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

[20190510]rman备份的疑问8.txt

程序员文章站 2022-05-09 08:05:35
[20190510]rman备份的疑问8.txt--//上午测试rman备份多个文件,探究input memory buffer 的问题.--//补充测试5个文件的情况.--//http://blog.itpub.net/267265/viewspace-2148246/=>[20171204]关于 ......

[20190510]rman备份的疑问8.txt

--//上午测试rman备份多个文件,探究input memory buffer 的问题.
--//补充测试5个文件的情况.
--//http://blog.itpub.net/267265/viewspace-2148246/=>[20171204]关于rman备份疑问4.txt

1.环境:
scott@book> @ ver1
port_string                    version        banner
------------------------------ -------------- --------------------------------------------------------------------------------
x86_64/linux 2.4.xx            11.2.0.4.0     oracle database 11g enterprise edition release 11.2.0.4.0 - 64bit production

$ cat dx.sql
drop tablespace t&1 including contents and datafiles;
create tablespace t&1 datafile '/mnt/ramdisk/book/t&1..dbf' size 6m autoextend off logging online extent management local autoallocate blocksize 8k segment space management auto flashback on;
create table t&1 tablespace t&1 as select rownum id ,to_char(rownum,'fm000000')||lpad('&&2',26,'&&2') name from dual connect by level<=1e5;
--//t&1..dbf 2个点.事后才发现这个小问题.

$ paste -d " " <(seq -f "%02g" 5 ) <((echo a b c d e | tr ' ' '\n' )) | xargs -iq echo @ dx q | sqlplus -s -l scott/book

2.修改rman配置:

rman> configure channel 1 device type disk rate 128 k;
using target database control file instead of recovery catalog
old rman configuration parameters:
configure channel 1 device type disk rate 512 k;
new rman configuration parameters:
configure channel 1 device type disk rate 128 k;
new rman configuration parameters are successfully stored
--//延迟备份写盘速度,就可以看出一些细节.

--//rman> configure device type disk parallelism 1 backup type to backupset;
--//rman> configure controlfile autobackup off;

3.备份:
rman> backup  datafile 9,10,11,12,13 format '/home/oracle/backup/t12345_%t_%u' ;

starting backup at 2019-05-10 17:16:28
allocated channel: ora_disk_1
channel ora_disk_1: sid=58 device type=disk
channel ora_disk_1: starting full datafile backup set
channel ora_disk_1: specifying datafile(s) in backup set
input datafile file number=00009 name=/mnt/ramdisk/book/t01dbf
input datafile file number=00010 name=/mnt/ramdisk/book/t02dbf
input datafile file number=00011 name=/mnt/ramdisk/book/t03dbf
input datafile file number=00012 name=/mnt/ramdisk/book/t04dbf
input datafile file number=00013 name=/mnt/ramdisk/book/t05dbf
channel ora_disk_1: starting piece 1 at 2019-05-10 17:16:28
channel ora_disk_1: finished piece 1 at 2019-05-10 17:20:33
piece handle=/home/oracle/backup/t12345_1007918188_2ju1773c_1_1 tag=tag20190510t171628 comment=none
channel ora_disk_1: backup set complete, elapsed time: 00:04:05
channel ora_disk_1: throttle time: 0:04:00
finished backup at 2019-05-10 17:20:33

--//执行如下:
select set_count
        ,device_type
        ,type
        ,filename
        ,buffer_size
        ,buffer_count
        ,open_time
        ,close_time
    from v$backup_async_io
   where set_count=83
order by set_count
        ,type
        ,open_time
        ,close_time;

set_count device_type type      filename                                           buffer_size buffer_count open_time           close_time
--------- ----------- --------- -------------------------------------------------- ----------- ------------ ------------------- -------------------
       83 disk        aggregate                                                              0            0 2019-05-10 17:16:28 2019-05-10 17:20:28
       83 disk        input     /mnt/ramdisk/book/t01dbf                                524288            6 2019-05-10 17:16:28 2019-05-10 17:20:28
       83 disk        input     /mnt/ramdisk/book/t02dbf                                524288            6 2019-05-10 17:16:28 2019-05-10 17:20:28
       83 disk        input     /mnt/ramdisk/book/t03dbf                                524288            6 2019-05-10 17:16:32 2019-05-10 17:20:28
       83 disk        input     /mnt/ramdisk/book/t04dbf                                524288            6 2019-05-10 17:16:36 2019-05-10 17:20:28
       83 disk        input     /mnt/ramdisk/book/t05dbf                                524288            6 2019-05-10 17:16:40 2019-05-10 17:20:28
       83 disk        output    /home/oracle/backup/t12345_1007918188_2ju1773c_1_1     1048576            4 2019-05-10 17:16:28 2019-05-10 17:20:28
7 rows selected.
--//注意看open_time的时间,间隔4秒.顺序启动读取t03,t04,t05.
--//单个输入缓存512k ,512*6=3m.
--//开始启动同时读取t01,t02
--//也就是写出512k时,开始读取t03.再写出512k,读取t04.再再写出512k时,读取t05.
--//而512k就是一个input buffer 的大小,也就是开始阶段写完1个input buffer到output buffer,读取新数据文件.

4.如果我验证备份时3个文件,t03读取是8秒以后就可以验证我的判断.

rman> backup  datafile 9,10,11 format '/home/oracle/backup/t1_%t_%u' ;
starting backup at 2019-05-10 17:28:09
using channel ora_disk_1
channel ora_disk_1: starting full datafile backup set
channel ora_disk_1: specifying datafile(s) in backup set
input datafile file number=00009 name=/mnt/ramdisk/book/t01dbf
input datafile file number=00010 name=/mnt/ramdisk/book/t02dbf
input datafile file number=00011 name=/mnt/ramdisk/book/t03dbf
channel ora_disk_1: starting piece 1 at 2019-05-10 17:28:09
channel ora_disk_1: finished piece 1 at 2019-05-10 17:30:34
piece handle=/home/oracle/backup/t1_1007918889_2mu177p9_1_1 tag=tag20190510t172809 comment=none
channel ora_disk_1: backup set complete, elapsed time: 00:02:25
channel ora_disk_1: throttle time: 0:02:24
finished backup at 2019-05-10 17:30:34

select set_count
        ,device_type
        ,type
        ,filename
        ,buffer_size
        ,buffer_count
        ,open_time
        ,close_time
    from v$backup_async_io
   where set_count=86
order by set_count
        ,type
        ,open_time
        ,close_time;

set_count device_type type      filename                                       buffer_size buffer_count open_time           close_time
--------- ----------- --------- ---------------------------------------------- ----------- ------------ ------------------- -------------------
       86 disk        aggregate                                                          0            0 2019-05-10 17:28:09 2019-05-10 17:30:33
       86 disk        input     /mnt/ramdisk/book/t01dbf                           1048576            5 2019-05-10 17:28:09 2019-05-10 17:30:33
       86 disk        input     /mnt/ramdisk/book/t02dbf                           1048576            5 2019-05-10 17:28:09 2019-05-10 17:30:33
       86 disk        input     /mnt/ramdisk/book/t03dbf                           1048576            5 2019-05-10 17:28:17 2019-05-10 17:30:33
       86 disk        output    /home/oracle/backup/t1_1007918889_2mu177p9_1_1     1048576            4 2019-05-10 17:28:09 2019-05-10 17:30:33

--//注意看open_time的时间,间隔8秒.启动读取t03.
--//单个输入缓存1024k ,1024*5=3m.
--//开始启动同时读取t01,t02
--//也就是写出1m时,开始读取t03.
--//而1024k就是一个input buffer 的大小,也就是开始阶段写完1个input buffer到output buffer,读取新数据文件.

--//贴出4个文件的情况:
rman> backup  datafile 9,10,11,12 format '/home/oracle/backup/t1_%t_%u' ;
starting backup at 2019-05-10 17:35:43
using channel ora_disk_1
channel ora_disk_1: starting full datafile backup set
channel ora_disk_1: specifying datafile(s) in backup set
input datafile file number=00009 name=/mnt/ramdisk/book/t01dbf
input datafile file number=00010 name=/mnt/ramdisk/book/t02dbf
input datafile file number=00011 name=/mnt/ramdisk/book/t03dbf
input datafile file number=00012 name=/mnt/ramdisk/book/t04dbf
channel ora_disk_1: starting piece 1 at 2019-05-10 17:35:43
channel ora_disk_1: finished piece 1 at 2019-05-10 17:38:58
piece handle=/home/oracle/backup/t1_1007919343_2nu1787f_1_1 tag=tag20190510t173543 comment=none
channel ora_disk_1: backup set complete, elapsed time: 00:03:15
channel ora_disk_1: throttle time: 0:03:12
finished backup at 2019-05-10 17:38:58

set_count device_type type      filename                                           buffer_size buffer_count open_time           close_time
--------- ----------- --------- -------------------------------------------------- ----------- ------------ ------------------- -------------------
       87 disk        aggregate                                                              0            0 2019-05-10 17:35:43 2019-05-10 17:38:55
       87 disk        input     /mnt/ramdisk/book/t01dbf                               1048576            4 2019-05-10 17:35:43 2019-05-10 17:38:55
       87 disk        input     /mnt/ramdisk/book/t02dbf                               1048576            4 2019-05-10 17:35:43 2019-05-10 17:38:55
       87 disk        input     /mnt/ramdisk/book/t03dbf                               1048576            4 2019-05-10 17:35:51 2019-05-10 17:38:55
       87 disk        input     /mnt/ramdisk/book/t04dbf                               1048576            4 2019-05-10 17:35:59 2019-05-10 17:38:55
       87 disk        output    /home/oracle/backup/t1_1007919343_2nu1787f_1_1         1048576            4 2019-05-10 17:35:43 2019-05-10 17:38:55
6 rows selected.
--//自己看,不再解析了.