GoldenGate 12.2抽取Oracle 12c多租户配置过程
linux下安装12c
重启linux之后,dbca
PDB/CDB使用
SQL> select instance_name from v$instance;
INSTANCE_NAME
------------------------------------------------
GORCL
SQL> alter pluggable database p_orcl open;
Pluggable database altered.
SQL> alter session set container=p_orcl;
Session altered.
SQL> select con_id,dbid,NAME,OPEN_MODE from v$pdbs;
CON_ID DBID NAME OPEN_MODE
--------- ---------- --------------------------------------------------------------------------- ------------------------------
4 1842197265 P_ORCL READ WRITE
SQL> create user test identified by test;
User created.
SQL>create user hr identified by hr;
Create table test.t1(id int primary key, name varchar2(50));
Create table hr.t2(id int primary key, name varchar2(50));
SQL> alter session set container=cdb$root;
Session altered.
SQL> alter PLUGGABLE database all open;
Pluggable database altered.
SQL> select con_id,dbid,NAME,OPEN_MODE from v$pdbs;
CON_ID DBID NAME OPEN_MODE
---------- ---------- ------------------------------------------------------------------------------ ------------------------------
2 2940647386 PDB$SEED READ ONLY
3 1813216422 C_ORCL READ WRITE
4 1842197265 P_ORCL READ WRITE
然后在listener.ora, tnsnames.ora中,dbname因为CDB, PDB是不同的,可以单独配置。以下是listener.ora
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = G_ORCL)
(ORACLE_HOME = /app/oracle/product/12.1.0/dbhome_1)
(SID_NAME = GORCL)
)
(SID_DESC =
(SID_NAME = CLRExtProc)
(ORACLE_HOME = /app/oracle/product/12.1.0/dbhome_1)
(PROGRAM = extproc)
)
(SID_DESC =
(GLOBAL_DBNAME = P_ORCL)
(ORACLE_HOME = /app/oracle/product/12.1.0/dbhome_1)
(SID_NAME = GORCL)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.89.134)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
)
以下是tnsnames.ora
PORCL =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.89.134)(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = G_ORCL)
)
)
GORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.89.134)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = G_ORCL)
)
)
所以使用tnsping是针对上面tnsnames.ora中的设置建立的,都是指向同一个service,因此其实只有一个service。
直接连接到PDB的方法如下:
OGG12.2 安装
原理
OGG针对db12c多租户只需要配置一个extract,指向多个pdb;然后使用多个传输进程传输不同PDB的数据到目标端,当然也可以只用一个传输进程。
目标端针对不同的PDB,必须配置不同的rep进程。
源端DB准备
SQL>Alter database archivelog;
SQL>Alter database force logging;
SQL>Alter database add supplemental log data;
SQL>Alter system switch logfile;
SQL>alter system set enable_goldengate_replication=true;
SQL>create user C##ogg identified by ogg;
SQL>grant connect, create session, resource to c##ogg;
SQL>exec dbms_goldengate_auth.grant_admin_privilege(‘C##OGG’,container=>’all’)
SQL>grant dba to c##ogg container=all;
测试表
源端
测试表
PDB: P_orcl
Test.t1
Hr.t2
Pdb: pdb3
SQL>create user p3 identified by p3;
SQL>create table p3.t3 (id int primary key, name varchar2(50));
目标端
Pdb: pdb4
Dba user: pdb4_admin
SQL>Alter session set container=pdb4;
SQL>create user p4 identified by p4;
SQL>create table p4.t4 (id int primary key, name varchar2(50));
sqlplus / as sysdba
SQL> alter session set container=pdb4;
Session altered.
SQL> grant dba to pdb4_admin container=pdb4;
Grant succeeded.
SQL> conn pdb4_admin/pdb4_admin as sysdba;
Connected.
conn pdb4_admin/pdb4_admin@192.168.89.134:1521/pdb4 as sysdba;
配置
Credential store配置
GGSCI (localhost.localdomain) 27> create wallet
Created wallet at location 'dirwlt'.
Opened wallet at location 'dirwlt'.
GGSCI (localhost.localdomain) 28> ADD MASTERKEY
Master key 'OGG_DEFAULT_MASTERKEY' added to wallet at location 'dirwlt'.
GGSCI (localhost.localdomain) 29> INFO MASTERKEY
Masterkey Name: OGG_DEFAULT_MASTERKEY
Creation Date: Mon Oct 20 20:51:23 2014
Version: Creation Date: Status:
1 Mon Oct 20 20:51:23 2014 Current
GGSCI (localhost.localdomain) 30> INFO MASTERKEy version 1
Masterkey Name: OGG_DEFAULT_MASTERKEY
Creation Date: Mon Oct 20 20:51:23 2014
Version: 1
Renew Date: Mon Oct 20 20:51:23 2014
Status: Current
Key Hash (SHA1): 0x2E491E86DA7A0C0D767360B2B8C07968AD9A14BF
拷贝wallet目录dirwlt到其它系统,这样所有系统的认证信息相同。在其它系统确认masterkey的版本及key hash是相同的。
GGSCI (localhost.localdomain) 50> add credentialstore
Credential store created in ./dircrd/.
GGSCI (localhost.localdomain) 51> ALTER CREDENTIALSTORE ADD USER c##ogg alias extuser
Password:
Credential store in ./dircrd/ altered.
GGSCI (localhost.localdomain) 52> info CREDENTIALSTORE
Reading from ./dircrd/:
Domain: OracleGoldenGate
Alias: extuser
Userid: c##ogg
GGSCI (localhost.localdomain) 61> dblogin useridalias extuser
Successfully logged into database CDB$ROOT.
配置extract
export ORACLE_SID=GORCL
登录到pdb
GGSCI> dblogin userid c##ogg@porcl password ogg
The following enables supplemental logging for the schema scott.
GGSCI>ADD SCHEMATRANDATA scott
The following example logs all supported key and non-key columns
for all current and future tables in the schema named scott.
GGSCI>ADD SCHEMATRANDATA scott ALLCOLS
Logging of supplemental redo data enabled for table P_ORCL.TEST.T1.
TRANDATA for scheduling columns has been added on table 'P_ORCL.TEST.T1'.
GGSCI (localhost.localdomain) 11> add schematrandata p_orcl.hr allcols
2014-10-20 19:50:44 INFO OGG-01788 SCHEMATRANDATA has been added on schema hr.
2014-10-20 19:50:44 INFO OGG-01976 SCHEMATRANDATA for scheduling columns has been added on schema hr.
2014-10-20 19:50:44 INFO OGG-01977 SCHEMATRANDATA for all columns has been added on schema hr.
GGSCI (localhost.localdomain) 12> info trandata p_orcl.hr.t2
Logging of supplemental redo log data is disabled for table P_ORCL.HR.T2.
GGSCI (localhost.localdomain) 13> add trandata p_orcl.hr.t2
Logging of supplemental redo data enabled for table P_ORCL.HR.T2.
TRANDATA for scheduling columns has been added on table 'P_ORCL.HR.T2'.
GGSCI (localhost.localdomain) 14> info trandata p_orcl.hr.t2
Logging of supplemental redo log data is enabled for table P_ORCL.HR.T2.
Columns supplementally logged for table P_ORCL.HR.T2: ID.
抽取进程
extract ex12c setEnv(ORACLE_SID="GORCL") --dblogin userid c##ogg, password ogg useridAlias extuser LOGALLSUPCOLS UPDATERECORDFORMAT COMPACT exttrail ./dirdat/et sourceCatalog p_orcl table test.*; table hr.*; --SourceCatalog pdb3 table pdb3.p3.t3; |
GGSCI > add extract ex12c integrated tranlog, begin now
EXTRACT added.
GGSCI> add exttrail ./dirdat/et, extract ex12c
EXTTRAIL added.
GGSCI>REGISTER EXTRACT ex12c DATABASE CONTAINER (p_orcl,pdb3)
Register extract ex12c database container(pdb11)
配置replicat
replicat rep1
setenv(ORACLE_SID='GORCL') dbOptions IntegratedParams(Parallelism 6) userid pdb4_admin@localhost:1521/pdb4, password pdb4_admin assumeTargetDefs sourcecatalog p_orcl map hr.t2, target p4.t4; map test.t1, target p4.t4; map pdb3.p3.t3, target p4.t4; |
GGSCI>add replicat rep1 integrated exttrail ./dirdat/et
数据同步测试
DB操作
SQL> alter session set container=p_orcl;
Session altered.
SQL> insert into test.t1 values(1,'test1111');
1 row created.
SQL> commit;
Commit complete.
SQL> alter session set container=pdb4;
Session altered.
SQL> select * from p4.t4;
ID NAME
1 test1111
OGG验证
GGSCI (localhost.localdomain) 19> stats ex12c, daily
Sending STATS request to EXTRACT EX12C ...stats
Start of Statistics at 2014-10-21 01:29:17. Output to ./dirdat/et: Extracting from P_ORCL.TEST.T1 to P_ORCL.TEST.T1: *** Daily statistics since 2014-10-21 01:28:02 *** Total inserts 1.00 Total updates 0.00 Total deletes 0.00 Total discards 0.00 Total operations 1.00 End of Statistics. |
GGSCI (localhost.localdomain) 47> stats rep1, daily
Sending STATS request to REPLICAT REP1 ... Start of Statistics at 2014-10-21 02:17:28. Integrated Replicat Statistics: Total transactions 0.00 Redirected 1.00 DDL operations 0.00 Stored procedures 0.00 Datatype functionality 0.00 Event actions 0.00 Direct transactions ratio 0.00% Replicating from P_ORCL.TEST.T1 to PDB4.P4.T4: *** Daily statistics since 2014-10-21 02:12:56 *** Total inserts 1.00 Total updates 0.00 Total deletes 0.00 Total discards 0.00 Total operations 1.00 End of Statistics. |
测试完成。
GoldenGate 12.2抽取Oracle 12c多租户配置过程的更多相关文章
- Oracle 12c 多租户配置和修改 CDB 和 PDB 参数
1. 配置CDB 实例参数,影响CDB与所有 PDB为CDB配置例程参数相对于对于非CDB的数据库是变化不太.ALTER SYSTEM命令用于设置初始化参数,与使用ALTER DATABASE命令修改 ...
- Oracle 12c 多租户家族(12c 18c 19c)如何在 PDB 中添加 HR 模式
Oracle 12c 多租户家族(12c [12.2.0.1].18c [12.2.0.2].19c [12.2.0.3])如何在 PDB 中添加模式:19c (19.3) 手工添加示例 HR 用户 ...
- Oracle 12c多租户架构浅析
Oracle数据库12c的一大创新即是其采用的多租户架构.对于多租户这项新功能,业内的评价褒贬不一.有的声音认为,这项功能的用处不是特别大,但在某些场景或特定的环境下,多租户依然有它的用处.其最大的用 ...
- oracle 12c多租户下的日常操作变化
Oracle 12c创建用户时出现“ORA-65096: invalid common user or role name”的错误 在oracle中,引入了多租户概念,以前是一个instance对应一 ...
- oracle 12c 多租户 pdb 恢复(单个pdb数据文件、非系统pdb表空间、整个pdb数据库)
环境:数据库版本 Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production 实验准备:1.-- 数据库归 ...
- Oracle 12c 多租户在 CDB 中 Plug A PDB,Unplugging A PDB
Oracle 数据库 12 c 中介绍了多租户选项允许单个容器数据库 (CDB) 来承载多个单独的可插拔数据库 (PDB).本文简单的演示了如何在 CDB 中 Plug A PDB,Unpluggin ...
- [转]Oracle 12c多租户特性详解:PDB 的创建、克隆与维护
转自:http://chuansong.me/n/443660447865 PDB 的创建和访问 在使用 dbca 建库时,创建数据库之前,可以保存一下创建脚本,分析其具体执行过程.以自定义方式创建名 ...
- Oracle 12c 多租户 CDB 与 PDB 级别 expdb 与 impdb(表、用户、全库)
Oracle 数据库 12 c 多租户下,如何在容器数据库 (CDB) 和可插拔数据库 (PDB) 中使用 expdb 与 impdp (数据泵) 呢? 我们一起探讨下PDB 下进行表级,用户级别,全 ...
- Oracle 12c 多租户 手工创建 pdb 与 手工删除 pdb
实验环境: SQL> select * from v$version;BANNER ...
随机推荐
- 【剑指offer】二叉搜索树与双向链表
一.题目: 输入一棵二叉搜索树,将该二叉搜索树转换成一个排序的双向链表.要求不能创建任何新的结点,只能调整树中结点指针的指向. 二.思路: 对于一棵搜索二叉树来说,中序遍历得到的即是有序的结果,所以整 ...
- redis实现消息队列(七)
1. 介绍 redis有一个数据类型叫list(列表),它的每个子元素都是 string 类型的双向链表.我们可以通过 push,pop 操作从链表的头部或者尾部添加删除元素.这使得 list 既可以 ...
- 有关java反射机制 小结
111111111111 Class<?> cls = Class.forName("包名.类名"); Object o = cls.newInstance(); 22 ...
- vuex 子组件传值
以下是基础的使用方法,详细且深入使用方法详细见博客:https://segmentfault.com/a/1190000015782272 Vuex官网地址:https://vuex.vuejs.or ...
- WebStrom2018注册码
2RRJMBXW33-eyJsaWNlbnNlSWQiOiIyUlJKTUJYVzMzIiwibGljZW5zZWVOYW1lIjoi5b285bK4IHNvZnR3YXJlMiIsImFzc2lnb ...
- Cartographer源码阅读(3):程序逻辑结构
Cartographer早期的代码在进行3d制图的时候使用了UKF方法,查看现有的tag版本,可以转到0.1.0和0.2.0查看,包含kalman_filter文件夹. 文件夹中的pose_track ...
- 微信小程序实现简单的树形图treeview
H5有很多树形图(树状图)的组件,echarts也有.比如像bootstrap的treeview,定制性很强.不过这些都无法方便地为小程序所用,除非整个页面用H5搭建再用webview框进去,有点粗暴 ...
- element后太侧边
$router 是已经在ruterJs里面定义好的路由 以及组件 然后取值赋予进去就是了.但是真正的写法应该是 这样,, 执行点击事件的时候直接让跟换路由., 让后面 router-view 里面路由 ...
- jenkins配置详解之——执行者数量
jenkins上的执行者数量的设置并不是随意设置的,位置如下: 他是跟cpu核数密切相关的,原则上是不能超过cpu的核数的, 如何查看cpu的核数呢,命令如下: # 查看物理CPU个数cat /pro ...
- cocos2d JS 创建实现换行功能的聊天文本 testLable
-- 创建实现换行功能的文本 function LoadLabelHeroIntroduce(objLabelContent) //传入文本 ---------------------------- ...