1.可能是MSSQLSERVER和MSSQLSERVER AGENTservice的启动帐户是LOCALSYSTEM,你将SERVICE的启动ACCOUNT改为某域用户的帐户,并且该用户对发布和分发服务器的目录有写的权限。
2.你可以试试,在SQLSERVER中加入一个域用户的USER:Dim oApp 'as SQLDMO.Application
Dim oServer 'as SQLDMO.SQLServer
Dim oDatabase 'as SQLDMO.database
Dim oNames 'as SQLDMO.Namelist
Dim oName 'as variant
Set oApp=CreateObject("SQLDMO.Application")
Set oNames=oApp.ListAvailableSQLServers()
For Each oName in oNames
Set oServer =CreateObject("SQLDmo.SqlServer")
oServer.LoginSecure=Ture --改为域用户
oServer.connect oName
MsgBox "There are "&oServer.Databases.Count&"databases for server"&oName
oServer.Disconnect
Set oServer=nothing
NextoApp.quit
Set oApp=nothing

解决方案 »

  1.   

    ....
    Set oServer =CreateObject("SQLDmo.SqlServer")
    oServer.Connect="localhost", "domain\user", "password"
    ...
      

  2.   

    感谢leimin大哥指教,小弟试过了不是用户的问题用企业管理器作完订阅生成sql脚本如下:
    /****** Scripting the replication setup of server YUYN. Script Date: 2003-7-11 14:17:34 ******/
    /****** Please note: Any password parameter was scripted with NULL or empty string for security reason. ******/— 添加事务请求订阅: YUYN:test:进货单/****** Begin: Script to be run at Subscriber: YUYN ******/
    use [test1]
    GO
    exec sp_addpullsubscription @publisher = N'YUYN', @publisher_db = N'test', @publication = N'进货单', @independent_agent = N'true', @subscription_type = N'anonymous', @update_mode = N'read only', @immediate_sync = 1
    exec sp_addpullsubscription_agent @publisher = N'YUYN', @publisher_db = N'test', @publication = N'进货单', @distributor = N'YUYN', @subscriber_security_mode = 1, @distributor_security_mode = 0, @distributor_login = N'sa', @distributor_password = N'', @frequency_type = 64, @frequency_interval = 1, @frequency_relative_interval = 1, @frequency_recurrence_factor = 0, @frequency_subday = 4, @frequency_subday_interval = 5, @active_start_date = 0, @active_end_date = 0, @active_start_time_of_day = 0, @active_end_time_of_day = 235959, @enabled_for_syncmgr = N'false', @use_ftp = N'false', @publication_type = 0, @dts_package_location = N'subscriber', @offloadagent = N'false'
    GO其中 @independent_agent属性我不知道如何在订阅时用sqldmo中设,尽管我会在发布时设该属性,请指教。
      

  3.   

    pls try use :sp_addpullsubscription_agentAdds a new agent to the Subscriber database. This stored procedure is executed at the Subscriber on the subscription database.