当前位置:网站首页>SQL SERVER 2008 发布订阅到SQL Server 2017避坑指南
SQL SERVER 2008 发布订阅到SQL Server 2017避坑指南
2022-06-29 06:41:00 【A_single_cat】
使用SQL Server Management Studio创建发布与订阅的相关操作参考这里或官网文档, 本文主要记录在配置过程中遇到的坑
1.由于出现操作系统错误 3,进程无法读取文件“"C:\Program Files\Microsoft SQL
Server\MSSQL10_50.MSSQLSERVER\MSSQL\ReplData\unc\NETNETNET-
PC_CLOUDTRADB_SOA_LNGZ_20151130\20151130092501\View_TenderPurchase_45.pre
这是由于快照文件读取权限问题导致, 可以在同一台机器上链接两台sql server 服务避免这个问题
2.无法链接到Subscriber “XXX”
xxxx 无法打开与SQL Swever 的链接
与SQL Server链接时发生了与网络相关的或特定于实例的错误。 找不到或无法访问服务器。请检查实例名称是否正确以及SQL Server是否配置为允许远程链接。
- 检查已配置为允许远程链接
- SQL Server Browers 服务已开启
- 由于订阅模式选择的是由分发服务器推送订阅, 故需在发布服务器上配置订阅服务器的host
3.无法链接到 “XXX”
用户’sa’ 登录失败
- 检查密码是否正确(走了很多弯路, 包括设置别名,机器名, 机器名与服务名一致等。首先还是要检查提示的字面问题)
4.SQL Server 2008 发布订阅到SQL Server 2017 on Linux时,所选的订阅服务器不能满足所选发布的最低版本兼容级别
第一考虑为两版本的兼容级别不同导致 , 查询发现2008 的兼容级别为100, 2017 的兼容级别为140 , 修改2017的兼容级别为100重试 , 得到相同结果.
查看兼容级别
SELECT name, compatibility_level FROM sys.databases;
修改兼容级别
ALTER DATABASE database_name
SET COMPATIBILITY_LEVEL = 100;
由于本地安装SSMS版本为2012 , 认为可能是ssms版本导致, 所以采用命令订阅 。 创建一个相同版本的订阅并生成脚本 , 指定为一下目录, NewSubscription文件为订阅命令,修改相应的订阅服务器名称@subscriber , 数据库名称@destination_db , 发布名称 @publication , 用户名@subscriber_login ,密码@subscriber_password
首先在订阅服务器上创建数据库 she111用于接受订阅。 通过命令实现快照发布订阅, 在发布服务器上执行。通过发布服务器推送订阅 。
-- 订阅
use [disshell]
exec sp_addsubscription @publication = N'she2', @subscriber = N'sql1', @destination_db = N'she111', @subscription_type = N'Push', @sync_type = N'automatic', @article = N'all', @update_mode = N'read only', @subscriber_type = 0
exec sp_addpushsubscription_agent @publication = N'she2', @subscriber = N'sql1', @subscriber_db = N'she111', @job_login = null, @job_password = null, @subscriber_security_mode = 0, @subscriber_login = N'SA', @subscriber_password = N'password', @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 = 20220520, @active_end_date = 99991231, @enabled_for_syncmgr = N'False', @dts_package_location = N'Distributor'
GO
-- 发布命令事例
use [disshell]
exec sp_replicationdboption @dbname = N'disshell', @optname = N'publish', @value = N'true'
GO
-- 添加快照发布
use [disshell]
exec sp_addpublication @publication = N'she2', @description = N'来自发布服务器“LAPTOP-K7U2ESAM”的数据库“disshell”的快照发布。', @sync_method = N'native', @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'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'she2', @frequency_type = 4, @frequency_interval = 1, @frequency_relative_interval = 1, @frequency_recurrence_factor = 0, @frequency_subday = 2, @frequency_subday_interval = 10, @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 = 0, @publisher_login = N'sa', @publisher_password = N''
use [disshell]
exec sp_addarticle @publication = N'she2', @article = N'prices', @source_owner = N'dbo', @source_object = N'prices', @type = N'logbased', @description = null, @creation_script = null, @pre_creation_cmd = N'drop', @schema_option = 0x000000000803509D, @identityrangemanagementoption = N'manual', @destination_table = N'prices', @destination_owner = N'dbo', @vertical_partition = N'false'
GO
边栏推荐
- [量化投资系统]Django从数据库中实现筛选及分页
- 软件测试鸾音鹤信
- Postman pre request
- Appium automation test foundation ADB common commands (III)
- 嵌入式产品防盗版
- 蓝桥杯——13届第二批试题解析
- SAP ui5 Beginner (I) Introduction
- Common MySQL errors and solutions summarized painstakingly (I)
- pycharm的虚拟环境如何共享到jupyter-lab
- Kingbasees coping with transaction rollback caused by too fast growth of table age
猜你喜欢

4年工作经验,多线程间的5种通信方式都说不出来,你敢信?

Roblox sword nine sword two

【深度之眼吴恩达机器学习作业班第四期】Regularization正则化总结

Detailed explanation of top and free commands

Appium environment setup

Explanation of swing transformer theory

cv2.cvtColor

Common MySQL errors and solutions summarized painstakingly (II)

Vibration signal generation and processing based on MATLAB Doppler effect

Vulnhub's dc7 target
随机推荐
1032 Sharing
[industrial control old horse] detailed design of PLC six way responder system
Alicloud access resource: nosuchkey
关于开发web场景下如何解决手机访问web跨域问题
1031 Hello World for U
Vulnhub's DC8 target
基础语法 - 位运算
postman预处理/前置条件Pre-request
Postman pre request
Vulnhub's dc9 target
SAP ui5 Beginner (I) Introduction
Cartographer中的线程池操作
The table cannot be vacuumed because the cursor is open for a long time
Markdown skill tree (7): separator and reference
Vibration signal generation and processing based on MATLAB Doppler effect
Prompt during packaging: property 'sqlsessionfactory' or 'sqlsessiontemplate'‘
施努卡:轮胎自动抓取安装,3D视觉定位,机器人自动抓取
Viewing application and installation of Hana database license
DataTables screen error Popup
基础知识 - 语法标准(ANSI C、ISO C、GNU C)