11 10000l 2009transact-sql Debugger for SQL Server 2008-Part 2
This blog will go over what you need to know for setting up your environment for remote debugging along with best practices and other things to consider when using the debugger in SSMs.
This 3 part series covers:
- Basic Debugging
- Configure remote debugging & best practices
- Debugging triggers and stored procedures with breakpoints
The debugger consists of 2 components. the server component is installed with the sqlservr.exe. the client component is installed as part of SSMs. when SSMs and the instance you want to debug are on the same system, there is nothing configure. you do however need to login to the instance as a member ofSysAdminRole.
If you need to debug a remote instance, You need to enable the program and port exceptions using the Windows Firewall Control Panel application on both computers.
On the computer that is running the instance of the database engine, inWindows Firewall, Specify the following information:
- Add TCP port 135 to the exceptions list.
- Add the program sqlservr.exe to the exceptions list. By default, sqlservr.exe is installed in c: \ Program Files \ Microsoft SQL Server \ mssql10.InstanceName\ MSSQL \ binn, whereInstanceNameIs MSSQLServer for the default instance, and the Instance name for any named instance.
- If the Domain Policy requires network communications to be done through IPSec, you must also add UDP port 4500 and UDP port 500 to the exception list.
With the server instance taken care of, you now need to take care of SSMs on the client.
On the computer that is running SQL Server Management studio, inWindows Firewall, Specify the following information:
- Add TCP port 135 to the exceptions list.
- Add program ssms.exe (SQL Server Management studio) to the exceptions list. by default, ssms.exe is installed in c: \ Program Files \ Microsoft SQL Server \ 100 \ tools \ binn \ vsshell \ common7 \ IDE.
You are now ready to launch SSMs for remote debugging.
It is highly recommended that Transact-SQL code be debugged on a test server, not a production server, for the following reasons:
- Debugging is a highly privileged operation. Therefore, only members ofSysAdminFixed server role are allowed to debug in SQL Server.
- Debugging sessions often run for long periods of time while you investigate the operations of several Transact-SQL statements. locks, such as update locks, that are acquired by the session might be held for extended periods, until the session is ended or the transaction committed or rolled back.
That's it for Part 2.