[20221028]rman使用tape與增量備份測試2.txt
[20221028]rman使用tape與增量備份測試2.txt
--//參考連結:2017/201702/[20170208]rman tape.txt 2017/201702/[20170213]rman tape測試.txt
--//生產系統採用虛擬磁帶庫的備份方式,我以前發現不支援壓縮.參考連線http://blog.itpub.net/267265/viewspace-2645144/
--//最近遇到增量不能使用BLOCK CHANGE TRACKING檔案的情況,最後發現對方備份指令碼執行
alter database disable block change tracking;
--//導致的情況.奇葩的運維人員....無語啊.
--//前幾天測試使用的資料檔案沒有資料寫入,換成資料檔案1測試看看,當時的測試有點亂.
1.環境:
SCOTT@book> @ver1
PORT_STRING VERSION BANNER
------------------------------ -------------- --------------------------------------------------------------------------------
x86_64/Linux 2.4.xx 11.2.0.4.0 Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
--//先做一些清理工作.
ALTER DATABASE disable BLOCK CHANGE TRACKING;
--//RMAN> CONFIGURE CHANNEL DEVICE TYPE 'SBT_TAPE' clear;
--//RMAN> CONFIGURE DEFAULT DEVICE TYPE TO DISK;
--//並且刪除以前測試做的全部備份集.
$ cat ckfile.txt
SELECT file#
, incremental_level
, completion_time
, datafile_blocks
, blocks_read
, blocks_read/datafile_blocks* 100 AS PCT_READ_FOR_BACKUP
, blocks
FROM v$backup_datafile
WHERE file# in (&&1) order by 3;
2.建立測試環境:
--//測試前清理全部備份檔案集略.
--//在rman下執行,模擬tape方式:
RMAN> CONFIGURE CHANNEL DEVICE TYPE 'SBT_TAPE' PARMS 'SBT_LIBRARY=oracle.disksbt,ENV=(BACKUP_DIR=/u01/backup)';
using target database control file instead of recovery catalog
new RMAN configuration parameters:
CONFIGURE CHANNEL DEVICE TYPE 'SBT_TAPE' PARMS 'SBT_LIBRARY=oracle.disksbt,ENV=(BACKUP_DIR=/u01/backup)';
new RMAN configuration parameters are successfully stored
RMAN> CONFIGURE DEFAULT DEVICE TYPE TO SBT_TAPE;
old RMAN configuration parameters:
CONFIGURE DEFAULT DEVICE TYPE TO DISK;
new RMAN configuration parameters:
CONFIGURE DEFAULT DEVICE TYPE TO 'SBT_TAPE';
new RMAN configuration parameters are successfully stored
3.測試1:
--//採用模擬tape方式,沒有開啟BLOCK CHANGE TRACKING:
RMAN> backup incremental level=0 datafile 1 ;
Starting backup at 2022-10-28 09:04:00
allocated channel: ORA_SBT_TAPE_1
channel ORA_SBT_TAPE_1: SID=53 device type=SBT_TAPE
channel ORA_SBT_TAPE_1: WARNING: Oracle Test Disk API
channel ORA_SBT_TAPE_1: starting incremental level 0 datafile backup set
channel ORA_SBT_TAPE_1: specifying datafile(s) in backup set
input datafile file number=00001 name=/mnt/ramdisk/book/system01.dbf
channel ORA_SBT_TAPE_1: starting piece 1 at 2022-10-28 09:04:00
channel ORA_SBT_TAPE_1: finished piece 1 at 2022-10-28 09:04:03
piece handle=gs1bd1k0_1_1 tag=TAG20221028T090400 comment=API Version 2.0,MMS Version 8.1.3.0
channel ORA_SBT_TAPE_1: backup set complete, elapsed time: 00:00:03
Finished backup at 2022-10-28 09:04:03
Starting Control File and SPFILE Autobackup at 2022-10-28 09:04:03
piece handle=c-1337401710-20221028-00 comment=API Version 2.0,MMS Version 8.1.3.0
Finished Control File and SPFILE Autobackup at 2022-10-28 09:04:10
--//繼續測試,採用模擬tape方式,開啟BLOCK CHANGE TRACKING:
SYS@book> ALTER DATABASE ENABLE BLOCK CHANGE TRACKING using file '/u01/app/oracle/fast_recovery_area/block_change_tracking.f' ;
Database altered.
SYS@book> SELECT * FROM V$BLOCK_CHANGE_TRACKING
2 @ pr
==============================
STATUS : ENABLED
FILENAME : /u01/app/oracle/fast_recovery_area/block_change_tracking.f
BYTES : 11599872
PL/SQL procedure successfully completed.
--//已經開啟塊跟蹤特性.
RMAN> backup incremental level=1 datafile 1 ;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Starting backup at 2022-10-28 09:05:06
using channel ORA_SBT_TAPE_1
channel ORA_SBT_TAPE_1: starting incremental level 1 datafile backup set
channel ORA_SBT_TAPE_1: specifying datafile(s) in backup set
input datafile file number=00001 name=/mnt/ramdisk/book/system01.dbf
channel ORA_SBT_TAPE_1: starting piece 1 at 2022-10-28 09:05:06
channel ORA_SBT_TAPE_1: finished piece 1 at 2022-10-28 09:05:07
piece handle=gu1bd1m2_1_1 tag=TAG20221028T090506 comment=API Version 2.0,MMS Version 8.1.3.0
channel ORA_SBT_TAPE_1: backup set complete, elapsed time: 00:00:01
Finished backup at 2022-10-28 09:05:07
Starting Control File and SPFILE Autobackup at 2022-10-28 09:05:07
piece handle=c-1337401710-20221028-01 comment=API Version 2.0,MMS Version 8.1.3.0
Finished Control File and SPFILE Autobackup at 2022-10-28 09:05:08
SYS@book> @ ckfile.txt 1
FILE# INCREMENTAL_LEVEL COMPLETION_TIME DATAFILE_BLOCKS BLOCKS_READ PCT_READ_FOR_BACKUP BLOCKS
---------- ----------------- ------------------- --------------- ----------- ------------------- ----------
1 0 2022-10-28 09:04:02 99840 99840 100 83579
1 1 2022-10-28 09:05:07 99840 99840 100 5
--//BLOCKS_READ並沒有減少,因為BLOCK CHANGE TRACKING後才可是記錄塊scn的變化.而level=0備份在啟用之前.
$ ll /u01/backup/[g]*
-rw-r--r-- 1 oracle oinstall 687865872 2022-10-28 09:04:02 /u01/backup/gs1bd1k0_1_1
-rw-r--r-- 1 oracle oinstall 4194320 2022-10-28 09:05:07 /u01/backup/gu1bd1m2_1_1
--//僅僅備份變化的部分,備份檔案減少了
RMAN> backup incremental level=1 datafile 1 ;
Starting backup at 2022-10-28 09:06:26
using channel ORA_SBT_TAPE_1
channel ORA_SBT_TAPE_1: starting incremental level 1 datafile backup set
channel ORA_SBT_TAPE_1: specifying datafile(s) in backup set
input datafile file number=00001 name=/mnt/ramdisk/book/system01.dbf
channel ORA_SBT_TAPE_1: starting piece 1 at 2022-10-28 09:06:26
channel ORA_SBT_TAPE_1: finished piece 1 at 2022-10-28 09:06:27
piece handle=h01bd1oi_1_1 tag=TAG20221028T090626 comment=API Version 2.0,MMS Version 8.1.3.0
channel ORA_SBT_TAPE_1: backup set complete, elapsed time: 00:00:01
Finished backup at 2022-10-28 09:06:27
Starting Control File and SPFILE Autobackup at 2022-10-28 09:06:27
piece handle=c-1337401710-20221028-02 comment=API Version 2.0,MMS Version 8.1.3.0
Finished Control File and SPFILE Autobackup at 2022-10-28 09:06:28
SYS@book> @ ckfile.txt 1
FILE# INCREMENTAL_LEVEL COMPLETION_TIME DATAFILE_BLOCKS BLOCKS_READ PCT_READ_FOR_BACKUP BLOCKS
---------- ----------------- ------------------- --------------- ----------- ------------------- ----------
1 0 2022-10-28 09:04:02 99840 99840 100 83579
1 1 2022-10-28 09:05:07 99840 99840 100 5
1 1 2022-10-28 09:06:26 99840 1 .001001603 1
--//可以使用這時塊跟蹤檔案.BLOCKS_READ=1.因為這次增量備份之前做了一次增量在啟動塊跟蹤特性之前(有點繞口).
$ ll /u01/backup/[gh]*
-rw-r--r-- 1 oracle oinstall 687865872 2022-10-28 09:04:02 /u01/backup/gs1bd1k0_1_1
-rw-r--r-- 1 oracle oinstall 4194320 2022-10-28 09:05:07 /u01/backup/gu1bd1m2_1_1
-rw-r--r-- 1 oracle oinstall 4194320 2022-10-28 09:06:26 /u01/backup/h01bd1oi_1_1
--//如果使用累積增量,可能不行,可以如下驗證:
RMAN> backup incremental level 1 cumulative datafile 1;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Starting backup at 2022-10-28 09:08:53
using channel ORA_SBT_TAPE_1
channel ORA_SBT_TAPE_1: starting incremental level 1 datafile backup set
channel ORA_SBT_TAPE_1: specifying datafile(s) in backup set
input datafile file number=00001 name=/mnt/ramdisk/book/system01.dbf
channel ORA_SBT_TAPE_1: starting piece 1 at 2022-10-28 09:08:53
channel ORA_SBT_TAPE_1: finished piece 1 at 2022-10-28 09:08:54
piece handle=h21bd1t5_1_1 tag=TAG20221028T090853 comment=API Version 2.0,MMS Version 8.1.3.0
channel ORA_SBT_TAPE_1: backup set complete, elapsed time: 00:00:01
Finished backup at 2022-10-28 09:08:54
Starting Control File and SPFILE Autobackup at 2022-10-28 09:08:54
piece handle=c-1337401710-20221028-03 comment=API Version 2.0,MMS Version 8.1.3.0
Finished Control File and SPFILE Autobackup at 2022-10-28 09:08:55
SYS@book> @ ckfile.txt 1
FILE# INCREMENTAL_LEVEL COMPLETION_TIME DATAFILE_BLOCKS BLOCKS_READ PCT_READ_FOR_BACKUP BLOCKS
---------- ----------------- ------------------- --------------- ----------- ------------------- ----------
1 0 2022-10-28 09:04:02 99840 99840 100 83579
1 1 2022-10-28 09:05:07 99840 99840 100 5
1 1 2022-10-28 09:06:26 99840 1 .001001603 1
1 1 2022-10-28 09:08:54 99840 99840 100 7
--//可以發現累積cumulative模式無法使用,當前這樣的情況下.
--//再次執行累積備份也是一樣的情況.
RMAN> backup incremental level 1 cumulative datafile 1;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Starting backup at 2022-10-28 09:10:15
using channel ORA_SBT_TAPE_1
channel ORA_SBT_TAPE_1: starting incremental level 1 datafile backup set
channel ORA_SBT_TAPE_1: specifying datafile(s) in backup set
input datafile file number=00001 name=/mnt/ramdisk/book/system01.dbf
channel ORA_SBT_TAPE_1: starting piece 1 at 2022-10-28 09:10:16
channel ORA_SBT_TAPE_1: finished piece 1 at 2022-10-28 09:10:17
piece handle=h41bd1vo_1_1 tag=TAG20221028T091015 comment=API Version 2.0,MMS Version 8.1.3.0
channel ORA_SBT_TAPE_1: backup set complete, elapsed time: 00:00:01
Finished backup at 2022-10-28 09:10:17
Starting Control File and SPFILE Autobackup at 2022-10-28 09:10:17
piece handle=c-1337401710-20221028-04 comment=API Version 2.0,MMS Version 8.1.3.0
Finished Control File and SPFILE Autobackup at 2022-10-28 09:10:18
SYS@book> @ ckfile.txt 1
FILE# INCREMENTAL_LEVEL COMPLETION_TIME DATAFILE_BLOCKS BLOCKS_READ PCT_READ_FOR_BACKUP BLOCKS
---------- ----------------- ------------------- --------------- ----------- ------------------- ----------
1 0 2022-10-28 09:04:02 99840 99840 100 83579
1 1 2022-10-28 09:05:07 99840 99840 100 5
1 1 2022-10-28 09:06:26 99840 1 .001001603 1
1 1 2022-10-28 09:08:54 99840 99840 100 7
1 1 2022-10-28 09:10:16 99840 99840 100 7
$ ll /u01/backup/[gh]*
-rw-r--r-- 1 oracle oinstall 687865872 2022-10-28 09:04:02 /u01/backup/gs1bd1k0_1_1
-rw-r--r-- 1 oracle oinstall 4194320 2022-10-28 09:05:07 /u01/backup/gu1bd1m2_1_1
-rw-r--r-- 1 oracle oinstall 4194320 2022-10-28 09:06:26 /u01/backup/h01bd1oi_1_1
-rw-r--r-- 1 oracle oinstall 4194320 2022-10-28 09:08:54 /u01/backup/h21bd1t5_1_1
-rw-r--r-- 1 oracle oinstall 4194320 2022-10-28 09:10:16 /u01/backup/h41bd1vo_1_1
4.收尾還原:
RMAN> delete backupset completed after 'sysdate -1';
RMAN> CONFIGURE CHANNEL DEVICE TYPE 'SBT_TAPE' clear;
RMAN> CONFIGURE DEFAULT DEVICE TYPE TO DISK;
RMAN> CONFIGURE DEVICE TYPE 'SBT_TAPE' clear;
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/267265/viewspace-2921600/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- RMAN備份與恢復測試
- rman 增量備份恢復
- dg丟失歸檔,使用rman增量備份恢復
- oracle10g RMAN增量備份策略Oracle
- [20180423]關於rman備份的問題2.txt
- 使用RMAN增量備份處理Dataguard因歸檔丟失造成的gap
- 使用RMAN備份資料庫資料庫
- 【RMAN】RMAN備份至ASMASM
- [20190517]rman tape compressed.txt
- EXP增量備份
- Xtrabackup增量備份
- RMAN備份概述
- 【RMAN】RMAN的備份保留策略
- RMAN備份恢復典型案例——RMAN備份&系統變慢
- RMAN備份進度
- rman 備份指令碼指令碼
- RMAN的備份原理
- [20190515]熱備份模式與rman衝突.txt模式
- [20210527]rman與undo表空間備份.txt
- MySQL 定時增量備份MySql
- 12 使用RMAN備份和恢復檔案
- oracle資料庫使用rman備份指令碼Oracle資料庫指令碼
- oracle資料庫備份之exp增量備份Oracle資料庫
- RMAN備份恢復技巧
- 【rman備份策略】實驗
- Oracle RMAN備份實戰Oracle
- Oracle OCP(60):RMAN 備份Oracle
- RMAN增量恢復
- RMAN備份相關知識與技能總結
- [20221020]奇怪的增量備份.txt
- 【RMAN】同時建立多個備份(建立多重備份)
- 【RMAN】在備庫執行rman備份時報錯RMAN-06820 ORA-17629
- RMAN 備份相關的概念
- [20190522]rman備份問題.txt
- RMAN備份異機恢復
- RMAN備份詳解(轉載)
- postgresql物理備份工具pg_rman的使用詳解SQL
- oracle 增量備份恢復驗證Oracle