当前位置:网站首页>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
边栏推荐
- 498. 对角线遍历(模拟)
- Alicloud access resource: nosuchkey
- 100 lectures on Excel advanced drawing skills (VI) - practical application cases of Gantt chart in project progress
- 产品安全 - 小漏洞导致大问题
- 施努卡:视觉定位系统厂家 什么是视觉定位系统
- Schnuka: 3D machine vision inspection system 3D vision inspection application industry
- 1032 Sharing
- C编译器 - 隐式函数声明
- [industrial control old horse] detailed explanation of design principle of pattern fountain based on PLC
- Schnuka: 3D visual recognition system 3D visual inspection principle
猜你喜欢

【工控老马】基于PLC的花样喷泉设计原理详解

Some examples.

SQL injection bypass (6)

Perceiving healthy life, enabling boundless connection -- contributing to openharmony 3.1 ecological construction

Viewing application and installation of Hana database license

cv2.cvtColor

VMware vcenter/ESXI系列漏洞总结

Kingbasees v8r6 cluster maintenance case -- single instance data migration to cluster case

1032 Sharing

ShapeShifter: Robust Physical Adversarial Attack on Faster R-CNN Object Detector
随机推荐
【工控老马】基于PLC的花样喷泉设计原理详解
编译原理王者之路
Alicloud access resource: nosuchkey
js异或混淆代码
Check whether tensorflow supports GPU and test program
Schnuka: what is visual positioning system? How visual positioning system works
Roblox sword nine sword two
关于KingbaseES临时文件过大问题
多态中的向上和向下转型
Gateway controller communication protocol
cv2.cvtColor
自动化测试 - uiautomator2框架应用 - 自动打卡
MIPS instruction set and brief analysis
手把手系列---安装SpotBugs、并快速上手使用
498. diagonal traversal (simulation)
Schnuka: 3D visual inspection scheme 3D visual inspection application industry
SQL 注入绕过(六)
DataTables screen error Popup
How to share the virtual environment of pycharm to jupyter Lab
101. symmetric binary tree (recursive and iterative methods)