Назад | Перейти на главную страницу

ошибка при настройке репликации с mssql на mysql

Я пытаюсь настроить репликацию с SQL Server 2005 на MySql 5.1.53. Я могу добавить публикацию без проблем. Однако, когда я иду добавить подписку, я получаю такую ​​ошибку:

Подписчики OLE DB или ODBC не могут подписаться на статью «table_1» в публикации «mySqlReplicationPub», потому что в статье есть столбец с отметкой времени, а публикация - «allow_queued_tran» (разрешает подписки с обновлением по очереди).

Однако у меня нет столбцов с отметками времени в таблице_1 (см. Ниже), и я установил для allow_qued_tran значение false.

Вот ddl для table_1

CREATE TABLE [dbo].[table_1](
    [objectId] [int] NOT NULL,
    [name] [varchar](50) NOT NULL,
    [aBit] [bit] NOT NULL,
    [nVar] [nvarchar](50) NOT NULL,
PRIMARY KEY CLUSTERED 
(
    [objectId] ASC
)

Вот мой код для создания публикации и подписчика

-- Enable Replication
exec sp_replicationdboption 
    @dbname = N'mySqlReplication',
    @optname = N'publish', 
    @value = N'true'
    GO

-- Adding the transactional publication
exec sp_addpublication 
    @publication = N'mySqlReplicationPub', 
    @description = N'Transactional publication of database ''mySqlReplication'' from Publisher ''hostname''.', 
    @sync_method = N'concurrent_c', 
    @retention = 0, 
    @allow_push = N'true', 
    @allow_pull = N'false', 
    @allow_anonymous = N'true', 
    @enabled_for_internet = N'false', 
    @snapshot_in_defaultfolder = N'true', 
    @compress_snapshot = N'false', 
    @ftp_port = 21, 
    --    @ftp_login = N'anonymous', 
    @allow_subscription_copy = N'false', 
    @add_to_active_directory = N'false', 
    @repl_freq = N'continuous', 
    @status = N'active', 
    @independent_agent = N'true', 
    @immediate_sync = N'true', 
    @allow_sync_tran = N'false', 
    @autogen_sync_procs = N'false', 
    @allow_queued_tran = N'false', 
    @allow_dts = N'false', 
    @replicate_ddl = 0,
    @allow_initialize_from_backup = N'false', 
    @enabled_for_p2p = N'false', 
    @enabled_for_het_sub = N'true'
GO


exec sp_addpublication_snapshot 
    @publication = N'mySqlReplicationPub', 
    @frequency_type = 1, 
    @frequency_interval = 0, 
    @frequency_relative_interval = 0, 
    @frequency_recurrence_factor = 0, 
    @frequency_subday = 0, 
    @frequency_subday_interval = 0, 
    @active_start_time_of_day = 0, 
    @active_end_time_of_day = 235959, 
    @active_start_date = 0, 
    @active_end_date = 0, 
    @job_login = null, 
    @job_password = null, 
    @publisher_security_mode = 1

--Add the table to be replicated
exec sp_addarticle 
    @publication = N'mySqlReplicationPub', 
    @article = N'table_1', 
    @source_owner = N'dbo', 
    @source_object = N'table_1', 
    @type = N'logbased', 
    @description = null, 
    @creation_script = null, 
    @pre_creation_cmd = N'drop', 
    @schema_option = 0x000000000803509F, 
    --    @identityrangemanagementoption = N'manual', 
    @destination_table = N'table_1', 
    @destination_owner = N'dbo', 
    @vertical_partition = N'false', 
    @ins_cmd = N'CALL sp_MSins_dbotable_1', 
    @del_cmd = N'CALL sp_MSdel_dbotable_1', 
    @upd_cmd = N'SCALL sp_MSupd_dbotable_1'
GO


--add all of the columns to the article
exec sp_articlecolumn
    @publication = N'mySqlReplicationPub'
    ,@article = N'table_1'
    ,@refresh_synctran_procs = 1
GO

--Add the subscriber, the error is coming when running sp_addsubscription
exec sp_addsubscription 
    @publication = N'mySqlReplicationPub', 
    @subscriber = N'mysql-pc', --change to subscriber hostname
    @destination_db = N'mysqlDb', --change to subscriber db name
    @subscription_type = N'Push',
    @sync_type = N'automatic', 
    @article = N'all', 
    @update_mode = N'read only', 
    @subscriber_type = 1

exec sp_addpushsubscription_agent 
    @publication = N'mySqlReplicationPub', 
    @subscriber = N'mysql-pc', --change to subscriber hostname
    @subscriber_db = N'mysqlDb', --change to subscriber db name
    @job_login = null, 
    @job_password = null, 
    @subscriber_security_mode = 0,
    @subscriber_login = N'mssql', --change
    @subscriber_password = '', --change
    @subscriber_provider = N'MSDASQL',
    @subscriber_datasrc = N'mySQLdsn', --change
    @frequency_type = 64, 
    @frequency_interval = 0, 
    @frequency_relative_interval = 0,
    @frequency_recurrence_factor = 0, 
    @frequency_subday = 0, 
    @frequency_subday_interval = 0, 
    @active_start_time_of_day = 0, 
    @active_end_time_of_day = 235959, 
    @active_start_date = 20110922, 
    @active_end_date = 99991231, 
    @enabled_for_syncmgr = N'False', 
    @dts_package_location = N'Distributor'
GO

Любая помощь будет принята с благодарностью.

Я считаю, что это как-то связано с schema_option sp_addarticle. Если вы посмотрите на возможные значения для этого, 0x08 имеет дело с отметками времени.

Вот то, что у меня сейчас работает (спасибо http://ratecontrol.blogspot.com/2010/12/one-way-transactional-replication-from.html)

--step 1
-- Adding the transactional publication
exec sp_replicationdboption 
    @dbname = N'mySqlReplication', 
    @optname = N'publish', 
    @value = N'true'
GO

exec sp_addpublication @publication = N'mySqlReplication'
    , @description = N'Transactional publication of database'
    , @sync_method = N'concurrent_c'
    , @retention = 0
    , @allow_push = N'true'
    , @allow_pull = N'false'
    , @allow_anonymous = N'true'
    , @enabled_for_internet = N'false'
    , @snapshot_in_defaultfolder = N'true'
    , @compress_snapshot = N'false'
    , @ftp_port = 21
    , @allow_subscription_copy = N'false'
    , @add_to_active_directory = N'false'
    , @repl_freq = N'continuous'
    , @status = N'active'
    , @independent_agent = N'true'
    , @immediate_sync = N'true'
    , @allow_sync_tran = N'false'
    , @allow_queued_tran = N'false'
    , @allow_dts = N'false'
    , @replicate_ddl = 0
    , @allow_initialize_from_backup = N'false'
    , @enabled_for_p2p = N'false'
    , @enabled_for_het_sub = N'true'
    , @autogen_sync_procs = 'false'
GO
--add the article to the publication
exec sp_addarticle @publication = N'mySqlReplication'
    , @article = N'table_1'
    , @source_owner = N'dbo'
    , @source_object = N'table_1'
    , @type = N'logbased'
    , @pre_creation_cmd = N'none'
    , @ins_cmd = N'SQL'
    , @del_cmd = N'SQL'
    , @upd_cmd = N'SQL'
    , @schema_option = 0x20025081
    , @status = 24
GO

--add all of the columns to the article
exec sp_articlecolumn @publication = N'mySqlReplication'
    , @article = N'table_1'
    , @refresh_synctran_procs = 1
GO

--end step1

--step2
--add the publication snaphot
exec sp_addpublication_snapshot 
    @publication = N'mySqlReplication',
    @frequency_type = 1, 
    @frequency_interval = 0, 
    @frequency_relative_interval = 0, 
    @frequency_recurrence_factor = 0, 
    @frequency_subday = 0, 
    @frequency_subday_interval = 0, 
    @active_start_time_of_day = 0, 
    @active_end_time_of_day = 235959, 
    @active_start_date = 0, 
    @active_end_date = 0, 
    @job_login = null, 
    @job_password = null, 
    @publisher_security_mode = 1
GO
--end step2

--step3
--add the subscriber(s)
use [bjMySqlReplication]
exec sp_addsubscription @publication = N'mySqlReplication'
    , @subscriber = N'mySQLdsn'  --system DSN
    , @destination_db = N'mySQLdb'
    , @subscription_type = N'Push'
    , @sync_type = N'automatic'
    , @article = N'all'
    , @update_mode = N'read only'
    , @subscriber_type = 3
GO

--add the pushing subscription agent
exec sp_addpushsubscription_agent @publication = N'mySqlReplication'
    , @subscriber = N'mySQLdsn'  --system DSN
    , @subscriber_db = N'mySQLdb'
    , @job_login = null
    , @job_password = null
    , @subscriber_security_mode = 0
    , @subscriber_login = N'mssql'
    , @subscriber_password = ''
    , @subscriber_provider = N'MSDASQL'
    , @subscriber_datasrc = N'mySQLdsn'  --system DSN
    , @frequency_type = 64
    , @frequency_interval = 1
    , @frequency_relative_interval = 0
    , @frequency_recurrence_factor = 0
    , @frequency_subday = 0
    , @frequency_subday_interval = 0
    , @active_start_time_of_day = 0
    , @active_end_time_of_day = 235959
    , @active_start_date = 20101202
    , @active_end_date = 99991231
    , @enabled_for_syncmgr = N'False'
    , @dts_package_location = N'Distributor'
GO
--end step3