SQLServer執行儲存過程失敗(sys.xp_cmdshell)問題處理
今天在調整一備庫的備份策略的時候,執行job失敗,其中具體錯誤資訊和解決方法記錄下,僅供以後參考使用。
錯誤資訊:
Date 2016/12/21 11:05:48
Log Job History (Job_FULLBACKUP)
Step ID 1
Server WINDOWS
Job Name Job_FULLBACKUP
Step Name mssqlserver_fullbackup
Duration 00:00:00
Sql Severity 16
Sql Message ID 15281
Operator Emailed
Operator Net sent
Operator Paged
Retries Attempted 0
Message
Executed as user: NT AUTHORITY\NETWORK SERVICE. 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. [SQLSTATE 42000] (Error 15281). The step failed.
錯誤原因:
未啟動xp_cmdshell,xp_cmdshell 擴充套件儲存過程將命令字串作為命令 shell 執行,並以文字行的形式返回所有輸出。即透過系統命令呼叫系統儲存過程
由於存在安全隱患, xp_cmdshell 預設是關閉的。
解決方法:
方法1:
利用圖形介面,外圍應用配置器,啟動xp_cmdshell即可
sqlserver2005和2008略有差別,具體參照如下:
SQLServer 2005外圍應用配置器可以在程式介面找到
SQLServer2008的外圍配置器整合到【方面】裡,需要到資料庫例項下去找和配置
方法2:
透過命令方式,啟動xp_cmdshell
sp_configure 'show advanced options',1
reconfigure
go
sp_configure 'xp_cmdshell',1
reconfigure
go
知識擴充套件:
檢視系統資料庫引數配置: select * from sys.configurations where name='xp_cmdshell'
修改系統資料庫引數:
sp_configure 'show advanced options',1
reconfigure
go
sp_configure 'xp_cmdshell',1
reconfigure
go
sp_configure具體使用參考:
錯誤資訊:
Date 2016/12/21 11:05:48
Log Job History (Job_FULLBACKUP)
Step ID 1
Server WINDOWS
Job Name Job_FULLBACKUP
Step Name mssqlserver_fullbackup
Duration 00:00:00
Sql Severity 16
Sql Message ID 15281
Operator Emailed
Operator Net sent
Operator Paged
Retries Attempted 0
Message
Executed as user: NT AUTHORITY\NETWORK SERVICE. 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. [SQLSTATE 42000] (Error 15281). The step failed.
錯誤原因:
未啟動xp_cmdshell,xp_cmdshell 擴充套件儲存過程將命令字串作為命令 shell 執行,並以文字行的形式返回所有輸出。即透過系統命令呼叫系統儲存過程
由於存在安全隱患, xp_cmdshell 預設是關閉的。
解決方法:
方法1:
利用圖形介面,外圍應用配置器,啟動xp_cmdshell即可
sqlserver2005和2008略有差別,具體參照如下:
SQLServer 2005外圍應用配置器可以在程式介面找到
SQLServer2008的外圍配置器整合到【方面】裡,需要到資料庫例項下去找和配置
方法2:
透過命令方式,啟動xp_cmdshell
sp_configure 'show advanced options',1
reconfigure
go
sp_configure 'xp_cmdshell',1
reconfigure
go
知識擴充套件:
檢視系統資料庫引數配置: select * from sys.configurations where name='xp_cmdshell'
列名 |
資料型別 | 說明 |
---|---|---|
configuration_id |
int |
配置值的唯一 ID。 |
name |
nvarchar(35) |
配置選項的名稱。 |
value |
sql_variant |
該選項的配置值。 |
minimum |
sql_variant |
配置選項的最小值。 |
maximum |
sql_variant |
配置選項的最大值。 |
value_in_use |
sql_variant |
該選項當前使用的執行值。 |
description |
nvarchar(255) |
配置選項的說明。 |
is_dynamic |
bit |
1 = 執行 RECONFIGURE 語句時生效的變數。 |
is_advanced |
bit |
1 = 僅當設定了 show advanced 選項時才顯示該變數。 |
修改系統資料庫引數:
語法格式: sp_configure [ @configname= ] 'hadoop connectivity', [ @configvalue = ] { 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 } [;] RECONFIGURE [;]示例:
sp_configure 'show advanced options',1
reconfigure
go
sp_configure 'xp_cmdshell',1
reconfigure
go
sp_configure具體使用參考:
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/27067062/viewspace-2131110/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 儲存過程問題。。儲存過程
- Sqlserver中的儲存過程SQLServer儲存過程
- SqlServer-儲存過程分頁SQLServer儲存過程
- sqlserver 常用儲存過程集錦SQLServer儲存過程
- 儲存過程中巢狀儲存過程的變數執行方式儲存過程巢狀變數
- Linux Yum 安裝失敗處理過程整理Linux
- goldengate ddl_setup執行失敗處理Go
- Jenkins執行批處理檔案失敗Jenkins
- sqlserver2008連結伺服器中執行儲存過程配置過程SQLServer伺服器儲存過程
- /*動態執行儲存過程DEMO*/儲存過程
- SqlServer儲存過程的建立與使用SQLServer儲存過程
- ADO中sqlserver儲存過程使用SQLServer儲存過程
- npm install過程失敗的幾種處理方法NPM
- linux swap掛載失敗問題處理Linux
- 一個儲存過程的問題!儲存過程
- 儲存過程單引號問題儲存過程
- MySQL儲存過程的異常處理方法MySql儲存過程
- 檢視正在執行的儲存過程儲存過程
- 執行Sybase儲存過程並返回ResultSet儲存過程
- 使用ADO執行儲存過程 (轉)儲存過程
- 使用Command執行儲存過程 (轉)儲存過程
- 【SqlServer】清除過期資料的儲存過程SQLServer儲存過程
- Mac openssl 未找到 / 載入失敗問題處理Mac
- 通過儲存過程執行通過DBLINK的查詢語句失敗-單個語句成功--ORA-00604儲存過程
- SQLServer查詢使用者儲存過程SQLServer儲存過程
- sqlserver儲存過程實現多表分頁SQLServer儲存過程
- 解密SQLServer2005儲存過程解密SQLServer儲存過程
- ADO中sqlserver儲存過程使用 (轉)SQLServer儲存過程
- mysql多次呼叫儲存過程的問題MySql儲存過程
- Java呼叫Oracle儲存過程的問題JavaOracle儲存過程
- Spark 叢集執行任務失敗的故障處理Spark
- Oracle:建立JOB定時執行儲存過程Oracle儲存過程
- 儲存過程執行EXECUTE IMMEDIATE沒反應儲存過程
- oracle 如何終止儲存過程的執行Oracle儲存過程
- [MSSQL]sql 儲存過程定時執行方法SQL儲存過程
- 整合手機平臺待辦資料失敗問題跟蹤和處理(Mongodb、Oracle、SQLServer)MongoDBOracleSQLServer
- SQLServer 2005通用分頁儲存過程SQLServer儲存過程
- MySQL儲存過程的許可權問題MySql儲存過程