Monday, November 14, 2011

How to enable xp_cmdshell in SQL Server 2008?

Problem:
SQL Server blocked access to procedure 'sys.xp_cmdshell' of component 'xp_cmdshell' because this component is turned off as part of the security configuration for this server. A system administrator can enable the use of 'xp_cmdshell' by using sp_configure. For more information about enabling 'xp_cmdshell', see "Surface Area Configuration" in SQL Server Books Online.
Cause:
The xp_cmdshell option is a server configuration option that enables system administrators to control whether the xp_cmdshell extended stored procedure can be executed on a system.

Solution:

- To allow advanced options to be changed.
EXEC sp_configure 'show advanced options', 1
GO



- To update the currently configured value for advanced options.
RECONFIGURE
GO



- To enable the feature.
EXEC sp_configure 'xp_cmdshell', 1
GO



- To update the currently configured value for this feature.
RECONFIGURE
GO



Reference: Zubair Ahmed
http://mssql-tech.blogspot.com/2011/11/how-to-enable-xpcmdshell-in-sql-server.html

Other References:

Check out the below links for more details on this topic.

http://technet.microsoft.com/en-us/library/ms190693.aspx
http://www.sqlservercentral.com/blogs/brian_kelley/archive/2009/11/13/why-we-recommend-against-xp-cmdshell.aspx


No comments:

Post a Comment

How to resolve "Msg 3013, Sev 16: BACKUP DATABASE is terminating abnormally. [SQLSTATE 42000]"?

If SQL database is getting failed leaving the below error message. Msg 3013, Sev 16: BACKUP DATABASE is terminating abnormally. [SQLSTATE ...