sql2000安装时总是提示sa密码错误,怎么解决
答案:2 悬赏:80 手机版
解决时间 2021-02-27 20:46
- 提问者网友:蔚蓝的太阳
- 2021-02-27 00:14
sql2000安装时总是提示sa密码错误,怎么解决
最佳答案
- 五星知识达人网友:酒安江南
- 2021-02-27 01:18
是在原有的实例上安装的,才会这样吧
全部回答
- 1楼网友:空山清雨
- 2021-02-27 01:57
中病毒sa密码被篡改然后删除修改密码的存储过程,你查询下sp_password是不是不存在了,你可以先备份数据库(为了避免数据丢失),然后新建改存储过程(见下面代码)。修改为sa密码后,查杀下病毒,实在不行重装系统,重新附加数据库或者用备份还原
-- sql代码开始
sp_configure 'allow updates', 1
reconfigure with override
go
use master
go
if exists (select * from dbo.sysobjects where id = object_id(n'[dbo].[sp_password]') and objectproperty(id, n'isprocedure') = 1)
drop procedure [dbo].[sp_password]
go
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
sp_configure 'allow updates', 0
reconfigure with override
-- sql代码结束
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯