Goldengate 部署oracle10g在 rac asm環境,完整教程

前言

 Goldengate再rac 環境部署,和單機部署區別仍是有點大,主要存在環境上.html

環境

oracle10g ,sid=racweb

準備工做

1.在rac節點,配置監聽動態註冊,確保goldengate用戶可以鏈接實例。安裝部分分爲源端和目標端sql

節點一配置:數據庫

[oracle@rac1 admin]$ cat listener.ora 
# listener.ora.rac1 Network Configuration File: /opt/oracle/102/db_1/network/admin/listener.ora.rac1
# Generated by Oracle configuration tools.

LISTENER_RAC1 =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = rac1-vip)(PORT = 1521)(IP = FIRST))
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.141)(PORT = 1521)(IP = FIRST))
    )
  )

SID_LIST_LISTENER_RAC1 =
  (SID_LIST =
    (SID_DESC =
      (SID_NAME = PLSExtProc)
      (ORACLE_HOME = /opt/oracle/102/db_1)
      (PROGRAM = extproc)
    )
      (SID_DESC =
      (GLOBAL_DBNAME = +ASM)
      (ORACLE_HOME = /opt/oracle/102/db_1)
      (SID_NAME = +ASM1)
    ) 
 )
[oracle@rac1 admin]$ cat tnsnames.ora
# tnsnames.ora Network Configuration File: /opt/oracle/102/db_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.

RAC =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = rac1-vip)(PORT = 1521))
    (ADDRESS = (PROTOCOL = TCP)(HOST = rac2-vip)(PORT = 1521))
    (LOAD_BALANCE = yes)
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = rac)
    )
  )

LISTENERS_RAC =
  (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = TCP)(HOST = rac1-vip)(PORT = 1521))
    (ADDRESS = (PROTOCOL = TCP)(HOST = rac2-vip)(PORT = 1521))
  )

RAC2 =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = rac2-vip)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = rac)
      (INSTANCE_NAME = rac2)
    )
  )

RAC1 =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = rac1-vip)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = rac)
      (INSTANCE_NAME = rac1)
    )
  )


EXTPROC_CONNECTION_DATA =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
    )
    (CONNECT_DATA =
      (SID = PLSExtProc)
      (PRESENTATION = RO)
    )
  )

ASM =  
 (DESCRIPTION =  
    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.141)(PORT = 1521))  
    (CONNECT_DATA =  
      (SERVER = DEDICATED)  
      (SERVICE_NAME = +ASM)  
      (SID_NAME = +ASM1)  
    )  
  )

 節點二相同配置,記得修改對應參數bash

重啓監聽服務器

[oracle@rac1 admin]$ srvctl stop listener -n rac1
[oracle@rac1 admin]$ srvctl stop listener -n rac2
[oracle@rac1 admin]$ srvctl start listener -n rac1
[oracle@rac1 admin]$ srvctl start listener -n rac2

 檢查asm實例oracle

[oracle@rac1 admin]$ export ORACLE_SID=+ASM1
[oracle@rac1 admin]$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.1.0 - Production on Thu Jun 2 16:01:51 2016

Copyright (c) 1982, 2005, Oracle.  All rights reserved.


Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production
With the Partitioning, Real Application Clusters, OLAP and Data Mining options

SQL> conn sys/111111@192.168.1.142:1521/+ASM  as sysdba
Connected.

源端:

2.安裝 Goldengateapp

tar xvf xxxxxx.tar.gzspa

cd xxxxpwa

[oracle@rac1 oracle]$ ./ggsci
GGSCI (rac1) 2> create subdirs

 

[oracle@gg gg]$ ./ggsci

 配置gg的mgr端口,目標端也須要作一樣的配置

GGSCI (gg) 5> edit param mgr GGSCI (gg) 5> view param mgr port 7809 GGSCI (gg) 5> start mgr GGSCI (gg) 5> info mgr

--安裝完畢

3.數據庫的環境準備,需添加附加日誌

原數據庫Oracle
----》alter database add supplemental log data;  //添加附加信息
Alter system switch logfile;
查看 select supplemental_log_data_min from v$database; 必須是yes

 4.Goldengate同步用戶,我默認用system,避免權限糾結..

5.進入./ggsci 打開要同步的表的附件日誌信息

GGSCI (rac1) 3> dblogin userid system@rac1,password 111111
或者
GGSCI (rac1) 3> dblogin userid system@192.168.1.141:1521/rac,password 111111
--添加附加日誌的表
Add trandata gg.t1 或 gg.*

6.此步驟添加抓取進程,和傳輸進程,wan表明抓取進程,pwan表明傳輸進程

GGSCI (rac1) 8> edit param wan
GGSCI (rac1) 8> view param wan            
EXTRACT WAN
USERID wan@192.168.1.141:1521/rac,PASSWORD wan --登陸的用戶
TRANLOGOPTIONS ASMUSER sys@ASM,ASMPASSWORD 111111  --登陸asm的
EXTTRAIL ./dirdat/et      --抓取的數據放這裏
TABLE wan.t1;   --抓取的表


GGSCI (rac1) 8> Add Extract wan, TranLog, Begin Now  threads 2  --rac有幾個threads 2 就寫幾個
GGSCI (rac1) 8> Add ExtTrail ./dirdat/et, Extract wan, Megabytes 5  --創建./dirdat/et文件爲5m

GGSCI (rac1) 10> edit param pwan
GGSCI (rac1) 11> view param pwan
EXTRACT pwan
RMTHOST 192.168.1.105,MGRPORT 7809,COMPRESS  --傳輸給目標數據庫服務器
RMTTRAIL ./dirdat/ww  --遠程目標存放的數據文件
passthru
TABLE wan.t1; 

GGSCI (rac1) 11> Add Extract pwan, ExtTrailSource ./dirdat/et   --傳輸進程pwan,提取的數據文件路徑 
GGSCI (rac1) 11> Add RmtTrail ./dirdat/ab, Extract psalesab, Megabytes 5 --創建目標數據庫的數據文件./dirdat/ab爲5m

 

GGSCI (rac1) 12> start extract *  --啓動創建好的進程
GGSCI (rac1) 12> info all

Program     Status      Group       Lag           Time Since Chkpt

MANAGER     RUNNING                                           
EXTRACT     RUNNING     PWAN        00:00:00      00:00:06    
EXTRACT     RUNNING     WAN         00:00:00      00:00:08    
view report wan log  --若是不能啓動,用此命令查看日誌

 

目標端

說明:目標端建立個寫入進程,我命名爲rwan

1.安裝 Goldengate

tar xvf xxxxxx.tar.gz

cd xxxx

[oracle@rac1 oracle]$ ./ggsci
GGSCI (rac1) 2> create subdirs

[oracle@gg gg]$ ./ggsci

 配置gg的mgr端口,源端也須要作一樣的配置

GGSCI (gg) 5> edit param mgr
GGSCI (gg) 5> view param mgr
port 7809
GGSCI (gg) 5> start mgr
GGSCI (gg) 5> info mgr

配置檢查數據一致性的表

編輯全局數據文件   //添加檢查數據一致性的表
Edit params ./GLOBALS
CHECKPOINTTABLE system.checkpointtable
保存
建立表
Dblogin userid system, password oracle
Add checkpointtable

 添加rwan配置文件

GGSCI (gg) 8> view param rwan

replicat rwan
userid system,password 111111
HANDLECOLLISIONS
ASSUMETARGETDEFS
--ddl include all
--ddlerror default ignore retryop
discardfile ./dirrpt/rwan.dsc,append
map wan.t1, target chis.t1;

添加rwan進程

GGSCI (gg) 8> Add Replicat rwan, ExtTrail ./dirdat/ww 

 啓動 start replicat rwan

GGSCI (gg) 9> info all

Program     Status      Group       Lag           Time Since Chkpt

MANAGER     RUNNING                                           
  
REPLICAT    RUNNING     RWAN        00:00:00      00:00:07  

 到此就配置成功了。

 

總結

源端數據庫對某表,作了dll操做,目標端已打補丁的方式添加,添加後,需對rwan進程重啓一次。

再配置過程當中參考了以下文章:

https://blogs.oracle.com/imc/entry/oracle_goldengate_configuring_ddl_replication

http://www.ibmdba.com/?p=129

http://www.oracle.com/webfolder/technetwork/tutorials/obe/fmw/goldengate/11g/orcl_orcl/index.html

相關文章
相關標籤/搜索