FLASHCOPY增量同步在資料庫恢復中的應用(2/4)

djb1008發表於2011-05-25

1.1.4 記錄資料庫的SCN,檢查特徵表是否存在

SQL> select checkpoint_change# from v$database;

CHECKPOINT_CHANGE#

------------------

455256

SQL> select count(1) from aidu.test02;

select count(1) from aidu.test02

*

ERROR at line 1:

ORA-00942: table or view does not exist

此時還沒有建立特徵表,所以報物件不存在的錯誤,這是正常的。

[@more@]

1.1.5 DS8100儲存上登入DSCLI管理介面,開始進行FLASHCOPY操作

dscli> mkflash -freeze –cp –record -persist 5000-5002:8000-8002 5100-5102:8100-8102

Date/Time: 2011517 下午031301 IBM DSCLI Version: 5.3.1.172 DS: IBM.2107-75TXXXX

CMUC00137I mkflash: FlashCopy pair 5000:8000 successfully created.

CMUC00137I mkflash: FlashCopy pair 5001:8001 successfully created.

CMUC00137I mkflash: FlashCopy pair 5002:8002 successfully created.

CMUC00137I mkflash: FlashCopy pair 5100:8100 successfully created.

CMUC00137I mkflash: FlashCopy pair 5101:8101 successfully created.

CMUC00137I mkflash: FlashCopy pair 5102:8102 successfully created.

dscli> unfreezeflash 50 51

Date/Time: 2011517 下午031316 IBM DSCLI Version: 5.3.1.172 DS: IBM.2107-75TXXXX

CMUC00172I unfreezeflash: FlashCopy consistency group for logical subsystem 50: successfully reset.

CMUC00172I unfreezeflash: FlashCopy consistency group for logical subsystem 51: successfully reset.

不斷檢視flashcopy的複製進度

dscli> lsflash -l 5000-8200

Date/Time: 2011517 下午031332 IBM DSCLI Version: 5.3.1.172 DS: IBM.2107-75TXXXX

ID SrcLSS SequenceNum Timeout ActiveCopy Recording Persistent Revertible SourceWriteEnabled TargetWriteEnabled BackgroundCopy OutOfSyncTracks DateCreated Da

teSynced State AllowTgtSE

5000:8000 50 0 60 Enabled Enabled Enabled Disabled Enabled Enabled Enabled 287952 Tue May 17 15:31:38 CST 2011 Tue May 17 15:31:38 CST 2011 Valid Disabled

5001:8001 50 0 60 Enabled Enabled Enabled Disabled Enabled Enabled Enabled 287976 Tue May 17 15:31:38 CST 2011 Tue May 17 15:31:38 CST 2011 Valid Disabled

5002:8002 50 0 60 Disabled Enabled Enabled Disabled Enabled Enabled Enabled 327680 Tue May 17 15:31:38 CST 2011 Tue May 17 15:31:38 CST 2011 Valid Disabled

5100:8100 51 0 60 Enabled Enabled Enabled Disabled Enabled Enabled Enabled 287136 Tue May 17 15:31:38 CST 2011 Tue May 17 15:31:38 CST 2011 Valid Disabled

5101:8101 51 0 60 Enabled Enabled Enabled Disabled Enabled Enabled Enabled 288000 Tue May 17 15:31:38 CST 2011 Tue May 17 15:31:38 CST 2011 Valid Disabled

5102:8102 51 0 60 Disabled Enabled Enabled Disabled Enabled Enabled Enabled 327680 Tue May 17 15:31:38 CST 2011 Tue May 17 15:31:38 CST 2011 Valid Disabled

複製的空間大小為120GDS8100完成120G的複製工作,大概需要7分鐘。在flashcopy複製資料期間可以同步進行下面的插入資料的操作。

1.1.6 插入實驗資料,生成兩個歸檔日誌檔案,記載SCN

SQL>conn aidu/*******

SQL>create table test02(id number(10,2),name varchar2(200),primary key(id));

SQL> insert into test02(id,name) values(1,’test for flashcopy and resyncflash with db’);

已建立 1 行。

SQL> insert into test02(id,name) select id+(select count(1) from test02),name from test02;

已建立 1 行。

SQL> /

已建立2行。

SQL> /

已建立4行。

SQL> /

已建立8行。

SQL> /

已建立16行。

SQL> /

已建立32行。

SQL> /

已建立64行。

SQL> commit;

提交完成。

SQL> select count(1) from test02

COUNT(1)

----------

128

在表test01裡插入了128條記錄。

SQL>conn / as sysdba

SQL> select checkpoint_change# from v$database;

CHECKPOINT_CHANGE#

453645

1.1.7 檢查FLASHCOPY的進度,直至FLASHCOPY 完成複製

檢查mkflash命令是否完成,看到下面的結果就表示複製完成了。

dscli> lsflash -l 1000-9000

Date/Time: 2011517 下午031332 IBM DSCLI Version: 5.3.1.172 DS: IBM.2107-75TXXXX

ID SrcLSS SequenceNum Timeout ActiveCopy Recording Persistent Revertible SourceWriteEnabled TargetWriteEnabled BackgroundCopy OutOfSyncTracks DateCreated Da

teSynced State AllowTgtSE

5000:8000 50 0 60 Enabled Enabled Enabled Disabled Enabled Enabled Enabled 0 Tue May 17 15:31:38 CST 2011 Tue May 17 15:31:38 CST 2011 Valid Disabled

5001:8001 50 0 60 Enabled Enabled Enabled Disabled Enabled Enabled Enabled 0 Tue May 17 15:31:38 CST 2011 Tue May 17 15:31:38 CST 2011 Valid Disabled

5002:8002 50 0 60 Disabled Enabled Enabled Disabled Enabled Enabled Enabled 0 Tue May 17 15:31:38 CST 2011 Tue May 17 15:31:38 CST 2011 Valid Disabled

5100:8100 51 0 60 Enabled Enabled Enabled Disabled Enabled Enabled Enabled 0 Tue May 17 15:31:38 CST 2011 Tue May 17 15:31:38 CST 2011 Valid Disabled

5101:8101 51 0 60 Enabled Enabled Enabled Disabled Enabled Enabled Enabled 0 Tue May 17 15:31:38 CST 2011 Tue May 17 15:31:38 CST 2011 Valid Disabled

5102:8102 51 0 60 Disabled Enabled Enabled Disabled Enabled Enabled Enabled 0 Tue May 17 15:31:38 CST 2011 Tue May 17 15:31:38 CST 2011 Valid Disabled

使用使用了-record -persist 引數,所以關係被保留,我們可以透過OutOfSyncTracks列的值來判斷是否完成了本次的複製,當所有行的該列的值都為0,則表示複製工作完成了。

FLASHCOPY增量同步在資料庫恢復中的應用(3/4)

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

相關文章