MS SQL 2008 发布订阅配置错误总结

时间:2023-01-13 16:57:55

      最近在配置SQL 2008的发布订阅功能时,遇到了几个小错误,顺便归纳总结一下(以后碰到各类关于发布订阅的错误都将收录、更新到这篇文章),方便自己在以后碰到这类问题时,能够迅速解决问题。毕竟人的记忆能力有时效性,时间久了,有可能有些东西就模糊了或忘了,好记性不如烂笔头。

错误1:在数据库服务器上新建本地发布服务时报错。

 

MS SQL 2008 发布订阅配置错误总结

                                                      (图1)

报错的具体细节如下所示:

MS SQL 2008 发布订阅配置错误总结
TITLE: New Publication Wizard
------------------------------ Microsoft SQL Server Management Studio is unable to access replication components because replication is not installed on this instance of SQL Server. For information about installing replication, see the topic Installing Replication in SQL Server Books Online. For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=10.50.1600.1&EvtSrc=Microsoft.SqlServer.Management.UI.ReplUtilitiesErrorSR&EvtID=ReplicationNotInstalled&LinkId=20476 ------------------------------
ADDITIONAL INFORMATION: Replication components are not installed on this server. Run SQL Server Setup again and select the option to install replication. (Microsoft SQL Server, Error: 21028) For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=10.50.4000&EvtSrc=MSSQLServer&EvtID=21028&LinkId=20476 ------------------------------
BUTTONS: OK
------------------------------

 查看具体原因,是因为安装数据库实例时,没有选择安装Replication components,需要添加Replication components,首先找到安装光盘或安装镜像文件,挂载到光驱或拷贝到某个文件目录,例如,我这边挂载后的安装介质位于Z盘,在运行里面输入cmd命令,转到Z盘,输入下面命令:

setup.exe /q /Features=Replication /InstanceName=MSSQLSERVER /ACTION=INSTALL /IAcceptSQLServerLicenseTerms ,然后耐心等待安装完成,从网上搜索的资料看,好像下面命令start /wait X:\Servers\setup.exe /qb INSTANCENAME=MSSQLSERVER ADDLOCAL=SQL_Replication也可,不过,这条命令我还没有试验过。不保证能够顺利执行。

 

错误2:The Process could not execute ‘sp_repcmd’ on ‘xxxx’

 

MS SQL 2008 发布订阅配置错误总结

                                                       (图2)

报错的具体细节如下所示:

DESCRIPTION: Replication-Replication Transaction-Log Reader Subsystem: agent xxxxx failed. The process could not execute 'sp_replcmds' on 'xxxxxx'.

从网上查到的资料,只需修改数据库的Owner设置为sa即可解决,但是本质原因是啥?我没搞明白,后来查了一下资料:http://*.com/questions/2723061/sql-server-2008-replication-failing-with-process-could-not-execute-sp-replcmds 显然不一定要修改数据库的Owner为sa也可。看来这应该是权限问题引起的。

MS SQL 2008 发布订阅配置错误总结

                                           (图3) 

错误3:Replication-Replication Distribution Subsystem agent xxxxxxx failed. The process could not read file 'xxxxxxx' due to OS error 3.

 

MS SQL 2008 发布订阅配置错误总结

                                                          (图4)

查看SQL SERVER日志文件,发现很多类似错误:

Date 6/28/2013 10:40:01 AM

Log SQL Server (Current - 6/28/2013 10:39:00 AM)

Source spid454

Message 

Replication-Replication Distribution Subsystem: agent xxxxxxxxxx failed. The process could not read file 'xxxxxxxxxxxxxxxxxx' due to OS error 3.

 Date 6/28/2013 10:40:01 AM

Log SQL Server (Current - 6/28/2013 10:39:00 AM)

 Source spid454

 Message

 Error: 14151, Severity: 18, State: 1.

 

产生这个错误的原因是因为使用请求订阅或远程分发服务器时,您必须指定一个 UNC 网络共享,例如 \\<computername>\snapshot,而不是为快照文件夹的本地路径。单击发布属性,查看Snapshot属性,发现快照文件位于G:\GEG_MESDB文件夹里,但是此时这里修改不了,只能去掉“Put files in the default folder"选项,勾选”Put Files in the following folder“选项,输入网络路径,即可解决上面这个错误。

MS SQL 2008 发布订阅配置错误总结

 

错误4:

Date 7/12/2013 1:20:38 PM

Log SQL Server (Current - 7/12/2013 1:10:00 PM)

Source spid326

Message

Replication-Replication Snapshot Subsystem: agent EGVNT02-MESDB-EGV_MESDB-1 failed. The replication agent had encountered an exception.

Source: Unknown

Exception Type: System.UnauthorizedAccessException

Exception Message: Access to the path '\\EGVNT02\EGV_MESDB_Replication\unc\EGVNT02_MESDB_EGV_MESDB\20130712132037\' is denied.

Messa

MS SQL 2008 发布订阅配置错误总结

文件夹权限问题,我用NT 账号T1登录数据库,但是配置过程中用的是NT账号T2,共享文件夹没有授权给NT账号T2,所以报上面错误。

参考资料:

http://www.sqlserverclub.com/essentialguides/how-to-install-sql-server-2005-replication.aspx

http://social.msdn.microsoft.com/Forums/sqlserver/en-US/64c041f5-3822-408f-b072-99feb18a5fcc/replication-components-are-not-installed

http://www.cnblogs.com/dudu/archive/2010/08/25/1808313.html

http://*.com/questions/2723061/sql-server-2008-replication-failing-with-process-could-not-execute-sp-replcmds

http://www.sqlservercentral.com/blogs/sqlrepl/2011/11/30/the-process-could-not-read-file-due-to-os-error-3/