[20171129]rman input memory buffer 4.txt

lfree發表於2017-11-29

[20171129]rman input memory buffer 4.txt

--//Input Memory Buffers如何測試,不清楚.不過找到一本電子書.摘要如下:

Oracle RMAN 11g Backup and Recovery.pdf

作者:Robert G. Freeman Matthew Hart
頁數:689
出版社:Mc graw hill
出版號: ISBN: 978-0-07-162861-7
        MHID: 0-07-162861-4

RMAN in Memory P80

    RMAN builds buffers in memory through which it streams data blocks for potential backup. This
memory utilization counts against the total size of the PGA and, sometimes, the SGA. There are
two kinds of memory buffers. Input buffers are the buffers that are filled with data blocks read
from files that are being backed up. Output buffers are the buffers that are filled when the
memory-to-memory write occurs to determine whether a particular block needs to be backed up.
When the output buffer is filled, it is written to the backup location. The memory buffers differ
depending on whether you are backing up to or restoring from disk or tape. Figure 2-3 illustrates
input and output buffer allocation. It illustrates a backup of two datafiles being multiplexed into
a single backup set.
       
Input Memory Buffers

    When you are backing up the database, the size and number of input memory buffers depend on
the exact backup command being executed. Primarily, they depend on the number of files being
multiplexed into a single backup. Multiplexing refers to the number of files that will have their
blocks backed up to the same backup piece. To keep the memory allocation within reason, the
following rules are applied to the memory buffer sizes based on the number of files being backed
up together:

■ If the number of files going into the backup set is four or less, then RMAN allocates four
   buffers per file at 1MB per buffer. The total will be 16MB or less.
■ If the number of files going into the backup set is greater than four, but no greater than
   eight, then each file gets four buffers, each of 512KB. This ensures that the total remains
   at 16MB or less.
■ If the number of files being multiplexed is greater than eight, then RMAN allocates four
   buffers of size 128KB. This ensures that each file being backed up will account for 512KB
   of buffer memory.

--//可以想像如果輸入快取如果全部寫入輸出快取,透過輸出檔案寫到備份集中的資料分佈,也能猜測出輸入快取大小.
--//我在11g備份9個資料檔案在一個備份集合看到的input memory buffer = 512K.而不是128K,而且最後備份t09表空間對應的資料檔案.
--//我在10g下重複測試:

1.環境:
SYS@test> @ &r/ver1

PORT_STRING                    VERSION        BANNER
------------------------------ -------------- ----------------------------------------------------------------
x86_64/Linux 2.4.xx            10.2.0.4.0     Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi

CREATE TABLESPACE T01 DATAFILE '/mnt/ramdisk/test/T01.dbf' SIZE 6M AUTOEXTEND OFF LOGGING ONLINE EXTENT MANAGEMENT LOCAL AUTOALLOCATE BLOCKSIZE 8K SEGMENT SPACE MANAGEMENT AUTO FLASHBACK ON;
CREATE TABLESPACE T02 DATAFILE '/mnt/ramdisk/test/T02.dbf' SIZE 6M AUTOEXTEND OFF LOGGING ONLINE EXTENT MANAGEMENT LOCAL AUTOALLOCATE BLOCKSIZE 8K SEGMENT SPACE MANAGEMENT AUTO FLASHBACK ON;
CREATE TABLESPACE T03 DATAFILE '/mnt/ramdisk/test/T03.dbf' SIZE 6M AUTOEXTEND OFF LOGGING ONLINE EXTENT MANAGEMENT LOCAL AUTOALLOCATE BLOCKSIZE 8K SEGMENT SPACE MANAGEMENT AUTO FLASHBACK ON;
CREATE TABLESPACE T04 DATAFILE '/mnt/ramdisk/test/T04.dbf' SIZE 6M AUTOEXTEND OFF LOGGING ONLINE EXTENT MANAGEMENT LOCAL AUTOALLOCATE BLOCKSIZE 8K SEGMENT SPACE MANAGEMENT AUTO FLASHBACK ON;
CREATE TABLESPACE T05 DATAFILE '/mnt/ramdisk/test/T05.dbf' SIZE 6M AUTOEXTEND OFF LOGGING ONLINE EXTENT MANAGEMENT LOCAL AUTOALLOCATE BLOCKSIZE 8K SEGMENT SPACE MANAGEMENT AUTO FLASHBACK ON;
CREATE TABLESPACE T06 DATAFILE '/mnt/ramdisk/test/T06.dbf' SIZE 6M AUTOEXTEND OFF LOGGING ONLINE EXTENT MANAGEMENT LOCAL AUTOALLOCATE BLOCKSIZE 8K SEGMENT SPACE MANAGEMENT AUTO FLASHBACK ON;
CREATE TABLESPACE T07 DATAFILE '/mnt/ramdisk/test/T07.dbf' SIZE 6M AUTOEXTEND OFF LOGGING ONLINE EXTENT MANAGEMENT LOCAL AUTOALLOCATE BLOCKSIZE 8K SEGMENT SPACE MANAGEMENT AUTO FLASHBACK ON;
CREATE TABLESPACE T08 DATAFILE '/mnt/ramdisk/test/T08.dbf' SIZE 6M AUTOEXTEND OFF LOGGING ONLINE EXTENT MANAGEMENT LOCAL AUTOALLOCATE BLOCKSIZE 8K SEGMENT SPACE MANAGEMENT AUTO FLASHBACK ON;
CREATE TABLESPACE T09 DATAFILE '/mnt/ramdisk/test/T09.dbf' SIZE 6M AUTOEXTEND OFF LOGGING ONLINE EXTENT MANAGEMENT LOCAL AUTOALLOCATE BLOCKSIZE 8K SEGMENT SPACE MANAGEMENT AUTO FLASHBACK ON;
CREATE TABLESPACE T10 DATAFILE '/mnt/ramdisk/test/T10.dbf' SIZE 6M AUTOEXTEND OFF LOGGING ONLINE EXTENT MANAGEMENT LOCAL AUTOALLOCATE BLOCKSIZE 8K SEGMENT SPACE MANAGEMENT AUTO FLASHBACK ON;

create table t01 tablespace t01 as select rownum id ,lpad('A',32,'A') name from dual connect by level<=1e5;
create table t02 tablespace t02 as select rownum id ,lpad('B',32,'B') name from dual connect by level<=1e5;
create table t03 tablespace t03 as select rownum id ,lpad('C',32,'C') name from dual connect by level<=1e5;
create table t04 tablespace t04 as select rownum id ,lpad('D',32,'D') name from dual connect by level<=1e5;
create table t05 tablespace t05 as select rownum id ,lpad('E',32,'E') name from dual connect by level<=1e5;
create table t06 tablespace t06 as select rownum id ,lpad('F',32,'F') name from dual connect by level<=1e5;
create table t07 tablespace t07 as select rownum id ,lpad('G',32,'G') name from dual connect by level<=1e5;
create table t08 tablespace t08 as select rownum id ,lpad('H',32,'H') name from dual connect by level<=1e5;
create table t09 tablespace t09 as select rownum id ,lpad('I',32,'I') name from dual connect by level<=1e5;
create table t10 tablespace t10 as select rownum id ,lpad('J',32,'J') name from dual connect by level<=1e5;
alter system checkpoint;
alter system checkpoint;

2.測試:

RMAN> CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET;

new RMAN configuration parameters:
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET;
new RMAN configuration parameters are successfully stored

RMAN> report schema;

Report of database schema

List of Permanent Datafiles
===========================
File Size(MB) Tablespace           RB segs Datafile Name
---- -------- -------------------- ------- ------------------------
1    510      SYSTEM               ***     /mnt/ramdisk/test/system01.dbf
2    350      UNDOTBS1             ***     /mnt/ramdisk/test/undotbs01.dbf
3    380      SYSAUX               ***     /mnt/ramdisk/test/sysaux01.dbf
4    100      USERS                ***     /mnt/ramdisk/test/users01.dbf
5    100      EXAMPLE              ***     /mnt/ramdisk/test/example01.dbf
6    15       MSSM                 ***     /mnt/ramdisk/test/mssm01.dbf
7    6        T01                  ***     /mnt/ramdisk/test/T01.dbf
8    6        T02                  ***     /mnt/ramdisk/test/T02.dbf
9    6        T03                  ***     /mnt/ramdisk/test/T03.dbf
10   6        T04                  ***     /mnt/ramdisk/test/T04.dbf
11   6        T05                  ***     /mnt/ramdisk/test/T05.dbf
12   6        T06                  ***     /mnt/ramdisk/test/T06.dbf
13   6        T07                  ***     /mnt/ramdisk/test/T07.dbf
14   6        T08                  ***     /mnt/ramdisk/test/T08.dbf
15   6        T09                  ***     /mnt/ramdisk/test/T09.dbf
16   6        T10                  ***     /mnt/ramdisk/test/T10.dbf

List of Temporary Files
=======================
File Size(MB) Tablespace           Maxsize(MB) Tempfile Name
---- -------- -------------------- ----------- --------------------
1    18       TEMP                 32767       /mnt/ramdisk/test/test01.dbf


RMAN> backup datafile 7,8,9,10,11,12,13,14,15,16 filesperset 10 format '/home/oracle/backup/t123456789A_%U';
Starting backup at 2017-11-29 10:43:27
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00007 name=/mnt/ramdisk/test/T01.dbf
input datafile fno=00008 name=/mnt/ramdisk/test/T02.dbf
input datafile fno=00009 name=/mnt/ramdisk/test/T03.dbf
input datafile fno=00010 name=/mnt/ramdisk/test/T04.dbf
input datafile fno=00011 name=/mnt/ramdisk/test/T05.dbf
input datafile fno=00012 name=/mnt/ramdisk/test/T06.dbf
input datafile fno=00013 name=/mnt/ramdisk/test/T07.dbf
input datafile fno=00014 name=/mnt/ramdisk/test/T08.dbf
input datafile fno=00015 name=/mnt/ramdisk/test/T09.dbf
input datafile fno=00016 name=/mnt/ramdisk/test/T10.dbf
channel ORA_DISK_1: starting piece 1 at 2017-11-29 10:43:28
channel ORA_DISK_1: finished piece 1 at 2017-11-29 10:43:29
piece handle=/home/oracle/backup/t123456789A_1jskp9ug_1_1 tag=TAG20171129T104327 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 2017-11-29 10:43:29

$ strings t123456789A_1jskp9ug_1_1 | egrep "AAAAA|BBBBB|CCCCC|DDDDD|EEEEE|FFFFF|GGGGG|HHHHH|IIIII|JJJJJ" | cut -c11-20 | uniq -c
   8430 AAAAAAAAAA
   8430 BBBBBBBBBB
   8430 CCCCCCCCCC
   8430 DDDDDDDDDD
   8430 EEEEEEEEEE
   8430 FFFFFFFFFF
   8430 GGGGGGGGGG
   8430 HHHHHHHHHH
  10116 AAAAAAAAAA
  10116 BBBBBBBBBB
  10116 CCCCCCCCCC
  10116 DDDDDDDDDD
  10116 EEEEEEEEEE
  10116 FFFFFFFFFF
  10116 GGGGGGGGGG
  10116 HHHHHHHHHH
  10416 AAAAAAAAAA
  10416 BBBBBBBBBB
  10416 CCCCCCCCCC
  10416 DDDDDDDDDD
  10416 EEEEEEEEEE
  10416 FFFFFFFFFF
  10416 GGGGGGGGGG
  10416 HHHHHHHHHH
  10752 AAAAAAAAAA
  10752 BBBBBBBBBB
  10752 CCCCCCCCCC
  10752 DDDDDDDDDD
  10752 EEEEEEEEEE
  10752 FFFFFFFFFF
  10752 GGGGGGGGGG
  10752 HHHHHHHHHH
  10416 AAAAAAAAAA
  10416 BBBBBBBBBB
  10416 CCCCCCCCCC
  10416 DDDDDDDDDD
  10416 EEEEEEEEEE
  10416 FFFFFFFFFF
  10416 GGGGGGGGGG
  10416 HHHHHHHHHH
  10752 AAAAAAAAAA
  10752 BBBBBBBBBB
  10752 CCCCCCCCCC
  10752 DDDDDDDDDD
  10752 EEEEEEEEEE
  10752 FFFFFFFFFF
  10752 GGGGGGGGGG
  10752 HHHHHHHHHH
  10416 AAAAAAAAAA
  10416 BBBBBBBBBB
  10416 CCCCCCCCCC
  10416 DDDDDDDDDD
  10416 EEEEEEEEEE
  10416 FFFFFFFFFF
  10416 GGGGGGGGGG
  10416 HHHHHHHHHH
  10752 AAAAAAAAAA
  10752 BBBBBBBBBB
  10752 CCCCCCCCCC
  10752 DDDDDDDDDD
  10752 EEEEEEEEEE
  10752 FFFFFFFFFF
  10752 GGGGGGGGGG
  10752 HHHHHHHHHH
  10416 AAAAAAAAAA
  10416 BBBBBBBBBB
  10416 CCCCCCCCCC
  10416 DDDDDDDDDD
  10416 EEEEEEEEEE
  10416 FFFFFFFFFF
  10416 GGGGGGGGGG
  10416 HHHHHHHHHH
   7534 AAAAAAAAAA
   7534 BBBBBBBBBB
   7534 CCCCCCCCCC
   7534 DDDDDDDDDD
   7534 EEEEEEEEEE
   7534 FFFFFFFFFF
   7534 GGGGGGGGGG
   7534 HHHHHHHHHH
--//也是先解決8個,繼續.看來我理解錯誤.
   8430 IIIIIIIIII
   8430 JJJJJJJJJJ
  10116 IIIIIIIIII
  10116 JJJJJJJJJJ
  10416 IIIIIIIIII
  10416 JJJJJJJJJJ
  10752 IIIIIIIIII
  10752 JJJJJJJJJJ
  10416 IIIIIIIIII
  10416 JJJJJJJJJJ
  10752 IIIIIIIIII
  10752 JJJJJJJJJJ
  10416 IIIIIIIIII
  10416 JJJJJJJJJJ
  10752 IIIIIIIIII
  10752 JJJJJJJJJJ
  10416 IIIIIIIIII
  10416 JJJJJJJJJJ
   7534 IIIIIIIIII
   7534 JJJJJJJJJJ

$ strings t123456789A_1jskp9ug_1_1 | egrep "AAAAA|BBBBB|CCCCC|DDDDD|EEEEE|FFFFF|GGGGG|HHHHH|IIIII|JJJJJ" | cut -c11-20 | uniq -c | grep "IIIII"
   8430 IIIIIIIIII
  10116 IIIIIIIIII
  10416 IIIIIIIIII
  10752 IIIIIIIIII
  10416 IIIIIIIIII
  10752 IIIIIIIIII
  10416 IIIIIIIIII
  10752 IIIIIIIIII
  10416 IIIIIIIIII
   7534 IIIIIIIIII

$ strings t123456789A_1jskp9ug_1_1 | egrep "AAAAA|BBBBB|CCCCC|DDDDD|EEEEE|FFFFF|GGGGG|HHHHH|IIIII|JJJJJ" | cut -c11-20 | uniq -c | grep "AAAAA"
   8430 AAAAAAAAAA
  10116 AAAAAAAAAA
  10416 AAAAAAAAAA
  10752 AAAAAAAAAA
  10416 AAAAAAAAAA
  10752 AAAAAAAAAA
  10416 AAAAAAAAAA
  10752 AAAAAAAAAA
  10416 AAAAAAAAAA
   7534 AAAAAAAAAA

--//備份集合大於8個,先備份8個資料檔案,輸入快取512K.繼續解決...,如此迴圈.
--//不過從數量上看讀512K(64塊)

SYS@test> column PARTITION_NAME noprint
SYS@test> select * from dba_extents where owner=user and segment_name in ('T01');
OWNER  SEGMENT_NAME SEGMENT_TYPE TABLESPACE_NAME EXTENT_ID      FILE_ID     BLOCK_ID        BYTES       BLOCKS RELATIVE_FNO
------ ------------ ------------ --------------- --------- ------------ ------------ ------------ ------------ ------------
SYS    T01          TABLE        T01                     0            7            9        65536            8            7
SYS    T01          TABLE        T01                     1            7           17        65536            8            7
SYS    T01          TABLE        T01                     2            7           25        65536            8            7
SYS    T01          TABLE        T01                     3            7           33        65536            8            7
SYS    T01          TABLE        T01                     4            7           41        65536            8            7
SYS    T01          TABLE        T01                     5            7           49        65536            8            7
SYS    T01          TABLE        T01                     6            7           57        65536            8            7
SYS    T01          TABLE        T01                     7            7           65        65536            8            7
SYS    T01          TABLE        T01                     8            7           73        65536            8            7
SYS    T01          TABLE        T01                     9            7           81        65536            8            7
SYS    T01          TABLE        T01                    10            7           89        65536            8            7
SYS    T01          TABLE        T01                    11            7           97        65536            8            7
SYS    T01          TABLE        T01                    12            7          105        65536            8            7
SYS    T01          TABLE        T01                    13            7          113        65536            8            7
SYS    T01          TABLE        T01                    14            7          121        65536            8            7
SYS    T01          TABLE        T01                    15            7          129        65536            8            7
SYS    T01          TABLE        T01                    16            7          137      1048576          128            7
SYS    T01          TABLE        T01                    17            7          265      1048576          128            7
SYS    T01          TABLE        T01                    18            7          393      1048576          128            7
SYS    T01          TABLE        T01                    19            7          521      1048576          128            7
20 rows selected.
--//不小心建立schema=sys.
--//不過有1個細節注意10g的前面8塊是os,檔案頭,以及點陣圖區.而11g前面1M是os,檔案頭,以及點陣圖區.不是正好對齊.
--//也就是 9-63塊的內容對於的"AAAA"數量是8430.
SYS@test> select count(*) from t01 where DBMS_ROWID.ROWID_BLOCK_NUMBER (rowid) between 9 and 63 ;
    COUNT(*)
------------
        8430

SELECT    'select count(*) from t01 where DBMS_ROWID.ROWID_BLOCK_NUMBER (rowid) between '
           || TO_CHAR (64 + (ROWNUM - 1) * 64)
           || ' and '
           || TO_CHAR (64+ ROWNUM * 64 - 1)
           || ' ;'
              c100
      FROM DUAL
CONNECT BY LEVEL <= 9;

C100
--------------------------------------------------------------------------------------------
select count(*) from t01 where DBMS_ROWID.ROWID_BLOCK_NUMBER (rowid) between 64 and 127 ;
select count(*) from t01 where DBMS_ROWID.ROWID_BLOCK_NUMBER (rowid) between 128 and 191 ;
select count(*) from t01 where DBMS_ROWID.ROWID_BLOCK_NUMBER (rowid) between 192 and 255 ;
select count(*) from t01 where DBMS_ROWID.ROWID_BLOCK_NUMBER (rowid) between 256 and 319 ;
select count(*) from t01 where DBMS_ROWID.ROWID_BLOCK_NUMBER (rowid) between 320 and 383 ;
select count(*) from t01 where DBMS_ROWID.ROWID_BLOCK_NUMBER (rowid) between 384 and 447 ;
select count(*) from t01 where DBMS_ROWID.ROWID_BLOCK_NUMBER (rowid) between 448 and 511 ;
select count(*) from t01 where DBMS_ROWID.ROWID_BLOCK_NUMBER (rowid) between 512 and 575 ;
select count(*) from t01 where DBMS_ROWID.ROWID_BLOCK_NUMBER (rowid) between 576 and 639 ;
9 rows selected.

SYS@test> select count(*) from t01 where DBMS_ROWID.ROWID_BLOCK_NUMBER (rowid) between 64 and 127 ;
    COUNT(*)
------------
       10116

SYS@test> select count(*) from t01 where DBMS_ROWID.ROWID_BLOCK_NUMBER (rowid) between 128 and 191 ;
    COUNT(*)
------------
       10416

SYS@test> select count(*) from t01 where DBMS_ROWID.ROWID_BLOCK_NUMBER (rowid) between 192 and 255 ;
    COUNT(*)
------------
       10752

--//不再計算了.
SYS@test> select count(*) from t01 where DBMS_ROWID.ROWID_BLOCK_NUMBER (rowid) between 512 and 575 ;
    COUNT(*)
------------
       10416

SYS@test> select count(*) from t01 where DBMS_ROWID.ROWID_BLOCK_NUMBER (rowid) between 576 and 639 ;
    COUNT(*)
------------
        7534

■ If the number of files being multiplexed is greater than eight, then RMAN allocates four
   buffers of size 128KB. This ensures that each file being backed up will account for 512KB
   of buffer memory.
--//也就是512K的輸入快取.分配4個每個128K.
--//10個資料檔案同時備份到備份集合.

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

相關文章