[20190509]rman備份的疑問5.txt

lfree發表於2019-05-09

[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為什麼這樣設計小資料檔案的備份方式,也看不出有什麼優勢啊...


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

相關文章