[20171130]關於rman的一些總結.txt

lfree發表於2017-11-29

[20171130]關於rman的一些總結.txt

--//最近一直做rman相關測試,測試那個亂,沒辦法.無法從周圍的人獲得幫助,純粹是自己的亂猜,亂測,不知道別人是否能看懂我寫的東西.
--//有必要做一些總結,不一定對,僅僅是我當前的看法.

1.資料檔案備份集中,檔案頭是最後寫到備份集檔案的.
2.使用備份集恢復也是一樣,檔案頭也是最好寫入的.
3.以上情況對as copy的方式也是一樣.

--//oracle這樣操作主要目的保證備份是好的可用,反之恢復也是一樣.

4.關於備份引數filesperset,最好選擇1(我自己的認為這樣比較好,缺點當然是備份檔案顯得有點多),如果覺得備份檔案太多,建議選擇4,
  次之選擇8,大於8.我個人不建議選擇.
5.關於rman備份的input or output memory buffer問題,我直接摘錄一段:

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.

    Bear in mind that these memory amounts are on a per-channel basis. So, if you allocate two
channels to back up a database with 32 datafiles, for instance, then RMAN will load-balance the
files between the two channels and may not end up with 16 files per channel. If some files are
significantly larger than others, you may end up with only 8 files going into one backup set and
24 files going into the other. If this were the case, then the buffers for the first channel with 8 files
would allocate 16MB of memory for input buffers (four buffers multiplied by 512KB each, multiplied
by 8 files), and the second channel would allocate 12MB of memory buffers (512KB per file
multiplied by 24 files).
    You can use the following query to monitor the size of buffers on a per-file basis while the
backup is running:

SELECT set_count, device_type, type, filename, buffer_size, buffer_count, open_time, close_time
  FROM v$backup_async_io
ORDER BY set_count, type, open_time, close_time;

--//注意:原來有這個問題!下次備份注意看buffer_size!

Output Buffers When Backing Up to Disk P81
    In addition to input buffers, RMAN allocates output buffers, depending on what the output source
is. If you are backing up to disk, then RMAN allocates output buffers that must fill up with data blocks
from the input buffers before being flushed to the backup piece on your file system. Per channel,
there will be four output buffers, each of which is 1MB. So, the memory footprint per channel will
always be 4MB.

Output Memory Buffers When Backing Up to Tape P81
    Memory allocation is different when backing up to tape, to account for the slower I/O rates
that we expect from tape devices. When you are backing up to or restoring from tape, RMAN
allocates four buffers per channel process, each of which is 256KB, so that the total memory
footprint per channel is 1MB.

6.關於寫入備份集順序問題.我個人認為至少對於單個資料檔案應該按照順序寫入.

7.檔案頭損壞,dbv與rman檢查無效,感覺都是壞塊,使用如下命令無效!!
RMAN> recover datafile 6 block 1;
RMAN> blockrecover datafile 6 block 1;

8.另外在備份期間如果有髒塊寫盤:會在一些檢視中記錄資料塊的最高scn,這樣確定如果不完全恢復scn在檔案頭與最高scn之間情況,
  不會選擇這個備份,而且如果catalog,oracle不會掃描備份集合或者備份image,確定最高的scn.
--//as copy備份記錄在,例子:
select recid,file#,NAME,CHECKPOINT_CHANGE#,ABSOLUTE_FUZZY_CHANGE# from v$datafile_copy where recid=33 ;
--//備份集可以查詢,例子:
select file#,CHECKPOINT_CHANGE#,ABSOLUTE_FUZZY_CHANGE# from v$backup_datafile;

9.疑問:
--//上個星期做了rman copy備份與資料檔案變化的測試.
--//在做rman copy備份時資料檔案增大,連結:http://blog.itpub.net/267265/viewspace-2147642/
http://blog.itpub.net/267265/viewspace-2147673/
--//提到檢查備份copy image時發現沒有BBBBB,CCCC字串.
--//我的猜測oracle 做映像備份與建立備份集一樣,也是根據資料檔案點陣圖區確定讀取那些資料塊,這樣在備份開始後新建立的塊不會備份.
$ strings /home/oracle/backup/sugar01.dbf | grep "AAAA" |wc
100000  170040 3624077
$ strings /home/oracle/backup/sugar01.dbf | grep "BBBB" |wc
      0       0       0
$ strings /home/oracle/backup/sugar01.dbf | grep "CCCC" |wc
      0       0       0

--//後記:這是我當時的理解,實際上應該是錯誤的.有必要做一些的測試.自己看著都覺得亂!!

--//在做rman copy備份時資料檔案減少的情況下,連結:http://blog.itpub.net/267265/viewspace-2147673/
--//而我在減少檔案大小後:
SCOTT@book> ALTER DATABASE DATAFILE '/mnt/ramdisk/book/sugar01.dbf' RESIZE 9M ;
Database altered.

$ strings /home/oracle/backup/sugar01.dbf_yyy |grep "BBBBB" |wc
  62394  106045 2256986

$ strings /home/oracle/backup/sugar01.dbf_yyy |grep "CCCC" |wc
      0       0       0

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

相關文章