OGG initail load 使用文件传输初始化
一、mgr 进程配置(源端和目标端使用相同的配置)
GGSCI (oradb) 1> view params mgr
PORT 7809
二、源端批量抽取进程配置
GGSCI (oradb) 4> edit params extftor
SOURCEISTABLE
userid ggs,password ggs
rmthost 192.168.222.154,mgrport 7809
rmtfile ./dirdat/pp
--rmtfile ./dirdat/pp,maxfiles 5000,megabytes 500
table lixia.t10;
三、目标端批量复制进程配置
GGSCI (fmsserver) 3> edit params repftor
SPECIALRUN
END RUNTIME
userid ggs,password ggs
extfile ./dirdat/pp
ASSUMETARGETDEFS
map lixia.t10,target lixia.t10;
四、源端启动MGR
GGSCI (oradb) 4> start mgr
Manager started.
五、目标端启动MGR
GGSCI (fmsserver) 6> start mgr
Manager started.
六、在源端使用操作系统命令发起 extract(注意:此种 extract,ggsci的info all是看不到的)
[oracle@oradb ~]$ cd /home/oracle
[oracle@oradb ~]$ /app/gg2/extract PARAMFILE /app/gg2/dirprm/extftor.prm REPORTFILE /app/gg2/dirrpt/EXTFTOR.rpt
--源端批量抽取进程执行失败,而且OGG的错误日志没有任何输出,这个时候查看操作系统 /var/log/messages日志,看你到如下错误信息
[root@oradb ~]# tail -100 /var/log/messages
Nov 22 10:39:51 oradb Oracle GoldenGate Capture for Oracle[20522]: 2015-11-22 10:39:51 INFO OGG-00992 Oracle GoldenGate Capture for Oracle, extftor.prm: EXTRACT starting.
Nov 22 10:39:51 oradb Oracle GoldenGate Capture for Oracle[20522]: 2015-11-22 10:39:51 INFO OGG-03059 Oracle GoldenGate Capture for Oracle, extftor.prm: Operating system character set identified as UTF-8.
Nov 22 10:39:51 oradb Oracle GoldenGate Capture for Oracle[20522]: 2015-11-22 10:39:51 INFO OGG-02695 Oracle GoldenGate Capture for Oracle, extftor.prm: ANSI SQL parameter syntax is used for parameter parsing.
Nov 22 10:39:51 oradb Oracle GoldenGate Capture for Oracle[20522]: 2015-11-22 10:39:51 INFO OGG-01017 Oracle GoldenGate Capture for Oracle, extftor.prm: Wildcard resolution set to IMMEDIATE because SOURCEISTABLE is used.
Nov 22 10:39:51 oradb Oracle GoldenGate Capture for Oracle[20522]: 2015-11-22 10:39:51 INFO OGG-03522 Oracle GoldenGate Capture for Oracle, extftor.prm: Setting session time zone to source database time zone 'GMT'.
Nov 22 10:39:51 oradb Oracle GoldenGate Capture for Oracle[20522]: 2015-11-22 10:39:51 WARNING OGG-00254 Oracle GoldenGate Capture for Oracle, extftor.prm: MAXFILES is a deprecated parameter.
Nov 22 10:39:51 oradb Oracle GoldenGate Capture for Oracle[20522]: 2015-11-22 10:39:51 INFO OGG-06509 Oracle GoldenGate Capture for Oracle, extftor.prm: Using the following key columns for source table LIXIA.T10: OBJECT_ID.
Nov 22 10:39:51 oradb Oracle GoldenGate Capture for Oracle[20522]: 2015-11-22 10:39:51 INFO OGG-01851 Oracle GoldenGate Capture for Oracle, extftor.prm: filecaching started: thread ID: 140162969368320.
Nov 22 10:39:51 oradb Oracle GoldenGate Capture for Oracle[20522]: 2015-11-22 10:39:51 WARNING OGG-01262 Oracle GoldenGate Capture for Oracle, extftor.prm: The call to the ggDirIsWritable() function from line 2862 in cm_cachedir_add() failed with reason 'The directory /home/oracle/dirtmp to hold temporary cachefiles does not exist or is not writable'.
Nov 22 10:39:51 oradb Oracle GoldenGate Capture for Oracle[20522]: 2015-11-22 10:39:51 ERROR OGG-01264 Oracle GoldenGate Capture for Oracle, extftor.prm: The call to the cm_cachedir_add() function from line 2603 in cm_init_vm_facilities() returned an unexpected value.
Nov 22 10:39:51 oradb Oracle GoldenGate Capture for Oracle[20522]: 2015-11-22 10:39:51 ERROR OGG-01668 Oracle GoldenGate Capture for Oracle, extftor.prm: PROCESS ABENDING.
Nov 22 10:39:54 oradb kernel: hrtimer: interrupt took 3057793 ns
Nov 22 10:40:01 oradb Oracle GoldenGate Command Interpreter for Oracle[16763]: 2015-11-22 10:40:01 INFO OGG-00987 Oracle GoldenGate Command Interpreter for Oracle: GGSCI command (oracle): info all.
原因:
操作系统日志提示/home/oracle/dirtmp 目录不存在,因为我们是在 /home/oracle目录下执行命令,导致无法找到 dirtmp目录
Nov 22 10:39:51 oradb Oracle GoldenGate Capture for Oracle[20522]: 2015-11-22 10:39:51 WARNING OGG-01262
Oracle GoldenGate Capture for Oracle, extftor.prm: The call to the ggDirIsWritable()
function from line 2862 in cm_cachedir_add() failed with reason 'The directory /home/oracle/dirtmp to
hold temporary cachefiles does not exist or is not writable'.
处理:切换到 /app/gg2 目录再执行命令
[oracle@oradb dirrpt]$ cd /app/gg2/
[oracle@oradb gg2]$ pwd
/app/gg2
[oracle@oradb gg2]$ /app/gg2/extract PARAMFILE /app/gg2/dirprm/extftor.prm REPORTFILE /app/gg2/dirrpt/EXTFTOR.rpt
七、在目标端的 /app/gg2/dirdat 目录可以看如下文件
[oracle@fmsserver dirdat]$ ls -lrt pp*|wc -l
1
[oracle@fmsserver dirdat]$ ls -lrth pp*
-rw-r-----. 1 oracle oinstall 29M Nov 22 11:55 pp000000
[oracle@fmsserver dirdat]$ pwd
/app/gg2/dirdat
八、等待 extrac 完成,可以从/app/gg2/dirrpt/EXTFTOR.rpt 判断
[oracle@oradb dirrpt]$ cd /app/gg2/dirrpt
[oracle@oradb dirrpt]$ cat EXTFTOR.rpt
***********************************************************************
Oracle GoldenGate Capture for Oracle
Version 12.1.2.1.0 OGGCORE_12.1.2.1.0_PLATFORMS_140727.2135.1_FBO
Linux, x64, 64bit (optimized), Oracle 11g on Aug 7 2014 09:31:26
Copyright (C) 1995, 2014, Oracle and/or its affiliates. All rights reserved.
Starting at 2015-11-22 10:43:10
***********************************************************************
Operating System Version:
Linux
Version #1 SMP Tue Jan 29 11:47:41 EST 2013, Release 2.6.32-358.el6.x86_64
Node: oradb
Machine: x86_64
soft limit hard limit
Address Space Size : unlimited unlimited
Heap Size : unlimited unlimited
File Size : unlimited unlimited
CPU Time : unlimited unlimited
Process id: 20567
Description:
***********************************************************************
** Running with the following parameters **
***********************************************************************
2015-11-22 10:43:10 INFO OGG-03059 Operating system character set identified as UTF-8.
2015-11-22 10:43:10 INFO OGG-02695 ANSI SQL parameter syntax is used for parameter parsing.
SOURCEISTABLE
2015-11-22 10:43:10 INFO OGG-01017 Wildcard resolution set to IMMEDIATE because SOURCEISTABLE is used.
userid ggs,password ***
2015-11-22 10:43:10 INFO OGG-03522 Setting session time zone to source database time zone 'GMT'.
rmthost 192.168.222.154,mgrport 7809
rmtfile ./dirdat/pp,maxfiles 5000,megabytes 500
2015-11-22 10:43:10 WARNING OGG-00254 MAXFILES is a deprecated parameter.
table lixia.t10;
2015-11-22 10:43:10 INFO OGG-06509 Using the following key columns for source table LIXIA.T10: OBJECT_ID.
2015-11-22 10:43:10 INFO OGG-01851 filecaching started: thread ID: 139950894868224.
2015-11-22 10:43:10 INFO OGG-01815 Virtual Memory Facilities for: COM
anon alloc: mmap(MAP_ANON) anon free: munmap
file alloc: mmap(MAP_SHARED) file free: munmap
target directories:
/app/gg2/dirtmp.
CACHEMGR virtual memory values (may have been adjusted)
CACHESIZE: 64G
CACHEPAGEOUTSIZE (default): 8M
PROCESS VM AVAIL FROM OS (min): 128G
CACHESIZEMAX (strict force to disk): 96G
Database Version:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
PL/SQL Release 11.2.0.4.0 - Production
CORE 11.2.0.4.0 Production
TNS for Linux: Version 11.2.0.4.0 - Production
NLSRTL Version 11.2.0.4.0 - Production
Database Language and Character Set:
NLS_LANGUAGE = "AMERICAN"
NLS_TERRITORY = "AMERICA"
NLS_CHARACTERSET = "ZHS16GBK"
2015-11-22 10:43:10 INFO OGG-01478 Output file ./dirdat/pp is using format RELEASE 12.1.
2015-11-22 10:43:16 INFO OGG-01226 Socket buffer size set to 27985 (flush size 27985).
Processing table LIXIA.T10
***********************************************************************
* ** Run Time Statistics ** *
***********************************************************************
Report at 2015-11-22 10:43:17 (activity since 2015-11-22 10:43:10)
Output to ./dirdat/pp:
From Table LIXIA.T10:
# inserts: 108854
# updates: 0
# deletes: 0
# discards: 0
REDO Log Statistics
Bytes parsed 0
Bytes output 29666633
九、在目标端使用操作系统命令启动批量复制进程
[oracle@fmsserver gg2]$ /app/gg2/replicat paramfile /app/gg2/dirprm/repftor.prm reportfile /app/gg2/dirrpt/REPFTOR.rpt
十、等待 replicat 完成,可以从 /app/gg2/dirrpt/REPFTOR.rpt 中判断
[oracle@fmsserver dirrpt]$ more REPFTOR.rpt
。。。。。 省略 N行 。。。。
___________________________________________________________________
Reading /app/gg2/dirdat/pp000000, current RBA 29667995, 108854 records
Report at 2015-11-22 11:19:51 (activity since 2015-11-22 11:19:37)From Table LIXIA.T10 to LIXIA.T10:
# inserts: 108854
# updates: 0
# deletes: 0
# discards: 0
。。。。。 省略 N行 。。。。