Я создал репликацию транзакций, и вот мои сценарии:
Сценарий распространения:
use master
exec sp_adddistributor @distributor = N'servername', @password = N''
GO
exec sp_adddistributiondb @database = N'distribution',
@data_folder = N'C:\Program Files\Microsoft SQL Server\MSSQL14.MSSQLSERVER\MSSQL\Data',
@log_folder = N'C:\Program Files\Microsoft SQL Server\MSSQL14.MSSQLSERVER\MSSQL\Data',
@log_file_size = 2,
@min_distretention = 0, @max_distretention = 72,
@history_retention = 48,
@deletebatchsize_xact = 5000, @deletebatchsize_cmd = 2000,
@security_mode = 1
GO
use [distribution]
if (not exists (select * from sysobjects
where name = 'UIProperties' and type = 'U '))
create table UIProperties(id int)
if (exists (select * from ::fn_listextendedproperty('SnapshotFolder', 'user', 'dbo', 'table', 'UIProperties', null, null)))
EXEC sp_updateextendedproperty N'SnapshotFolder', N'E:\snapshot\ReplData', 'user', dbo, 'table', 'UIProperties'
else
EXEC sp_addextendedproperty N'SnapshotFolder', N'E:\snapshot\ReplData', 'user', dbo, 'table', 'UIProperties'
GO
exec sp_adddistpublisher @publisher = N'servername',
@distribution_db = N'distribution',
@security_mode = 1
Сценарий публикации
use [databasename]
exec sp_replicationdboption @dbname = N'databasename', @optname = N'publish', @value = N'true'
GO
use [databasename]
exec [databasename].sys.sp_addlogreader_agent @job_login = N'pcusername',
@job_password = null, -- pc does not have any password
@publisher_security_mode = 1,
@job_name = null
GO
-- Adding the transactional publication
use [databasename]
exec sp_addpublication @publication = N'Basketball17Pub',
@description = N'Transactional publication of database ''databasename'' from Publisher ''servername''.',
@sync_method = N'concurrent',
@retention = 0,
@allow_push = N'true', @allow_pull = N'true',
@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 = 1, @allow_initialize_from_backup = N'false',
@enabled_for_p2p = N'false',
@enabled_for_het_sub = N'false'
GO
Я использовал одну машину для дистрибьютора и публикация и сетевой снимок, используемый для моментального снимка
Но задание не выполняется - что мне не хватает? Есть предложения?