将SQLServer数据同步到MySQL 用什么方法?
天蓬老师
天蓬老师 2017-04-17 15:25:00
0
2
1031

目的:将 SQLServer 数据表里的数据自动同步到 MySQL 的数据表里。
环境:两个数据库分别在两台服务器上;SQLServer表名为 tb1, MySQL表名为 tb2
同步方法:
1、实时同步:在 SQLServer 建立 ODBC 数据源,将 MySQL 数据库设置为系统DSN,然后建立链接服务器 mysql。在 tb1 表上建立插入、修改、删除触发器,自动更新MySQL表。
2、定时作业:还没用过,不会,谁能给个例子?谢谢。

问题:
1、方法1需要两台服务器都工作正常,MySQL不能关机或重启,否则会同步不成功。而且测试往 SQLServer 的tb1表中插入数据时,还报错:

链接服务器"mysql"的 OLE DB 访问接口 "MSDASQL" 返回了消息 "[MySQL][ODBC 5.2(w) Driver]Optional feature not supported"。

2、方法2定时作业,同步时同步 tb1 表中的全部数据还是只同步当天的数据?怎样区分?按时间吗?具体怎样同步到链接服务器 mysql 的 tb2 表中?

这两种同步方法哪种稳定?同时也好检查同步失败的数据?或者还有其它什么方法吗?(不用第三方软件)

希望有类似经验的大神们给个方案,十分感谢!

天蓬老师
天蓬老师

欢迎选择我的课程,让我们一起见证您的进步~~

reply all(2)
阿神

Timing synchronization pressure is smaller. If you have two fields created_at and updated_at, created_at represents when the record was created, and updated_at represents when the record was updated. Every time you synchronize, select the records of the current period according to these two fields and then store them.

大家讲道理

Why not try kettle? It is an ETL tool that is used for data extraction and supports various databases. It can also schedule jobs and interrupt and resume uploads, which fully meets your needs. The company has used it before, and it is very good. Okay, it’s very powerful, you can try it. http://www.oschina.net/p/kettle There is also a lot of information online

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!