使用RMAN或資料泵初始化OGG目標庫

myownstars發表於2013-05-22

OGG 10引入新token變數LOGCSN,對應於oraclescn,對此replicat可以指定開始csn

Start replicat atcsn | aftercsn

 

準備階段

同步前需確保源庫的事務都已提交,應反覆檢查gv$transaction

對於無法終止的事務,從其起始時間執行extract

eg:

sql> select min(start_time) from v$transaction/gv$transaction;

MIN(START_TIME)

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

02/08/13 19:21:38

The real-time extract can then be added by

ggsci> add extract tranlog begin 2013-02-08 19:20:00 --&gt> in case of standalone database

ggsci> add extract tranlog threads(number_of_threads) begin 2013-02-08 19:20:00 --&gt> in case of RAC

 

RMAN

假定source/target具有相同目錄結構

--source

source db新增supplemental日誌

SQLPLUS > alter database add supplemental log data

Enable Supplemental Logging at Table Level

GGSCI> dblogin userid xxxxx password xxxxxx

GGSCI> add trandata .

新增extract/datapump程式和trail檔案

備份資料庫並檢視其SCN

RMAN> backup database plus archivelog ;

RMAN> restore database preview summary;

Media recovery start SCN is 34821758

Recovery must be done beyond SCN 34822578 to clear datafile fuzziness

Finished restore at 10-OCT-10

將引數檔案傳送到target

 

--target

Startup nomount

使用duplicate命令clone資料庫

OS> RMAN target sys/@<source>

RMAN> connect auxiliary /

RMAN> duplicate target database to nofilenamecheck until scn ;

執行完畢後檢視alert log

RESETLOGS after incomplete recovery UNTIL CHANGE 34822578

SCN 34822578之後的工作則由replicat執行

啟動replicat

GGSCI> add replicat , exttrail ./dirdat/

GGSCI> start replicat , atcsn

 

注:對於RAC系統,以上步驟大同小異;

唯一需要注意的是恢復RAC期間需要cluster_database設為false

 

228257.1

 

資料泵

--source

增添supplemental log

alter database add supplemental log data ;

Enable Supplemental Logging at Table Level on source

GGSCI> dblogin userid xxxxx password xxxxxx

GGSCI> add trandata .

獲取current_scn

SQLPLUS> select current_scn from v$database ;

CURRENT_SCN

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

28318029

expdp directory=dumpdir full=y parallel=4 dumpfile=ora102_%u.dmp flashback_scn=28318029

 

--target

Impdp匯入

GGSCI> add replicat , exttrail ./dirdat/

GGSCI> start replicat , aftercsn 28318029

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

相關文章