1. İlk olarak veritabanı kurulmuş olmalıdır. 2. Golden gate yazılımı her 2 tarafta da kurulmuş olmalıdır.
3. Ana veritabanını(örneğimizde ankara) replikasyon için hazırlamak gereklidir. Ankara
SQL> shutdown immediate
SQL> startup mount
SQL> alter database archivelog;
SQL> alter database open;
SQL> select log_mode from v$database;
LOG_MODE
ARCHIVELOG
SQL> alter database add supplemental log data;
Database altered.
SQL> alter system set recyclebin=off scope=spfile; SQL> PURGE DBA_RECYCLEBIN;
DBA Recyclebin purged.
SQL> create tablespace gg_tbls datafile 'C:\app\Administrator\oradata\ANKARA\gg_tbls.dbf' size 100m reuse autoextend on;
Tablespace created.
SQL> create user ggate identified by oracle default tablespace gg_tbls quota unlimited on gg_tbls;
User created.
SQL> grant create session, connect, resource to ggate;
Grant succeeded.
SQL> grant dba to ggate; -- just in case
Grant succeeded.
SQL> grant execute on utl_file to ggate;
Grant succeeded.
SQL> exit
[CMD] cd C:\ogg112101_ggs_Windows_x64_ora11g_64bit
[CMD] sqlplus / as sysdba
SQL> @marker_setup.sql
SQL> @ddl_setup.sql
SQL> @role_setup.sql
SQL> grant GGS_GGSUSER_ROLE to ggate;
SQL> @ddl_enable.sql
SQL> exit
Golden Gate komut satırına bağlan
[CMD] ggsci
Oracle GoldenGate Command Interpreter for Oracle Version 11.2.1.0.1 OGGCORE_11.2.1.0.1_PLATFORMS_120423.0230_FBO Linux, x86, 32bit (optimized), Oracle 11g on Apr 23 2012 08:09:25
Copyright (C) 1995, 2012, Oracle and/or its affiliates. All rights reserved.
GGSCI (ytestvt) 1> EDIT PARAMS ./GLOBALS
GGSCHEMA ggate
GGSCI (ytestvt) 2> exit
SQL komut satırına gir:
SQL> create user source identified by oracle default tablespace users temporary tablespace temp;
User created.
SQL> grant connect,resource,unlimited tablespace to source;
Grant succeeded.
SQL> exit
[CMD] -> mkdir C:\ogg112101_ggs_Windows_x64_ora11g_64bit\dirdat\tr
3. Yedek veritabanını(örneğimizde eskisehir) hazırlamak gereklidir.
Eskisehir
SQL> create user target identified by oracle default tablespace users temporary tablespace temp;
User created.
SQL> grant connect,resource,unlimited tablespace to target;
Grant succeeded.
SQL> grant dba to target; -- or particular grants
Grant succeeded.
SQL> exit;
[CMD] -> mkdir C:\ogg112101_ggs_Windows_x64_ora11g_64bit\dirdat\tr
[CMD] -> mkdir C:\ogg112101_ggs_Windows_x64_ora11g_64bit\discard
4. Ankara
GoldenGate komut satırına bağlanılır:
[CMD] ggsci
Oracle GoldenGate Command Interpreter for Oracle Version 11.2.1.0.1 OGGCORE_11.2.1.0.1_PLATFORMS_120423.0230_FBO Linux, x86, 32bit (optimized), Oracle 11g on Apr 23 2012 08:09:25
Copyright (C) 1995, 2012, Oracle and/or its affiliates. All rights reserved.
GGSCI (ytestvt) 1> edit params mgr
PORT 7809
GGSCI (ytestvt) 2> start manager
Manager started.
GGSCI (ytestvt) 3> info all
Program Status Group Lag at Chkpt Time Since Chkpt
MANAGER RUNNING
GGSCI (ytestvt) 4> dblogin userid ggate
Password:
Successfully logged into database.
GGSCI (ytestvt) 5> ADD SCHEMATRANDATA source (Eğer uygun patch yüklü değilse hata alınır. Bu durumda add trandata test.test şeklinde tablo bazında ekleme yapılabilir.)
2012-12-06 16:23:20 INFO OGG-01788 SCHEMATRANDATA has been added on schema source.
GGSCI (ytestvt) 6> add extract ext1, tranlog, begin now
EXTRACT added.
GGSCI (ytestvt) 7> add exttrail C:\ogg112101_ggs_Windows_x64_ora11g_64bit\dirdat\tr, extract ext1
EXTTRAIL added.
GGSCI (ytestvt) 8> edit params ext1
extract ext1
userid ggate, password oracle
exttrail C:\ogg112101_ggs_Windows_x64_ora11g_64bit\dirdat\tr
ddl include mapped objname source.*;
table source.*;
GGSCI (ytestvt) 9> info all
Program Status Group Lag at Chkpt Time Since Chkpt
MANAGER RUNNING
EXTRACT STOPPED EXT1 00:00:00 00:01:29
GGSCI (ytestvt) 10> add extract pump1, exttrailsource C:\ogg112101_ggs_Windows_x64_ora11g_64bit\dirdat\tr , begin now
EXTRACT added.
GGSCI (ytestvt) 11> add rmttrail C:\ogg112101_ggs_Windows_x64_ora11g_64bit\dirdat\tr, extract pump1
RMTTRAIL added.
GGSCI (ytestvt) 12> edit params pump1
EXTRACT pump1
USERID ggate, PASSWORD oracle
RMTHOST db2, MGRPORT 7809
RMTTRAIL C:\ogg112101_ggs_Windows_x64_ora11g_64bit\dirdat\tr
PASSTHRU
table source.*;
GGSCI (ytestvt) 13> info all
Program Status Group Lag at Chkpt Time Since Chkpt
MANAGER RUNNING
EXTRACT STOPPED EXT1 00:00:00 00:02:33
EXTRACT STOPPED PUMP1 00:00:00 00:02:56
GGSCI (ytestvt) 14>
5.ESKISEHIR:
GoldenGate komut satırına bağlanılır:
[CMD] ggsci
Oracle GoldenGate Command Interpreter for Oracle Version 11.2.1.0.1 OGGCORE_11.2.1.0.1_PLATFORMS_120423.0230_FBO Linux, x86, 32bit (optimized), Oracle 11g on Apr 23 2012 08:09:25
Copyright (C) 1995, 2012, Oracle and/or its affiliates. All rights reserved.
GGSCI (testvt) 1> edit params mgr
PORT 7809
GGSCI (testvt) 2> start manager
Manager started.
GGSCI (testvt) 3> info all
Program Status Group Lag at Chkpt Time Since Chkpt
MANAGER RUNNING
GGSCI (testvt) 4> EDIT PARAMS ./GLOBALS
CHECKPOINTTABLE target.checkpoint
GGSCI (testvt) 5> dblogin userid target
Password:
Successfully logged into database.
GGSCI (testvt) 6> add checkpointtable target.checkpoint
Successfully created checkpoint table target.checkpoint.
GGSCI (testvt) 7>
Add replicat.
GGSCI (testvt) 8> add replicat rep1, exttrail C:\ogg112101_ggs_Windows_x64_ora11g_64bit\dirdat\tr, begin now
REPLICAT added.
GGSCI (testvt) 9> edit params rep1
REPLICAT rep1
ASSUMETARGETDEFS
USERID target, PASSWORD oracle
discardfile C:\ogg112101_ggs_Windows_x64_ora11g_64bit\discard\rep1_discard.txt, append, megabytes 10
DDL (Patch eksikliğinden kaynaklanan bir sorun çıkarabilir. Alternatifi "ddl include mapped" ve "ddlerror default ignore retryop" satırlarını eklemektir.)
map source.*, target target.*;
GGSCI (testvt) 10> info all
Program Status Group Lag at Chkpt Time Since Chkpt
MANAGER RUNNING
REPLICAT STOPPED REP1 00:00:00 00:01:52
GGSCI (testvt)
6. ANKARA
extract'lar başlatılır :
GGSCI (ytestvt) 14> start extract ext1
Sending START request to MANAGER ...
EXTRACT EXT1 starting
GGSCI (ytestvt) 15> start extract pump1
Sending START request to MANAGER ...
EXTRACT PUMP1 starting
GGSCI (ytestvt) 16> info all
Program Status Group Lag at Chkpt Time Since Chkpt
MANAGER RUNNING
EXTRACT RUNNING EXT1 00:00:00 00:00:01
EXTRACT RUNNING PUMP1 00:00:00 00:01:01
7. ESKISEHIR
GGSCI (testvt) 11> start replicat rep1
Sending START request to MANAGER ...
REPLICAT REP1 starting
GGSCI (testvt) 12> info all
Program Status Group Lag at Chkpt Time Since Chkpt
MANAGER RUNNING
REPLICAT RUNNING REP1 00:00:00 00:00:06
Bundan sonraki adımlar test adımları. Eğer schema eklenmediyse (ADD SCHEMATRANDATA source yapılmadıysa) , tablo her iki tarafta yaratıldıktan sonra aşağıdaki işlemler yapılabilir, ekleme schema bazlı ise aşağıdaki işlemler de sorun yaşanmayacaktır.
8. ANKARA
[CMD] -> sqlplus source/oracle
SQL*Plus: Release 11.2.0.3.0 Production on Fri Dec 7 20:09:17 2012
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - Production With the Partitioning and Real Application Testing options
SQL> select * from t1; select * from t1
*
ERROR at line 1: ORA-00942: table or view does not exist
SQL> create table t1 (id number primary key, name varchar2(50));
Table created.
SQL> insert into t1 values (1,'test');
1 row created.
SQL> insert into t1 values (2,'test');
1 row created.
SQL> commit;
Commit complete.
SQL>
9. ESKISEHIR :
[oracle@db2 gg]$ sqlplus target/oracle
SQL*Plus: Release 11.2.0.3.0 Production on Fri Dec 7 20:09:41 2012
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - Production With the Partitioning and Real Application Testing options
SQL> select * from t1;
ID NAME
--------------------------------------------------
1 test
2 test
No comments:
Post a Comment