1.
" msg 15281, Level 16, State 1, procedure xp_cmdshell, line 1th
SQL Server blocked access to the process ' Sys.xp_cmdshell ' of component ' xp_cmdshell ' because this component was shut down as part of this server's security configuration. System administrators can enable ' xp_cmdshell ' by using sp_configure. For more information about enabling ' xp_cmdshell ', see "surface area Configurator" in SQL Server Books Online. ”
Workaround:
When 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
If not sqlserver2005 you can use the following method (I did not experiment)
EXEC sp_configure ' show advanced options ', 1; RECONFIGURE; EXEC sp_configure ' xp_cmdshell ', 1; RECONFIGURE
RECONFIGURE: Specifies that if the configuration settings do not require the server to be stopped and restarted, the currently running values are updated and the SQL Server service will be restarted if this keyword is not available.
Remind: Open execution order is ' show advanced options ' before executing ' xp_cmdshell '. , if you want to turn off this advanced option, execute ' xp_cmdshell ' and then ' show advance options '. The number 1 is on and 0 is off.
If the Cmdshell is not working yet, run it again:
DBCC ADDEXTENDEDPROC ("xp_cmdshell", "Xplog70.dll");--
Or
Sp_addextendedproc xp_cmdshell, @dllname = ' Xplog70.dll '
To restore Cmdshell.
2.
Execute Master.dbo.xp_cmdshell ' osql-u sa-p 123456-i d:\test.sql '
SQL Server blocked access to the process ' Sys.xp_cmdshell ' for component ' xp_cmdshell ' when opening a large storage. sql file