【OGG】OGG的单向DML复制配置(一)
各位技术爱好者,看完本文后,你可以掌握如下的技能,也可以学到一些其它你所不知道的知识,~O(∩_∩)O~:
① OGG的单向DML实时复制功能
② 数据库的静默安装
③ OGG的安装
④ OGG下数据的初始化工作
注意:本篇BLOG中代码部分需要特别关注的地方我都用黄色背景和红色字体来表示,比如下边的例子中,thread 1的最大归档日志号为33,thread 2的最大归档日志号为43是需要特别关注的地方。
List of Archived Logs in backup set 11
Thrd Seq Low SCN Low Time Next SCN Next Time
---- ------- ---------- ------------------- ---------- ---------
1 32 1621589 2015-05-29 11:09:52 1625242 2015-05-29 11:15:48
1 33 1625242 2015-05-29 11:15:48 1625293 2015-05-29 11:15:58
2 42 1613951 2015-05-29 10:41:18 1625245 2015-05-29 11:15:49
2 43 1625245 2015-05-29 11:15:49 1625253 2015-05-29 11:15:53
本文如有错误或不完善的地方请大家多多指正,ITPUB留言或QQ皆可,您的批评指正是我写作的最大动力。
项目 |
source db |
target db |
db 类型 |
单实例 |
单实例 |
db version |
11.2.0.3 |
11.2.0.3 |
db 存储 |
FS type |
FS type |
ORACLE_SID |
ogg1 |
ogg2 |
db_name |
ogg1 |
ogg2 |
主机IP地址: |
192.168.59.129 |
192.168.59.130 |
OS版本及kernel版本 |
RHEL6.5 64位,2.6.32-504.16.2.el6.x86_64 |
RHEL6.5 64位,2.6.32-504.16.2.el6.x86_64 |
OGG版本 |
11.2.1.0.1 64位 |
11.2.1.0.1 64位 |
OS hostname |
orcltest |
rhel6_lhr |
【OGG】OGG的下载和安装篇:http://blog.itpub.net/26736162/viewspace-1693241/
本文基于OGG的DML复制功能,后续会推出系列的OGG配置,包括DDL复制,双向复制,还有rac到单实例的复制等等,主要参考网址为:http://ylw6006.blog.51cto.com/all/470441/16 ,非常感谢斩月大师。
配置2台服务器,搭建OGG,实现hr用户下的数据dml复制功能。
首先在source和target端确保/etc/hosts中的主机名到ip地址的解析是正确的,且127.0.0.1没有指向本主机名,这里以target端为例:
[oracle@rhel6_lhr ~]$ hostname
rhel6_lhr
[oracle@rhel6_lhr ~]$ more /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.59.130 rhel6_lhr
[oracle@rhel6_lhr ~]$ ifconfig
eth0 Link encap:Ethernet HWaddr 00:0C:29:C0:A7:56
inet addr:192.168.59.130 Bcast:192.168.59.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fec0:a756/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:650153 errors:0 dropped:0 overruns:0 frame:0
TX packets:160873 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:824479355 (786.2 MiB) TX bytes:16495312 (15.7 MiB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:104417 errors:0 dropped:0 overruns:0 frame:0
TX packets:104417 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:26855022 (25.6 MiB) TX bytes:26855022 (25.6 MiB)
[oracle@rhel6_lhr ~]$
source端:
[oracle@orcltest ~]$ dbca -silent -createDatabase -templateName General_Purpose.dbc -gdbname ogg1 -sid ogg1 -sysPassword lhr -systemPassword lhr -responseFile NO_VALUE -datafileDestination /u01/app/oracle/oradata -redoLogFileSize 50 -recoveryAreaDestination /u01/app/oracle/flash_recovery_area -storageType FS -characterSet ZHS16GBK -nationalCharacterSet AL16UTF16 -sampleSchema true -memoryPercentage 30 -totalMemory 200 -databaseType OLTP -emConfiguration NONE -automaticMemoryManagement true
Copying database files
1% complete
3% complete
10% complete
17% complete
24% complete
35% complete
Creating and starting Oracle instance
37% complete
42% complete
47% complete
52% complete
53% complete
56% complete
58% complete
Registering database with Oracle Restart
64% complete
Completing Database Creation
68% complete
71% complete
75% complete
85% complete
96% complete
100% complete
Look at the log file "/u02/app/oracle/cfgtoollogs/dbca/ogg1/ogg1.log" for further details.
[oracle@orcltest ~]$
[oracle@orcltest ~]$ ps -ef|grep ora_
oracle 20620 1 0 10:18 ? 00:00:00 ora_pmon_ogg1
oracle 20622 1 0 10:18 ? 00:00:00 ora_psp0_ogg1
oracle 20624 1 0 10:19 ? 00:00:00 ora_vktm_ogg1
oracle 20628 1 0 10:19 ? 00:00:00 ora_gen0_ogg1
oracle 20630 1 0 10:19 ? 00:00:00 ora_diag_ogg1
oracle 20632 1 0 10:19 ? 00:00:00 ora_dbrm_ogg1
oracle 20634 1 0 10:19 ? 00:00:00 ora_dia0_ogg1
oracle 20636 1 0 10:19 ? 00:00:00 ora_mman_ogg1
oracle 20638 1 0 10:19 ? 00:00:00 ora_dbw0_ogg1
oracle 20640 1 0 10:19 ? 00:00:00 ora_lgwr_ogg1
oracle 20642 1 0 10:19 ? 00:00:00 ora_ckpt_ogg1
oracle 20644 1 0 10:19 ? 00:00:00 ora_smon_ogg1
oracle 20646 1 0 10:19 ? 00:00:00 ora_reco_ogg1
oracle 20648 1 0 10:19 ? 00:00:00 ora_mmon_ogg1
oracle 20650 1 0 10:19 ? 00:00:00 ora_mmnl_ogg1
oracle 20652 1 0 10:19 ? 00:00:00 ora_d000_ogg1
oracle 20654 1 0 10:19 ? 00:00:00 ora_s000_ogg1
oracle 20690 1 0 10:19 ? 00:00:00 ora_arc0_ogg1
oracle 20692 1 0 10:19 ? 00:00:00 ora_arc1_ogg1
oracle 20694 1 0 10:19 ? 00:00:00 ora_arc2_ogg1
oracle 20696 1 0 10:19 ? 00:00:00 ora_arc3_ogg1
oracle 20698 1 0 10:19 ? 00:00:00 ora_qmnc_ogg1
oracle 20729 1 0 10:19 ? 00:00:00 ora_cjq0_ogg1
oracle 20744 1 0 10:19 ? 00:00:00 ora_q000_ogg1
oracle 20746 1 0 10:19 ? 00:00:00 ora_q001_ogg1
oracle 20768 19494 0 10:21 pts/0 00:00:00 grep ora_
[oracle@orcltest ~]$
target端:
[oracle@rhel6_lhr ~]$ dbca -silent -createDatabase -templateName General_Purpose.dbc -gdbname ogg2 -sid ogg2 -sysPassword lhr -systemPassword lhr -responseFile NO_VALUE -datafileDestination /u01/app/oracle/oradata -redoLogFileSize 50 -recoveryAreaDestination /u01/app/oracle/flash_recovery_area -storageType FS -characterSet ZHS16GBK -nationalCharacterSet AL16UTF16 -sampleSchema true -memoryPercentage 30 -totalMemory 200 -databaseType OLTP -emConfiguration NONE -automaticMemoryManagement true
Copying database files
1% complete
3% complete
10% complete
17% complete
24% complete
31% complete
35% complete
Creating and starting Oracle instance
37% complete
42% complete
47% complete
52% complete
53% complete
56% complete
58% complete
Registering database with Oracle Restart
64% complete
Completing Database Creation
68% complete
71% complete
75% complete
85% complete
96% complete
100% complete
Look at the log file "/u01/app/oracle/cfgtoollogs/dbca/ogg2/ogg2.log" for further details.
You have new mail in /var/spool/mail/oracle
[oracle@rhel6_lhr ~]$ ps -ef|grep ora_
oracle 12227 1 0 20:12 ? 00:00:00 ora_pmon_ogg2
oracle 12229 1 0 20:12 ? 00:00:00 ora_psp0_ogg2
oracle 12231 1 1 20:12 ? 00:00:03 ora_vktm_ogg2
oracle 12235 1 0 20:12 ? 00:00:00 ora_gen0_ogg2
oracle 12237 1 0 20:12 ? 00:00:00 ora_diag_ogg2
oracle 12239 1 0 20:12 ? 00:00:00 ora_dbrm_ogg2
oracle 12241 1 0 20:12 ? 00:00:00 ora_dia0_ogg2
oracle 12243 1 0 20:12 ? 00:00:00 ora_mman_ogg2
oracle 12245 1 0 20:12 ? 00:00:00 ora_dbw0_ogg2
oracle 12247 1 0 20:12 ? 00:00:00 ora_lgwr_ogg2
oracle 12249 1 0 20:12 ? 00:00:00 ora_ckpt_ogg2
oracle 12251 1 0 20:12 ? 00:00:00 ora_smon_ogg2
oracle 12253 1 0 20:12 ? 00:00:00 ora_reco_ogg2
oracle 12255 1 0 20:12 ? 00:00:00 ora_mmon_ogg2
oracle 12257 1 0 20:12 ? 00:00:00 ora_mmnl_ogg2
oracle 12259 1 0 20:12 ? 00:00:00 ora_d000_ogg2
oracle 12261 1 0 20:12 ? 00:00:00 ora_s000_ogg2
oracle 12289 1 0 20:12 ? 00:00:00 ora_arc0_ogg2
oracle 12291 1 0 20:12 ? 00:00:00 ora_arc1_ogg2
oracle 12293 1 0 20:12 ? 00:00:00 ora_arc2_ogg2
oracle 12295 1 0 20:12 ? 00:00:00 ora_arc3_ogg2
oracle 12297 1 0 20:12 ? 00:00:00 ora_qmnc_ogg2
oracle 12330 1 0 20:12 ? 00:00:00 ora_cjq0_ogg2
oracle 12347 1 0 20:13 ? 00:00:00 ora_q000_ogg2
oracle 12349 1 0 20:13 ? 00:00:00 ora_q001_ogg2
oracle 12492 7669 0 20:15 pts/2 00:00:00 grep ora_
[oracle@rhel6_lhr ~]$
该步骤确保ORACLE和OGG的环境变量正确,listener启动即可。
[oracle@orcltest ~]$ more .bash_profile
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
export PATH=$PATH:/sbin/:$HOME/bin
# for oracle user
unset USERNAME
export EDITOR=vi
export ORACLE_SID=ogg1
export ORACLE_BASE=/u02/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib:/usr/local/lib
export PATH=$ORACLE_HOME/bin:$PATH
export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib:$ORACLE_HOME/network/jlib
export TNS_ADMIN=$ORACLE_HOME/network/admin
umask 022
#export NLS_LANG="SIMPLIFIED CHINESE_CHINA.AL32UTF8"
export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
export SQLPATH=$ORACLE_HOME/sqlplus/admin
alias sqlplus='rlwrap sqlplus'
alias rman='rlwrap rman'
alias asmcmd='rlwrap asmcmd'
alias alert_log='tail -200f $ORACLE_BASE/diag/rdbms/$ORACLE_SID/$ORACLE_SID/trace/alert_$ORACLE_SID.log'
export OGG_HOME=/u01/gg11
export PATH=$OGG_HOME:$ORACLE_HOME/bin:$PATH
export LD_LIBRARY_PATH=$OGG_HOME:$ORACLE_HOME/lib:$LD_LIBRARYPATH
alias ggsci='rlwrap ggsci'
export NLS_DATE_FORMAT='YYYY-MM-DD HH24:mi:ss'
[oracle@orcltest ~]$
[oracle@orcltest ~]$ more $TNS_ADMIN/tnsnames.ora
# tnsnames.ora Network Configuration File: /u02/app/oracle/product/11.2.0/dbhome_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.
OGG1 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.59.129)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = ogg1)
)
)
OGG2 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.59.130)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = ogg2)
)
)
[oracle@orcltest ~]$
[oracle@orcltest ~]$ tnsping ogg1
TNS Ping Utility for Linux: Version 11.2.0.3.0 - Production on 10-JUN-2015 10:29:54
Copyright (c) 1997, 2011, Oracle. All rights reserved.
Used parameter files:
/u02/app/oracle/product/11.2.0/dbhome_1/network/admin/sqlnet.ora
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.59.129)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = ogg1)))
OK (0 msec)
[oracle@orcltest ~]$ tnsping ogg2
TNS Ping Utility for Linux: Version 11.2.0.3.0 - Production on 10-JUN-2015 10:30:02
Copyright (c) 1997, 2011, Oracle. All rights reserved.
Used parameter files:
/u02/app/oracle/product/11.2.0/dbhome_1/network/admin/sqlnet.ora
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.59.130)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = ogg2)))
OK (0 msec)
[oracle@orcltest ~]$ sqlplus sys/lhr@ogg1 as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on Wed Jun 10 10:30:13 2015
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL>
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@orcltest ~]$ sqlplus sys/lhr@ogg2 as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on Wed Jun 10 10:30:21 2015
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@orcltest ~]$
这里需要确保source端数据库运行在归档模式,且开启最小数据库附加日志,可以不用打开force logging,但是建议打开这个功能,然后在source和target端都创建用于复制的数据库账号ggusr,为了方便,这里直接赋予dba权限,如果对数据库安全要求高,可以去查询ogg文档,赋予复制需要的最小权限!
source端:
[oracle@orcltest ~]$ sqlplus sys/lhr@ogg1 as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on Wed Jun 10 10:31:52 2015
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> show parameter name
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_file_name_convert string
db_name string ogg1
db_unique_name string ogg1
global_names boolean FALSE
instance_name string ogg1
lock_name_space string
log_file_name_convert string
processor_group_name string
service_names string ogg1
SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 3
Next log sequence to archive 5
Current log sequence 5
SQL> select name,SUPPLEMENTAL_LOG_DATA_MIN, FORCE_LOGGING from v$database;
NAME SUPPLEME FOR
--------- -------- ---
OGG1 NO NO
SQL> alter database add supplemental log data ;
Database altered.
SQL> alter system switch logfile;
System altered.
SQL> select name,SUPPLEMENTAL_LOG_DATA_MIN, FORCE_LOGGING from v$database;
NAME SUPPLEME FOR
--------- -------- ---
OGG1 YES NO
SQL> select name from v$datafile;
NAME
--------------------------------------------------------------------------------
/u01/app/oracle/oradata/ogg1/system01.dbf
/u01/app/oracle/oradata/ogg1/sysaux01.dbf
/u01/app/oracle/oradata/ogg1/undotbs01.dbf
/u01/app/oracle/oradata/ogg1/users01.dbf
/u01/app/oracle/oradata/ogg1/example01.dbf
SQL> create tablespace TS_OGG datafile '/u01/app/oracle/oradata/ogg1/ts_ogg01.dbf' size 50M ;
Tablespace created.
SQL> create user ggusr identified by lhr default tablespace TS_OGG;
User created.
SQL> grant resource, connect, dba to ggusr;
Grant succeeded.
SQL>
target端:
[oracle@orcltest ~]$ sqlplus sys/lhr@ogg2 as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on Wed Jun 10 10:37:08 2015
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> show parameter name
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_file_name_convert string
db_name string ogg2
db_unique_name string ogg2
global_names boolean FALSE
instance_name string ogg2
lock_name_space string
log_file_name_convert string
processor_group_name string
service_names string ogg2
SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 3
Next log sequence to archive 5
Current log sequence 5
SQL> select name,SUPPLEMENTAL_LOG_DATA_MIN, FORCE_LOGGING from v$database;
NAME SUPPLEME FOR
--------- -------- ---
OGG2 NO NO
SQL> select name from v$datafile;
NAME
--------------------------------------------------------------------------------
/u01/app/oracle/oradata/ogg2/system01.dbf
/u01/app/oracle/oradata/ogg2/sysaux01.dbf
/u01/app/oracle/oradata/ogg2/undotbs01.dbf
/u01/app/oracle/oradata/ogg2/users01.dbf
/u01/app/oracle/oradata/ogg2/example01.dbf
SQL> create tablespace TS_OGG datafile '/u01/app/oracle/oradata/ogg2/ts_ogg01.dbf' size 50M ;
Tablespace created.
SQL> create user ggusr identified by lhr default tablespace TS_OGG;
User created.
SQL> grant resource, connect, dba to ggusr;
Grant succeeded.
SQL>
备注: 在oracle中可以通过rowid来定位某条记录,但是目标端的数据库和源端数据库的数据库可能完全不一样,所以无法通过rowid来确定源端数据库的逻辑变化,这时附加日志supplemental log便登上了表演的舞台。数据库在开启附加日志功能后,对于源端的修改操作,oracle会同时追加能够唯一标示记录的列到redo log。这样目标端数据库就可以知道源端发生了哪些具体的变化。
以下操作在source和target端都需要做:
http://blog.itpub.net/26736162/viewspace-1693241/
source和target端均操作:
[oracle@orcltest gg11]$ cd $OGG_HOME
[oracle@orcltest gg11]$ ggsci
Oracle GoldenGate Command Interpreter for Oracle
Version 11.2.1.0.1 OGGCORE_11.2.1.0.1_PLATFORMS_120423.0230_FBO
Linux, x64, 64bit (optimized), Oracle 11g on Apr 23 2012 08:32:14
Copyright (C) 1995, 2012, Oracle and/or its affiliates. All rights reserved.
GGSCI (orcltest) 1> edit params mgr
PORT 7809
~
~
。。。。。。。。。。。。。
~
"dirprm/mgr.prm" 1L, 10C written
GGSCI (orcltest) 2> view params mgr
PORT 7809
GGSCI (orcltest) 3> info all
Program Status Group Lag at Chkpt Time Since Chkpt
MANAGER STOPPED
GGSCI (orcltest) 4> start mgr
Manager started.
GGSCI (orcltest) 5> info mgr
Manager is running (IP port orcltest.7809).
GGSCI (orcltest) 6> view report mgr
***********************************************************************
Oracle GoldenGate Manager for Oracle
Version 11.2.1.0.1 OGGCORE_11.2.1.0.1_PLATFORMS_120423.0230
Linux, x64, 64bit (optimized), Oracle 11g on Apr 23 2012 04:27:29
Copyright (C) 1995, 2012, Oracle and/or its affiliates. All rights reserved.
Starting at 2015-06-10 10:49:05
***********************************************************************
Operating System Version:
Linux
Version #1 SMP Sun Nov 10 22:19:54 EST 2013, Release 2.6.32-431.el6.x86_64
Node: orcltest
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: 21192
Parameters...
PORT 7809
***********************************************************************
** Run Time Messages **
***********************************************************************
2015-06-10 10:49:05 INFO OGG-00983 Manager started (port 7809).
ogg告警日志内容(/u01/gg11/ggserr.log):
2015-06-09 20:46:45 INFO OGG-00987 Oracle GoldenGate Command Interpreter for Oracle: GGSCI command (oracle): edit params mgr.
2015-06-09 20:46:58 INFO OGG-00987 Oracle GoldenGate Command Interpreter for Oracle: GGSCI command (oracle): start mgr.
2015-06-09 20:46:58 INFO OGG-00983 Oracle GoldenGate Manager for Oracle, mgr.prm: Manager started (port 7809).
解锁hr用户,并在hr用户下创建表t1:
[oracle@orcltest gg11]$ sqlplus sys/lhr@ogg1 as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on Wed Jun 10 10:56:45 2015
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> alter user hr identified by hr account unlock;
User altered.
SQL> grant connect,resource,select_catalog_role to hr;
Grant succeeded.
SQL> create table hr.t1 as select * from dba_objects;
Table created.
SQL> alter table hr.t1 add constraint pk_t1 primary key(object_id);
Table altered.
SQL> select count(*) from hr.t1;
COUNT(*)
----------
75203
SQL>
SQL> conn sys/lhr@ogg2 as sysdba
Connected.
SQL> alter user hr identified by hr account unlock;
User altered.
SQL> grant connect,resource,select_catalog_role to hr;
Grant succeeded.
SQL> create table hr.t1 as select * from dba_objects where 1=2;
Table created.
SQL> alter table hr.t1 add constraint pk_t1 primary key(object_id);
Table altered.
SQL> select count(*) from hr.t1;
COUNT(*)
----------
0
SQL>
初始化加载数据,在异构数据库平台(例如oracle-mysql),这个功能显得非常的有用!而在oracle-oracle的数据复制条件下,oracle推荐使用expdp/impdp工具
GGSCI (orcltest) 1> add extract einig1,sourceistable //sourceistable代表直接从表中读取数据
EXTRACT added.
GGSCI (orcltest) 2> info all
Program Status Group Lag at Chkpt Time Since Chkpt
MANAGER RUNNING
GGSCI (orcltest) 3> info einig1,task
EXTRACT EINIG1 Initialized 2015-06-10 11:03 Status STOPPED
Checkpoint Lag Not Available
Log Read Checkpoint Not Available
First Record Record 0
Task SOURCEISTABLE
GGSCI (orcltest) 4> info einig1,showch
EXTRACT EINIG1 Initialized 2015-06-10 11:03 Status STOPPED
Checkpoint Lag Not Available
Log Read Checkpoint Not Available
First Record Record 0
Task SOURCEISTABLE
Current Checkpoint Detail:
Read Checkpoint #1
Database Table
Startup Checkpoint (starting position in the data source):
Record #: 0
Timestamp: Not Available
Table:
Current Checkpoint (position of last record read in the data source):
Record #: 0
Timestamp: Not Available
Table:
CSN state information:
CRC: 7F-47-3E-B8
CSN: Not available
Header:
Version = 2
Record Source = U
Type = 3
# Input Checkpoints = 1
# Output Checkpoints = 0
File Information:
Block Size = 2048
Max Blocks = 100
Record Length = 2048
Current Offset = 0
Configuration:
Data Source = 2
Transaction Integrity = 0
Task Type = 1
Status:
Start Time = 2015-06-10 11:03:37
Last Update Time = 2015-06-10 11:03:37
Stop Status = G
Last Result = 0
GGSCI (orcltest) 5>
GGSCI (orcltest) 5> edit params einig1 //einig1代表extract initial load group 1缩写
extract einig1
setenv (NLS_LANG=AMERICAN_AMERICA.ZHS16GBK)
userid ggusr,password lhr
rmthost 192.168.59.130,mgrport 7809
rmttask replicat,group rinig1
extract einig1
setenv (ORACLE_SID=ogg1)
setenv (NLS_LANG=AMERICAN_AMERICA.ZHS16GBK)
userid ggusr,password lhr
rmthost 192.168.59.130,mgrport 7809
rmttask replicat,group rinig1
table hr.t1;
~
~
~
。。。。。。。。。。。。。。。。。。
~
~
~
"dirprm/einig1.prm" 7L, 189C written
GGSCI (orcltest) 6> view params einig1
extract einig1
setenv (ORACLE_SID=ogg1)
setenv (NLS_LANG=AMERICAN_AMERICA.ZHS16GBK)
userid ggusr,password lhr
rmthost 192.168.59.130,mgrport 7809
rmttask replicat,group rinig1
table hr.t1;
GGSCI (orcltest) 7>
GGSCI (orcltest) 9> info *,task
EXTRACT EINIG1 Initialized 2015-06-10 11:03 Status STOPPED
Checkpoint Lag Not Available
Log Read Checkpoint Not Available
First Record Record 0
Task SOURCEISTABLE
GGSCI (orcltest) 10>
[oracle@rhel6_lhr gg11]$ ggsci
Oracle GoldenGate Command Interpreter for Oracle
Version 11.2.1.0.1 OGGCORE_11.2.1.0.1_PLATFORMS_120423.0230_FBO
Linux, x64, 64bit (optimized), Oracle 11g on Apr 23 2012 08:32:14
Copyright (C) 1995, 2012, Oracle and/or its affiliates. All rights reserved.
GGSCI (rhel6_lhr) 1> info *,task
No ER groups exist.
GGSCI (rhel6_lhr) 2> add replicat rinig1,specialrun //specialrun代表只运行一次
REPLICAT added.
GGSCI (rhel6_lhr) 3> info *,task
REPLICAT RINIG1 Initialized 2015-06-09 22:18 Status STOPPED
Checkpoint Lag 00:00:00 (updated 00:00:03 ago)
Log Read Checkpoint Not Available
Task SPECIALRUN
GGSCI (rhel6_lhr) 4> info all
Program Status Group Lag at Chkpt Time Since Chkpt
MANAGER RUNNING
GGSCI (rhel6_lhr) 5> edit params rinig1 //rinig1的名字必须同source端定义的group名字相同,rinig1代表replicat initial load group 1缩写
GGSCI (rhel6_lhr) 6> view params rinig1
replicat rinig1
setenv (ORACLE_SID=ogg2)
setenv (ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1)
setenv (NLS_LANG=AMERICAN_AMERICA.ZHS16GBK)
assumetargetdefs
userid ggusr,password lhr
discardfile ./dirrpt/rinig1.dsc,purge
map hr.*,target hr.*;
GGSCI (rhel6_lhr) 7>
GGSCI (rhel6_lhr) 7> info einig1,task
ERROR: Invalid command.
GGSCI (rhel6_lhr) 8> info rinig1
REPLICAT RINIG1 Initialized 2015-06-09 22:18 Status STOPPED
Checkpoint Lag 00:00:00 (updated 00:03:33 ago)
Log Read Checkpoint Not Available
Task SPECIALRUN
GGSCI (rhel6_lhr) 9> info rinig1,task
REPLICAT RINIG1 Initialized 2015-06-09 22:18 Status STOPPED
Checkpoint Lag 00:00:00 (updated 00:03:52 ago)
Log Read Checkpoint Not Available
Task SPECIALRUN
GGSCI (rhel6_lhr) 10> info rinig1,showch
REPLICAT RINIG1 Initialized 2015-06-09 22:18 Status STOPPED
Checkpoint Lag 00:00:00 (updated 00:03:58 ago)
Log Read Checkpoint Not Available
Task SPECIALRUN
Current Checkpoint Detail:
Read Checkpoint #1
SPECIALRUN task -- ** Initialized **
CSN state information:
CRC: AF-F4-5D-35
CSN: Not available
Header:
Version = 2
Record Source = U
Type = -1
# Input Checkpoints = 1
# Output Checkpoints = 0
File Information:
Block Size = 2048
Max Blocks = 100
Record Length = 2048
Current Offset = 0
Configuration:
Data Source = -1
Transaction Integrity = -1
Task Type = 2
Status:
Start Time = 2015-06-09 22:18:34
Last Update Time = 2015-06-09 22:18:34
Stop Status = G
Last Result = 0
GGSCI (rhel6_lhr) 11>
GGSCI (orcltest) 1> start extract einig1
Sending START request to MANAGER ...
EXTRACT EINIG1 starting
GGSCI (orcltest) 2> info *,task
EXTRACT EINIG1 Initialized 2015-06-10 11:03 Status RUNNING
Checkpoint Lag Not Available
Log Read Checkpoint Not Available
First Record Record 0
Task SOURCEISTABLE
GGSCI (orcltest) 3> view report einig1
2015-06-10 12:40:54 INFO OGG-01017 Wildcard resolution set to IMMEDIATE because SOURCEISTABLE is used.
***********************************************************************
Oracle GoldenGate Capture for Oracle
Version 11.2.1.0.1 OGGCORE_11.2.1.0.1_PLATFORMS_120423.0230_FBO
Linux, x64, 64bit (optimized), Oracle 11g on Apr 23 2012 08:42:16
Copyright (C) 1995, 2012, Oracle and/or its affiliates. All rights reserved.
Starting at 2015-06-10 12:40:54
***********************************************************************
Operating System Version:
Linux
Version #1 SMP Sun Nov 10 22:19:54 EST 2013, Release 2.6.32-431.el6.x86_64
Node: orcltest
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: 21707
Description:
***********************************************************************
** Running with the following parameters **
***********************************************************************
2015-06-10 12:40:54 INFO OGG-03035 Operating system character set identified as UTF-8. Locale: en_US, LC_ALL:.
extract einig1
setenv (ORACLE_SID=ogg1)
Set environment variable (ORACLE_SID=ogg1)
setenv (ORACLE_HOME=/u02/app/oracle/product/11.2.0/dbhome_1)
Set environment variable (ORACLE_HOME=/u02/app/oracle/product/11.2.0/dbhome_1)
setenv (NLS_LANG=AMERICAN_AMERICA.ZHS16GBK)
Set environment variable (NLS_LANG=AMERICAN_AMERICA.ZHS16GBK)
userid ggusr,password ***
rmthost 192.168.59.130,mgrport 7809
rmttask replicat,group rinig1
table hr.t1;
Using the following key columns for source table HR.T1: OBJECT_ID.
2015-06-10 12:40:55 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:
/u01/gg11/dirtmp.
CACHEMGR virtual memory values (may have been adjusted)
CACHESIZE: 64G
CACHEPAGEOUTSIZE (normal): 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.3.0 - 64bit Production
PL/SQL Release 11.2.0.3.0 - Production
CORE 11.2.0.3.0 Production
TNS for Linux: Version 11.2.0.3.0 - Production
NLSRTL Version 11.2.0.3.0 - Production
Database Language and Character Set:
NLS_LANG = "AMERICAN_AMERICA.ZHS16GBK"
NLS_LANGUAGE = "AMERICAN"
NLS_TERRITORY = "AMERICA"
NLS_CHARACTERSET = "ZHS16GBK"
Processing table HR.T1
GGSCI (orcltest) 4> view report einig1
2015-06-10 12:40:54 INFO OGG-01017 Wildcard resolution set to IMMEDIATE because SOURCEISTABLE is used.
***********************************************************************
Oracle GoldenGate Capture for Oracle
Version 11.2.1.0.1 OGGCORE_11.2.1.0.1_PLATFORMS_120423.0230_FBO
Linux, x64, 64bit (optimized), Oracle 11g on Apr 23 2012 08:42:16
Copyright (C) 1995, 2012, Oracle and/or its affiliates. All rights reserved.
Starting at 2015-06-10 12:40:54
***********************************************************************
Operating System Version:
Linux
Version #1 SMP Sun Nov 10 22:19:54 EST 2013, Release 2.6.32-431.el6.x86_64
Node: orcltest
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: 21707
Description:
***********************************************************************
** Running with the following parameters **
***********************************************************************
2015-06-10 12:40:54 INFO OGG-03035 Operating system character set identified as UTF-8. Locale: en_US, LC_ALL:.
extract einig1
setenv (ORACLE_SID=ogg1)
Set environment variable (ORACLE_SID=ogg1)
setenv (ORACLE_HOME=/u02/app/oracle/product/11.2.0/dbhome_1)
Set environment variable (ORACLE_HOME=/u02/app/oracle/product/11.2.0/dbhome_1)
setenv (NLS_LANG=AMERICAN_AMERICA.ZHS16GBK)
Set environment variable (NLS_LANG=AMERICAN_AMERICA.ZHS16GBK)
userid ggusr,password ***
rmthost 192.168.59.130,mgrport 7809
rmttask replicat,group rinig1
table hr.t1;
Using the following key columns for source table HR.T1: OBJECT_ID.
2015-06-10 12:40:55 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:
/u01/gg11/dirtmp.
CACHEMGR virtual memory values (may have been adjusted)
CACHESIZE: 64G
CACHEPAGEOUTSIZE (normal): 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.3.0 - 64bit Production
PL/SQL Release 11.2.0.3.0 - Production
CORE 11.2.0.3.0 Production
TNS for Linux: Version 11.2.0.3.0 - Production
NLSRTL Version 11.2.0.3.0 - Production
Database Language and Character Set:
NLS_LANG = "AMERICAN_AMERICA.ZHS16GBK"
NLS_LANGUAGE = "AMERICAN"
NLS_TERRITORY = "AMERICA"
NLS_CHARACTERSET = "ZHS16GBK"
Processing table HR.T1
***********************************************************************
* ** Run Time Statistics ** *
***********************************************************************
Report at 2015-06-10 12:42:01 (activity since 2015-06-10 12:40:55)
Output to rinig1:
From Table HR.T1:
# inserts: 75203
# updates: 0
# deletes: 0
# discards: 0
REDO Log Statistics
Bytes parsed 0
Bytes output 21007968
GGSCI (orcltest) 5> info *,task //再次查看的时候,数据已经初始化完成。
EXTRACT EINIG1 Last Started 2015-06-10 12:41 Status STOPPED
Checkpoint Lag Not Available
Log Read Checkpoint Table HR.T1
2015-06-10 12:42:00 Record 75203
Task SOURCEISTABLE
GGSCI (orcltest) 6>
第一次查看日志,Processing table HR.T1表示正在处理,第二次查看出现Run Time Statistics 信息,表示数据已经初始化完成,insert了75203条数据。
GGSCI (rhel6_lhr) 1> view report rinig1
***********************************************************************
Oracle GoldenGate Delivery for Oracle
Version 11.2.1.0.1 OGGCORE_11.2.1.0.1_PLATFORMS_120423.0230_FBO
Linux, x64, 64bit (optimized), Oracle 11g on Apr 23 2012 08:48:07
Copyright (C) 1995, 2012, Oracle and/or its affiliates. All rights reserved.
Starting at 2015-06-09 22:34:42
***********************************************************************
Operating System Version:
Linux
Version #1 SMP Tue Apr 21 08:37:59 PDT 2015, Release 2.6.32-504.16.2.el6.x86_64
Node: rhel6_lhr
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: 19600
Description:
***********************************************************************
** Running with the following parameters **
***********************************************************************
2015-06-09 22:34:47 INFO OGG-03035 Operating system character set identified as UTF-8. Locale: en_US, LC_ALL:.
replicat rinig1
setenv (ORACLE_SID=ogg2)
Set environment variable (ORACLE_SID=ogg2)
setenv (ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1)
Set environment variable (ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1)
setenv (NLS_LANG=AMERICAN_AMERICA.ZHS16GBK)
Set environment variable (NLS_LANG=AMERICAN_AMERICA.ZHS16GBK)
assumetargetdefs
userid ggusr,password ***
discardfile ./dirrpt/rinig1.dsc,purge
map hr.*,target hr.*;
2015-06-09 22:34:48 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:
/u01/gg11/dirtmp.
CACHEMGR virtual memory values (may have been adjusted)
CACHESIZE: 2G
CACHEPAGEOUTSIZE (normal): 8M
PROCESS VM AVAIL FROM OS (min): 4G
CACHESIZEMAX (strict force to disk): 3.41G
Database Version:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
PL/SQL Release 11.2.0.3.0 - Production
CORE 11.2.0.3.0 Production
TNS for Linux: Version 11.2.0.3.0 - Production
NLSRTL Version 11.2.0.3.0 - Production
Database Language and Character Set:
NLS_LANG = "AMERICAN_AMERICA.ZHS16GBK"
NLS_LANGUAGE = "AMERICAN"
NLS_TERRITORY = "AMERICA"
NLS_CHARACTERSET = "ZHS16GBK"
***********************************************************************
** Run Time Messages **
***********************************************************************
Wildcard MAP resolved (entry hr.*):
map "HR"."T1",target hr."T1";
Using following columns in default map by name:
OWNER, OBJECT_NAME, SUBOBJECT_NAME, OBJECT_ID, DATA_OBJECT_ID,
OBJECT_TYPE, CREATED, LAST_DDL_TIME, TIMESTAMP, STATUS, TEMPORARY,
GENERATED, SECONDARY, NAMESPACE, EDITION_NAME
Using the following key columns for target table HR.T1: OBJECT_ID.
***********************************************************************
* ** Run Time Statistics ** *
***********************************************************************
Report at 2015-06-09 22:35:53 (activity since 2015-06-09 22:34:49)
From Table HR.T1 to HR.T1:
# inserts: 75203
# updates: 0
# deletes: 0
# discards: 0
CACHE OBJECT MANAGER statistics
CACHE MANAGER VM USAGE
vm current = 0 vm anon queues = 0
vm anon in use = 0 vm file = 0
vm used max = 0 ==> CACHE BALANCED
CACHE CONFIGURATION
cache size = 2G cache force paging = 3.41G
buffer min = 64K buffer highwater = 8M
pageout eligible size = 8M
================================================================================
RUNTIME STATS FOR SUPERPOOL
CACHE Transaction Stats
trans active = 0 max concurrent = 0
non-zero total = 0 trans total = 0
CACHE File Caching
disk current = 0 disk total = 0
disk caching = 0 file cached = 0
file retrieves = 0
CACHE MANAGEMENT
buffer links = 0 anon gets = 0
forced unmaps = 0 cnnbl try = 0
cached out = 0 force out = 0
Allocation Request Distribution
< 128B: 0
128B: 0 0 | 512B: 0 0
2K: 0 0 | 8K: 0 0
32K: 0 0 | 128K: 0 0
512K: 0 0 | 2M: 0 0
8M: 0 0 | 32M: 0 0
128M: 0 0 | 512M: 0 0
2G: 0 0 | 8G: 0
Cached Transaction Size Distribution
0: 0
< 4K: 0
4K: 0 0 | 16K: 0 0
64K: 0 0 | 256K: 0 0
1M: 0 0 | 4M: 0 0
16M: 0 0 | 64M: 0 0
256M: 0 0 | 1G: 0 0
4G: 0 0 | 16G: 0 0
64G: 0 0 | 256G: 0 0
1T: 0 0 | 4T: 0 0
16T: 0 0 | 64T: 0 0
256T: 0 0 |1024T: 0 0
================================================================================
CUMULATIVE STATS FOR SUPERPOOL
CACHE Transaction Stats
trans active = 0 max concurrent = 0
non-zero total = 0 trans total = 0
CACHE File Caching
disk current = 0 disk total = 0
disk caching = 0 file cached = 0
file retrieves = 0
CACHE MANAGEMENT
buffer links = 0 anon gets = 0
forced unmaps = 0 cnnbl try = 0
cached out = 0 force out = 0
Allocation Request Distribution
< 128B: 0
128B: 0 0 | 512B: 0 0
2K: 0 0 | 8K: 0 0
32K: 0 0 | 128K: 0 0
512K: 0 0 | 2M: 0 0
8M: 0 0 | 32M: 0 0
128M: 0 0 | 512M: 0 0
2G: 0 0 | 8G: 0
Cached Transaction Size Distribution
0: 0
< 4K: 0
4K: 0 0 | 16K: 0 0
64K: 0 0 | 256K: 0 0
1M: 0 0 | 4M: 0 0
16M: 0 0 | 64M: 0 0
256M: 0 0 | 1G: 0 0
4G: 0 0 | 16G: 0 0
64G: 0 0 | 256G: 0 0
1T: 0 0 | 4T: 0 0
16T: 0 0 | 64T: 0 0
256T: 0 0 |1024T: 0 0
QUEUE Statistics:
num queues = 15 default index = 0
cur len = 0 max len = 0
q vm current = 0 vm max = 0
q hits = 0 q misses = 0
queue size q hits curlen maxlen cannibalized
0 64K 0 0 0 0
1 128K 0 0 0 0
2 256K 0 0 0 0
3 512K 0 0 0 0
4 1M 0 0 0 0
5 2M 0 0 0 0
6 4M 0 0 0 0
7 8M 0 0 0 0
8 16M 0 0 0 0
9 32M 0 0 0 0
10 64M 0 0 0 0
11 128M 0 0 0 0
12 256M 0 0 0 0
13 512M 0 0 0 0
14 1G 0 0 0 0
================================================================================
RUNTIME STATS FOR CACHE POOL #0
POOL INFO group: rinig1 id: p19600_BLOB
trans active = 0 trans concurrent (max) = 0
trans total = 0 (0 )
flag = 0x00000030
last error = (0=<none>)
Allocation Request Distribution
< 128B: 0
128B: 0 0 | 512B: 0 0
2K: 0 0 | 8K: 0 0
32K: 0 0 | 128K: 0 0
512K: 0 0 | 2M: 0 0
8M: 0 0 | 32M: 0 0
128M: 0 0 | 512M: 0 0
2G: 0 0 | 8G: 0
================================================================================
CUMULATIVE STATS FOR CACHE POOL #0
POOL INFO group: rinig1 id: p19600_BLOB
trans active = 0 trans concurrent (max) = 0
trans total = 0 (0 )
flag = 0x00000030
last error = (0=<none>)
Allocation Request Distribution
< 128B: 0
128B: 0 0 | 512B: 0 0
2K: 0 0 | 8K: 0 0
32K: 0 0 | 128K: 0 0
512K: 0 0 | 2M: 0 0
8M: 0 0 | 32M: 0 0
128M: 0 0 | 512M: 0 0
2G: 0 0 | 8G: 0
QUEUE Statistics:
num queues = 15 default index = 0
cur len = 0 max len = 0
q vm current = 0 vm max = 0
q hits = 0 q misses = 0
queue size q hits curlen maxlen cannibalized
0 64K 0 0 0 0
1 128K 0 0 0 0
2 256K 0 0 0 0
3 512K 0 0 0 0
4 1M 0 0 0 0
5 2M 0 0 0 0
6 4M 0 0 0 0
7 8M 0 0 0 0
8 16M 0 0 0 0
9 32M 0 0 0 0
10 64M 0 0 0 0
11 128M 0 0 0 0
12 256M 0 0 0 0
13 512M 0 0 0 0
14 1G 0 0 0 0
================================================================================
RUNTIME STATS FOR CACHE POOL #0
POOL INFO group: rinig1 id: p19600_BLOB
trans active = 0 trans concurrent (max) = 0
trans total = 0 (0 )
flag = 0x00000030
last error = (0=<none>)
Allocation Request Distribution
< 128B: 0
128B: 0 0 | 512B: 0 0
2K: 0 0 | 8K: 0 0
32K: 0 0 | 128K: 0 0
512K: 0 0 | 2M: 0 0
8M: 0 0 | 32M: 0 0
128M: 0 0 | 512M: 0 0
2G: 0 0 | 8G: 0
================================================================================
CUMULATIVE STATS FOR CACHE POOL #0
POOL INFO group: rinig1 id: p19600_BLOB
trans active = 0 trans concurrent (max) = 0
trans total = 0 (0 )
flag = 0x00000030
last error = (0=<none>)
Allocation Request Distribution
< 128B: 0
128B: 0 0 | 512B: 0 0
2K: 0 0 | 8K: 0 0
32K: 0 0 | 128K: 0 0
512K: 0 0 | 2M: 0 0
8M: 0 0 | 32M: 0 0
128M: 0 0 | 512M: 0 0
2G: 0 0 | 8G: 0
GGSCI (rhel6_lhr) 2> info *,task
REPLICAT RINIG1 Initialized 2015-06-09 22:18 Status STOPPED
Checkpoint Lag 00:00:00 (updated 00:23:29 ago)
Log Read Checkpoint Not Available
Task SPECIALRUN
GGSCI (rhel6_lhr) 3>
数据量验证:
[oracle@orcltest ~]$ sqlplus sys/lhr@ogg2 as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on Wed Jun 10 12:41:48 2015
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> select count(*) from hr.t1;
COUNT(*)
----------
75203
打开需要传输的schema的表的附加日志:
[oracle@orcltest gg11]$ ggsci
Oracle GoldenGate Command Interpreter for Oracle
Version 11.2.1.0.1 OGGCORE_11.2.1.0.1_PLATFORMS_120423.0230_FBO
Linux, x64, 64bit (optimized), Oracle 11g on Apr 23 2012 08:32:14
Copyright (C) 1995, 2012, Oracle and/or its affiliates. All rights reserved.
GGSCI (orcltest) 1> dblogin userid ggusr, password lhr
ERROR: Unable to connect to database using user ggusr. Please check privileges.
ORA-01034: ORACLE not available
ORA-27101: shared memory realm does not exist
Linux-x86_64 Error: 2: No such file or directory.
GGSCI (orcltest) 2> dblogin userid ggusr@ogg1, password lhr
Successfully logged into database.
GGSCI (orcltest) 3> info trandata hr.*
Logging of supplemental redo log data is disabled for table HR.COUNTRIES.
Logging of supplemental redo log data is disabled for table HR.DEPARTMENTS.
Logging of supplemental redo log data is disabled for table HR.EMPLOYEES.
Logging of supplemental redo log data is disabled for table HR.JOBS.
Logging of supplemental redo log data is disabled for table HR.JOB_HISTORY.
Logging of supplemental redo log data is disabled for table HR.LOCATIONS.
Logging of supplemental redo log data is disabled for table HR.REGIONS.
Logging of supplemental redo log data is disabled for table HR.T1.
GGSCI (orcltest) 4> add trandata hr.*
Logging of supplemental redo data enabled for table HR.COUNTRIES.
Logging of supplemental redo data enabled for table HR.DEPARTMENTS.
Logging of supplemental redo data enabled for table HR.EMPLOYEES.
Logging of supplemental redo data enabled for table HR.JOBS.
Logging of supplemental redo data enabled for table HR.JOB_HISTORY.
Logging of supplemental redo data enabled for table HR.LOCATIONS.
Logging of supplemental redo data enabled for table HR.REGIONS.
Logging of supplemental redo data enabled for table HR.T1.
GGSCI (orcltest) 5>
GGSCI (orcltest) 5> info trandata hr.*
Logging of supplemental redo log data is enabled for table HR.COUNTRIES.
Columns supplementally logged for table HR.COUNTRIES: COUNTRY_ID.
Logging of supplemental redo log data is enabled for table HR.DEPARTMENTS.
Columns supplementally logged for table HR.DEPARTMENTS: DEPARTMENT_ID.
Logging of supplemental redo log data is enabled for table HR.EMPLOYEES.
Columns supplementally logged for table HR.EMPLOYEES: EMPLOYEE_ID.
Logging of supplemental redo log data is enabled for table HR.JOBS.
Columns supplementally logged for table HR.JOBS: JOB_ID.
Logging of supplemental redo log data is enabled for table HR.JOB_HISTORY.
Columns supplementally logged for table HR.JOB_HISTORY: EMPLOYEE_ID, START_DATE.
Logging of supplemental redo log data is enabled for table HR.LOCATIONS.
Columns supplementally logged for table HR.LOCATIONS: LOCATION_ID.
Logging of supplemental redo log data is enabled for table HR.REGIONS.
Columns supplementally logged for table HR.REGIONS: REGION_ID.
Logging of supplemental redo log data is enabled for table HR.T1.
Columns supplementally logged for table HR.T1: OBJECT_ID.
GGSCI (orcltest) 1> add extract eora_hr,tranlog,begin now
EXTRACT added.
GGSCI (orcltest) 2> info all
Program Status Group Lag at Chkpt Time Since Chkpt
MANAGER RUNNING
EXTRACT STOPPED EORA_HR 00:00:00 00:00:06
GGSCI (orcltest) 1> edit params eora_hr
extract eora_hr
setenv (NLS_LANG=AMERICAN_AMERICA.ZHS16GBK)
ddl include all
userid ggusr, password lhr
exttrail ./dirdat/aa
extract eora_t1
setenv (ORACLE_SID=ogg1)
setenv (ORACLE_HOME=/u02/app/oracle/product/11.2.0/dbhome_1)
setenv (NLS_LANG=AMERICAN_AMERICA.ZHS16GBK)
userid ggusr,password lhr
exttrail ./dirdat/hr
table hr.*;
~
~
~
。。。。。。。。。。。。。
~
~
~
~
"dirprm/eora_hr.prm" 7L, 213C written
GGSCI (orcltest) 2> view params eora_t1
extract eora_hr
setenv (ORACLE_SID=ogg1)
setenv (ORACLE_HOME=/u02/app/oracle/product/11.2.0/dbhome_1)
setenv (NLS_LANG=AMERICAN_AMERICA.ZHS16GBK)
userid ggusr,password lhr
exttrail ./dirdat/hr
table hr.*;
GGSCI (orcltest) 3>
GGSCI (orcltest) 6> add exttrail ./dirdat/hr,extract eora_hr,megabytes 100
EXTTRAIL added.
GGSCI (orcltest) 7> info all
Program Status Group Lag at Chkpt Time Since Chkpt
MANAGER RUNNING
EXTRACT STOPPED EORA_HR 00:00:00 00:05:08
GGSCI (orcltest) 8> start extract eora_hr
Sending START request to MANAGER ...
EXTRACT EORA_HR starting
GGSCI (orcltest) 9> info all
Program Status Group Lag at Chkpt Time Since Chkpt
MANAGER RUNNING
EXTRACT RUNNING EORA_HR 00:00:00 00:00:08
GGSCI (orcltest) 10>
GGSCI (orcltest) 10> info extract eora_hr
EXTRACT EORA_HR Last Started 2015-06-10 14:57 Status RUNNING
Checkpoint Lag 00:00:00 (updated 00:00:07 ago)
Log Read Checkpoint Oracle Redo Logs
2015-06-10 14:57:05 Seqno 7, RBA 5097472
SCN 0.1098894 (1098894)
GGSCI (orcltest) 11>
GGSCI (orcltest) 11> edit params pora_hr
extract pora_hr
setenv (ORACLE_SID=ogg1)
setenv (ORACLE_HOME=/u02/app/oracle/product/11.2.0/dbhome_1)
setenv (NLS_LANG=AMERICAN_AMERICA.ZHS16GBK)
passthru
rmthost 192.168.59.130,mgrport 7809
rmttrail ./dirdat/pa
table hr.*;
~
~
~
。。。。。。。。。。。。。。
~
~
~
~
~
"dirprm/pora_hr.prm" [New] 8L, 235C written
GGSCI (orcltest) 12> view params pora_hr
extract pora_hr
setenv (ORACLE_SID=ogg1)
setenv (ORACLE_HOME=/u02/app/oracle/product/11.2.0/dbhome_1)
setenv (NLS_LANG=AMERICAN_AMERICA.ZHS16GBK)
passthru
rmthost 192.168.59.130,mgrport 7809
rmttrail ./dirdat/pa
table hr.*;
GGSCI (orcltest) 13> add extract pora_hr