简体   繁体   English

无法在 Visual Studio Team System 2008 中调试 SQL Server 2005 存储过程

[英]Unable to debug SQL Server 2005 stored procedures in Visual Studio Team System 2008

I have been trying to debug SQL Server 2005 stored procedures, in Visual Studio Team System 2008.我一直在尝试在 Visual Studio Team System 2008 中调试 SQL Server 2005 存储过程。

I connected to the database server and did a right-click "Execute", on the stored procedure.我连接到数据库服务器并在存储过程上右键单击“执行”。 I even tried "Step Into Stored Procedure", with no luck.我什至尝试过“步入存储过程”,但没有运气。

替代文字
(source: googlepages.com ) (来源: googlepages.com

The IDE shows it is running, but I can not seem to break or step into the stored procedure. IDE 显示它正在运行,但我似乎无法中断或进入存储过程。

替代文字
(source: googlepages.com ) (来源: googlepages.com

I have checked the event viewer and there are no logs.我检查了事件查看器,没有日志。 There are no output or messages showing where the problem is.没有 output 或显示问题所在的消息。

Visual studio contains the following components:- Visual Studio 包含以下组件:-

替代文字
(source: googlepages.com ) (来源: googlepages.com

Loads of forums mention debugging issues, but no simple solution were found.很多论坛都提到了调试问题,但没有找到简单的解决方案。

Am I missing something?我错过了什么吗? Or does anyone know of a more concise site, that walks through successfull stored procedure debugging?或者有谁知道一个更简洁的站点,它可以成功地进行存储过程调试?

Check this, specially the remote debugging part: http://www.dbazine.com/sql/sql-articles/cook1检查这个,特别是远程调试部分: http://www.dbazine.com/sql/sql-articles/cook1

For other general information on debugging sql check http://msdn.microsoft.com/en-us/library/zefbf0t6.aspx有关调试 sql 的其他一般信息,请查看http://msdn.microsoft.com/en-us/library/zefbf0t6.aspx

Remember that you also have to have admin privileges on the sql server box that you're debugging on.请记住,您还必须对正在调试的 sql 服务器框具有管理员权限。 In the past, I've had to use the RunAs option in the explorer context menu to start Visual Studio.过去,我不得不使用资源管理器上下文菜单中的 RunAs 选项来启动 Visual Studio。 I use the same credentials as the admin user on the sql server box.我使用与 sql 服务器框上的管理员用户相同的凭据。

One issue to investigate is that any SQL Server user account involved in SQL debugging must have "execute" rights on an extended stored procedure called sp_sdidebug, a right that only the system administrator account (sa) has by default.需要调查的一个问题是,SQL 调试中涉及的任何 SQL 服务器用户帐户都必须对名为 sp_sdidebug 的扩展存储过程具有“执行”权限,默认情况下只有系统管理员帐户 (sa) 才具有该权限。

To check this, use the account to log into SQL Server and then type the following SQL command using SQL Server Management Studio:要检查这一点,请使用该帐户登录 SQL 服务器,然后使用 SQL 服务器管理工作室键入以下 SQL 命令:

EXEC master..sp_sdidebug

You'll see either a result stating that the command completed successfully or an execute permission error.您将看到表明命令成功完成的结果或执行权限错误。 If you see the latter result, you should also check that the account has permission to the master database itself.如果您看到后一个结果,您还应该检查该帐户是否具有对主数据库本身的权限。 It's not unknown for a DBA to give permission to the stored procedure, but not to the master database. DBA 向存储过程授予权限而不是向主数据库授予权限并不是未知的。

The quickest way to grant execution rights for a SQL Server account to sp_sdidebug is to enter the following SQL:将 SQL 服务器帐户的执行权限授予 sp_sdidebug 的最快方法是输入以下 SQL:

GRANT EXECUTE ON master..sp_sdidebug TO SpecificAccountName

There's another issue, but it won't affect you as you're using Server Explorer.还有另一个问题,但它不会影响您,因为您正在使用服务器资源管理器。 If you're debugging from a client application, you also have to execute the following command:如果您从客户端应用程序调试,您还必须执行以下命令:

EXEC master..sp_sdidebug 'legacy_on'

Note that remote SQL Server debugging is done using the DCOM, and this can be tricky to configure properly.请注意,远程 SQL 服务器调试是使用 DCOM 完成的,正确配置可能会很棘手。 First, you need to install the full remote debugging components on the remote database server.首先,您需要在远程数据库服务器上安装完整的远程调试组件。 You may also need to repeat this process every time the SQL Server is upgraded with a service pack or a patch.每次使用服务包或补丁升级 SQL 服务器时,您可能还需要重复此过程。

Have you enabled SQL Server debugging in the project?项目中开启SQL服务器调试了吗?

Project |项目 | Properties |属性 | Debug tab.调试选项卡。

EDIT: Can also enable "Allow SQL/CLR Debugging" on a data connection in the server explorer.编辑:还可以在服务器资源管理器中的数据连接上启用“允许 SQL/CLR 调试”。

its the windows firewall.它的 windows 防火墙。 disable it and try it shall work禁用它并尝试它应该可以工作

Have you tried debugging locally on the server via Citrix or RDP?您是否尝试过通过 Citrix 或 RDP 在服务器上进行本地调试?

Hope this helps,希望这可以帮助,

Bill账单

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM