gpt4 book ai didi

sql-server-2008 - 使用 FTP 的 SQL Server 复制

转载 作者:行者123 更新时间:2023-12-01 06:40:23 25 4
gpt4 key购买 nike

我有:
SQL A - 发布者(SQL 2008 R2 Dev)
SQL B - 订阅者(SQL 2008 R2 标准)

SQL A 和 SQL B 在不同的网络上,不允许直接连接。

我在 SQL A 上启用 FTP 发布。
在 SQL B 上创建订阅以从 FTP 获取文件。

但是由于某种原因,当我在 SQL B 上运行代理时,它给出了一个错误无法连接到 SQL A。嗯,是吗?当然因为是FTP复制,所以没有连接。

我究竟做错了什么?

-- THIS IS ON PUBLISHER:
-- Enabling the replication database
use master
exec sp_replicationdboption @dbname = N'Publisher_DB', @optname = N'publish', @value = N'true'
GO

exec [Publisher_DB].sys.sp_addlogreader_agent @job_login = null, @job_password = null, @publisher_security_mode = 1
GO
exec [Publisher_DB].sys.sp_addqreader_agent @job_login = null, @job_password = null, @frompublisher = 1
GO
-- Adding the snapshot publication
use [Publisher_DB]
exec sp_addpublication @publication = N'Test_S', @description = N'Snapshot publication of database ''Publisher_DB'' from Publisher ''SQL-A''.', @sync_method = N'native', @retention = 0, @allow_push = N'true', @allow_pull = N'true', @allow_anonymous = N'true', @enabled_for_internet = N'true', @snapshot_in_defaultfolder = N'false', @alt_snapshot_folder = N'\\SQL-A\D$\SqlReplica', @compress_snapshot = N'true', @ftp_address = N'SQL-A', @ftp_port = 21, @ftp_subdirectory = N'\\SQL-A\D$\SqlReplica', @ftp_login = N'anonymous', @allow_subscription_copy = N'true', @add_to_active_directory = N'false', @repl_freq = N'snapshot', @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
GO

exec sp_addpublication_snapshot @publication = N'Test_S', @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
exec sp_grant_publication_access @publication = N'Test_S', @login = N'sa'
GO
exec sp_grant_publication_access @publication = N'Test_S', @login = N'NT AUTHORITY\SYSTEM'
GO
exec sp_grant_publication_access @publication = N'Test_S', @login = N'NT AUTHORITY\NETWORK SERVICE'
GO
exec sp_grant_publication_access @publication = N'Test_S', @login = N'DOMAIN\Developers & Test Admins'
GO
exec sp_grant_publication_access @publication = N'Test_S', @login = N'distributor_admin'
GO

-- Adding the snapshot articles
use [Publisher_DB]
exec sp_addarticle @publication = N'Test_S', @article = N'test_table', @source_owner = N'dbo', @source_object = N'test_table', @type = N'logbased', @description = N'', @creation_script = N'', @pre_creation_cmd = N'drop', @schema_option = 0x000000000803509D, @identityrangemanagementoption = N'none', @destination_table = N'test_table', @destination_owner = N'dbo', @status = 24, @vertical_partition = N'false', @ins_cmd = N'SQL', @del_cmd = N'SQL', @upd_cmd = N'SQL'
GO

-- Adding the snapshot subscriptions
use [Publisher_DB]
exec sp_addsubscription @publication = N'Test_S', @subscriber = N'SQL-B', @destination_db = N'Publisher_DB', @subscription_type = N'Pull', @sync_type = N'automatic', @article = N'all', @update_mode = N'read only', @subscriber_type = 0
GO

-----------------BEGIN: Script to be run at Publisher 'SQL-A'---------------
use [Publisher_DB]
exec sp_addsubscription @publication = N'Test_S', @subscriber = N'SQL-B', @destination_db = N'Publisher_DB', @sync_type = N'Automatic', @subscription_type = N'pull', @update_mode = N'read only'
GO
-----------------END: Script to be run at Publisher 'SQL-A'-----------------

-----------------BEGIN: Script to be run at Subscriber 'SQL-A'--------------
use [Publisher_DB]
exec sp_addpullsubscription @publisher = N'SQL-A', @publication = N'Test_S', @publisher_db = N'Publisher_DB', @independent_agent = N'True', @subscription_type = N'pull', @description = N'', @update_mode = N'read only', @immediate_sync = 1

exec sp_addpullsubscription_agent @publisher = N'SQL-A', @publisher_db = N'Publisher_DB', @publication = N'Test_S', @distributor = N'SQL-B', @distributor_security_mode = 1, @distributor_login = N'', @distributor_password = null, @enabled_for_syncmgr = N'False', @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 = 20120622, @active_end_date = 99991231, @alt_snapshot_folder = N'\\SQL-B\D$\SqlReplica\ftp', @working_directory = N'\\SQL-B\D$\SqlReplica\ftp', @use_ftp = N'False', @job_login = null, @job_password = null, @publication_type = 0
GO
-----------------END: Script to be run at Subscriber 'SQL-A'---------------

最佳答案

`添加

@ftp_address = N'SQL-A', 
@ftp_port = 21,
@ftp_subdirectory = N'\SQL-A\D$\SqlReplica',
@ftp_login = N'anonymous'

sp_addpullsubscription_agent命令和更改 @use_ftpN'True'

关于sql-server-2008 - 使用 FTP 的 SQL Server 复制,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11161749/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com