1.http://www.dbdream.com.cn/2013/05/17/ogg-00446%E9%94%99%E8%AF%AF%E8%A7%A3%E5%86%B3/
OGG-00446错误解决
部署OGG的时候,REPLICAT进程启动失败。
1 | GGSCI (tsycodsdb) 16> info all |
2 |
3 | Program Status Group Lag Time Since Chkpt |
4 | MANAGER RUNNING |
5 | REPLICAT RUNNING REPJJ 00:00:00 00:00:09 |
6 | REPLICAT RUNNING REPYY 00:00:00 00:00:04 |
7 | REPLICAT STOPPED TREPLVC 00:00:00 00:04:37 |
经查看,发现遇到OGG-00446错误。
1 | 2013-04-28 19:53:12 ERROR OGG-00446 Could not open checkpoint file /app/oracle/product/10.2.0/ogg/dirchk/TREPLVA.cpr, mode 1 (error 2, No such file or directory). |
2 |
3 | 2013-04-28 19:53:12 ERROR OGG-01668 PROCESS ABENDING. |
4 | 2013-04-28 19:53:11 INFO OGG-00987 Oracle GoldenGate Command Interpreter for Oracle: GGSCI command (oracle): start TREPLVC aftercsn 12335663166653. |
5 | 2013-04-28 19:53:11 INFO OGG-00963 Oracle GoldenGate Manager for Oracle, mgr.prm: Command received from GGSCI on host 10.157.165.241 (START REPLICAT TREPLVC AFTERCSN 12335663166653). |
6 | 2013-04-28 19:53:11 INFO OGG-00975 Oracle GoldenGate Manager for Oracle, mgr.prm: REPLICAT TREPLVC starting. |
7 | 2013-04-28 19:53:12 INFO OGG-00995 Oracle GoldenGate Delivery for Oracle, treplvc.prm: REPLICAT TREPLVC starting. |
8 | 2013-04-28 19:53:12 ERROR OGG-00446 Oracle GoldenGate Delivery for Oracle, treplvc.prm: Could not open checkpoint file /app/oracle/product/10.2.0/ogg/dirchk/TREPLVA.cpr, mode 1 (error 2, No such file or directory). |
9 | 2013-04-28 19:53:12 ERROR OGG-01668 Oracle GoldenGate Delivery for Oracle, treplvc.prm: PROCESS ABENDING. |
查看TREPLVC进程,明明使用的是/app/oracle/product/10.2.0/ogg/dirpcs/TREPLVC.pcr文件,为什么提示TREPLVA.pcr文件未找到呢?
01 | GGSCI (tsycodsdb) 17> info TREPLVC DETAIL |
02 |
03 | REPLICAT TREPLVC Initialized 2013-04-28 19:51 Status STOPPED |
04 | Checkpoint Lag 00:00:00 (updated 00:05:33 ago) |
05 | Log Read Checkpoint File ./dirdat/VC000000 |
06 | First Record RBA 0 |
07 | Extract Source Begin End |
08 | ./dirdat/VC000000 * Initialized * First Record |
09 | Report file /app/oracle/product/10.2.0/ogg/dirrpt/TREPLVC.rpt |
10 | Parameter file /app/oracle/product/10.2.0/ogg/dirprm/treplvc.prm |
11 | Checkpoint file /app/oracle/product/10.2.0/ogg/dirchk/TREPLVC.cpr |
12 | Process file /app/oracle/product/10.2.0/ogg/dirpcs/TREPLVC.pcr |
13 | Stdout file /app/oracle/product/10.2.0/ogg/dirout/TREPLVC.out |
14 | Error log /app/oracle/product/10.2.0/ogg/ggserr.log |
以上信息说明在ADD REPLICAT的时候指定的进程名字是TREPLVC,那么有可能是在TREPLVC进程的配置文件中,写错了进程的名字,经排查,的确如此。
01 | GGSCI (tsycodsdb) 18> edit params treplvc |
02 | REPLICAT TREPLVA |
03 | SETENV (NLS_LANG=AMERICAN_AMERICA.ZHS16GBK) |
04 | SETENV (ORACLE_SID=yyjc) |
05 | USERID ogguser, PASSWORD ogguser |
06 | HANDLECOLLISIONS |
07 | SOURCEDEFS ./dirdef/sdcw.def |
08 | SETENV (NLS_LANG=AMERICAN_AMERICA.ZHS16GBK) |
09 | SETENV (ORACLE_SID=yyjc) |
10 | USERID ogguser, PASSWORD ogguser |
11 | HANDLECOLLISIONS |
12 | SOURCEDEFS ./dirdef/sdcw.def |
原来是进程名字写错了,修改成正确的名字TREPLVC后,问题解决。
01 | GGSCI (tsycodsdb) 1> start treplva aftercsn 12354995266226 |
02 |
03 | Sending START request to MANAGER ... |
04 | REPLICAT TREPLVA starting |
05 | GGSCI (tsycodsdb) 2> info all |
06 | Program Status Group Lag Time Since Chkpt |
07 | MANAGER RUNNING |
08 | REPLICAT RUNNING REPJJ 00:00:00 00:00:09 |
09 | REPLICAT RUNNING REPYY 00:00:00 00:00:04 |
10 |
|
2.http://blog.itpub.net/31485142/viewspace-2151879/
ogg之colmap映射
首先源和目标建表:
源:create table tb02(col1 int, col2 int, col3 int);
目标:create table tb02(col1 int, col3 int, col2 int);
抽取进程
GGSCI (pc6) 2> edit params ext_s1
extract ext_s1
setenv (NLS_LANG="AMERICAN_AMERICA.AL32UTF8")
setenv (ORACLE_SID="hyyk")
userid ogg,password oracle
gettruncates
--FORMATASCII, NONAMES, DELIMITER '|'
--FORMATSQL ORACLE, NONAMES
--FORMATXML
exttrail /u01/app/oggs/dirdat/ss
--table sender.tab1, TOKENS(TK-CSN=@getenv('TRANSACTION','CSN'));
table sender.*;
--table sender.tb10, where(col3 = @PRESENT and col1 >10);
投递进程
GGSCI (pc6) 5> edit params pump_s1
extract pump_s1
passthru
userid ogg,password oracle
rmthost 192.168.1.80,mgrport 7809
rmttrail /u01/app/oggd/dirdat/sd
--table sender.tab1;
--table sender.tb10;
table sender.*;
复制进程
GGSCI (ogg-80) 2> edit params rep_s1
replicat rep_s1
setenv(NLS_LANG=AMERICAN_AMERICA.ZHS16GBK)
setenv(ORACLE_SID="ogg")
userid ogg,password oracle
--handlecollisions
ASSUMETARGETDEFS
DISCARDFILE ./dirrpt/rorabb.dsc,PURGE
userid ogg,password oracle
map sender.tab1,target receiver.tab1;
map sender.tb10,target receiver.tb10;
map sender.tb02,target receiver.tb02;
源插入记录:
SENDER@hyyk> insert into tb02 values(1,2,3);
SENDER@hyyk> commit;
源端查看数据
SENDER@hyyk> select * from tb02;
COL1 COL2 COL3
---------- ---------- ----------
1 2 3
目标端查看
这里强调一下如果是ogg11g的话,结果应该是这样的
COL1 COL3 COL2
---------- ---------- ----------
1 2 3
说明ogg 11g是按照列的顺序来的,而不是按照列名来对应的。
如果是ogg12c的话,结果应该是这样的,而本文用的是ogg12c
RECEIVER@ogg> select * from tb02;
COL1 COL3 COL2
---------- ---------- ----------
1 3 2
说明ogg 12c是按照列名的来的,而不是按照列顺序的来对应的。
针对ogg 11g 的问题 我们想实现使用列名来映射
方法一:
我们首先想到加colmap,测试一下:
MAP SENDER.TB02, TARGET RECEIVER.TB02, colmap(usedefaults, col2=col3, col3=col2);
源端再次插入数据
insert into tb02 values(2,3,4);
commit ;
目标
SQL> select * from gtj.tb02
COL1 COL3 COL2
---------- ---------- ----------
1 2 3
2 4 3
发现数据一致 这里要说明一下
MAP SENDER.TB02, TARGET RECEIVER.TB02, colmap(usedefaults, col2=col3, col3=col2);
这里的等号左边是目标端,右边是源端
方法二:
使用定义文件
GGSCI (pc6) 2> edit params defgen
DEFSFILE ./dirdef/test.def
USERID ogg, PASSWORD oracle
TABLE sender.tb02;
生成test.def文件,ftp传输到目标的dirdef文件目录下。
目标rep2进程修改:
--ASSUMETARGETDEFS
SOURCEDEFS ./dirdef/test.def
重启rep2进程后,此时再次进行源端插入操作:insert into tb02 values(3,4,5);
检查目标结果:
select * from gtj.tb02;
COL1 COL3 COL2
---------- ---------- ----------
1 2 3
2 3 4
3 5 4
ok,结果对了。
colmap正确的映射或者配置定义文件(此时不需要colmap都可以实现,但是很多时候如果结构不一致时,还是需要的定义文件的)。实际生产上,如果要配置colmap,一定要注意进行测试,确保正确的结果再上线。
方法三:
执行insert into tb02(col1,col2,col3) values(11,12,13);