cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Recreate function dbo.xp_real_cmdshell

Former Member
2,977

A while ago we dropped some xp_real-functions in a production database, because of some security issues.
How can we recreate these functions?

Executing the following create statement as DBA:

create function dbo.xp_real_cmdshell(
  in command varchar(8000) default null,
  in redir_output char(254) default '' )
returns integer
internal name 'xp_real_cmdshell'
go

results in an error message:

Could not execute statement.
Permission denied: you do not have permission to use
the "CREATE FUNCTION" statement
SQLCODE=-121, ODBC 3 State="42000"
Line 1, column 1

Does anybody know how to solve this problem?

Accepted Solutions (1)

Accepted Solutions (1)

Former Member

There isn't a way to do this on an existing database that I know of - the server will not permit anyone (including a DBA) to link a new procedure to an internal server mechanism.

To get the system procedures back, dbinit a new database, and do an unload/reload into it.

VolkerBarth
Contributor
0 Kudos

...and that's why the "secure server features" have been introduced with v10, right?

dbsrv12 -sf cmdshell ...

Former Member
0 Kudos

I was hoping to avoid creating a new database. Was hoping on something like
sp_configure updates,1
ala ASE..

Answers (0)