安装好sql2000数据库和用友U810.1软件,在进行U8应用服务器配置时提示登录SA失败,如下图所示:
奇怪的是我安装SQL2000的时候用的是默认为空的口令,配置的时候密码也没错,检查了SQL服务也是启动的,sql2000数据库安装时也是用的混合模式,太奇怪了,
然后尝试去修改一下SA密码的时候,发现问题来了,改不了SA密码,提示:错误 2812: 未能找到存储过程‘sp_password’,如下图所示:
这个问题就出来了,这样的话肯定是连接不上数据库的,即使用DOS命令的 osql -U SA 也是登录不上,于是尝试修复方法如下,
打开SQL2000数据库的查询分析器输入如下语句进行修复。
-- 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代码结束
全选直接按F5执行就好了,正常操作如下图所示,修复完后会有正确提示的:
怕复制错的可以下载我们提供的文件,下载地址如下:
出现上述问题的主要原因是由于SQL服务器中毒或者本身系统有问题,导致病毒篡改 SQL 用户的密码,病毒为了阻止操作员手工修正(修改)SQL用户的密码,而把存储过程 'sp_password' 删除,导致的问题,上述语句是修复SP_PASSWORD存储过程。