ORACLE RAC+OGG配置
实验环境
主机名 IP地址
rac01 192.168.56.10
rac02 192.168.56.20
rac-scan 192.168.56.30
目标库:
ora-ogg 192.168.56.40
实验是从rac环境到单实例的ogg同步
1. 查看rac节点是否有ASM的监听注册(双节点)
[oracle@rac01 ~]$ lsnrctl services LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 22-MAY-2017 16:07:08 Copyright (c) 1991, 2013, Oracle. All rights reserved. Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
Services Summary...
Service "+ASM" has 1 instance(s).
Instance "+ASM1", status READY, has 1 handler(s) for this service...
Handler(s):
"DEDICATED" established:1 refused:0 state:ready
LOCAL SERVER
Service "orcl" has 1 instance(s).
Instance "orcl1", status READY, has 1 handler(s) for this service...
Handler(s):
"DEDICATED" established:0 refused:0 state:ready
LOCAL SERVER
Service "orclXDB" has 1 instance(s).
Instance "orcl1", status READY, has 1 handler(s) for this service...
Handler(s):
"D000" established:0 refused:0 current:0 max:1022 state:ready
DISPATCHER <machine: rac01, pid: 4164>
(ADDRESS=(PROTOCOL=tcp)(HOST=rac01)(PORT=44556))
The command completed successfully
如果没有,需要用grid用户在$ORACLE_HOME/network/admin/listener.ora文件中添加静态注册,然后reload listener(双节点):
[grid@rac01 admin]$ vi listener.ora
LISTENER=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER)))) # 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=ON # line added by Agent SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = +ASM)
(ORACLE_HOME=/u01/app/11.2.0/grid)
(SID_NAME = +ASM1)
)
)
2. 用oracle用户编辑$ORACLE_HOME/network/admin/tnsnames.ora文件,使其用别名可连接ASM实例和数据库
[oracle@rac01 admin]$ cat 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. rac =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = rac-scan)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
) ASM =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.56.10)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = +ASM)
(SID_NAME = +ASM1)
) )
3. 查看endpoints_listener.ora文件配置是否合理
[grid@rac01 admin]$ cat endpoints_listener.ora
LISTENER_RAC01=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=rac01-vip)(PORT=1521))(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.56.10)(PORT=1521)(IP=FIRST)))) # line added by Agent
4.测试连接:
[oracle@rac01 ~]$ sqlplus sys/oracle@ASM as sysasm SQL*Plus: Release 11.2.0.4.0 Production on Mon May 22 16:16:11 2017 Copyright (c) 1982, 2013, Oracle. All rights reserved. Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Real Application Clusters and Automatic Storage Management options SQL> select instance_name from v$instance; INSTANCE_NAME
----------------
+ASM1 [oracle@rac01 ~]$ sqlplus sys/oracle@rac as sysdba SQL*Plus: Release 11.2.0.4.0 Production on Mon May 22 16:16:49 2017 Copyright (c) 1982, 2013, Oracle. All rights reserved. Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options SQL> select instance_name from v$instance; INSTANCE_NAME
----------------
orcl1
5. 安装acfs(ASM Cluster File System)
[grid@rac01 ~]$ acfsload -s
ACFS-9228: usage: acfsload {start|stop} [-s]
[grid@rac01 ~]$ acfsload start
ACFS-9130: Root access required
[grid@rac01 ~]$ exit
logout
[root@rac01 ogg]# cd /u01/app/11.2.0/grid/bin/
[root@rac01 bin]# ./acfsload start
ACFS-9391: Checking for existing ADVM/ACFS installation.
ACFS-9392: Validating ADVM/ACFS installation files for operating system.
ACFS-9393: Verifying ASM Administrator setup.
ACFS-9308: Loading installed ADVM/ACFS drivers.
ACFS-9327: Verifying ADVM/ACFS devices.
ACFS-9156: Detecting control device '/dev/asm/.asm_ctl_spec'.
ACFS-9156: Detecting control device '/dev/ofsctl'.
ACFS-9322: completed
6. 这里可以使用挂在上来的磁盘或者现有的ASM磁盘做ogg的软件目录
我采用在现有ASM磁盘上创建一个ASM卷并挂载
[grid@rac01 ~]$ sqlplus / as sysasm SQL*Plus: Release 11.2.0.4.0 Production on Fri May 19 15:43:24 2017 Copyright (c) 1982, 2013, Oracle. All rights reserved. Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Real Application Clusters and Automatic Storage Management options SQL> alter diskgroup DATA add volume acfsload size 1G; Diskgroup altered. SQL> quit [grid@rac01 ~]$ ll /dev/asm*
brw-rw---- 1 grid oinstall 8, 32 May 19 15:44 /dev/asm-disk1
brw-rw---- 1 grid oinstall 8, 16 May 19 15:44 /dev/asm-disk2
brw-rw---- 1 grid oinstall 8, 48 May 19 10:33 /dev/asm-disk3 /dev/asm:
total 0
brwxrwx--- 1 root dba 252, 107521 May 19 15:44 acfsload-210
7. 创建acfs挂载目录,在两个节点都要创建相同目录
[root@rac01 deinstall]# mkdir -p /u01/app/acfsmounts/acfsload-210
[root@rac02 deinstall]# mkdir -p /u01/app/acfsmounts/acfsload-210
8. 用mkfs创建文件系统
[root@rac01 deinstall]# mkfs -t acfs -n acfs01 /dev/asm/acfsload-210
shell-init: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
mkfs.acfs: version = 11.2.0.4.0
mkfs.acfs: on-disk version = 39.0
mkfs.acfs: volume = /dev/asm/acfsload-210
mkfs.acfs: volume size = 1073741824
mkfs.acfs: Format complete.
9. 用acfsuit命令注册文件系统
[root@rac01 bin]# acfsutil registry -a -f /dev/asm/acfsload-210 /u01/app/acfsmounts/acfsload-210
acfsutil registry: mount point /u01/app/acfsmounts/acfsload-210 successfully added to Oracle Registry
10. 使用mount.acfs -o all命令挂载文件系统
[root@rac01 bin]# mount.acfs -o all
[root@rac01 bin]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_rac01-LogVol01
21G 13G 6.8G 65% /
tmpfs 1.9G 134M 1.8G 7% /dev/shm
/dev/sda1 190M 42M 138M 24% /boot
/dev/asm/acfsload-210
1.0G 79M 946M 8% /u01/app/acfsmounts/acfsload-210
11. 改变文件系统的归属,改为Oracle:oinstall
[root@rac01 bin]# chown oracle:oinstall /u01/app/acfsmounts/acfsload-210
[root@rac01 bin]# ll -d /u01/app/acfsmounts/acfsload-210
drwxrwx--- 4 oracle oinstall 4096 May 19 15:53 /u01/app/acfsmounts/acfsload-210
12. 安装ogg软件
创建文件目录:mkdir /tmp/orasoft
将安装文件上传到该目录下面并解压
[oracle@rac01 orasoft]$ ls
fbo_ggs_Linux_x64_shiphome fbo_ggs_Linux_x64_shiphome.zip OGG-12.2.0.1.1-ReleaseNotes.pdf OGG-12.2.0.1-README.txt
使用图形化安装,指定ogg_home,oracle用户的oracle_home,安装11g的ogg
[oracle@rac01 ~]$ /tmp/orasoft/fbo_ggs_Linux_x64_shiphome/Disk1/runInstalle
13. 配置oracle环境变量,需要加入LD_LIBRARY_PATH及OGG_HOME等
[oracle@rac01 orasoft]$ cat ~/.bash_profile
# .bash_profile # Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi # User specific environment and startup programs
PATH=$PATH:$HOME/bin export PATH
export ORACLE_SID=orcl1
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1
export ORACLE_UNQNAME=orcl
#export PATH=$ORACLE_HOME/bin:$PATH
umask 022 export OGG_HOME=/u01/app/acfsmounts/acfsload-210/ogg
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib:$ORACLE_HOME/rdbms/lib
export PATH=$PATH:$ORACLE_HOME/bin:$OGG_HOME
14. 配置mgr进程
[oracle@rac01 ~]$ cd /u01/app/acfsmounts/acfsload-210/ogg/
[oracle@rac01 ogg]$ ggsci Oracle GoldenGate Command Interpreter for Oracle
Version 12.2.0.1.1 OGGCORE_12.2.0.1.0_PLATFORMS_151211.1401_FBO
Linux, x64, 64bit (optimized), Oracle 11g on Dec 12 2015 00:54:38
Operating system character set identified as UTF-8. Copyright (C) 1995, 2015, Oracle and/or its affiliates. All rights reserved. GGSCI (rac01) 1> edit params mgr
GGSCI (rac01) 2> view params mgr PORT 7808
autostart er *
autorestart er * GGSCI (rac01) 3> start mgr
GGSCI (rac01) 4> info mgr Manager is running (IP port rac01.7808, Process ID 18924).
15. 目标库安装ogg,方法同样,目标安装在/ogg目录下
16. 在rac库上创建用户,配置,授权等以及开启ddl复制相关脚本
SQL> create user ogg identified by ogg; User created. SQL> grant connect,resource,unlimited tablespace to ogg; User created. SQL> create tablespace ogg datafile '+data' size 1g autoextend off; Tablespace created. SQL> alter user ogg default tablespace ogg; User altered. SQL> select username,default_tablespace from dba_users where username='OGG'; USERNAME DEFAULT_TABLESPACE
------------------------------ ------------------------------
OGG OGG SQL> @sequence.sql 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; Grant succeeded. SQL> @ddl_enable.sql Trigger altered. SQL> @ddl_pin ogg PL/SQL procedure successfully completed. PL/SQL procedure successfully completed. PL/SQL procedure successfully completed. SQL> alter database add supplemental log data; Database altered. SQL> alter system set enable_goldengate_replication=true scope=both; System altered.
17. 创建同步的用户test,同步test用户下面的数据
SQL> create user test identified by test; User created. SQL> grant connect,resource to test; Grant succeeded.
18. 源端配置extract group抽取数据
[oracle@rac01 ogg]$ ggsci GGSCI (rac01) 1>
GGSCI (rac01) 2> dblogin userid ogg password ogg
Successfully logged into database. GGSCI (rac01 as ogg@orcl1) 3> add extract testext,tranlog,begin now,threads 2
EXTRACT added. GGSCI (rac01 as ogg@orcl1) 4> add exttrail ./dirdat/et,extract testext
EXTTRAIL added. GGSCI (rac01 as ogg@orcl1) 5> edit params testext EXTRACT testext
SETENV (ORACLE_HOME = "/u01/app/oracle/product/11.2.0/db_1")
USERID ogg@rac, PASSWORD ogg
TRANLOGOPTIONS ASMUSER sys@ASM,ASMPASSWORD oracle
EXTTRAIL ./dirdat/et
DYNAMICRESOLUTION
DDL INCLUDE ALL
TABLE test.*;
19. 源端配置data pump传送数据
[oracle@rac01 ogg]$ ggsci GGSCI (rac01) 2> dblogin userid ogg password ogg
Successfully logged into database. GGSCI (rac01 as ogg@orcl1) 3> add extract testpump,exttrailsource ./dirdat/et,begin now
EXTRACT added. GGSCI (rac01 as ogg@orcl1) 4> add rmttrail ./dirdat/rt,extract testpump
RMTTRAIL added. GGSCI (rac01 as ogg@orcl1) 5> edit params testpump EXTRACT testpump
rmthost 192.168.56.40, mgrport 7808
rmttrail ./dirdat/rt
passthru
table test.*; GGSCI (rac01 as ogg@orcl1) 6> info all Program Status Group Lag at Chkpt Time Since Chkpt MANAGER RUNNING
EXTRACT STOPPED EXTDATA 00:00:00 00:53:31
EXTRACT STOPPED TESTPUMP 00:00:00 00:04:01
20. 目标库配置:
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. SQL> alter system set enable_goldengate_replication=true scope=both; System altered. SQL> exit [oracle@ora-ogg ogg]$ ./ggsci
GGSCI (ora-ogg) 2> dblogin userid ogg password ogg
Successfully logged into database. GGSCI (ora-ogg as ogg@orcl) 3> add replicat testrpt,exttrail ./dirdat/rt,nodbcheckpoint
REPLICAT added. GGSCI (ora-ogg as ogg@orcl) 4> edit params testrpt
REPLICAT testrpt
setenv (ORACLE_SID=orcl)
SETENV (ORACLE_HOME = "/u01/app/oracle/product/11.2.0/db_1")
USERID ogg@orcl,PASSWORD ogg
ASSUMETARGETDEFS
HANDLECOLLISIONS
REPERROR (DEFAULT, DISCARD)
DDLERROR DEFAULT DISCARD
DDLOPTIONS REPORT
DISCARDFILE ./repsz.dsc,append,megabytes 100
MAP test.*, TARGET test.*; GGSCI (ora-ogg as ogg@orcl) 6> info all Program Status Group Lag at Chkpt Time Since Chkpt MANAGER STOPPED
REPLICAT STOPPED TESTRPT 00:00:00 00:01:32
21. 启动各个进程:
启动顺序
source和target端的mgr -- > source端的extract --> target端的replicat --> source端的extract pump source: GGSCI (rac01 as ogg@orcl1) 11> info all Program Status Group Lag at Chkpt Time Since Chkpt MANAGER RUNNING
EXTRACT RUNNING TESTEXT 00:00:00 00:00:08
EXTRACT RUNNING TESTPUMP 00:00:00 00:00:02 target: GGSCI (ora-ogg as ogg@orcl) 19> info all Program Status Group Lag at Chkpt Time Since Chkpt MANAGER RUNNING
REPLICAT RUNNING TESTRPT 00:00:00 00:00:01
22. 开始同步
总结:遇到的坑:
1. ggsci无法进入,报错如下:
[oracle@rac01 ~]$ ggsci
Cannot load ICU resource bundle 'ggMessage', error code 2 - No such file or directory
Aborted (core dumped) 原因1:ggsci必须在ogg的安装目录下输入才能进入;
原因2:未配置oracle用户的环境变量。 2. 无法启动REPLICAT,
GGSCI (ora-ogg as ogg@orcl) 7> start testrpt Sending START request to MANAGER ... ERROR: Access denied. 2017-05-22 15:29:10 WARNING OGG-01742 Command sent to MGR MGR returned with an ERROR response.
告警中日志错误
2017-05-22 15:29:10 WARNING OGG-00936 Oracle GoldenGate Manager for Oracle, mgr.prm: Access denied (request from 192.168.56.40, rule #0). 解决办法,在目标库mgr配置文件中添加访问主机IP:
GGSCI (ora-ogg as ogg@orcl) 8> edit params mgr
PORT 7808
ACCESSRULE, PROG *, IPADDR 192.168.*.*, ALLOW 3. 一些命令
开启mgr: start mgr
开启其他进程: start * / start 进程名
关闭相反 查看参数:view params 进程名
查看日志:view report 进程名
查看日志:OGG_HOME/ggserr.log
ORACLE RAC+OGG配置的更多相关文章
- JDBC连接oracle RAC数据库配置
RAC的配置如下: node1:ip地址192.168.60.132,实例名:rac1,主机名:rac1 node2:ip地址192.168.60.144,实例名:rac2,主机名:rac2 RAC服 ...
- Oracle 11gR2 RAC网络配置,更改public ip、vip和scanip
Oracle 11gR2 RAC网络配置,更改public ip.vip和scanip 转载黑裤子 发布于2018-10-30 01:08:02 阅读数 2898 收藏 展开 转载. https:/ ...
- 【Oracle 集群】Linux下Oracle RAC集群搭建之Oracle DataBase安装(八)
Oracle 11G RAC数据库安装(八) 概述:写下本文档的初衷和动力,来源于上篇的<oracle基本操作手册>.oracle基本操作手册是作者研一假期对oracle基础知识学习的汇总 ...
- 【Oracle 集群】Linux下Oracle RAC集群搭建之基本测试与使用(九)
Oracle 11G RAC数据库安装(九) 概述:写下本文档的初衷和动力,来源于上篇的<oracle基本操作手册>.oracle基本操作手册是作者研一假期对oracle基础知识学习的汇总 ...
- 【转】【Oracle 集群】Linux下Oracle RAC集群搭建之基本测试与使用(九)
原文地址:http://www.cnblogs.com/baiboy/p/orc9.html 阅读目录 目录 检查RAC状态 检查创建的数据库 全部参考文献 相关文章 Oracle 11G RAC ...
- 【转】【Oracle 集群】Linux下Oracle RAC集群搭建之Oracle DataBase安装(八)
原文地址:http://www.cnblogs.com/baiboy/p/orc8.html 阅读目录 目录 数据库安装 参考文献 相关文章 Oracle 11G RAC数据库安装(八) 概述:写 ...
- 安装Oracle RAC 11g
1.Oracle Enterprise Linux 和 iSCSI 上构建 Oracle RAC 11g 集群 2.Oracle RAC 的所有共享磁盘存储将基于 iSCSI,iSCSI 使用在第三个 ...
- Oracle RAC客户端tnsnames.ora相关配置及测试
1.Oracle RAC服务端/etc/hosts部分内容如下 2.查看服务端的local_listener和remote_listener参数 3.客户端tnsnames.ora配置参考 3.1 1 ...
- ORACLE RAC 下非缺省端口监听配置(listener.ora tnsnames.ora)
不论是单实例还是RAC,对于非缺省端口下(1521)的监听器,pmon进程不会将service/instance注册到监听器,即不会实现动态注册.与单实例相同,RAC非缺省端口的监听器也是通过设置参数 ...
随机推荐
- Android 用SSL构建安全的Socket
SSL(安全套接层)是 Netscape公司在1994年开发的,最初用于WEB浏览器,为浏览器与服务器间的数据传递提供安全保障,提供了加密.来源认证和数据完整性的功能.现在SSL3.0得到了普遍的使用 ...
- [Ramda] Get a List of Unique Values From Nested Arrays with Ramda (flatMap --> Chain)
In this lesson, we'll grab arrays of values from other arrays, resulting in a nested array. From the ...
- Oracle12c导入scott测试用户(转)
登入DBA用户 connect sys as sysdba; 创建scott用户 create user c##scott identified by tiger;--用户名前加c##,12c要求 授 ...
- rebar工具使用备忘录
http://cryolite.iteye.com/blog/1159448 rebar是一个开源的erlang应用自动构建工具.basho的tuncer开发.它实际上是一个erlang脚本(escr ...
- sqlserver中的存储过程 函数 事物 索引及视图
存储过程和函数具体的区别: 核心提示:本质上没区别.只是函数有限制只能返回一个标量,而存储过程可以返回多个.并且函数是可以 ...
- springboot 使用传统方式部署
spring boot默认创建出来的应用程序是内嵌web容器的,直接运行jar文件就可以的,但通常我们也需要将程序部署到tomcat中,这需要做如下改进: 1.pom.xml修改 打包方式需要修改成w ...
- tomcat启动时自动加载一个类 MyServletContextListener
目的: 我们知道在tomcat启动后,需要页面请求进行驱动来执行操作接而响应.我们希望在tomcat启动的时候能够自动运行一个后台线程,以处理我们需要的一些操作.因此需要tomcat启动时就自动加载一 ...
- 动态备份SQL-SERVER数据库——SQLDMO
转载:http://www.cnblogs.com/liulanglang/archive/2007/12/04/981812.html 上周要写一个SQL-SERVER数据库备份还原的程序,很没有思 ...
- 生成式模型(generative) vs 判别式模型(discriminative)
Andrew Ng, On Discriminative vs. Generative classifiers: A comparison of logistic regression and nai ...
- WIN10+QT5.9+VS2015编译RedisDesktopManager
原文:WIN10+QT5.9+VS2015编译RedisDesktopManager 官方源码编译安装说明地址:http://docs.redisdesktop.com/en/latest/insta ...