Random thoughts about everything and nothing

A severe error occured…SQL Server 2000

with 2 comments

A few weeks ago we ran into the following error in a piece of code: 

System.Data.SqlClient.SqlException: A severe error occurred on the current command. The results, if any, should be discarded.

Wierd…the code was running fine until yesterday! After some investigation (CSI-style) we found that the “XP_CMDSHELL”-commando in our stored procedure was the guilty one.

Background Information
Quote: “When xp_cmdshell is invoked by a user who is a member of the sysadmin fixed server role, xp_cmdshell will be executed under the security context in which the SQL Server service is running. When the user is not a member of the sysadmin group, xp_cmdshell will impersonate the SQL Server Agent proxy account, which is specified using xp_sqlagent_proxy_account. If the proxy account is not available, xp_cmdshell will fail. This is true only for Microsoft® Windows NT® 4.0 and Windows 2000. On Windows 9.x, there is no impersonation and xp_cmdshell is always executed under the security context of the Windows 9.x user who started SQL Server.”

What’s causing?
In our case we were using the xp_sqlagent_proxy_account, which used a domain service account, which migrated to another domain, which wasn’t communicated, which…well, anyway.  We found the problem 🙂

Just this
Ow, just this snippet to set the proxy account:

use master

xp_sqlagent_proxy_account N’SET’
                        , N'<DOMAIN>’
                        , N'<PASSWORD>’
                        , N'<PASSWORD>’
And to read the current setting…

use master

xp_sqlagent_proxy_account N’GET’

In both cases, logon as sysadmin…


Written by Michael

June 26, 2007 at 9:15 pm

Posted in Exception, SQL

2 Responses

Subscribe to comments with RSS.

  1. Hi! I was surfing and found your blog post… nice! I love your blog. 🙂 Cheers! Sandra. R.


    September 10, 2009 at 9:54 pm

  2. Sign: zdbrw Hello!!! pvntp and 1631samaypckpw and 8356 : Great!

    celebrity fuck you

    August 24, 2010 at 7:23 pm

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: