oracle11g同步到gbase8s
Oracle格式化转换:
col d format a10;
测试SQL语句:
alter table t1 add(d varchar2(10));
alter table t1 rename column d to e;
alter table t1 modify b varchar2(10);
GBase8s测试语句:
alter table ora_8s add c varchar(10);
开启CDC功能
dbaccess test syscdcv1.sql
关闭
execute function gbasedbt.cdc_set_fullrowlogging('test:gbasedbt.*',0);
环境:
源端Oracle:192.168.1.15 test/test 表名:test123
目标端oracle:192.168.1.15 test1/test1 表名:test123
insert into test123 values(1,'a',to_date('2022-03-12 11:12:30','yyyy-mm-dd hh24:mi:ss'));
insert into test123 values(2,'b',to_date('2022-03-12 11:12:30','yyyy-mm-dd hh24:mi:ss'));
insert into test123 values(3,'c',to_date('2022-03-12 11:12:30','yyyy-mm-dd hh24:mi:ss'));
insert into test123 values(4,'d',to_date('2022-03-12 11:12:30','yyyy-mm-dd hh24:mi:ss'));
insert into test123 values(5,'e',to_date('2022-03-12 11:12:30','yyyy-mm-dd hh24:mi:ss'));
update test123 set b = 'aa' where a = 1;
update test123 set b = 'bb' where a = 2;
update test123 set b = 'cc' where a = 3;
update test123 set b = 'dd' where a = 4;
update test123 set b = 'ee' where a = 5;
delete from test123 where a = 1;
delete from test123 where a = 2;
delete from test123 where a = 3;
delete from test123 where a = 4;
delete from test123 where a = 5;
alter table test123 add(d int);
alter table test123 drop column b;
insert into test123 values(1,to_date('2022-03-12 11:12:30','yyyy-mm-dd hh24:mi:ss'),1);
insert into test123 values(2,to_date('2022-03-12 11:12:30','yyyy-mm-dd hh24:mi:ss'),2);
insert into test123 values(3,to_date('2022-03-12 11:12:30','yyyy-mm-dd hh24:mi:ss'),3);
insert into test123 values(4,to_date('2022-03-12 11:12:30','yyyy-mm-dd hh24:mi:ss'),4);
insert into test123 values(5,to_date('2022-03-12 11:12:30','yyyy-mm-dd hh24:mi:ss'),5);
oracle插入BLOB数据:
Oracle:
用户信息:ww/ww
建表语句:create table sync_test(a number,b char(10),c blob,d date ,e varchar2(10),f blob);
GBase8s:
库名:test
建表语句:create table sync_test(a int,b char(10),c blob,d datetime year to second,e varchar2(10),f clob);
插入数据:
DECLARE
tempimg BLOB;
tempdir BFILE:=BFILENAME('TEST_DIR','1.jpg'); -- 从指定图片路径读1.jpg
BEGIN
INSERT INTO sync_test VALUES (1,'1.jpg',EMPTY_BLOB(),to_date('2022-01-12','yyyy-mm-dd'),'测试','fadfadfafdafdafd') RETURNING c INTO TEMPIMG;
DBMS_LOB.FILEOPEN(tempdir);
DBMS_LOB.LOADFROMFILE(tempimg,tempdir,DBMS_LOB.GETLENGTH(tempdir));
DBMS_LOB.FILECLOSE(tempdir);
COMMIT;
END;
/
评论
热门帖子
- 12025-12-01浏览数:182763
- 22023-05-09浏览数:25057
- 42023-09-25浏览数:18525
- 52020-05-11浏览数:17528