In this article, we will
know how to enable/disable xp_cmdshell using sp_configure in SQL Server.
xp_cmdshell use to import text file to SQL Server.
When I tried to import .txt file using xp_cmdshell to SQL Server found following error.
"Msg 15281, Level 16, State 1,
Procedure xp_cmdshell, Line 1
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', search for 'xp_cmdshell' in SQL Server Books
Online."
Here we have to enable xp_cmdshell
in SQLServer.
Enable xp_cmdshell using sp_configure in SQL Server
To enable xp_cmdshell using sp_configure execute
the following script.
Use Master
GO
EXEC master.dbo.sp_configure 'show advanced options', 1
RECONFIGURE WITH
OVERRIDE
GO
EXEC master.dbo.sp_configure 'xp_cmdshell', 1
RECONFIGURE WITH
OVERRIDE
GO
|
Disable xp_cmdshell
using sp_configure in SQL Server
To disable xp_cmdshell using sp_configure execute
the following script.
Use Master
GO
EXEC master.dbo.sp_configure 'show advanced options', 1
RECONFIGURE WITH
OVERRIDE
GO
EXEC master.dbo.sp_configure 'xp_cmdshell', 0
RECONFIGURE WITH
OVERRIDE
GO
|
No comments:
Post a Comment
Please do not enter any spam link in the comment box.