OGG 10引入新token变量LOGCSN,对应于oracle的scn,对此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 -->> in case of standalone database
ggsci> add extract tranlog threads(number_of_threads) begin 2013-02-08 19:20:00 -->> 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/@
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