oracle 的 BLOCK CHANGE TRACKING
從10G版本開始,引入了BLOCK CHANGE TRACKING特性,這次算是真正的增量了。
當這個特性開啟後,ORACLE會建立一個trace檔案,並起用後臺程式CTWR記錄變化的資料塊,當需要增量備份的時候,就直接讀這個檔案獲得要備份的資料塊,速度確實是有質的飛躍(參考http://www.alidba.net/index.php/archives/51)
--啟用BLOCK CHANGE TRACKING特性
SQL> alter database enable block change tracking using file '/data/ora10g/RACDBSTD/trace.dbf' reuse;
Database altered.
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.
Total System Global Area 167772160 bytes
Fixed Size 1218316 bytes
Variable Size 62916852 bytes
Database Buffers 100663296 bytes
Redo Buffers 2973696 bytes
Database mounted.
Database opened.
--全備資料庫(這個全備好像需要再開啟BLOCK CHANGE TRACKING後,後面的增備才能利用到)
RMAN> run{
2> allocate channel c1 device type disk format '/data/backup/db_fullb%u';
3> backup incremental level 0 database ;
4> }
released channel: ORA_DISK_1
allocated channel: c1
channel c1: sid=141 devtype=DISK
Starting backup at 14-MAY-11
channel c1: starting incremental level 0 datafile backupset
channel c1: specifying datafile(s) in backupset
input datafile fno=00001 name=/data/ora10g/RACDBSTD/system.259.727735501
input datafile fno=00003 name=/data/ora10g/RACDBSTD/sysaux.261.727735559
input datafile fno=00002 name=/data/ora10g/RACDBSTD/undo01.DBF
input datafile fno=00005 name=/data/ora10g/RACDBSTD/users.264.727735605
channel c1: starting piece 1 at 14-MAY-11
channel c1: finished piece 1 at 14-MAY-11
piece handle=/data/backup/db_fullb17mcb0h7 tag=TAG20110514T182335 comment=NONE
channel c1: backup set complete, elapsed time: 00:00:45
channel c1: starting incremental level 0 datafile backupset
channel c1: specifying datafile(s) in backupset
including current control file in backupset
channel c1: starting piece 1 at 14-MAY-11
channel c1: finished piece 1 at 14-MAY-11
piece handle=/data/backup/db_fullb18mcb0ik tag=TAG20110514T182335 comment=NONE
channel c1: backup set complete, elapsed time: 00:00:02
Finished backup at 14-MAY-11
released channel: c1
--增量備份
SQL> drop table testtab purge;
Table dropped.
SQL> create table testtab as select * from dba_objects where 1 = 2;
Table created.
SQL> insert into testtab select * from dba_objects;
44964 rows created.
SQL> commit;
Commit complete.
RMAN> run{
2> allocate channel c1 device type disk format '/data/backup/db_incb%u';
3> backup incremental level 1 database ;
4> };
allocated channel: c1
channel c1: sid=141 devtype=DISK
Starting backup at 14-MAY-11
channel c1: starting incremental level 1 datafile backupset
channel c1: specifying datafile(s) in backupset
input datafile fno=00001 name=/data/ora10g/RACDBSTD/system.259.727735501
input datafile fno=00003 name=/data/ora10g/RACDBSTD/sysaux.261.727735559
input datafile fno=00002 name=/data/ora10g/RACDBSTD/undo01.DBF
input datafile fno=00005 name=/data/ora10g/RACDBSTD/users.264.727735605
channel c1: starting piece 1 at 14-MAY-11
channel c1: finished piece 1 at 14-MAY-11
piece handle=/data/backup/db_incb19mcb0k0 tag=TAG20110514T182503 comment=NONE
channel c1: backup set complete, elapsed time: 00:00:07
channel c1: starting incremental level 1 datafile backupset
channel c1: specifying datafile(s) in backupset
including current control file in backupset
channel c1: starting piece 1 at 14-MAY-11
channel c1: finished piece 1 at 14-MAY-11
piece handle=/data/backup/db_incb1amcb0k7 tag=TAG20110514T182503 comment=NONE
channel c1: backup set complete, elapsed time: 00:00:02
Finished backup at 14-MAY-11
released channel: c1
SQL> alter session set nls_date_format='yyyy-mm-dd hh24:mi:ss';
Session altered.
SQL> select file#, incremental_level, completion_time, datafile_blocks ,blocks_read,
2 trunc((blocks_read / datafile_blocks) * 100,2) as "read%",
3 used_change_tracking
4 from v$backup_datafile
5 where incremental_level > 0
6 order by completion_time;
FILE# INCREMENTAL_LEVEL COMPLETION_TIME DATAFILE_BLOCKS BLOCKS_READ read% USE
---------- ----------------- ------------------- --------------- ----------- ---------- ---
5 1 2011-05-14 18:10:51 640 640 100 NO
2 1 2011-05-14 18:10:58 6400 6400 100 NO
3 1 2011-05-14 18:11:08 20480 20480 100 NO
1 1 2011-05-14 18:11:17 53760 53760 100 NO
5 1 2011-05-14 18:15:51 640 640 100 NO
2 1 2011-05-14 18:15:58 6400 6400 100 NO
3 1 2011-05-14 18:16:08 20480 20480 100 NO
1 1 2011-05-14 18:16:18 53760 53760 100 NO
3 1 2011-05-14 18:17:25 20480 1 0 YES
1 1 2011-05-14 18:17:25 53760 1 0 YES
2 1 2011-05-14 18:17:25 6400 1 .01 YES
FILE# INCREMENTAL_LEVEL COMPLETION_TIME DATAFILE_BLOCKS BLOCKS_READ read% USE
---------- ----------------- ------------------- --------------- ----------- ---------- ---
5 1 2011-05-14 18:17:25 640 1 .15 YES
1 1 2011-05-14 18:25:07 53760 679 1.26 YES
3 1 2011-05-14 18:25:07 20480 2039 9.95 YES
2 1 2011-05-14 18:25:07 6400 419 6.54 YES
5 1 2011-05-14 18:25:07 640 1 .15 YES
16 rows selected.
SQL> shutdown abort
ORACLE instance shut down.
--刪除資料檔案
rm /data/ora10g/RACDBSTD/users.264.727735605
--恢復
RMAN> startup mount
Oracle instance started
database mounted
Total System Global Area 167772160 bytes
Fixed Size 1218316 bytes
Variable Size 62916852 bytes
Database Buffers 100663296 bytes
Redo Buffers 2973696 bytes
RMAN> restore database;
Starting restore at 14-MAY-11
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=157 devtype=DISK
channel ORA_DISK_1: starting datafile backupset restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00001 to /data/ora10g/RACDBSTD/system.259.727735501
restoring datafile 00002 to /data/ora10g/RACDBSTD/undo01.DBF
restoring datafile 00003 to /data/ora10g/RACDBSTD/sysaux.261.727735559
restoring datafile 00005 to /data/ora10g/RACDBSTD/users.264.727735605
channel ORA_DISK_1: reading from backup piece /data/backup/db_fullb17mcb0h7
channel ORA_DISK_1: restored backup piece 1
piece handle=/data/backup/db_fullb17mcb0h7 tag=TAG20110514T182335
channel ORA_DISK_1: restore complete, elapsed time: 00:00:46
Finished restore at 14-MAY-11
--recover 用到了增量備份
RMAN> recover database;
Starting recover at 14-MAY-11
using channel ORA_DISK_1
channel ORA_DISK_1: starting incremental datafile backupset restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
destination for restore of datafile 00001: /data/ora10g/RACDBSTD/system.259.727735501
destination for restore of datafile 00002: /data/ora10g/RACDBSTD/undo01.DBF
destination for restore of datafile 00003: /data/ora10g/RACDBSTD/sysaux.261.727735559
destination for restore of datafile 00005: /data/ora10g/RACDBSTD/users.264.727735605
channel ORA_DISK_1: reading from backup piece /data/backup/db_incb19mcb0k0
channel ORA_DISK_1: restored backup piece 1
piece handle=/data/backup/db_incb19mcb0k0 tag=TAG20110514T182503
channel ORA_DISK_1: restore complete, elapsed time: 00:00:03
starting media recovery
media recovery complete, elapsed time: 00:00:05
Finished recover at 14-MAY-11
RMAN> alter database open;
database opened
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/758322/viewspace-695271/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Oracle Block Change Tracking功能OracleBloC
- 啟用oracle block change trackingOracleBloC
- Block Change Tracking (Oracle 塊修改跟蹤)BloCOracle
- Oracle10g新增BLOCK CHANGE TRACKING功能OracleBloC
- oracle 10g 開啟BLOCK CHANGE TRACKINGOracle 10gBloC
- Oracle 塊修改跟蹤 (Block Change Tracking) 說明OracleBloC
- oracle 10g R2 Block change tracking 新特性Oracle 10gBloC
- oracle 10g中使用block change tracking加快增量備份Oracle 10gBloC
- 加快RMAN增量備份的速度(block change tracking特性)BloC
- Oracle RMAN 增量備份優化方法(啟用 Block Change Tracking特性)Oracle優化BloC
- 啟用Block Change Tracking-10g新特性BloC
- ZT 啟用Block Change Tracking-10g新特性BloC
- 10g中的塊修改跟蹤特性(Block Change Tracking)BloC
- Oracle OCP 1Z0 O53 Q78(RMAN block change tracking)OracleBloC
- block change tracking檔案可以放在flash_recovery_area裡!BloC
- sqlserver Change Data Capture&Change TrackingSQLServerAPT
- XTTS全備開啟BCT後等待事件 block change tracking buffer spaceTTS事件BloC
- Entity Framework Tutorial Basics(19):Change TrackingFramework
- 適用於rman增級備份之資料庫特性db block change tracking學習思路資料庫BloC
- Oracle OCP 1Z0 053 Q662(rman change tracking file)Oracle
- 初探SQL Server 2008 Change TrackingSQLServer
- Oracle OCP 1Z0 053 Q78(RMAN&change tracking file)Oracle
- oracle dump blockOracleBloC
- oracle block type!OracleBloC
- ORACLE BLOCK DUMPOracleBloC
- oracle hot blockOracleBloC
- Oracle ASM Active Change DirectoryOracleASM
- Oracle (block clean out) oracle的塊清除OracleBloC
- oracle block phisical address to block#OracleBloC
- oracle block的深入研究OracleBloC
- ORA-00607: Internal error occurred while making a change to a data blockErrorWhileBloC
- Oracle Log Block SizeOracleBloC
- Oracle Find block in ASMOracleBloCASM
- oracle block 格式 (zt)OracleBloC
- Sql資料庫利用linkserver和 CT[CHANGE_TRACKING]實現釋出訂閱SQL資料庫Server
- ORACLE SQL DEVELOPER User Interface ChangeOracleSQLDeveloper
- Oracle Data block 的物理結構OracleBloC
- Oracle 的 data block研讀(二)OracleBloC