oracle 12c cdc,ORACLE 11g同步CDC实验

ORACLE 11g 同步CDC实验

1.创建数据库用户:以管理员账户登录

1)业务操作用户

create user appuser identified by appuser default tablespace users;

grant connect,resource to appuser

grant create view to appuser

2)发布用户

create user cdc_pub identified by cdc default tablespace users;

grant connect,resource to cdc_pub

GRANT SELECT_CATALOG_ROLE TO cdc_pub

GRANT EXECUTE_CATALOG_ROLE TO cdc_pub

GRANT EXECUTE ON DBMS_CDC_PUBLISH TO cdc_pub

grant create job to cdc_pub -- Oracle 11g 中为必须

3)订阅用户

create user cdc_sub identified by cdc default tablespace users;

grant connect,resource to cdc_sub

grant execute on DBMS_CDC_SUBSCRIBE TO CDC_SUB

2.创建业务表:以业务用户账户(APPUSER)登录

create table SalesOrder ( orderId int not null,

customerId int not null, DueDate date not null, deliverTo int not null,

createddttm date default sysdate,

constraint pk_salesOrder primary key(orderId))

create table SalesOrderDetail ( SOLineId int not null,

orderID int not null, itemNumber varchar2(20)not null,

quantity decimal(13,4), linePrice decimal(13,4)w,

constraint pk_SODetail primary key( SoLineID ))

3.创建发布:以发布者登录(CDC_PUB)

1)创建发布集

BEGIN

DBMS_CDC_PUBLISH.CREATE_CHANGE_SET(

change_set_name =>'CDCSET_SO',--改变集

description =>'Change set for SalesOrder, SalesOrderDetail',

change_source_name =>'SYNC_SOURCE');

END;

2)创建发布表:一个发布集对应多个发布的表

发布表即是用于存放变更了的数据的表。以下语句将在发布者(CDC_PUB)名下新建两个发布表:

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值