暂无图片
暂无图片
2
暂无图片
暂无图片
暂无图片
oracle12c_ogg安装配置
4406
9页
40次
2019-09-18
10墨值下载
注意:
oracle
12C R2ogg12.2版本不兼容
一、安装前准备
1.linux操作系统版本
Red Hat Enterprise Linux Server release 6.4
源库10.88.3.180 目标库:10.88.129.180
2.GoldenGate版本
Version 12.3.0.1.4 OGGCORE_12.3.0.1.4_PLATFORMS_170630.0419_FBO
3.oracle版本
goldengate 12c 针对oracle 12c配置的主要变化
1
一个 CDB包含多个PDB,源端部署的一个extract可访问所有pdb redo,理论上不需要每个pdb单独配置extract.
2
抽取模式只能是integrated(集成)模式,不支持claasic capture传统方式捕获;
3
因为要使用integrated extract,因此,需要能访问log mining server,而这个只能从cdb$root中访问;
4
源端要使用common user,即c##ogg这种用户来访问源端DB,这样能访问DB的redo log & all pdbs。
5
在GGSCI或参数文件中,可以使用pdb.schema.table来访问具体的表或序列;
6
可以在参数文件 中使用sourceCatalog参数,指定一个PDB,后面的参数中只需要schema.table即可;
7
目标端每个pdb要有一个replicat进程,即一个replicat进程只能投递到一个PDB,不能投递到多个。
8
源端OGG用户需要赋权:dbms_goldengate_auth.grant_admin_privilege(‘C##GGADMIN’,container=>‘all’),同时建议将ogg的用户设置赋权为:
grant dba to c##ogg container=all;
9
源端DB除了以前要打开归档, force logging, 最小附加日志,可能还需要打开一个开关:alter system set enable_goldengate_replication=true;
由于oracle 12c已经是多租户架构,在使用OGG同步的时候,需要考虑下面一些情况:
二、配置单向同步
(1)源端安装GoldenGate(目标端也需要安装)
1.创建用户
创建目录:
mkdir -p /ogg
chmod -R 777 /ogg
chown -R ogg:oinstall /ogg
创建ogg用户:
useradd -g oinstall -G dba ogg
设置用户密码:
passwd ogg#1q2w3e
2.解压ogg软件
unzip 123014_fbo_ggs_Linux_x64_shiphome.zip
3.设置环境变量(目标端也需要设置)
su - ogg
vim .bash_profile
export ORACLE_BASE=/oracle/
export ORACLE_HOME=$ORACLE_BASE/product/12.2.1
export ORACLE_SID=newsms
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export GGATE=/ogg
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export PATH=$PATH:$ORACLE_HOME/bin:$GGATE
source .bash_profile 使环境变量生效
Oracle12c_ogg安装配置
2019
3
28
11:23
分区 oracle12c_ogg安装配置 的第 1
4.安装ogg软件
图形化安装方法中,在software location部分选择环境变量中GGATE的值,不过要注意给GGATE目录适当的限;
Database Location部分就是ORACLE_HOME的值。
(2)目标端安装GoldenGate同上(安装步骤一样)
(3)配置源端数据库
(需要搭建双向同步的话,目的数据库也需要如下配置)
1.tns设置(目标端也同样设置)
NEWSMS =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.88.3.180)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = newsms)
)
)
NEWSMSPDB =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.88.3.180)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = newsmspdb)
)
)
2.
开启归档(如果归档没有开启需要开启)
alter system set log_archive_dest='/oradata/arch' scope=spfile; ------修改归档路径
alter system set db_recovery_file_dest='' scope=spfile; --关闭闪回
shutdown immediate;
startup mount;
alter database archivelog;
alter database open;
查看闪回是否关闭:
select flashback_on from v$database;
注意:
查看归档日志路径
SQL>show parameter log_archive_dest_1
NAME TYPE VALUE
log_archive_dest_1 string location='/oradata/arch DB_UNIQUE_NAME=newsms,valid_for=(all_logfiles,all_roles)'
归档日志路径信息与后面的注册抽取进程的错误有关,报错为:
GGSCI (primrac1.example.com as ggcw@orcldg1) 5> register extract ext1 database
2019-02-20 01:36:19 ERROR OGG-15415 Log archive destination at the source database must be configured with the NOREGISTER attribute for
destination id '1'.
此时需要删除DB_UNIQUE_NAME
SQL> alter system set log_archive_dest_1='location=/oradata/arch valid_for=(all_logfiles,all_roles)' scope=spfile;
删除后注册成功!
3
.设置数据库force logging
SQL>select force_logging from v$database;
SQL>alter database force logging;
4
.开启最小附加日志(DDL的话好开启数据库级别
SQL>select supplemental_log_data_min from v$database; ----查看是否开启了最小附加日志模式
SQL>alter database add supplemental log data;
千万不要小看这步日志设置,其实在GoldenGate的配置中,这步是最容易出错的环节。如果开启DDL复制做冗灾备份,最好直接在数据库级别打开补全日志:
SQL>alter database add supplemental log data(primary key,unique,foreign key) columns;
分区 oracle12c_ogg安装配置 的第 2
SQL>alter database add supplemental log data(primary key,unique,foreign key) columns;
检查一下,全是yes就ok
SQL>select supplemental_log_data_min,supplemental_log_data_pk,supplemental_log_data_ui from v$database;
5.
修改参数
SQL
>alter system set enable_goldengate_replication=true;
6.切换归档日志
SQL> ALTER SYSTEM SWITCH LOGFILE;
7.启用模式级补充日志记录
登录到pdb
GGSCI (sfa-sms-test) 1> dblogin userid C##OGG@newsmspdb,password C##OGG123
Successfully logged into database NEWSMSPDB.
GGSCI>ADD SCHEMATRANDATA newsms
GGSCI>ADD SCHEMATRANDATA newsms ALLCOLS
ADD SCHEMATRANDATA schema [ALLCOLS | NOSCHEDULINGCOLS]
在没有选项的情况下,ADD SCHEMATRANDATA模式允许在源系统上对主键进行无条件补充日志记录,并对给定模式中所有当前和未来表的所有唯一键和外键进行条件补
充日志记录。无条件日志将主键值强制记录到日志中,无论当前操作中是否更改了该键。如果在当前操作中至少更改了一个外键或唯一键的列值,则条件日志记录该外键或
唯一键的所有列值。默认值是可选的
ALLCOLS可用于启用对表中所有列的无条件补充日志记录,并适用于给定模式中的所有当前和未来表。当源表和目标表具有不同的调度列时,用于支持集成副本。(调度列
是主键、惟一键和外键。)
NOSCHEDULINGCOLS只记录模式中现有表和稍后添加的新表的主键值和所有有效的惟一索引。这是模式级日志记录的最低要求级别,仅对非集成模式下的副本有效。
Oracle GoldenGate支持模式级补充日志记录。当使用Oracle GoldenGate DDL复制特性时,Oracle源数据库需要模式级日志记录。在所有其他用例中,它都是可选的,
但是您必须使用表级日志记录默认情况下,模式级日志自动支持对模式中所有表的主键进行无条件补充日志记录,对惟一键和外键进行条件补充日志记录。选项允许您根据
需要更改日志记录。
Note:
Oracle strongly recommends using schema-level logging rather than table-level logging, because it ensures that any new tables added to a schema are
captured if they satisfy wildcard specifications.
8.启用表级补充日志记录
在下列情况下,在源系统上启用表级补充日志记录:
在不使用模式级日志记录时启用所需的日志记录级别。必须使用模式级或表级日志记录。默认情况下,表级日志自动启用表的主键的无条件补充日志记录和表的惟一键和外
键的条件补充日志记录。选项允许您根据需要更改日志记录。
防止记录任何给定表的主键。
在表级记录非键列值,以支持特定的Oracle GoldenGate特性,如过滤。
ADD TRANDATA [container.]schema.table [, COLS (columns)] [, NOKEY] [, ALLCOLS | NOSCHEDULINGCOLS]
container is the name of the root container or pluggable database if the table is in a multitenant container database.
schema is the source schema that contains the table.
table is the name of the table. See Administering Oracle GoldenGate for Windows and UNIX for instructions for specifying object names.
ADD TRANDATA without other options automatically enables unconditional supplemental logging of the primary key and conditional supplemental
logging of unique key(s) and foreign key(s) of the table. Unconditional logging forces the primary key values to the log whether or not the key was
changed in the current operation. Conditional logging logs all of the column values of a foreign or unique key if at least one of them was changed in
the current operation. The default is optional to support nonintegrated Replicat (see also NOSCHEDULINGCOLS) but is required to support integrated
Replicat because primary key, unique keys, and foreign keys must all be available to the inbound server to compute dependencies. For more
information about integrated Replicat, see Section 5.3, "Deciding Which Apply Method to Use".
ALLCOLS enables the unconditional supplemental logging of all of the columns of the table. Use to support integrated Replicat when the source and
target tables have different scheduling columns. (Scheduling columns are the primary key, the unique key, and the foreign key.)
NOSCHEDULINGCOLS is valid for Replicat in nonintegrated mode only. It issues an ALTER TABLE command with an ADD SUPPLEMENTAL LOG DATA
ALWAYS clause that is appropriate for the type of unique constraint that is defined for the table, or all columns in the absence of a unique constraint.
This command satisfies the basic table-level logging requirements of Oracle GoldenGate when schema-level logging will not be used. See Section 10.1,
"Ensuring Row Uniqueness in Source and Target Tables" for how Oracle GoldenGate selects a key or index.
COLS columns logs non-key columns that are required for a KEYCOLS clause or for filtering and manipulation. The parentheses are required. These
columns will be logged in addition to the primary key unless the NOKEY option is also present.
NOKEY prevents the logging of the primary key or unique key. Requires a KEYCOLS clause in the TABLE and MAP parameters and a COLS clause in the
分区 oracle12c_ogg安装配置 的第 3
of 9
10墨值下载
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文档的来源(墨天轮),文档链接,文档作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。