2012-07-11 58 views
0

我想在sql中創建一個策略,將sproc限制爲命名約定。sp_execute_policy SQL中的錯誤,如何創建SQL方面策略

當有人創建一個新的存儲過程,他們將被迫與sp_

像前綴的存儲過程 - sp_MySprocName

但是當我嘗試使用正確的命名約定創建新的sproc時,我收到了以下錯誤。

當我右鍵點擊政策,並選擇我的政策我點擊Evaluate選項,一切運行得很好,不像當我實際上創建一個新的sproc我得到這個錯誤。

Msg 6522, Level 16, State 1, Procedure sp_execute_policy, Line 0 
A .NET Framework error occurred during execution of user-defined routine or aggregate "sp_execute_policy": 
System.TypeInitializationException: The type initializer for 'Microsoft.SqlServer.Management.Dmf.PolicyEvaluationHelper' threw an exception. ---> System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.SqlServer.Diagnostics.STrace, Version=10.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The system cannot find the file specified. 
System.IO.FileNotFoundException: 
at Microsoft.SqlServer.Management.Dmf.PolicyEvaluationHelper..cctor() 
System.TypeInitializationException: 
at Microsoft.SqlServer.Management.Dmf.PolicyEvaluationHelper.EvaluateAutomatedPolicy(String policy, SqlXml eventData, Int64& historyId) 
at Microsoft.SqlServer.Management.Dmf.PolicyEvaluationWrapper.EvaluateAutomatedPolicy(String policy, SqlXml eventData, Int64& historyId) 

Screen Shot Of Condition And Error

什麼我需要做的就是這個錯誤的拼車?

我已將存儲過程更新爲proc_的前綴。現在他們是proc_MyProcedure

我仍然收到相同的錯誤。

有什麼建議嗎?

+1

讓它們前面加上一個存儲過程以sp_是執行一個不好的做法,解決了這一問題。如果有的話,你應該寫一個禁止的政策。 – podiluska 2012-07-11 07:51:23

回答

0

基本上問題是microsoft.sqlserver.diadnostics.strace.dll未安裝在GAC中。此外,該文件不在我的服務器上,也不在安裝DVD上,所以我無法安裝它。我在家裏的個人電腦上發現了它,但有一個竅門可以到達我的工作服務器。

我相信,我已經通過複製

C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\PrivateAssemblies\Microsoft.SqlServer.Diagnostics.STrace to C:\Program Files\Microsoft SQL Server\100\Tools\Binn\VSSHell\Common7\IDE