最近在配置SQL 2008的发布订阅功能时,遇到了几个小错误,顺便概括总结一下(之后碰到各种关于发布订阅的错误都将收录、更新到这篇文章),方便本身在之后碰到这类问题时,可以迅速解决问题。毕竟人的记忆能力有时效性,时间久了,有可能有些东西就模糊了或忘了,好记性不如烂笔头。html
错误1:在数据库服务器上新建本地发布服务时报错。sql
(图1)数据库
报错的具体细节以下所示:服务器
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也可,不过,这条命令我尚未试验过。不保证可以顺利执行。ide
错误2:The Process could not execute ‘sp_repcmd’ on ‘xxxx’sqlserver
(图2)ui
报错的具体细节以下所示:this
DESCRIPTION: Replication-Replication Transaction-Log Reader Subsystem: agent xxxxx failed. The process could not execute 'sp_replcmds' on 'xxxxxx'.spa
从网上查到的资料,只需修改数据库的Owner设置为sa便可解决,可是本质缘由是啥?我没搞明白,后来查了一下资料:http://stackoverflow.com/questions/2723061/sql-server-2008-replication-failing-with-process-could-not-execute-sp-replcmds 显然不必定要修改数据库的Owner为sa也可。看来这应该是权限问题引发的。
(图3)
错误3:Replication-Replication Distribution Subsystem agent xxxxxxx failed. The process could not read file 'xxxxxxx' due to OS error 3.
(图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“选项,输入网络路径,便可解决上面这个错误。
错误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
文件夹权限问题,我用NT 帐号T1登陆数据库,可是配置过程当中用的是NT帐号T2,共享文件夹没有受权给NT帐号T2,因此报上面错误。
参考资料:
http://www.sqlserverclub.com/essentialguides/how-to-install-sql-server-2005-replication.aspx