xp_cmdshellでログ出力をさせようとしたら権限不足でエラーになった。

ネットで調べてみると、以下のおまじないが必要なようです。


xp_cmdshellを実行させたいユーザー名でSQL Serverにログインして

以下のコマンドを実行。


※ログインユーザーへ、サーバーロールの設定が必要です。

  とりあえずサーバーロールにsysadminを設定しました。


xp_cmdshellを使用するために権限を与える方法

-- To allow advanced options to be changed.
EXEC sp_configure 'show advanced options', 1
GO
-- To update the currently configured value for advanced options.
RECONFIGURE
GO
-- To enable the feature.
EXEC sp_configure 'xp_cmdshell', 1
GO
-- To update the currently configured value for this feature.
RECONFIGURE
GO



msdn

http://msdn.microsoft.com/ja-jp/library/ms190693.aspx