開啟較大儲存量的.sql檔案時,出現SQL Server 阻止了對組件 'xp_cmdshell' 的 過程'sys.xp_cmdshell' 的訪問

來源:互聯網
上載者:User

標籤:

1.

“訊息 15281,層級 16,狀態 1,過程 xp_cmdshell,第 1 行
SQL Server 阻止了對組件 ‘xp_cmdshell‘ 的 過程‘sys.xp_cmdshell‘ 的訪問,因為此組件已作為此伺服器安全配置的一部分而被關閉。系統管理員可以通過使用 sp_configure 啟用 ‘xp_cmdshell‘。有關啟用 ‘xp_cmdshell‘ 的詳細資料,請參閱 SQL Server 聯機叢書中的 "介面區配置器". ”

解決方案:

sqlserver2005時

EXEC sp_configure N‘show advanced options‘, N‘1‘ 
RECONFIGURE WITH OVERRIDE
EXEC sp_configure N‘xp_cmdshell‘, N‘1‘
RECONFIGURE WITH OVERRIDE 
EXEC sp_configure N‘show advanced options‘, N‘0‘ 
RECONFIGURE WITH OVERRIDE
如果不是sqlserver2005可使用如下的方法(我沒有實驗)

EXEC sp_configure ‘show advanced options‘, 1;RECONFIGURE;EXEC sp_configure ‘xp_cmdshell‘, 1;RECONFIGURE

RECONFIGURE:指定如果配置設定不需要伺服器停止並重新啟動,則更新當前啟動並執行值,如果沒有這個關鍵字的話將要重新啟動sqlserver服務才會生效。

Remind:開啟執行順序是‘show advanced options‘,然後才執行‘xp_cmdshell‘。,如果要關閉這個進階選項的話,要先執行‘xp_cmdshell‘然後再執行‘show advanced options‘。數字1代表開啟,0代表關閉。

如果cmdshell還不行的話,就再運行:
dbcc addextendedproc("xp_cmdshell","xplog70.dll");--
或者
sp_addextendedproc xp_cmdshell,@dllname=‘xplog70.dll‘
來恢複cmdshell。

 

 

2.

執行 master.dbo.xp_cmdshell ‘osql -U sa -P 123456 -i d:\test.sql‘

開啟較大儲存量的.sql檔案時,出現SQL Server 阻止了對組件 'xp_cmdshell' 的 過程'sys.xp_cmdshell' 的訪問

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.