The forum will experience an outage sometime between February 10 at 7:00pm EST and February 12 at 11:59 EST for installation of security updates. The actual time and duration of the outage are unknown but attempts will be made to minimize the downtime. We apologize for any inconvenience.

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?

asked 01 Dec '11, 05:24

Dan%20Jernberg's gravatar image

Dan Jernberg
41226
accept rate: 0%

edited 15 Mar '13, 21:32

Mark%20Culp's gravatar image

Mark Culp
22.3k9129262


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.

permanent link

answered 01 Dec '11, 07:08

Glenn%20Paulley's gravatar image

Glenn Paulley
10.7k568104
accept rate: 43%

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

dbsrv12 -sf cmdshell ...

(01 Dec '11, 07:30) Volker Barth

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

(01 Dec '11, 07:47) Dan Jernberg
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×26
×14
×6

question asked: 01 Dec '11, 05:24

question was seen: 828 times

last updated: 15 Mar '13, 21:32