Wednesday, December 16, 2009
Debug T-SQL or Stored Procedures Remotely in SQL Server 2005 and Visual Studio 2005
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.
Thursday, December 10, 2009
ASP.net 2.0 Active Directory Membership provider
<system.web>
<authentication mode="Forms">
<forms name="ADAuthCookie" timeout="10" loginUrl="Login.aspx" defaultUrl="Default.aspx"></forms>
</authentication>
<authorization>
<deny users="?"/>
<allow users="*"/>
</authorization>
<membership defaultProvider="DomainLoginMembershipProvider">
<providers>
<add name="DomainLoginMembershipProvider"
type="System.Web.Security.ActiveDirectoryMembershipProvider,System.Web, Version=2.0.0.0,Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
connectionStringName="ADConnectionString"
attributeMapUsername="sAMAccountName"
enableSearchMethods="true"
connectionUsername="User@Domain.com"
connectionPassword="Password" />
</providers>
</membership>
Dont for get to add asp.net 2 login control.
Wednesday, December 9, 2009
Attachable Subscribers in SQL Server Replication 2008/2005(Part 2)
- For informational and historical reasons I’ve add a referencing to the method of attachable subscribers in SQL Server 2000 to show the features that have been deprecated in SQL server 2005/08 you can skip this part and move to section B :
A- In SQL Server 2000 the scenario was as below:
On the publisher:
1. Create the database snapshot.
2. Back up the published database.
3. Create a temporary database and restore the published database on the temporary database.
4. Create a new 'no-sync' pull subscription from the temporary database to the published database.
5. Run the merge agent to synchronize the databases.
6. Copy the subscription databases (database.msf file)
7. Register the subscriber computer
8. Register the subscribing database using sp_addmergesubscription
On the subscriber:
1. Attach the subscription database copy (Database.msf)
2. Create a pull subscription using sp_addmergepullsubscription
3. Connect to the publisher using a dial up connection
4. Run the merge agent to synchronize the data.
B-In SQL Server 2008/05 :
-Subscribers could be initialized by using other subscribers replicated databases without direct publisher snapshot sachems:
1 backup subscriber database.
2 Attaches to a separated server backed up database with keeping replication information option check box checked to preserve replication information.
3 -Rowguid column in new attached Db show shared related publisher information.
4- Run generated scripts from old subscriber on a new subscriber to get publisher information such as name, server location, and login account to:
use [CommonDB_Sub]
exec sp_addmergepullsubscription
@publisher = N'ABDELRAHMAN', @publication = N'Pub_ItemSalesPrice',
@publisher_db = N'CommonDB', @subscriber_type = N'Local', @subscription_priority = 0,@description = N'', @sync_type = N'none'
exec sp_addmergepullsubscription_agent @publisher = N'ABDELRAHMAN',
@publisher_db = N'CommonDB',
@publication = N'Pub_ItemSalesPrice', @distributor = N'ABDELRAHMAN',
@distributor_security_mode = 0, @distributor_login = N'sa',
@distributor_password = N'nsg_ss_0103', @enabled_for_syncmgr = N'False',
@frequency_type = 1, @frequency_interval = 0, @frequency_relative_interval = 0,
@frequency_recurrence_factor = 0, @frequency_subday = 0,
@frequency_subday_interval = 0, @active_start_time_of_day = 0,
active_end_time_of_day = 235959, @active_start_date = 0, @active_end_date = 0, @alt_snapshot_folder = N'', @working_directory = N'', @use_ftp = N'False', @job_login = null, @job_password = null, @publisher_security_mode = 0, @publisher_login = N'sa', @publisher_password = N'nsg_ss_0103', @use_interactive_resolver = N'False', @dynamic_snapshot_location = N'',@use_web_sync = 0
GO
Note : its important to set the prameter of both stored procdsure sp_addmergepullsubscription , sp_addmergepullsubscription_ agent,its important to set @sync_type = N'none' to create subscriber without publisher installation also set @alt_snapshot_folder a path of the replication data after copying unc folder from the publisher .
7 .In order to register the subscriber information to the publisher you need to run the following script :
use [CommonDB]exec sp_addmergesubscription @publication = N'Pub_ItemSalesPrice',
@subscriber = N'ABDELRAHMAN\MSSQL2', @subscriber_db = N'CommonDB_Sub', @subscription_type = N'pull', @subscriber_type = N'local', @subscription_priority = 0, @sync_type = N'none'
This will create subscriber to the publisher database
8. start pull data between publisher and subscriber, in our case we need to pull data from publisher through start button in View synchronizations status:
You can see all agent history by press view Job History.
C-Testing Replication Synchronization in SQLserver 2008/05
1. Add new row to the attached subscriber and press view sync status and start sync agent.
Saturday, December 5, 2009
SQL error msg 20 state 16 Encryption not supported on SQL Server
[Microsoft][ODBC SQL Server Driver][Shared Memory]Encryption not supported on SQL Server
[Microsoft][ODBC SQL Server Driver][Shared Memory]ConnectionOpen (PreLoginHandshake()).
to overcome this problem for unknown reasons unForce protocol encryption under Client configration utilitiy ,by unchecking Force protocol encryption ,after that you should be able to connect to all your sql servers .