国强极客
有问题请加微信:guoqiang7585
国强极客

sql2000修改sa密码提示sql2000错误2812未能找到存储过程'sp_password'解决方法

sql2000修改sa密码提示sql2000错误2812未能找到存储过程'sp_password'解决方法
全国大流量卡免费领

还是因为这次客户服务器的原因,因为客户的网站,以前的sa密码是123456,是弱口令,加上客户要求开放1433端口,导致服务器sql2000经常被扫描到,并且修改密码。
今天客户的网站显示数据库连接失败,sa密码错误,sa登陆失败,sa的密码肯定是正确的,我也没有修改过,所以出现的问题肯定是被恶意修改了。那密码肯定是要改回来的,在修改sa的密码时候,就出现了sql2000错误2812 :未能找到存储过程’sp_password’ 这个错误,下面就说下解决的方法:

用WINDOWS身份验证登陆到SQL SERVER的查询工具。复制–粘贴–执行就OK拉。

create procedure sp_password
@old sysname = NULL, -- the old (current) password
@new sysname, -- the new password
@loginame sysname = NULL -- user to change password on
as
-- SETUP RUNTIME OPTIONS / DECLARE VARIABLES --
set nocount on
declare @self int
select @self = CASE WHEN @loginame is null THEN 1 ELSE 2 END

-- RESOLVE LOGIN NAME
if @loginame is null
select @loginame = suser_sname()

-- CHECK PERMISSIONS (SecurityAdmin per Richard Waymire) --
IF (not is_srvrolemember('securityadmin') = 1)
AND not @self = 1
begin
dbcc auditevent (107, @self, 0, @loginame, NULL, NULL, NULL)
raiserror(15210,-1,-1)
return (1)
end
ELSE
begin
dbcc auditevent (107, @self, 1, @loginame, NULL, NULL, NULL)
end

-- DISALLOW USER TRANSACTION --
set implicit_transactions off
IF (@@trancount > 0)
begin
raiserror(15002,-1,-1,'sp_password')
return (1)
end

-- RESOLVE LOGIN NAME (disallows nt names)
if not exists (select * from master.dbo.syslogins where
loginname = @loginame and isntname = 0)
begin
raiserror(15007,-1,-1,@loginame)
return (1)
end

-- IF non-SYSADMIN ATTEMPTING CHANGE TO SYSADMIN, REQUIRE PASSWORD (218078) --
if (@self <> 1 AND is_srvrolemember('sysadmin') = 0 AND exists
(SELECT * FROM master.dbo.syslogins WHERE loginname = @loginame and isntname = 0
AND sysadmin = 1) )
SELECT @self = 1

-- CHECK OLD PASSWORD IF NEEDED --
if (@self = 1 or @old is not null)
if not exists (select * from master.dbo.sysxlogins
where srvid IS NULL and
name = @loginame and
( (@old is null and password is null) or
(pwdcompare(@old, password, (CASE WHEN xstatus&2048 = 2048 THEN 1 ELSE 0 END)) = 1) ) )
begin
raiserror(15211,-1,-1)
return (1)
end

-- CHANGE THE PASSWORD --
update master.dbo.sysxlogins
set password = convert(varbinary(256), pwdencrypt(@new)), xdate2 = getdate(), xstatus = xstatus & (~2048)
where name = @loginame and srvid IS NULL

-- UPDATE PROTECTION TIMESTAMP FOR MASTER DB, TO INDICATE SYSLOGINS CHANGE --
exec('use master grant all to null')

-- FINALIZATION: RETURN SUCCESS/FAILURE --
if @@error <> 0
return (1)
raiserror(15478,-1,-1)
return (0) -- sp_password
赞赏
全国大流量卡免费领
对内容有疑问,请加我微信:guoqiang7585
# #
首页      程序开发      数据库      sql2000修改sa密码提示sql2000错误2812未能找到存储过程'sp_password'解决方法

国强极客

sql2000修改sa密码提示sql2000错误2812未能找到存储过程'sp_password'解决方法
还是因为这次客户服务器的原因,因为客户的网站,以前的sa密码是123456,是弱口令,加上客户要求开放1433端口,导致服务器sql2000经常被扫描到,并且修改密码。 今天客户的网站显示数据库…
扫描二维码继续阅读
2016-09-28