Use distributed functions
OpenDataSource
OpenQuery
OpenRowSet
Processing distributed databases, writing programs is relatively simple, but the configuration of DTC is complicated. I checked MSDN for evidence.
I wrote a program for simplicity and found that only one company in 10 companies can obtain data. I searched MSDN and found that many people encountered problems in configuring DTC. The article is as follows:
I. A. Do not use transactions. Use SELECT statements. Can I perform distributed queries?
B. LINKSERVER cannot operate on the local machine when performing distributed update transactions (that is, it cannot return distributed transactions)
C. dbcc traceon (3604,730 0) -- use tracking to view more detailed error information.
D.download the dtcping.exe package of msbench on two machines and run it according to README instructions. See error information.
Http://download.microsoft.com/download/complus/msdtc/1.7/nt45/en-us/DTCPing.exe
2. Whether MSDTC is enabled for both machines.
Iii. Whether MSDTC is set correctly.
1. Open the command prompt, Run "net stop msdtc", and then run "net start msdtc ".
2. Go to "Component Service Management Tools ".
3. Browse to "start management tool ".
4. Select "component service ".
A. Expand the "component service" tree and then expand "my computer ".
B. Right-click "my computer" and select "properties ".
C. On the MSDTC tab, make sure the following options are selected: Network DTC Access
Network Management
Network transactions
XA transaction
E. In addition, "DTC Logon account" must be set to "NT Authority \ NetworkService ".
5. Click OK ". This will prompt you that "ms dtc will stop and restart.
All dependent services will be stopped. Press "yes" to continue ". Click "yes" to continue.
6. Click "OK" to close the "my computer" Properties window.
4.
MSDTC depends on RPC. RPC uses port 135 to test whether port 135 is enabled. Is there a firewall? If the firewall is disabled first.
Telnet IP 135
If it is disabled, open it.
5.
For various reasons, SQLOLEDB cannot use distributed transactions and is changed to "MSDASQL" ODBC connection.
Use RRAS instead of RAS. (control panel -- Management Tools -- remote service manager)
Check whether you are using Remote Access Server (RAS) to access remote servers. if so, make sure that you have implemented Routing RAS (RRAS ). linked server does not work on RAS because RAS allows only one way communication.
7. Check whether your two servers are in the same domain.
Whether to establish a trusted connection if it is not in the same domain.
8. Upgrade to SP4.
9. Upgrade MDAC to 2.6 or above, preferably 2.8.
10. Install the latest SQL patch: sp3a
'Location Of All Patches
Http://www.microsoft.com/downloads/details.aspx? Displaylang = zh-cn & FamilyID = 9032f608-160a-4537-a2b6-4cb265b80766
'The patch to be installed SQL 2000 sp3
Http://download.microsoft.com/download/d/d/e/dde427eb-0296-4eac-a47c-d11a66b03816/chs_sql2ksp3.exe
For the above 10 points
I think:
1. environment is important. Step by step
Because it is win2000 and SQL server
8. If it is WIN2000, upgrade to SP4
9. Upgrade MDAC to 2.6 or above, preferably 2.8.
10. Install the latest SQL patch: sp3a
Two points.
I found that 10 companies could handle up to 9. Only one failed.
2. Tools are very important.
(1) If port 135 is suspected, use a tool to check the port and find that the port is correct.
(2) nowHttp://download.microsoft.com/download/complus/msdtc/1.7/nt45/en-us/DTCPing.exe
Tool, test, read readme, said by three steps, the first step to verify the name, the second step to verify rpc, the third step dtc, well, I found that the name verification failed,
It is always found that netbios of TCP/IP is disabled, and the name of cough dtc must be specified. He does not need IP. I.
3. The remote computer can only be accessed by IP address, but cannot be accessed by name.
(1) whether the two routes are correct due to the routing configuration problem (VPN connectivity does not mean that the access is successful, the versions are consistent, and the access is allowed without other exceptions ).
(2) check whether the error log DCOM is displayed. If this error occurs, you cannot access it by name.
(3) check whether the netbios of the corresponding TCP/IP is enabled.
(4) A strange one: if a VPN is built, the local mask must be 255.255.255.0. If it is 224,240, it indicates that the distributed transaction cannot be started.
(5) If the two libraries are local, using these functions is invalid.