sp_changedistributor_password (Transact-SQL)

适用于:SQL ServerAzure SQL 托管实例

更改分发服务器的密码。 此存储过程在分发服务器上的任何数据库中执行。 如果这是远程分发服务器,则需要在使用此分发服务器的所有发布服务器服务器上运行它。 如果分发或发布服务器数据库位于可用性组中,则需要在所有分发服务器和发布服务器节点上运行。 节点是主节点还是辅助节点并不重要。

Transact-SQL 语法约定

语法

sp_changedistributor_password [ @password = ] 'password'
[ ; ]

参数

[ @password = ] 'password'

新密码。 @password为 sysname,无默认值。 如果分发服务器是本地的,则会更改系统登录名的密码 distributor_admin

返回代码值

0(成功)或 1(失败)。

备注

sp_changedistributor_password用于所有类型的副本 (replica)。

示例

-- Change the password on the Distributor. 
-- To avoid storing the password in the script file, the value is passed 
-- into SQLCMD as a scripting variable. For information about how to use 
-- scripting variables on the command line and in SQL Server Management
-- Studio, see the "Executing Replication Scripts" section in the topic
-- "Programming Replication Using System Stored Procedures".
USE master;
GO

DECLARE @password NVARCHAR(50) = "YourLongP@$$w0rdHere";

EXEC sp_changedistributor_password @password;
GO

权限

只有 sysadmin 固定服务器角色的成员才能执行sp_changedistributor_password

另请参阅