安裝好sql2000數(shù)據(jù)庫和用友U810.1軟件,在進(jìn)行U8應(yīng)用服務(wù)器配置時提示登錄SA失敗,如下圖所示:
奇怪的是我安裝SQL2000的時候用的是默認(rèn)為空的口令,配置的時候密碼也沒錯,檢查了SQL服務(wù)也是啟動的,sql2000數(shù)據(jù)庫安裝時也是用的混合模式,太奇怪了,
然后嘗試去修改一下SA密碼的時候,發(fā)現(xiàn)問題來了,改不了SA密碼,提示:錯誤 2812: 未能找到存儲過程‘sp_password’,如下圖所示:
這個問題就出來了,這樣的話肯定是連接不上數(shù)據(jù)庫的,即使用DOS命令的 osql -U SA 也是登錄不上,于是嘗試修復(fù)方法如下,
打開SQL2000數(shù)據(jù)庫的查詢分析器輸入如下語句進(jìn)行修復(fù)。
-- 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代碼結(jié)束
全選直接按F5執(zhí)行就好了,正常操作如下圖所示,修復(fù)完后會有正確提示的:
怕復(fù)制錯的可以下載我們提供的文件,下載地址如下:
出現(xiàn)上述問題的主要原因是由于SQL服務(wù)器中毒或者本身系統(tǒng)有問題,導(dǎo)致病毒篡改 SQL 用戶的密碼,病毒為了阻止操作員手工修正(修改)SQL用戶的密碼,而把存儲過程 'sp_password' 刪除,導(dǎo)致的問題,上述語句是修復(fù)SP_PASSWORD存儲過程。