2016-11-18 55 views
-1

如何啓用 xp_cmdshell爲什麼它阻止或禁止?*master..xp_cmdshell是SQL Server上blockes

+1

大多數DBA的誰知道他們在做什麼贏得不啓用xp_cmdshell;實際上它可能會被棄用! –

+0

你想用它做什麼?通常有更安全的替代品 – MartW

+0

先生,我想要在觸發器中運行.exe文件。 –

回答

0

同時使您需要查看的

的允許部分xp_cmdshell的MSDN文檔: 請按照鏈接

https://msdn.microsoft.com/en-us/library/ms190693.aspx 




    EXEC sp_configure 'show advanced options', 1 
    GO 

    RECONFIGURE 
    GO 

    EXEC sp_configure 'xp_cmdshell', 1 
    GO 

    RECONFIGURE 
    GO 
+0

1.儘量不要複製內容。 2.(如果你做1)你應該明確說明你已經複製了內容的來源。 – TheLostMind

+0

是啊,自己開始我貼了xp_cmdshell MSDN文檔:... @ TheLostMind – Chanukya

+0

@Chanukya:看[如何引用材料](https://stackoverflow.com/help/referencing);缺少的是一個鏈接。 –

0

xp_cmdshell-將給定的命令字符串或批處理文件作爲操作系統命令shell執行,並將任何輸出作爲文本行返回。

權限/版權:只有SysAdmin固定角色才能執行它。

語法

xp_cmdshell的{「command_string「} [,no_output] 參數

‘command_string’

是對命令串在操作系統命令殼或從DOS提示符執行。 command_string是varchar(255)或nvarchar(4000),沒有默認值。

command_string不能包含多個雙引號集。

如果command_string引用的文件路徑或程序名中存在任何空格,則需要一對引號。

如果您在嵌入式空間時遇到問題,請考慮使用FAT 8.3文件名作爲解決方法。

no_output

是可選參數executi

- 允許高級選項進行更改。 EXEC sp_configure'顯示高級選項',1 GO - 更新高級選項的當前配置值。 RECONFIGURE GO - 禁用xp_cmdshell的選項現在 版EXEC sp_configure的xp_cmdshell',0 GO RECONFIGURE GO

更多的Info-- http://yrushka.com/index.php/sql-server/security/execute-remotely-t-sql-command-through-xp_cmdshell/

0
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 
相關問題