Mar*_*lli 4 replication sql-server transactional-replication sql-server-2016
在我的一台服务器中创建出版物的过程中,我不断收到以下错误消息
分发器尚未正确安装。无法启用数据库进行发布。
尽管我已经多次删除并重新创建了分配器。
--==============================================================
-- replication - create publication - complete
-- marcelo miorelli
-- 06-Oct-2015
--==============================================================
select @@servername
select @@version
select @@spid
select @@servicename
--==============================================================
-- step 00 -- configuring the distributor
-- if there is already a distributor AND it is not healthy,
-- you can have a look at the jobs related to this distributor and
-- MAYBE, if you need to get rid of it, run this step
-- generally you need to run this when adding a publication it says there is a problem with the distributor
--==============================================================
use master
go
sp_dropdistributor
-- Could not drop the Distributor 'QG-V-SQL-TS\AIFS_DEVELOPMENT'. This Distributor has associated distribution databases.
EXEC sp_dropdistributor
@no_checks = 1
,@ignore_distributor = 1
GO
--==============================================================
-- step 01 -- configuring the distributor
-- tell this server who is the distributor and the admin password to connect there
-- create the distributor database
--==============================================================
use master
exec sp_adddistributor
@distributor = N'the_same_server'
,@heartbeat_interval=10
,@password='#J4g4nn4th4_the_password#'
USE master
EXEC sp_adddistributiondb
@database = 'dist1',
@security_mode = 1;
GO
--==============================================================
-- check thing out before going ahead and create the publications
--==============================================================
USE master;
go
--Is the current server a Distributor?
--Is the distribution database installed?
--Are there other Publishers using this Distributor?
EXEC sp_get_distributor
--Is the current server a Distributor?
SELECT is_distributor FROM sys.servers WHERE name='repl_distributor' AND data_source=@@servername;
--Which databases on the Distributor are distribution databases?
SELECT name FROM sys.databases WHERE is_distributor = 1
--What are the Distributor and distribution database properties?
EXEC sp_helpdistributor;
EXEC sp_helpdistributiondb;
EXEC sp_helpdistpublisher;
--==============================================================
-- here you need to have a distributor in place
-- Enabling the replication database
-- the name of the database we want to replicate is COLAFinance
--==============================================================
use master
exec sp_get_distributor
use master
exec sp_replicationdboption @dbname = N'the_database_to_publish',
@optname = N'publish',
@value = N'true'
GO
Run Code Online (Sandbox Code Playgroud)
有什么遗漏吗?有任何想法吗?
我想我已经成功了,我所做的很简单
缺少对过程 sp_adddistpublisher 的调用。
配置发布者以使用指定的分发数据库。此存储过程在分发服务器上的任何数据库上执行。请注意,在使用此存储过程之前,必须先运行存储过程 sp_adddistributor (Transact-SQL) 和 sp_adddistributiondb (Transact-SQL)。
我已经在下面的脚本中添加了最后一个命令step01
:
--==============================================================
-- step 01 -- configuring the distributor
-- tell this server who is the distributor and the admin password to connect there
-- create the distributor database
--==============================================================
use master
exec sp_adddistributor
@distributor = N'the_same_server'
,@heartbeat_interval=10
,@password='#J4g4nn4th4_the_password#'
USE master
EXEC sp_adddistributiondb
@database = 'dist1',
@security_mode = 1;
GO
exec sp_adddistpublisher @publisher = N'the_same_server',
@distribution_db = N'dist1';
GO
Run Code Online (Sandbox Code Playgroud)
我注意到现在当我调用以下过程时:
EXEC sp_get_distributor
Run Code Online (Sandbox Code Playgroud)
我看到distribution db installed
equals 列1
,我之前就应该注意到这个指示。
如果它有效,我将保留此答案不变,否则我将相应地添加它。
归档时间: |
|
查看次数: |
26087 次 |
最近记录: |