mssql 发布库 Invalid object name 'syspublications'

前段时间在删除分发的时候  Invalid object name 'syspublications'

导致整个server 都不能重做replication

解决如下

EXEC sp_removedbreplication dbname

发现还是不行

 sp_replicationdboption 'Problem
Database','Publish','false'
然后在出问题的库中重建系统表


CREATE TABLE [dbo].[syspublications](

[description] [nvarchar](255) NULL,

[name] [sysname] NOT NULL,

[pubid] [int] IDENTITY(1,1) NOT NULL,

[repl_freq] [tinyint] NOT NULL,

[status] [tinyint] NOT NULL,

[sync_method] [tinyint] NOT NULL,

[snapshot_jobid] [binary](16) NULL,

[independent_agent] [bit] NOT NULL,

[immediate_sync] [bit] NOT NULL,

[enabled_for_internet] [bit] NOT NULL,

[allow_push] [bit] NOT NULL,

[allow_pull] [bit] NOT NULL,

[allow_anonymous] [bit] NOT NULL,

[immediate_sync_ready] [bit] NOT NULL,

[allow_sync_tran] [bit] NOT NULL,

[autogen_sync_procs] [bit] NOT NULL,

[retention] [int] NULL,

[allow_queued_tran] [bit] NOT NULL DEFAULT ((0)),

[snapshot_in_defaultfolder] [bit] NOT NULL DEFAULT ((1)),

[alt_snapshot_folder] [nvarchar](255) NULL,

[pre_snapshot_script] [nvarchar](255) NULL,

[post_snapshot_script] [nvarchar](255) NULL,

[compress_snapshot] [bit] NOT NULL DEFAULT ((0)),

[ftp_address] [sysname] NULL,

[ftp_port] [int] NOT NULL DEFAULT ((21)),

[ftp_subdirectory] [nvarchar](255) NULL,

[ftp_login] [sysname] NULL DEFAULT (N'anonymous'),

[ftp_password] [nvarchar](524) NULL,

[allow_dts] [bit] NOT NULL DEFAULT ((0)),

[allow_subscription_copy] [bit] NOT NULL DEFAULT ((0)),

[centralized_conflicts] [bit] NULL,

[conflict_retention] [int] NULL,

[conflict_policy] [int] NULL,

[queue_type] [int] NULL,

[ad_guidname] [sysname] NULL,

[backward_comp_level] [int] NOT NULL DEFAULT ((10)),

[allow_initialize_from_backup] [bit] NOT NULL DEFAULT ((0)),

[min_autonosync_lsn] [binary](10) NULL,

[replicate_ddl] [int] NULL DEFAULT ((1)),

[options] [int] NOT NULL DEFAULT ((0))

) ON [PRIMARY]

 ok 可以新建发布

但是分发机器publisher isactive=0

开启

sp_changedistpublisher publisher, 'active', 'true'

ok 问题解决。

练一技,修百艺,而成于自然.
原文地址:https://www.cnblogs.com/xwj1985/p/2097819.html