Unable to debug SQL Server 2005 stored procedures

2019-03-21 03:27发布

问题:

I have been trying to debug SQL Server 2005 stored procedures, in Visual Studio Team System 2008.

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)

The IDE shows it is running, but I can not seem to break or step into the stored procedure.


(source: googlepages.com)

I have checked the event viewer and there are no logs. There are no output or messages showing where the problem is.

Visual studio contains the following components :-


(source: 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 ?

回答1:

Check this, specially the remote debugging part: 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



回答2:

Remember that you also have to have admin privileges on the sql server box that you're debugging on. In the past, I've had to use the RunAs option in the explorer context menu to start Visual Studio. I use the same credentials as the admin user on the sql server box.



回答3:

Have you enabled SQL Server debugging in the project?

Project | Properties | Debug tab.

EDIT: Can also enable "Allow SQL/CLR Debugging" on a data connection in the server explorer.



回答4:

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.

To check this, use the account to log into SQL Server and then type the following SQL command using SQL Server Management Studio:

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.

The quickest way to grant execution rights for a SQL Server account to sp_sdidebug is to enter the following 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. 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.



回答5:

Have you tried debugging locally on the server via Citrix or RDP?

Hope this helps,

Bill



回答6:

its the windows firewall. disable it and try it shall work