执行SQL语句出错:未能找到存储过程"sp-addsrvrolemember".

执行SQL语句出错:未能找到存储过程"sp-addsrvrolemember".,第1张

这是SQL自带的存储过程,在master的存储过程里,可以用以下语句重建,或者重装SQL,记得做好备份工作。

create procedure sp_addsrvrolemember

@loginame sysname, -- login name

@rolename sysname = NULL -- server role name

as

-- SETUP RUNTIME OPTIONS / DECLARE VARIABLES --

set nocount on

declare @retint,-- return value of sp call

@rolebitsmallint,

@ismem int,

@sidvarbinary(85)

-- DISALLOW USER TRANSACTION --

set implicit_transactions off

IF (@@trancount >0)

begin

raiserror(15002,-1,-1,'sp_addsrvrolemember')

return (1)

end

-- VALIDATE SERVER ROLE NAME, CHECKING PERMISSIONS --

select @ismem = is_srvrolemember(@rolename)

if @ismem is null

begin

dbcc auditevent (108, 1, 0, @loginame, NULL, @rolename, NULL)

raiserror(15402, -1, -1, @rolename)

return (1)

end

if @ismem = 0

begin

dbcc auditevent (108, 1, 0, @loginame, NULL, @rolename, NULL)

raiserror(15247,-1,-1)

return (1)

end

-- AUDIT A SUCCESSFUL SECURITY CHECK --

dbcc auditevent (108, 1, 1, @loginame, NULL, @rolename, NULL)

-- OBTAIN THE BIT FOR THIS ROLE --

select @rolebit = CASE @rolename

WHEN 'sysadmin' THEN 16

WHEN 'securityadmin'THEN 32

WHEN 'serveradmin' THEN 64

WHEN 'setupadmin' THEN 128

WHEN 'processadmin' THEN 256

WHEN 'diskadmin'THEN 512

WHEN 'dbcreator'THEN 1024

WHEN 'bulkadmin' THEN 4096

ELSE NULL END

select @sid = sid from master.dbo.syslogins where loginname = @loginame

-- ADD ROW FOR NT LOGIN IF NEEDED --

if @sid is null

begin

execute @ret = sp_MSaddlogin_implicit_ntlogin @loginame

if (@ret <>0)

begin

raiserror(15007,-1,-1,@loginame)

return (1)

end

end

-- CANNOT CHANGE SA ROLES --

else if @sid = 0x1 -- 'sa'

begin

raiserror(15405, -1 ,-1, @loginame)

return (1)

end

-- UPDATE ROLE MEMBERSHIP --

update master.dbo.sysxlogins set xstatus = xstatus | @rolebit, xdate2 = getdate()

where name = @loginame and srvid IS NULL

-- UPDATE PROTECTION TIMESTAMP FOR MASTER DB, TO INDICATE SYSLOGINS CHANGE --

exec('use master grant all to null')

raiserror(15488,-1,-1,@loginame,@rolename)

-- FINALIZATION: RETURN SUCCESS/FAILURE

return (@@error) -- sp_addsrvrolemember

GO

在还原数据库的时候出现"错误2812:未能找到存储过程'master.dbo.xp_fileexist'",

分析原因:这是因为某个出于安全考虑把系统扩展存储过程所有的动态连接库都删了

通过搜索查询到下面的解决方

解决方法:1、

把恢复数据库需要用到的存储过程个恢复,打开MSSQL查询分析器,分别运行下面的两条数据库语句即可.

EXEC sp_addextendedproc xp_dirtree ,@dllname ='xpstar.dll'

EXEC sp_addextendedproc xp_fileexist ,@dllname ='xpstar.dll'

解决方法:2、

重装SQL2000 SQL server 危险存储过程删除与恢复

删除

use master

exec sp_dropextendedproc 'xp_cmdshell'

exec sp_dropextendedproc 'xp_dirtree'

exec sp_dropextendedproc 'xp_enumgroups'

exec sp_dropextendedproc 'xp_fixeddrives'

exec sp_dropextendedproc 'xp_loginconfig'

exec sp_dropextendedproc 'xp_enumerrorlogs'

exec sp_dropextendedproc 'xp_getfiledetails'

exec sp_dropextendedproc 'Sp_OACreate'

exec sp_dropextendedproc 'Sp_OADestroy'

exec sp_dropextendedproc 'Sp_OAGetErrorInfo'

exec sp_dropextendedproc 'Sp_OAGetProperty'

exec sp_dropextendedproc 'Sp_OAMethod'

exec sp_dropextendedproc 'Sp_OASetProperty'

exec sp_dropextendedproc 'Sp_OAStop'

exec sp_dropextendedproc 'Xp_regaddmultistring'

exec sp_dropextendedproc 'Xp_regdeletekey'

exec sp_dropextendedproc 'Xp_regdeletevalue'

exec sp_dropextendedproc 'Xp_regenumvalues'

exec sp_dropextendedproc 'Xp_regread'

exec sp_dropextendedproc 'Xp_regremovemultistring'

exec sp_dropextendedproc 'Xp_regwrite'

drop procedure sp_makewebtask

go

恢复

use master

exec sp_addextendedproc xp_cmdshell,'xp_cmdshell.dll'

exec sp_addextendedproc xp_dirtree,'xpstar.dll'

exec sp_addextendedproc xp_enumgroups,'xplog70.dll'

exec sp_addextendedproc xp_fixeddrives,'xpstar.dll'

exec sp_addextendedproc xp_loginconfig,'xplog70.dll'

exec sp_addextendedproc xp_enumerrorlogs,'xpstar.dll'

exec sp_addextendedproc xp_getfiledetails,'xpstar.dll'

exec sp_addextendedproc sp_OACreate,'odsole70.dll'

exec sp_addextendedproc sp_OADestroy,'odsole70.dll'

exec sp_addextendedproc sp_OAGetErrorInfo,'odsole70.dll'

exec sp_addextendedproc sp_OAGetProperty,'odsole70.dll'

exec sp_addextendedproc sp_OAMethod,'odsole70.dll'

exec sp_addextendedproc sp_OASetProperty,'odsole70.dll'

exec sp_addextendedproc sp_OAStop,'odsole70.dll'

exec sp_addextendedproc xp_regaddmultistring,'xpstar.dll'

exec sp_addextendedproc xp_regdeletekey,'xpstar.dll'

exec sp_addextendedproc xp_regdeletevalue,'xpstar.dll'

exec sp_addextendedproc xp_regenumvalues,'xpstar.dll'

exec sp_addextendedproc xp_regread,'xpstar.dll'

exec sp_addextendedproc xp_regremovemultistring,'xpstar.dll'

exec sp_addextendedproc xp_regwrite,'xpstar.dll'

就是在选择还原设备的时候直接把你的备份数据库的文件的路径填进去,点确定点确定后还是"错误2812:未能找到存储过程'master.dbo.xp_fileexist'",这时候你直接点这个错误对话框的确定按钮即可,然后选择:强制还原数据库,点开始还原数据库等一会就OK了

未能找到存储过程'SP_ADDEXTENDEDPROC'

说明 这个SP_ADDEXTENDEDPROC'存储过程 你调用错误,确认是owner.SP_ADDEXTENDEDPROC'没有出现错误。以及SP_ADDEXTENDEDPROC是否存在以及你是否具有相关权限。

由于不知道你的测试环境,我默认是在oracle 下面


欢迎分享,转载请注明来源:夏雨云

原文地址:https://www.xiayuyun.com/zonghe/418235.html

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

发表评论

登录后才能评论

评论列表(0条)

    保存