修改SQL中SA密码,提示错误2812,未能找到存储过程"SA-PASSWORD",如何修改?

修改SQL中SA密码,提示错误2812,未能找到存储过程"SA-PASSWORD",如何修改?,第1张

你进入数据库,然后点数据库里有个安全,然后找到一个用户名SA,接着点开,然后有个强制修改密码,你直接输两遍你要输入的密码,就可以了,然后断开数据库,重新连接,注意服务器,这个服务器是你刚刚登陆进去修改的服务器,然后用用户名密码登陆,试试吧。

原因可能是由于黑客木马侵入,将sa密码更改,并删除了此存储过程,由此阻碍对密码的修改。解决方案就是重建这个存储过程。

*** 作过程如下:打开“企业管理器”在系统数据库“master”中找到“存储过程”,然后右击“新建存储过程”。将完整代码如下:

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

GO

新建好后重新修改下密码即可。


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/sjk/10087009.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-05
下一篇 2023-05-05

发表评论

登录后才能评论

评论列表(0条)

保存