Wednesday, December 16, 2009

Debug T-SQL or Stored Procedures Remotely in SQL Server 2005 and Visual Studio 2005

Transaction-SQL Debuger feature have been moved to VS.NET 2005 in SQL Server 2005 ,and return back SQL Server 2008 ,so inorder to enable debuging the only way to go through VS.NET 2005 SKU .
where is the setps to do :
Suppose we want to perform remote debugging to a different user's computer with the different user logged on to the computer, We have to consider two primary issues:
1- Permissions
By default, only administrators and the user running the remote debugger have access to connect to the remote debugger.
2-Connection
Visual Studio 2005 needs to know to which instance of the remote debugger you want to connect. If the same user is running the remote debugger and Visual Studio 2005, Visual Studio 2005 will be able to find the remote debugger without you telling it which user is running the remote debugger.
However, if a different user is running the remote debugger, Visual Studio 2005 must be told to connect to domain_name\user_name@remote_computer instead of just being told to connect to remote_computer.

How to set up the environment for remote debugging ??
Add the appropriate user to the Debugger Users group on the remote computer To do this, follow these steps:
1-On the remote computer, right-click My Computer, and then click Manage.
2-Under Computer Management, expand System Tools, expand Local Users and Groups, and then expand Groups.
3-Double-click Debugger Users-To add the appropriate user to the Debugger Users group, click Add in the Debugger Users Properties dialog box.
4-In the Select Users, Computers, or Groups dialog box, enter the appropriate user in the Enter the object names to select box, and then click OK two times. (For example, enter Domain1\User1)
5-Exit the Computer Management tool.
Note In Visual Studio .NET 2003 and Visual Studio .NET 2002, the user who is trying to perform remote debugging has to be a member of the Administrators group. However, in Visual Studio 2005, we don't need to add this user to the Administrators group.

Make sure that the Visual Studio 2005 remote debugging components are installed on the remote server.
To install remote debugging components ??
1-The Remote Debugger is available on the last disc of your Visual Studio installation set. Insert this disc in the remote computer.
For example, if you have four discs in your installation set, insert disc 4 in the remote computer. If you have a DVD instead of a CD, insert the DVD.
2-In Windows Explorer, open the CD/DVD. Locate the Remote Debugger folder (on the CD) or vs/Remote Debugger (on the DVD).
3-In the Remote Debugger folder, open the subfolder that matches your operating system (x86, x64, or IA64).
4-Start the copy of rdbgsetup.exe located in that subfolder, and follow the instructions to complete setup.
Start Remote Debugging:
When debugging T-SQL, the Remote Debugging Monitor will launch automatically during debugging.
1-Launch Visual Studio on the debugger host.
2-Use Visual Studio to attach to a program you want to debug on the remote machine or launch a program you want to debug on the remote machine as following :
A-From the Debug menu, choose Attach to Process. (If no project is open, choose Attach to Process from the Tools menu.)
B-In the Attach to Process dialog box, find the program you want to attach to from the Available Processes list:
1-If the program you want to debug is running on another machine, you must first select the remote machine in our case .
2-If the process is running under a different user account, check the Show processes from all users box.

C-In the Attach to box, make sure that either the type of code you will debug is listed or that Automatic: Managed code appears. If it doesn't:
Click Select.
In the Select Code Type dialog box, click Debug these code types and select the types to debug.
D-Click OK, then Click the Attach button.

5 comments:

  1. I аm sure this artiсle haѕ tоuched all the internеt people, its
    rеally гeallу gooԁ piece of ωriting on building
    up new blοg.
    Have a look at my homepage foreign investment

    ReplyDelete
  2. Heya i'm for the first time here. I came across this board and I find It really useful & it helped me out a lot. I hope to give something back and aid others like you helped me.
    Also visit my web page - http://www.tophatyachts.org/elgg/blog/view/186131/delighted-youngster-manual-by-dr-blaise-ryan

    ReplyDelete
  3. Mу spousе anԁ Ӏ stumbled οvег herе different ωeb ρage and thοught Ӏ might аs
    ωell сhеck things οut.
    I liκe whаt I see so nοw i'm following you. Look forward to looking into your web page for a second time.
    Feel free to visit my web page : tax return accounting

    ReplyDelete
  4. Whеn ѕomеοne writeѕ an агticle he/ѕhe maintaіnѕ the іmаgе of a usеr in
    his/hеr bгain that how a useг can know
    іt. Theгefore thаt's why this paragraph is perfect. Thanks!
    My blog : Natural appetite Control

    ReplyDelete
  5. I enϳоу reaԁing through a рost that can make people thinκ.

    Also, thanks for permitting me to comment!
    My website :: http://filthycomedy.com/EzekielHN

    ReplyDelete