RAC環境下配置OGG同步
環境介紹:
Source端:
作業系統版本:oracle linux 6.4 64bit
資料庫版本:11.2.0.1 64bit
ogg版本:fbo_ggs_Linux_x64_ora11g_64bit.tar
rac資料庫名:racdb
public ip:192.168.0.201/202
private ip:10.10.10.1/10.10.10.2
vip:192.168.0.203/204
scan名:scan
scan-ip:192.168.0.205
target端:
作業系統版本:oracle linux 6.4 64bit
資料庫版本:11.2.0.1 64bit
ogg版本:fbo_ggs_Linux_x64_ora11g_64bit.tar
資料庫名:orcl
ip:192.168.0.141
一:首先在兩個rac節點上配置ASM動態註冊,11g的監聽器引入了endpoints_listener.ora檔案管理
[grid@rac1 rac1]$ srvctl status listener
Listener LISTENER is enabled
Listener LISTENER is running on node(s): rac2,rac1
[grid@rac1 rac1]$ lsnrctl services
LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 11-JUL-2012 21:09:20
Copyright (c) 1991, 2011, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER)))
Services Summary...
Service "+ASM" has 1 instance(s).
Instance "+ASM1", status READY, has 1 handler(s) for this service...
Handler(s):
"DEDICATED" established:0 refused:0 state:ready
LOCAL SERVER
Service "rac.yang.com" has 1 instance(s).
Instance "rac1", status READY, has 1 handler(s) for this service...
Handler(s):
"DEDICATED" established:0 refused:0 state:ready
LOCAL SERVER
Service "racXDB.yang.com" has 1 instance(s).
Instance "rac1", status READY, has 1 handler(s) for this service...
Handler(s):
"D000" established:0 refused:0 current:0 max:1022 state:ready
DISPATCHER
(ADDRESS=(PROTOCOL=tcp)(HOST=rac1.yang.com)(PORT=63054))
The command completed successfully
[grid@rac1 rac1]$ cat $TNS_ADMIN/listener.ora
LISTENER=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER)))) # line added by Agent
LISTENER_SCAN3=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_SCAN3)))) # line added by Agent
LISTENER_SCAN2=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_SCAN2)))) # line added by Agent
LISTENER_SCAN1=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_SCAN1)))) # line added by Agent
ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER_SCAN1=ON # line added by Agent
ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER_SCAN2=ON # line added by Agent
ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER_SCAN3=ON # line added by Agent
ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER=ON # line added by Agent
[grid@rac1 rac1]$ cat /u01/grid/network/admin/endpoints_listener.ora
LISTENER_RAC1=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=rac1-vip)(PORT=1521))(ADDRESS=(PROTOCOL=TCP) (HOST=192.168.1.41)(PORT=1521)(IP=FIRST)))) # line added by Agent
[grid@rac1 rac1]$cat /u01/grid/network/admin/listener.ora
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = +ASM)
(ORACLE_HOME=/u01/grid)
(SID_NAME = +ASM1)
)
)
[grid@rac2 ~]$ cat /u01/grid/network/admin/listener.ora
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = +ASM)
(ORACLE_HOME=/u01/grid)
(SID_NAME = +ASM2)
)
)
注:紅色為新增的部分。
[oracle@rac1 ~]$ sqlplus sys/asmdb@192.168..0.201:1521/+ASM as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on Wed Jul 11 21:31:30 2012
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 Real Application Clusters and Automatic Storage Management options
SQL> show parameter name;
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_unique_name string +ASM
instance_name string +ASM1
lock_name_space string
service_names string +ASM
SQL> conn sys/asmdb@192.168.0.202:1521/+ASM as sysdba
Connected.
SQL> show parameter name;
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_unique_name string +ASM
instance_name string +ASM2
lock_name_space string
service_names string +ASM
[oracle@rac1]$ cat /u01/app/oracle/product/11.2.0/db_1/network/admin/tnsnames.ora
//節點2的tnsnames.ora檔案做相應的配置
RAC =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = rac-scan)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = rac.yang.com)
)
)
ASM =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.201)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = +ASM)
(SID_NAME = +ASM1)
)
)
注:紅色為新增的部分。
二:acfs上安裝ogg,acfs用來存放ogg的安裝目錄,便於叢集件的共享,在10g上部署可以選擇ocfs2,acfs的部署過程參考:http://ylw6006.blog.51cto.com/470441/925545
[root@rac1 ~]# ll -d /vol2/
drwxrwx--- 4 root asmadmin 4096 Jul 9 09:38 /vol2/
[root@rac1 ~]# id oracle
uid=501(oracle) gid=500(oinstall) groups=500(oinstall),502(asmdba),504(dba),505(oper)
[root@rac1 ~]# chown -R oracle.asmadmin /vol2/ (節點2做同樣的操作)
[root@rac1 ~]# ll -d /vol2/
drwxrwx--- 4 oracle asmadmin 4096 Jul 9 09:38 /vol2/
[root@rac1 ~]# su - oracle
[oracle@rac1 ~]$ mkdir -p /vol2/ogg
[oracle@rac1 ogg]$ tar -xvf /home/oracle/fbo_ggs_Linux_x64_ora11g_64bit.tar
[oracle@rac1 ~]$ grep 'LD_LIBRARY_PATH' .bash_profile (節點2做同樣的操作)
export LIBRARY_PATH=/vol2/ogg:$ORACLE_HOME/lib:$LD_LIBRARY_PATH
[oracle@rac1 ~]$ source .bash_profile
[oracle@rac1 ~]$ cd -
/vol2/ogg
[oracle@rac1 ogg]$ ./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 (rac1.yang.com) > create subdirs
Creating subdirectories under current directory /vol2/ogg
Parameter files /vol2/ogg/dirprm: already exists
Report files /vol2/ogg/dirrpt: created
Checkpoint files /vol2/ogg/dirchk: created
Process status files /vol2/ogg/dirpcs: created
SQL script files /vol2/ogg/dirsql: created
Database definitions files /vol2/ogg/dirdef: created
Extract data files /vol2/ogg/dirdat: created
Temporary files /vol2/ogg/dirtmp: created
Stdout files /vol2/ogg/dirout: created
GGSCI (rac1.yang.com) > view params mgr
port 7809
autostart er *
autorestart er *
GGSCI (rac1.yang.com) > start mgr
Manager started.
GGSCI (rac1.yang.com) > info mgr
Manager is running (IP port rac1.yang.com.7809).
GGSCI (rac1.yang.com) > exit
[oracle@rac1 ogg]$ netstat -ntpl |grep 7809
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
tcp 0 0 :::7809 :::* LISTEN 10622/mgr
三:rac資料庫上進行配置,建立使用者,授權,執行執行序列號和ddl複製的相關指令碼等
[oracle@rac1 ogg]$ sqlplus sys/orcl@racdb as sysdba
SQL> select instance_name from v$instance;
INSTANCE_NAME
----------------
rac1
SQL> create user ogg identified by ogg;
User created.
SQL> grant connect,resource,dba to ogg;
Grant succeeded.
SQL> @sequence.sql
SQL> alter database add supplemental log data;
Database altered.
SQL> alter database add supplemental log data (primary key) columns;
Database altered.
SQL> alter database add supplemental log data (foreign key) columns;
Database altered.
SQL> alter database add supplemental log data (unique) columns;
Database altered.
SQL> alter system archive log current;
System altered.
SQL> grant execute on utl_file to ogg;
Grant succeeded.
SQL> @marker_setup.sql
SQL> @ddl_setup.sql
SQL> @role_setup.sql
SQL> grant ggs_ggsuser_role to ogg;
SQL> @ddl_enable.sql
SQL> @ddl_pin ogg
如果出現執行指令碼無響應的情況,那麼要到ogg 安裝的根目錄下登陸sqlplus然後執行。
四:在source端配置extract group
SQL> create user test identified by test;
User created.
SQL> grant connect,resource to test;
Grant succeeded.
GGSCI (rac1.yang.com) > dblogin userid ogg,password ogg
Successfully logged into database.
GGSCI (rac1.yang.com) > add extract testext,tranlog,begin now,threads 2
EXTRACT added.
GGSCI (rac1.yang.com) > add exttrail /vol2/ogg/dirdat/et, extract testext
EXTTRAIL added.
GGSCI (rac1.yang.com) > view params testext
EXTRACT testext
SETENV (ORACLE_HOME = "/u01/app/oracle/product/11.2.0/db_1")
USERID ogg@racdb, PASSWORD ogg
TRANLOGOPTIONS ASMUSER sys@ASM,ASMPASSWORD asmdb
THREADOPTIONS MAXCOMMITPROPAGATIONDELAY 20000
EXTTRAIL /vol2/ogg/dirdat/et
DYNAMICRESOLUTION
DDL INCLUDE ALL
TABLE test.*;
五:在source端配置data pump extract group
GGSCI (rac1.yang.com) > add extract testpump,exttrailsource /vol2/ogg/dirdat/et,begin now
EXTRACT added.
GGSCI (rac1.yang.com) > add rmttrail /vol2/ogg/dirdat/rt,extract testpump
RMTTRAIL added.
GGSCI (rac1.yang.com) > view params testpump
EXTRACT testpump
RMTHOST 192.168.0.141, MGRPORT 7809
RMTTRAIL /vol2/ogg/dirdat/rt
PASSTHRU
TABLE test.*
六:target端配置,這裡要保證在tnsnames.ora檔案中配置了dg3連線串,同時建立/vol2/ogg/dirdat/rt目錄,並授權;在這裡未測試過target端和source使用不同的目錄是否可行!
[oracle@orcl ~]$ cat /u01/app/oracle/product/11.2.0/db_1/network/admin/tnsnames.ora
# tnsnames.ora Network Configuration File: /u01/app/oracle/product/11.2.0/db_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.
ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = orcl)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)
dg3 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.141)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
(SID_NAME = orcl)
)
)
SQL> create user ogg identified by ogg;
User created.
SQL> grant connect,resource,dba to ogg;
Grant succeeded.
SQL> create user test identified by test;
User created.
SQL> grant connect,resource to test;
Grant succeeded.
GGSCI (dg3.yang.com) > add replicat testrpt,exttrail /vol2/ogg/dirdat/rt,nodbcheckpoint
REPLICAT added.
GGSCI (dg3.yang.com) > view params testrpt
REPLICAT testrpt
SETENV (ORACLE_HOME = "/u01/app/oracle/product/11.2.0/db_1")
USERID ogg@dg3,PASSWORD ogg
ASSUMETARGETDEFS
HANDLECOLLISIONS
REPERROR (DEFAULT, DISCARD)
DDLERROR DEFAULT DISCARD
DDLOPTIONS REPORT
DISCARDFILE /vol2/ogg/repsz.dsc,append,megabytes 100
MAP test.*, TARGET test.*;
七:啟動各程式
GGSCI (rac1.yang.com) > start testext
Sending START request to MANAGER ...
EXTRACT TESTEXT starting
GGSCI (rac1.yang.com) > start testpump
Sending START request to MANAGER ...
EXTRACT TESTPUMP starting
GGSCI (rac1.yang.com) > info all
Program Status Group Lag at Chkpt Time Since Chkpt
MANAGER RUNNING
EXTRACT RUNNING TESTEXT 00:00:00 00:19:49
EXTRACT RUNNING TESTPUMP 00:00:00 00:03:24
GGSCI (dg3.yang.com) > start testrpt
Sending START request to MANAGER ...
REPLICAT TESTRPT starting
GGSCI (dg3.yang.com) > info all
Program Status Group Lag at Chkpt Time Since Chkpt
MANAGER RUNNING
REPLICAT RUNNING TESTRPT 00:00:00 00:00:02
程式安排在最後啟動,在啟動source端的pump程式之前,如果target端的replicat程式未啟動,則會報如下錯誤:
2012-07-15 13:56:14 ERROR OGG-01033 There is a problem in network communication, a remote file problem, encryption keys for target and source do not match (if using ENCRYPT) or an unknown error. (Remote file used is /vol2/ogg/dirdat/rt000000, reply received is Could not create /vol2/ogg/dirdat/rt000000).
八:測試同步情況
[oracle@rac1 ~]$ sqlplus test/test@rac
SQL*Plus: Release 11.2.0.3.0 Production on Sun Jul 15 14:11:52 2012
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, Real Application Clusters, Automatic Storage Management, Oracle Label Security,
OLAP, Data Mining, Oracle Database Vault and Real Application Testing options
SQL> create table t1 (id number,name char(10));
Table created.
SQL> desc t1;
Name Null? Type
----------------------------------------- -------- ----------------------------
ID NUMBER
NAME CHAR(10)
SQL> insert into t1 values (1,'one');
1 row created.
SQL> commit;
Commit complete.
SQL> select * from t1;
ID NAME
---------- ----------
1 one
[oracle@dg3 ~]$ sqlplus test/test@dg3
SQL*Plus: Release 11.2.0.3.0 Production on Sun Jul 15 14:12:31 2012
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 * from tab;
TNAME TABTYPE CLUSTERID
------------------------------ ------- ----------
T1 TABLE
SQL> select * from t1;
ID NAME
---------- ----------
1 one
總結:rac環境下配置ogg,基本同單例項無異!重點需要注意的地方有以下幾點!
1:使用ASM儲存,需要先配置ASM例項的靜態註冊,同時在tnsnames.ora檔案中配置連線串
2:在配置exttract程式中,注意需要配置TRANLOGOPTIONS 引數,輸入連線asm例項的憑證
3:在配置exttract程式中,新增tranlog的時候,需要寫thread 2
4: 注意程式的啟動順序,先是source和target端的mgr程式,其次是source端的extract程式,target端的replicat程式,最後是source端的extract pump程式
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/28389881/viewspace-1702282/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- LINUX 環境 mysql to mysql OGG安裝配置(二)LinuxMySql
- RAC環境下建立物理DATAGUARD(1)
- RAC環境下建立物理DATAGUARD(2)
- RAC和ASM環境下打patchASM
- Oracle RAC 環境下的連線管理Oracle
- Oracle 11g RAC到單例項OGG同步Oracle單例
- Oracle RAC環境下ASM磁碟組擴容OracleASM
- CentOS下Ant環境配置CentOS
- Maven環境下MyBatisGenerator 配置MavenMyBatis
- Windows 下 Laravel 環境配置WindowsLaravel
- linux下配置java環境LinuxJava
- OGG Integrated Mode(downstream方式)環境搭建
- linux環境下ssh 互信配置Linux
- Linux 下配置 node + mongodb 環境LinuxMongoDB
- RAC環境下的SEQUENCE對應用的影響
- app自動化測試環境配置:adb環境配置、monkey環境配置、appium環境配置大全APP
- Linux環境下nginx安裝配置LinuxNginx
- Mac下配置PHP+MySql環境MacPHPMySql
- wamp環境下虛擬域名配置
- docker下springboot的多環境配置DockerSpring Boot
- 在windows下配置Eclipse + go環境WindowsEclipseGo
- Docker 下安裝配置 lnmp 環境DockerLNMP
- Webpack下多環境配置的思路Web
- Mac環境下安裝配置RedisMacRedis
- RAC環境修改spfile的位置
- DM8 配置DMDSC主備環境(rac到單節點 )
- KingbaseES RAC部署案例之---SAN環境構建RAC
- RedHat 7.2配置LAMP環境下的redius+mysql+openvpn環境RedhatLAMPMySql
- 環境配置
- DM8 Linux環境下配置ODBCLinux
- Linux下Java環境變數的配置LinuxJava變數
- 手工清理19c RAC環境
- 配置開發環境、生成環境、測試環境開發環境
- React 和 Vite 環境下 TailwindCSS 的配置指南ReactViteAICSS
- windows下yolov8訓練環境配置WindowsYOLO
- Linux系統下CUDA和cuDNN環境配置LinuxDNN
- 如何下載Java-配置環境全教程Java
- Tomcat的下載及環境變數配置Tomcat變數
- (轉)Windows下安裝Docker, GitBash環境配置WindowsDockerGit