[20190509]rman备份的疑问5.txt

[20190509]rman备份的疑问5.txt

--//别人跟我提到的rman备份问题,我开始以为是assm与mssm的问题,实际测试情况不是.
--//开始备份时生成的备份集文件很大,以后会回缩(对方采用压缩方式).我以前测试也遇到类似的情况,我重复演示看看.

1.环境:
SYS@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

SYS@book> show parameter filesystem
NAME                 TYPE   VALUE
-------------------- ------ -----
filesystemio_options string NONE
--//测试不要使用异步IO.主要跟踪看到的异步IO信息目前我看不懂!!

CREATE TABLESPACE T01 DATAFILE '/mnt/ramdisk/book/t01.dbf' SIZE 40M AUTOEXTEND OFF LOGGING ONLINE EXTENT MANAGEMENT LOCAL AUTOALLOCATE BLOCKSIZE 8K SEGMENT SPACE MANAGEMENT MANUAL;
CREATE TABLESPACE T02 DATAFILE '/mnt/ramdisk/book/t02.dbf' SIZE 40M AUTOEXTEND OFF LOGGING ONLINE EXTENT MANAGEMENT LOCAL AUTOALLOCATE BLOCKSIZE 8K SEGMENT SPACE MANAGEMENT AUTO;
--//注意建立的数据文件AUTOEXTEND OFF,一个mssm,一个assm.主要避免一个数据文件快满时,oracle会自动提前扩展数据文件.

create table t01 tablespace  t01 as select rownum id ,lpad('A',32,'A') name from dual connect by level<=7e5;
create table t02a tablespace t02 as select rownum id ,lpad('A',32,'A') name from dual connect by level<=1e5;
create table t02b tablespace t02 as select rownum id ,lpad('B',32,'B') name from dual connect by level<=1e5;
create table t02c tablespace t02 as select rownum id ,lpad('C',32,'C') name from dual connect by level<=1e5;
create table t02d tablespace t02 as select rownum id ,lpad('D',32,'D') name from dual connect by level<=1e5;
create table t02e tablespace t02 as select rownum id ,lpad('E',32,'E') name from dual connect by level<=1e5;
create table t02f tablespace t02 as select rownum id ,lpad('F',32,'F') name from dual connect by level<=1e5;
create table t02g tablespace t02 as select rownum id ,lpad('G',32,'G') name from dual connect by level<=1e5;
--//基本写满这个数据文件.

2.建立测试脚本:
RMAN> report schema ;
Report of database schema for database with db_unique_name BOOK
List of Permanent Datafiles
===========================
File Size(MB) Tablespace           RB segs Datafile Name
---- -------- -------------------- ------- ------------------------
1    760      SYSTEM               ***     /mnt/ramdisk/book/system01.dbf
2    1150     SYSAUX               ***     /mnt/ramdisk/book/sysaux01.dbf
3    865      UNDOTBS1             ***     /mnt/ramdisk/book/undotbs01.dbf
4    128      USERS                ***     /mnt/ramdisk/book/users01.dbf
5    346      EXAMPLE              ***     /mnt/ramdisk/book/example01.dbf
6    6        TEA                  ***     /mnt/ramdisk/book/tea01.dbf
7    16       UNDOTBS1             ***     /mnt/ramdisk/book/undotbs02.dbf
8    16       UNDOTBS1             ***     /mnt/ramdisk/book/undotbs03.dbf
9    40       T01                  ***     /mnt/ramdisk/book/t01.dbf
10   40       T02                  ***     /mnt/ramdisk/book/t02.dbf

List of Temporary Files
=======================
File Size(MB) Tablespace           Maxsize(MB) Tempfile Name
---- -------- -------------------- ----------- --------------------
1    414      TEMP                 4096        /mnt/ramdisk/book/temp01.dbf

RMAN> CONFIGURE CONTROLFILE AUTOBACKUP OFF;
old RMAN configuration parameters:
CONFIGURE CONTROLFILE AUTOBACKUP ON;
new RMAN configuration parameters:
CONFIGURE CONTROLFILE AUTOBACKUP OFF;
new RMAN configuration parameters are successfully stored
--//测试前关闭控制文件自动备份,避免干扰.

RMAN> CONFIGURE CHANNEL 1 DEVICE TYPE DISK RATE 5M;

old RMAN configuration parameters:
CONFIGURE CHANNEL 1 DEVICE TYPE DISK RATE 10 M;
new RMAN configuration parameters:
CONFIGURE CHANNEL 1 DEVICE TYPE DISK RATE 5 M;
new RMAN configuration parameters are successfully stored
--//数据文件40M,40/5=8秒,监测15秒应该足够了(我自己先测了1次).这样备份慢一些,我监控可以看到信息.

$ cat tt.sh
#! /bin/bash
file=$1
>| /tmp/xx_${file}
>| /tmp/yy_${file}
strace -ftt -x -o /tmp/tt_${file}.txt rman target / <<< "backup as compressed backupset datafile "$file" format \"/home/oracle/backup/T_"${file}"_%U\" ;" &
seq 30 | xargs -I{} echo "ls -l /home/oracle/backup/T_${file}_*;sleep 0.5" | bash 2>/dev/null| ts.awk >> /tmp/xx_${file} 2>/dev/null &
seq 30 | xargs -I{} echo "stat -c '%s %b %B' /home/oracle/backup/T_${file}_*;sleep 0.5" | bash  2>/dev/null | ts.awk >> /tmp/yy_${file} 2>/dev/null &
wait

3.测试:
$ . tt.sh 9
Recovery Manager: Release 11.2.0.4.0 - Production on Thu May 9 09:25:27 2019
Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.
connected to target database: BOOK (DBID=1337401710)

RMAN>
Starting backup at 2019-05-09 09:25:30
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=156 device type=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: SID=170 device type=DISK
allocated channel: ORA_DISK_3
channel ORA_DISK_3: SID=184 device type=DISK
channel ORA_DISK_1: starting compressed full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00009 name=/mnt/ramdisk/book/t01.dbf
channel ORA_DISK_1: starting piece 1 at 2019-05-09 09:25:33
channel ORA_DISK_1: finished piece 1 at 2019-05-09 09:25:48
piece handle=/home/oracle/backup/T_9_12u13n4c_1_1 tag=TAG20190509T092532 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:15
channel ORA_DISK_1: throttle time: 0:00:06
Finished backup at 2019-05-09 09:25:48

RMAN>

Recovery Manager complete.
[1]   Done                    strace -ftt -x -o /tmp/tt_${file}.txt rman target / <<< "backup as compressed backupset datafile "$file" format \"/home/oracle/backup/T_"${file}"_%U\" ;"
[2]-  Done                    seq 30 | xargs -I{} echo "ls -l /home/oracle/backup/T_${file}_*;sleep 0.5" | bash 2> /dev/null | ts.awk >> /tmp/xx_${file} 2> /dev/null
[3]+  Done                    seq 30 | xargs -I{} echo "stat -c '%s %b %B' /home/oracle/backup/T_${file}_*;sleep 0.5" | bash 2> /dev/null | ts.awk >> /tmp/yy_${file} 2> /dev/null

$ uniq -c /tmp/xx_9
      2 [2019-05-09 09:25:33] -rw-r----- 1 oracle oinstall 41975808 May  9 09:25 /home/oracle/backup/T_9_12u13n4c_1_1
      2 [2019-05-09 09:25:34] -rw-r----- 1 oracle oinstall 41975808 May  9 09:25 /home/oracle/backup/T_9_12u13n4c_1_1
      2 [2019-05-09 09:25:35] -rw-r----- 1 oracle oinstall 41975808 May  9 09:25 /home/oracle/backup/T_9_12u13n4c_1_1
      2 [2019-05-09 09:25:36] -rw-r----- 1 oracle oinstall 41975808 May  9 09:25 /home/oracle/backup/T_9_12u13n4c_1_1
      2 [2019-05-09 09:25:37] -rw-r----- 1 oracle oinstall 41975808 May  9 09:25 /home/oracle/backup/T_9_12u13n4c_1_1
      2 [2019-05-09 09:25:38] -rw-r----- 1 oracle oinstall 41975808 May  9 09:25 /home/oracle/backup/T_9_12u13n4c_1_1
      2 [2019-05-09 09:25:39] -rw-r----- 1 oracle oinstall 41975808 May  9 09:25 /home/oracle/backup/T_9_12u13n4c_1_1
      2 [2019-05-09 09:25:40] -rw-r----- 1 oracle oinstall 2826240 May  9 09:25 /home/oracle/backup/T_9_12u13n4c_1_1
      2 [2019-05-09 09:25:41] -rw-r----- 1 oracle oinstall 2826240 May  9 09:25 /home/oracle/backup/T_9_12u13n4c_1_1
      1 [2019-05-09 09:25:42] -rw-r----- 1 oracle oinstall 2826240 May  9 09:25 /home/oracle/backup/T_9_12u13n4c_1_1

$ ls -l /mnt/ramdisk/book/t01.dbf
-rw-r----- 1 oracle oinstall 41951232 2019-05-09 10:25:02 /mnt/ramdisk/book/t01.dbf

--//41975808-41951232 = 24576
--//24576/8192 = 3 , 比数据文件多3个数据块.

$ uniq -c /tmp/yy_9
      2 [2019-05-09 09:25:33] 41975808 2072 512
      2 [2019-05-09 09:25:34] 41975808 2072 512
      2 [2019-05-09 09:25:35] 41975808 2072 512
      2 [2019-05-09 09:25:36] 41975808 2072 512
      1 [2019-05-09 09:25:37] 41975808 2072 512
      1 [2019-05-09 09:25:37] 41975808 4120 512
      2 [2019-05-09 09:25:38] 41975808 4120 512
      2 [2019-05-09 09:25:39] 41975808 4120 512
      2 [2019-05-09 09:25:40] 2826240 5528 512
      2 [2019-05-09 09:25:41] 2826240 5528 512
      1 [2019-05-09 09:25:42] 2826240 5528 512

--//可以发现开始备份文件大小41975808,而实际占2072块(每块512字节),2072*512 = 1060864,实际占用1M上下,也就是备份开始建立的
--//文件像临时表空间文件一样,是稀疏文件.
--//你可以发现最后生成的文件才2826240,而实际占5528块(单位512字节).这也是对方看到的情况.
--//我开始以为是使用mssm的缘故,我改成assm也是一样.也就是与这个无关.

$ . tt.sh 10
Recovery Manager: Release 11.2.0.4.0 - Production on Thu May 9 09:49:54 2019
Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.
connected to target database: BOOK (DBID=1337401710)
RMAN>
Starting backup at 2019-05-09 09:49:57
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=212 device type=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: SID=226 device type=DISK
allocated channel: ORA_DISK_3
channel ORA_DISK_3: SID=241 device type=DISK
channel ORA_DISK_1: starting compressed full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00010 name=/mnt/ramdisk/book/t02.dbf
channel ORA_DISK_1: starting piece 1 at 2019-05-09 09:49:59
channel ORA_DISK_1: finished piece 1 at 2019-05-09 09:50:15
piece handle=/home/oracle/backup/T_10_14u13oi7_1_1 tag=TAG20190509T094959 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:16
channel ORA_DISK_1: throttle time: 0:00:06
Finished backup at 2019-05-09 09:50:15

RMAN>

Recovery Manager complete.
[1]   Done                    strace -ftt -x -o /tmp/tt_${file}.txt rman target / <<< "backup as compressed backupset datafile "$file" format \"/home/oracle/backup/T_"${file}"_%U\" ;"
[2]-  Done                    seq 30 | xargs -I{} echo "ls -l /home/oracle/backup/T_${file}_*;sleep 0.5" | bash 2> /dev/null | ts.awk >> /tmp/xx_${file} 2> /dev/null
[3]+  Done                    seq 30 | xargs -I{} echo "stat -c '%s %b %B' /home/oracle/backup/T_${file}_*;sleep 0.5" | bash 2> /dev/null | ts.awk >> /tmp/yy_${file} 2> /dev/null

$ uniq -c /tmp/xx_10
      2 [2019-05-09 09:50:00] -rw-r----- 1 oracle oinstall 41975808 May  9 09:50 /home/oracle/backup/T_10_14u13oi7_1_1
      2 [2019-05-09 09:50:01] -rw-r----- 1 oracle oinstall 41975808 May  9 09:50 /home/oracle/backup/T_10_14u13oi7_1_1
      2 [2019-05-09 09:50:02] -rw-r----- 1 oracle oinstall 41975808 May  9 09:50 /home/oracle/backup/T_10_14u13oi7_1_1
      2 [2019-05-09 09:50:03] -rw-r----- 1 oracle oinstall 41975808 May  9 09:50 /home/oracle/backup/T_10_14u13oi7_1_1
      2 [2019-05-09 09:50:04] -rw-r----- 1 oracle oinstall 41975808 May  9 09:50 /home/oracle/backup/T_10_14u13oi7_1_1
      2 [2019-05-09 09:50:05] -rw-r----- 1 oracle oinstall 41975808 May  9 09:50 /home/oracle/backup/T_10_14u13oi7_1_1
      2 [2019-05-09 09:50:06] -rw-r----- 1 oracle oinstall 41975808 May  9 09:50 /home/oracle/backup/T_10_14u13oi7_1_1
      2 [2019-05-09 09:50:07] -rw-r----- 1 oracle oinstall 2867200 May  9 09:50 /home/oracle/backup/T_10_14u13oi7_1_1
      2 [2019-05-09 09:50:08] -rw-r----- 1 oracle oinstall 2867200 May  9 09:50 /home/oracle/backup/T_10_14u13oi7_1_1
      1 [2019-05-09 09:50:09] -rw-r----- 1 oracle oinstall 2867200 May  9 09:50 /home/oracle/backup/T_10_14u13oi7_1_1

$ uniq -c /tmp/yy_10
      2 [2019-05-09 09:50:00] 41975808 2072 512
      2 [2019-05-09 09:50:01] 41975808 2072 512
      2 [2019-05-09 09:50:02] 41975808 2072 512
      2 [2019-05-09 09:50:03] 41975808 2072 512
      2 [2019-05-09 09:50:04] 41975808 2072 512
      2 [2019-05-09 09:50:05] 41975808 4120 512
      2 [2019-05-09 09:50:06] 41975808 4120 512
      2 [2019-05-09 09:50:07] 2867200 5608 512
      2 [2019-05-09 09:50:08] 2867200 5608 512
      1 [2019-05-09 09:50:09] 2867200 5608 512
--//assm也是一样.

4.继续测试:
--//删除几个表看看.
SCOTT@book> drop table t02a purge ;
Table dropped.

SCOTT@book> drop table t02b purge ;
Table dropped.

SCOTT@book> drop table t02c purge ;
Table dropped.

--//重复备份数据文件10.注意先删除前面数据文件10的备份,主要我写的监测脚本不是很好.使用模糊查询.
RMAN> delete backupset 34;
using channel ORA_DISK_1
using channel ORA_DISK_2
using channel ORA_DISK_3

List of Backup Pieces
BP Key  BS Key  Pc# Cp# Status      Device Type Piece Name
------- ------- --- --- ----------- ----------- ----------
34      34      1   1   AVAILABLE   DISK        /home/oracle/backup/T_10_14u13oi7_1_1

Do you really want to delete the above objects (enter YES or NO)? yes
deleted backup piece
backup piece handle=/home/oracle/backup/T_10_14u13oi7_1_1 RECID=34 STAMP=1007805000
Deleted 1 objects

--//重复测试.
$ uniq -c /tmp/yy_10
      2 [2019-05-09 10:11:24] 41975808 2072 512
      2 [2019-05-09 10:11:25] 41975808 2072 512
      2 [2019-05-09 10:11:26] 41975808 2072 512
      2 [2019-05-09 10:11:27] 41975808 2072 512
      2 [2019-05-09 10:11:28] 41975808 2072 512
      2 [2019-05-09 10:11:29] 41975808 2072 512
      2 [2019-05-09 10:11:30] 41975808 2072 512
      2 [2019-05-09 10:11:31] 41975808 2072 512
      1 [2019-05-09 10:11:32] 41975808 2072 512
      1 [2019-05-09 10:11:32] 2097152 4104 512
      1 [2019-05-09 10:11:33] 2097152 4104 512
--//看到的情况还是一样.

5.再继续测试:
--//重新建立表空间T02,以及对应表.打开AUTOEXTEND ON看看.
SCOTT@book> ALTER DATABASE DATAFILE '/mnt/ramdisk/book/t02.dbf' AUTOEXTEND ON NEXT 16M MAXSIZE UNLIMITED;
Database altered.

--//重复测试,注意删除前面的备份.
$ uniq -c /tmp/yy_10
      2 [2019-05-09 10:22:41] 41975808 2072 512
      2 [2019-05-09 10:22:42] 41975808 2072 512
      2 [2019-05-09 10:22:43] 41975808 2072 512
      2 [2019-05-09 10:22:44] 41975808 2072 512
      1 [2019-05-09 10:22:45] 41975808 2072 512
      1 [2019-05-09 10:22:45] 41975808 4120 512
      2 [2019-05-09 10:22:46] 41975808 4120 512
      2 [2019-05-09 10:22:47] 41975808 4120 512
      2 [2019-05-09 10:22:48] 2859008 5592 512
      2 [2019-05-09 10:22:49] 2859008 5592 512
      1 [2019-05-09 10:22:50] 2859008 5592 512
--//看到的情况还是一样.

SCOTT@book> ALTER DATABASE   DATAFILE '/mnt/ramdisk/book/t02.dbf' RESIZE 100M;
Database altered.

--//重复测试,注意删除前面的备份.
$ uniq -c /tmp/yy_10
      1 [2019-05-09 10:25:13] 1056768 2072 512
      1 [2019-05-09 10:25:14] 1056768 2072 512
      2 [2019-05-09 10:25:15] 1056768 2072 512
      2 [2019-05-09 10:25:16] 1056768 2072 512
      2 [2019-05-09 10:25:17] 1056768 2072 512
      2 [2019-05-09 10:25:18] 1056768 2072 512
      2 [2019-05-09 10:25:19] 2105344 4120 512
      2 [2019-05-09 10:25:20] 2105344 4120 512
      2 [2019-05-09 10:25:21] 2105344 4120 512
      2 [2019-05-09 10:25:22] 2105344 4120 512
      1 [2019-05-09 10:25:23] 2105344 4120 512

$ uniq -c /tmp/xx_10
      1 [2019-05-09 10:25:13] -rw-r----- 1 oracle oinstall 1056768 May  9 10:25 /home/oracle/backup/T_10_1cu13qk9_1_1
      1 [2019-05-09 10:25:14] -rw-r----- 1 oracle oinstall 1056768 May  9 10:25 /home/oracle/backup/T_10_1cu13qk9_1_1
      2 [2019-05-09 10:25:15] -rw-r----- 1 oracle oinstall 1056768 May  9 10:25 /home/oracle/backup/T_10_1cu13qk9_1_1
      2 [2019-05-09 10:25:16] -rw-r----- 1 oracle oinstall 1056768 May  9 10:25 /home/oracle/backup/T_10_1cu13qk9_1_1
      2 [2019-05-09 10:25:17] -rw-r----- 1 oracle oinstall 1056768 May  9 10:25 /home/oracle/backup/T_10_1cu13qk9_1_1
      2 [2019-05-09 10:25:18] -rw-r----- 1 oracle oinstall 1056768 May  9 10:25 /home/oracle/backup/T_10_1cu13qk9_1_1
      2 [2019-05-09 10:25:19] -rw-r----- 1 oracle oinstall 2105344 May  9 10:25 /home/oracle/backup/T_10_1cu13qk9_1_1
      2 [2019-05-09 10:25:20] -rw-r----- 1 oracle oinstall 2105344 May  9 10:25 /home/oracle/backup/T_10_1cu13qk9_1_1
      2 [2019-05-09 10:25:21] -rw-r----- 1 oracle oinstall 2105344 May  9 10:25 /home/oracle/backup/T_10_1cu13qk9_1_1
      2 [2019-05-09 10:25:22] -rw-r----- 1 oracle oinstall 2105344 May  9 10:25 /home/oracle/backup/T_10_1cu13qk9_1_1
      1 [2019-05-09 10:25:23] -rw-r----- 1 oracle oinstall 2105344 May  9 10:25 /home/oracle/backup/T_10_1cu13qk9_1_1
--//这又看到另外的情况,当数据文件大于一定程度后,orcle备份方式生产的文件不再是接近数据文件大小.边界在哪里呢?
--//修改脚本延迟监测时间以及监测间隔.
$ cat  tt.sh
#! /bin/bash
file=$1
>| /tmp/xx_${file}
>| /tmp/yy_${file}
strace -ftt -x -o /tmp/tt_${file}.txt rman target / <<< "backup as compressed backupset datafile "$file" format \"/home/oracle/backup/T_"${file}"_%U\" ;" &
seq 30 | xargs -I{} echo "ls -l /home/oracle/backup/T_${file}_*;sleep 1" | bash 2>/dev/null| ts.awk >> /tmp/xx_${file} 2>/dev/null &
seq 30 | xargs -I{} echo "stat -c '%s %b %B' /home/oracle/backup/T_${file}_*;sleep 1" | bash  2>/dev/null | ts.awk >> /tmp/yy_${file} 2>/dev/null &
wait

--//采用不断尝试的方法最终确定:

SCOTT@book> ALTER DATABASE   DATAFILE '/mnt/ramdisk/book/t02.dbf' RESIZE 65512K;
Database altered.

SCOTT@book> select 64*1024-8*3 from dual ;
64*1024-8*3
-----------
      65512

--//也就是64M-3*8K 就出现这个现象.
--//注:自己有点不转弯,在测试63M,64M时,应该可以猜测应该是64M-3*8K.在这里浪费许多时间...
--//只要数据文件再增加8K,这个现象就消失,不会开始建立的备份文件文件与数据文件接近,并且是稀疏文件.

$ . tt.sh 10
Recovery Manager: Release 11.2.0.4.0 - Production on Thu May 9 10:46:27 2019
Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.
connected to target database: BOOK (DBID=1337401710)

RMAN>
Starting backup at 2019-05-09 10:46:30
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=170 device type=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: SID=184 device type=DISK
allocated channel: ORA_DISK_3
channel ORA_DISK_3: SID=198 device type=DISK
channel ORA_DISK_1: starting compressed full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00010 name=/mnt/ramdisk/book/t02.dbf
channel ORA_DISK_1: starting piece 1 at 2019-05-09 10:46:33
channel ORA_DISK_1: finished piece 1 at 2019-05-09 10:46:48
piece handle=/home/oracle/backup/T_10_1ku13rs9_1_1 tag=TAG20190509T104632 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:15
channel ORA_DISK_1: throttle time: 0:00:12
Finished backup at 2019-05-09 10:46:48
RMAN>
Recovery Manager complete.
[1]   Done                    strace -ftt -x -o /tmp/tt_${file}.txt rman target / <<< "backup as compressed backupset datafile "$file" format \"/home/oracle/backup/T_"${file}"_%U\" ;"
[2]-  Done                    seq 30 | xargs -I{} echo "ls -l /home/oracle/backup/T_${file}_*;sleep 1" | bash 2> /dev/null | ts.awk >> /tmp/xx_${file} 2> /dev/null
[3]+  Done                    seq 30 | xargs -I{} echo "stat -c '%s %b %B' /home/oracle/backup/T_${file}_*;sleep 1" | bash 2> /dev/null | ts.awk >> /tmp/yy_${file} 2> /dev/null

$ uniq -c /tmp/xx_10
      1 [2019-05-09 10:46:33] -rw-r----- 1 oracle oinstall 67117056 May  9 10:46 /home/oracle/backup/T_10_1ku13rs9_1_1
      1 [2019-05-09 10:46:34] -rw-r----- 1 oracle oinstall 67117056 May  9 10:46 /home/oracle/backup/T_10_1ku13rs9_1_1
      1 [2019-05-09 10:46:35] -rw-r----- 1 oracle oinstall 67117056 May  9 10:46 /home/oracle/backup/T_10_1ku13rs9_1_1
      1 [2019-05-09 10:46:36] -rw-r----- 1 oracle oinstall 67117056 May  9 10:46 /home/oracle/backup/T_10_1ku13rs9_1_1
      1 [2019-05-09 10:46:37] -rw-r----- 1 oracle oinstall 67117056 May  9 10:46 /home/oracle/backup/T_10_1ku13rs9_1_1
      1 [2019-05-09 10:46:38] -rw-r----- 1 oracle oinstall 67117056 May  9 10:46 /home/oracle/backup/T_10_1ku13rs9_1_1
      1 [2019-05-09 10:46:39] -rw-r----- 1 oracle oinstall 67117056 May  9 10:46 /home/oracle/backup/T_10_1ku13rs9_1_1
      1 [2019-05-09 10:46:40] -rw-r----- 1 oracle oinstall 67117056 May  9 10:46 /home/oracle/backup/T_10_1ku13rs9_1_1
      1 [2019-05-09 10:46:41] -rw-r----- 1 oracle oinstall 67117056 May  9 10:46 /home/oracle/backup/T_10_1ku13rs9_1_1
      1 [2019-05-09 10:46:42] -rw-r----- 1 oracle oinstall 67117056 May  9 10:46 /home/oracle/backup/T_10_1ku13rs9_1_1
      1 [2019-05-09 10:46:43] -rw-r----- 1 oracle oinstall 67117056 May  9 10:46 /home/oracle/backup/T_10_1ku13rs9_1_1
      1 [2019-05-09 10:46:44] -rw-r----- 1 oracle oinstall 67117056 May  9 10:46 /home/oracle/backup/T_10_1ku13rs9_1_1
      1 [2019-05-09 10:46:45] -rw-r----- 1 oracle oinstall 67117056 May  9 10:46 /home/oracle/backup/T_10_1ku13rs9_1_1
      1 [2019-05-09 10:46:46] -rw-r----- 1 oracle oinstall 2859008 May  9 10:46 /home/oracle/backup/T_10_1ku13rs9_1_1
      1 [2019-05-09 10:46:47] -rw-r----- 1 oracle oinstall 2859008 May  9 10:46 /home/oracle/backup/T_10_1ku13rs9_1_1
      1 [2019-05-09 10:46:48] -rw-r----- 1 oracle oinstall 2859008 May  9 10:46 /home/oracle/backup/T_10_1ku13rs9_1_1
      1 [2019-05-09 10:46:49] -rw-r----- 1 oracle oinstall 2859008 May  9 10:46 /home/oracle/backup/T_10_1ku13rs9_1_1
      1 [2019-05-09 10:46:50] -rw-r----- 1 oracle oinstall 2859008 May  9 10:46 /home/oracle/backup/T_10_1ku13rs9_1_1
      1 [2019-05-09 10:46:51] -rw-r----- 1 oracle oinstall 2859008 May  9 10:46 /home/oracle/backup/T_10_1ku13rs9_1_1
      1 [2019-05-09 10:46:53] -rw-r----- 1 oracle oinstall 2859008 May  9 10:46 /home/oracle/backup/T_10_1ku13rs9_1_1
      1 [2019-05-09 10:46:54] -rw-r----- 1 oracle oinstall 2859008 May  9 10:46 /home/oracle/backup/T_10_1ku13rs9_1_1
      1 [2019-05-09 10:46:55] -rw-r----- 1 oracle oinstall 2859008 May  9 10:46 /home/oracle/backup/T_10_1ku13rs9_1_1
      1 [2019-05-09 10:46:56] -rw-r----- 1 oracle oinstall 2859008 May  9 10:46 /home/oracle/backup/T_10_1ku13rs9_1_1
      1 [2019-05-09 10:46:57] -rw-r----- 1 oracle oinstall 2859008 May  9 10:46 /home/oracle/backup/T_10_1ku13rs9_1_1

$ ls -l /mnt/ramdisk/book/t02.dbf
-rw-r----- 1 oracle oinstall 67092480 2019-05-09 10:46:33 /mnt/ramdisk/book/t02.dbf
--//数据文件大小是 65512+8 = 65520K(包括OS头8k),65520*1024 = 67092480.
--//67117056 - 67092480 = 24576
--//24576/8192 = 3,也就是生成备份集文件大小是64M+8k= 64*1024*1024+8192 = 67117056
--//顺便讲一下我看了rman的压缩备份文件,我发现一个特点,位图区并不压缩.

$ uniq -c /tmp/yy_10
      1 [2019-05-09 10:46:33] 67117056 2072 512
      1 [2019-05-09 10:46:34] 67117056 2072 512
      1 [2019-05-09 10:46:35] 67117056 2072 512
      1 [2019-05-09 10:46:36] 67117056 2072 512
      1 [2019-05-09 10:46:37] 67117056 2072 512
      1 [2019-05-09 10:46:38] 67117056 4120 512
      1 [2019-05-09 10:46:39] 67117056 4120 512
      1 [2019-05-09 10:46:40] 67117056 4120 512
      1 [2019-05-09 10:46:41] 67117056 4120 512
      1 [2019-05-09 10:46:42] 67117056 4120 512
      1 [2019-05-09 10:46:43] 67117056 4120 512
      1 [2019-05-09 10:46:44] 67117056 4120 512
      1 [2019-05-09 10:46:45] 67117056 4120 512
      1 [2019-05-09 10:46:46] 2859008 5592 512
      1 [2019-05-09 10:46:47] 2859008 5592 512
      1 [2019-05-09 10:46:48] 2859008 5592 512
      1 [2019-05-09 10:46:49] 2859008 5592 512
      1 [2019-05-09 10:46:50] 2859008 5592 512
      1 [2019-05-09 10:46:51] 2859008 5592 512
      1 [2019-05-09 10:46:52] 2859008 5592 512
      1 [2019-05-09 10:46:53] 2859008 5592 512
      1 [2019-05-09 10:46:54] 2859008 5592 512
      1 [2019-05-09 10:46:55] 2859008 5592 512
      1 [2019-05-09 10:46:56] 2859008 5592 512

--//感觉还与rman的output buffer有关,rman有4个输出缓存,每个1M.

$ egrep "pwrite\(259|close\(259|pread\(261" /tmp/tt_10.txt | egrep -v '"\\x15\\xc2|\\x00\\xc2'
--//过滤egrep -v '"\\x15\\xc2|\\x00\\xc2'是控制文件.

36698 10:46:33.097624 close(259)        = 0
36698 10:46:33.163305 pread(261, "\x00\xa2\x00\x00\x00\x00\xc0\xff\x00\x00\x00\x00\x00\x00\x00\x00\x9b\xe5\x00\x00\x00\x20\x00\x00\xfd\x1f\x00\x00\x7d\x7c\x7b\x7a"..., 8192, 0) = 8192
36698 10:46:33.163385 pread(261, "\x00\xa2\x00\x00\x00\x00\xc0\xff\x00\x00\x00\x00\x00\x00\x00\x00\x9b\xe5\x00\x00\x00\x20\x00\x00\xfd\x1f\x00\x00\x7d\x7c\x7b\x7a"..., 8192, 0) = 8192
36698 10:46:33.163637 pread(261, "\x0b\xa2\x00\x00\x01\x00\x80\x02\x00\x00\x00\x00\x00\x00\x01\x04\x46\xd2\x00\x00\x00\x00\x00\x00\x00\x04\x20\x0b\x6e\x21\xb7\x4f"..., 1040384, 8192) = 1040384
36698 10:46:33.164208 pread(261, "\x20\xa2\x00\x00\x80\x00\x80\x02\x39\x4a\x84\x7d\x03\x00\x04\x04\x7a\xe0\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"..., 1048576, 1048576) = 1048576
36698 10:46:33.165452 pread(261, "\x20\xa2\x00\x00\x00\x01\x80\x02\x39\x4a\x84\x7d\x03\x00\x02\x04\x30\xe2\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"..., 1048576, 2097152) = 1048576
36698 10:46:33.166685 pread(261, "\x20\xa2\x00\x00\x80\x01\x80\x02\x39\x4a\x84\x7d\x03\x00\x02\x04\x32\xe2\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"..., 1048576, 3145728) = 1048576
36698 10:46:33.167927 pread(261, "\x20\xa2\x00\x00\x00\x02\x80\x02\x39\x4a\x84\x7d\x03\x00\x02\x04\x34\xe2\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"..., 1048576, 4194304) = 1048576
36698 10:46:33.169149 pread(261, "\x20\xa2\x00\x00\x80\x02\x80\x02\x39\x4a\x84\x7d\x03\x00\x02\x04\x36\xe2\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"..., 1048576, 5242880) = 1048576
36698 10:46:33.170374 pread(261, "\x20\xa2\x00\x00\x00\x03\x80\x02\x86\x4a\x84\x7d\x03\x00\x04\x04\x5e\x96\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"..., 1048576, 6291456) = 1048576
36698 10:46:33.171624 pread(261, "\x20\xa2\x00\x00\x80\x03\x80\x02\x86\x4a\x84\x7d\x03\x00\x02\x04\x94\x97\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"..., 1048576, 7340032) = 1048576
36698 10:46:33.172845 pread(261, "\x20\xa2\x00\x00\x00\x04\x80\x02\x86\x4a\x84\x7d\x03\x00\x02\x04\x96\x97\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"..., 1048576, 8388608) = 1048576
36698 10:46:33.174057 pread(261, "\x20\xa2\x00\x00\x80\x04\x80\x02\x86\x4a\x84\x7d\x03\x00\x02\x04\x90\x97\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"..., 1048576, 9437184) = 1048576
36698 10:46:33.175269 pread(261, "\x20\xa2\x00\x00\x00\x05\x80\x02\x86\x4a\x84\x7d\x03\x00\x02\x04\x92\x97\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"..., 1048576, 10485760) = 1048576
36698 10:46:33.176554 pread(261, "\x20\xa2\x00\x00\x80\x05\x80\x02\xba\x4a\x84\x7d\x03\x00\x04\x04\xaa\x97\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"..., 1048576, 11534336) = 1048576
36698 10:46:33.177782 pread(261, "\x20\xa2\x00\x00\x00\x06\x80\x02\xba\x4a\x84\x7d\x03\x00\x02\x04\xe0\x90\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"..., 1048576, 12582912) = 1048576
36698 10:46:33.178994 pread(261, "\x20\xa2\x00\x00\x80\x06\x80\x02\xba\x4a\x84\x7d\x03\x00\x02\x04\xe2\x90\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"..., 1048576, 13631488) = 1048576
36698 10:46:33.180217 pread(261, "\x20\xa2\x00\x00\x00\x07\x80\x02\xba\x4a\x84\x7d\x03\x00\x02\x04\xe4\x90\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"..., 1048576, 14680064) = 1048576
36698 10:46:33.181433 pread(261, "\x20\xa2\x00\x00\x80\x07\x80\x02\xba\x4a\x84\x7d\x03\x00\x02\x04\xe6\x90\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"..., 1048576, 15728640) = 1048576
36698 10:46:33.184438 pread(261, "\x20\xa2\x00\x00\x00\x08\x80\x02\xef\x4a\x84\x7d\x03\x00\x04\x04\xbd\x97\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"..., 1048576, 16777216) = 1048576
36698 10:46:33.185021 pwrite(259, "\x13\xa2\x00\x00\x01\x00\x00\x00\x05\x56\x84\x7d\x03\x00\x01\x04\xd3\x5e\x00\x00\x00\x04\x20\x0b\x00\x04\x20\x0b\x6e\x21\xb7\x4f"..., 1048576, 8192) = 1048576
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
36698 10:46:34.224895 pread(261, "\x20\xa2\x00\x00\x80\x08\x80\x02\xef\x4a\x84\x7d\x03\x00\x02\x04\x77\x9d\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"..., 1048576, 17825792) = 1048576
36698 10:46:34.260169 pread(261, "\x20\xa2\x00\x00\x00\x09\x80\x02\xef\x4a\x84\x7d\x03\x00\x02\x04\x75\x9d\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"..., 1048576, 18874368) = 1048576
36698 10:46:34.295845 pread(261, "\x20\xa2\x00\x00\x80\x09\x80\x02\xef\x4a\x84\x7d\x03\x00\x02\x04\x73\x9d\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"..., 1048576, 19922944) = 1048576
36698 10:46:34.331109 pread(261, "\x20\xa2\x00\x00\x00\x0a\x80\x02\xef\x4a\x84\x7d\x03\x00\x02\x04\x71\x9d\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"..., 1048576, 20971520) = 1048576
36698 10:46:34.332389 pread(261, "\x20\xa2\x00\x00\x80\x0a\x80\x02\x23\x4b\x84\x7d\x03\x00\x04\x04\x22\xe0\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"..., 1048576, 22020096) = 1048576
36698 10:46:35.368528 pread(261, "\x20\xa2\x00\x00\x00\x0b\x80\x02\x23\x4b\x84\x7d\x03\x00\x02\x04\x68\xe8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"..., 1048576, 23068672) = 1048576
36698 10:46:35.404228 pread(261, "\x20\xa2\x00\x00\x80\x0b\x80\x02\x23\x4b\x84\x7d\x03\x00\x02\x04\x6a\xe8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"..., 1048576, 24117248) = 1048576
36698 10:46:35.439582 pread(261, "\x20\xa2\x00\x00\x00\x0c\x80\x02\x23\x4b\x84\x7d\x03\x00\x02\x04\x6c\xe8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"..., 1048576, 25165824) = 1048576
36698 10:46:35.474894 pread(261, "\x20\xa2\x00\x00\x80\x0c\x80\x02\x23\x4b\x84\x7d\x03\x00\x02\x04\x6e\xe8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"..., 1048576, 26214400) = 1048576
36698 10:46:35.510190 pread(261, "\x20\xa2\x00\x00\x00\x0d\x80\x02\x58\x4b\x84\x7d\x03\x00\x04\x04\xac\x97\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"..., 1048576, 27262976) = 1048576
36698 10:46:36.546546 pread(261, "\x20\xa2\x00\x00\x80\x0d\x80\x02\x58\x4b\x84\x7d\x03\x00\x02\x04\x66\x98\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"..., 1048576, 28311552) = 1048576
36698 10:46:36.581819 pread(261, "\x20\xa2\x00\x00\x00\x0e\x80\x02\x58\x4b\x84\x7d\x03\x00\x02\x04\x64\x98\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"..., 1048576, 29360128) = 1048576
36698 10:46:36.617296 pread(261, "\x20\xa2\x00\x00\x80\x0e\x80\x02\x58\x4b\x84\x7d\x03\x00\x02\x04\x62\x98\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"..., 1048576, 30408704) = 1048576
36698 10:46:36.646622 pread(261, "\x20\xa2\x00\x00\x00\x0f\x80\x02\x58\x4b\x84\x7d\x03\x00\x02\x04\x60\x98\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"..., 1048576, 31457280) = 1048576
36698 10:46:36.663066 pread(261, "\x20\xa2\x00\x00\x80\x0f\x80\x02\x8f\x4b\x84\x7d\x03\x00\x04\x04\x55\x96\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"..., 1048576, 32505856) = 1048576
36698 10:46:37.698958 pread(261, "\x20\xa2\x00\x00\x00\x10\x80\x02\x8f\x4b\x84\x7d\x03\x00\x02\x04\x1f\x9b\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"..., 1048576, 33554432) = 1048576
36698 10:46:37.734314 pread(261, "\x20\xa2\x00\x00\x80\x10\x80\x02\x8f\x4b\x84\x7d\x03\x00\x02\x04\x1d\x9b\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"..., 1048576, 34603008) = 1048576
36698 10:46:37.770135 pread(261, "\x20\xa2\x00\x00\x00\x11\x80\x02\x8f\x4b\x84\x7d\x03\x00\x02\x04\x1b\x9b\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"..., 1048576, 35651584) = 1048576
36698 10:46:37.805641 pread(261, "\x20\xa2\x00\x00\x80\x11\x80\x02\x8f\x4b\x84\x7d\x03\x00\x02\x04\x19\x9b\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"..., 1048576, 36700160) = 1048576
36698 10:46:37.841105 pread(261, "\x00\xa2\x00\x00\xf8\x1f\x80\x02\x00\x00\x00\x00\x00\x00\x01\x05\x78\xba\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"..., 49152, 67043328) = 49152
36698 10:46:38.877862 pwrite(259, "\x38\xa2\x00\x00\x81\x00\x40\x00\x05\x56\x84\x7d\x03\x00\x01\x04\xd7\x67\x00\x00\x4b\x47\x43\x80\x01\x48\x44\x52\x4a\x31\x20\xa2"..., 1048576, 1056768) = 1048576
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
36698 10:46:46.253197 pwrite(259, "\x38\xa2\x00\x00\x81\x00\x40\x00\x05\x56\x84\x7d\x03\x00\x01\x04\x26\xf1\x00\x00\x85\x61\x58\x56\x15\x85\x61\x58\x56\x15\x85\x61"..., 753664, 2105344) = 753664
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
36698 10:46:46.257606 close(259)        = 0
36685 10:46:48.294566 close(259)        = 0
36685 10:46:48.338566 close(259)        = 0
36685 10:46:48.345322 close(259)        = 0
36685 10:46:48.459072 pread(261, "\x0b\xa2\x00\x00\x01\x00\x80\x00\x00\x00\x00\x00\x00\x00\x01\x04\xcd\xf4\x00\x00\x00\x00\x00\x00\x00\x04\x20\x0b\x6e\x21\xb7\x4f"..., 8192, 8192) = 8192
36685 10:46:48.607071 close(259)        = 0
--//注意看下划写的写入时间.与前面stat的输出对比blocks的变换.
--//2072*512 = 1060864,参考http://blog.itpub.net/267265/viewspace-2641011/=>[20190411]linux stat 命令疑问.txt
--//实际上大小还有减去4096(这块是间接块). 1060864-4096 = 1056768,
--//文件大小是1048576+8192 = 1056768,注意8192是偏移量是备份集的OS文件头.
--//(4120-2072)*512 = 1048576
--//(5592 - 4120)*512 = 753664
--//写入量与stat的输出监测一致.

--//可以猜测rman压缩备份的大致步骤:
--//input buffer => compress => output buffer => write file.输出缓存到1M后写入备份文件.
--//不大可能如下:
--//input buffer => output buffer => compress => write file.因为这样每次的写入量大小不一致.当然这个是我的猜测.

6.bbed观察备份文件:
BBED> info
 File#  Name                                  Size(blks)
 -----  ----                                  ----------
     9  /mnt/ramdisk/book/t02.dbf                    0
    10  /mnt/ramdisk/book/t02.dbf                    0
   100  /home/oracle/backup/T_10_1ku13rs9_1_1        0

--//发现位图区并不压缩.
$ seq 1 349   | xargs -I{} echo "dump /v dba 100,{} count 4 offset 0" | rlbbed | grep a20000 |  uniq -c | cut -c1-20
      1  13a20000
      1  14a20000
      1  1da20000
    125  1ea20000
    219  38a20000
      1  37a20000

 $ seq 129   | xargs -I{} echo "dump /v dba 10,{} count 4 offset 0" | rlbbed | grep a20000 |  uniq -c | cut -c1-20
      1  0ba20000
      1  1da20000
    125  1ea20000
      1  20a20000
      1  21a20000

--//可以发现位图区开始信息都没有变.开头还是0x1ea20000,而且备份文件与数据文件存在1个块的偏移.备份集文件位图区前面正好是3*8K.(我测
--//试备份文件集仅仅1个数据文件的情况,其它我没有测试)
--//备份压缩开始数据块头都是0x38a20000,结尾是0x37a20000.

7.附上增加8K的测试情况:
SCOTT@book> ALTER DATABASE   DATAFILE '/mnt/ramdisk/book/t02.dbf' RESIZE 65520K;
Database altered.

$ . tt.sh 10
Recovery Manager: Release 11.2.0.4.0 - Production on Thu May 9 11:38:45 2019
Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.
connected to target database: BOOK (DBID=1337401710)

RMAN>
Starting backup at 2019-05-09 11:38:47
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=170 device type=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: SID=184 device type=DISK
allocated channel: ORA_DISK_3
channel ORA_DISK_3: SID=198 device type=DISK
channel ORA_DISK_1: starting compressed full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00010 name=/mnt/ramdisk/book/t02.dbf
channel ORA_DISK_1: starting piece 1 at 2019-05-09 11:38:50
channel ORA_DISK_1: finished piece 1 at 2019-05-09 11:39:05
piece handle=/home/oracle/backup/T_10_1lu13uua_1_1 tag=TAG20190509T113850 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:15
channel ORA_DISK_1: throttle time: 0:00:12
Finished backup at 2019-05-09 11:39:05
RMAN>
Recovery Manager complete.
[1]   Done                    strace -ftt -x -o /tmp/tt_${file}.txt rman target / <<< "backup as compressed backupset datafile "$file" format \"/home/oracle/backup/T_"${file}"_%U\" ;"
[2]-  Done                    seq 30 | xargs -I{} echo "ls -l /home/oracle/backup/T_${file}_*;sleep 1" | bash 2> /dev/null | ts.awk >> /tmp/xx_${file} 2> /dev/null
[3]+  Done                    seq 30 | xargs -I{} echo "stat -c '%s %b %B' /home/oracle/backup/T_${file}_*;sleep 1" | bash 2> /dev/null | ts.awk >> /tmp/yy_${file} 2> /dev/null

$ uniq -c /tmp/xx_10
      1 [2019-05-09 11:38:51] -rw-r----- 1 oracle oinstall 1056768 May  9 11:38 /home/oracle/backup/T_10_1lu13uua_1_1
      1 [2019-05-09 11:38:52] -rw-r----- 1 oracle oinstall 1056768 May  9 11:38 /home/oracle/backup/T_10_1lu13uua_1_1
      1 [2019-05-09 11:38:53] -rw-r----- 1 oracle oinstall 1056768 May  9 11:38 /home/oracle/backup/T_10_1lu13uua_1_1
      1 [2019-05-09 11:38:54] -rw-r----- 1 oracle oinstall 1056768 May  9 11:38 /home/oracle/backup/T_10_1lu13uua_1_1
      1 [2019-05-09 11:38:55] -rw-r----- 1 oracle oinstall 1056768 May  9 11:38 /home/oracle/backup/T_10_1lu13uua_1_1
      1 [2019-05-09 11:38:56] -rw-r----- 1 oracle oinstall 2105344 May  9 11:38 /home/oracle/backup/T_10_1lu13uua_1_1
      1 [2019-05-09 11:38:57] -rw-r----- 1 oracle oinstall 2105344 May  9 11:38 /home/oracle/backup/T_10_1lu13uua_1_1
      1 [2019-05-09 11:38:58] -rw-r----- 1 oracle oinstall 2105344 May  9 11:38 /home/oracle/backup/T_10_1lu13uua_1_1
      1 [2019-05-09 11:38:59] -rw-r----- 1 oracle oinstall 2105344 May  9 11:38 /home/oracle/backup/T_10_1lu13uua_1_1
      1 [2019-05-09 11:39:00] -rw-r----- 1 oracle oinstall 2105344 May  9 11:38 /home/oracle/backup/T_10_1lu13uua_1_1
      1 [2019-05-09 11:39:01] -rw-r----- 1 oracle oinstall 2105344 May  9 11:38 /home/oracle/backup/T_10_1lu13uua_1_1
      1 [2019-05-09 11:39:02] -rw-r----- 1 oracle oinstall 2105344 May  9 11:38 /home/oracle/backup/T_10_1lu13uua_1_1
      1 [2019-05-09 11:39:03] -rw-r----- 1 oracle oinstall 2105344 May  9 11:38 /home/oracle/backup/T_10_1lu13uua_1_1
      1 [2019-05-09 11:39:04] -rw-r----- 1 oracle oinstall 2867200 May  9 11:39 /home/oracle/backup/T_10_1lu13uua_1_1
      1 [2019-05-09 11:39:05] -rw-r----- 1 oracle oinstall 2867200 May  9 11:39 /home/oracle/backup/T_10_1lu13uua_1_1
      1 [2019-05-09 11:39:06] -rw-r----- 1 oracle oinstall 2867200 May  9 11:39 /home/oracle/backup/T_10_1lu13uua_1_1
      1 [2019-05-09 11:39:07] -rw-r----- 1 oracle oinstall 2867200 May  9 11:39 /home/oracle/backup/T_10_1lu13uua_1_1
      1 [2019-05-09 11:39:08] -rw-r----- 1 oracle oinstall 2867200 May  9 11:39 /home/oracle/backup/T_10_1lu13uua_1_1
      1 [2019-05-09 11:39:09] -rw-r----- 1 oracle oinstall 2867200 May  9 11:39 /home/oracle/backup/T_10_1lu13uua_1_1
      1 [2019-05-09 11:39:10] -rw-r----- 1 oracle oinstall 2867200 May  9 11:39 /home/oracle/backup/T_10_1lu13uua_1_1
      1 [2019-05-09 11:39:11] -rw-r----- 1 oracle oinstall 2867200 May  9 11:39 /home/oracle/backup/T_10_1lu13uua_1_1
      1 [2019-05-09 11:39:12] -rw-r----- 1 oracle oinstall 2867200 May  9 11:39 /home/oracle/backup/T_10_1lu13uua_1_1
      1 [2019-05-09 11:39:13] -rw-r----- 1 oracle oinstall 2867200 May  9 11:39 /home/oracle/backup/T_10_1lu13uua_1_1
      1 [2019-05-09 11:39:14] -rw-r----- 1 oracle oinstall 2867200 May  9 11:39 /home/oracle/backup/T_10_1lu13uua_1_1

$ uniq -c /tmp/yy_10
      1 [2019-05-09 11:38:51] 1056768 2072 512
      1 [2019-05-09 11:38:52] 1056768 2072 512
      1 [2019-05-09 11:38:53] 1056768 2072 512
      1 [2019-05-09 11:38:54] 1056768 2072 512
      1 [2019-05-09 11:38:55] 1056768 2072 512
      1 [2019-05-09 11:38:56] 2105344 4120 512
      1 [2019-05-09 11:38:57] 2105344 4120 512
      1 [2019-05-09 11:38:58] 2105344 4120 512
      1 [2019-05-09 11:38:59] 2105344 4120 512
      1 [2019-05-09 11:39:00] 2105344 4120 512
      1 [2019-05-09 11:39:01] 2105344 4120 512
      1 [2019-05-09 11:39:02] 2105344 4120 512
      1 [2019-05-09 11:39:03] 2105344 4120 512
      1 [2019-05-09 11:39:04] 2867200 5608 512
      1 [2019-05-09 11:39:05] 2867200 5608 512
      1 [2019-05-09 11:39:06] 2867200 5608 512
      1 [2019-05-09 11:39:07] 2867200 5608 512
      1 [2019-05-09 11:39:08] 2867200 5608 512
      1 [2019-05-09 11:39:09] 2867200 5608 512
      1 [2019-05-09 11:39:10] 2867200 5608 512
      1 [2019-05-09 11:39:11] 2867200 5608 512
      1 [2019-05-09 11:39:12] 2867200 5608 512
      1 [2019-05-09 11:39:13] 2867200 5608 512
      1 [2019-05-09 11:39:14] 2867200 5608 512

7.总结:
--//1.当小数据文件备份时(8K数据块)(备份集1个数据文件的情况),大小小于等于64M-3*8K时,开始备份生成的备份集文件大小等于数据
--//文件大小(包括OS块)+3*8K.
--//2.我没有测试一个备份集包含多个文件的情况.
--//3.oracle为什么这样设计小数据文件的备份方式,也看不出有什么优势啊...

posted @ 2019-05-09 15:27  lfree  阅读(231)  评论(0编辑  收藏  举报