2014. 12. 17. 14:30

1. 서버에서 관리도구 - 구성요소 서비스를 연다.



2. 아래 사진과같이 옵션을 설정해준다.

XA 트랜잭션을 사용에 체크를 하여야 SQL에서 옵션처리를 통해 분산트랜잭션이 처리가 가능함.





3.SQL에 연결된서버를 등록하고 아래과같이 속성에서 설정.



4. 여기까지 처리가되었다면 일단 분산트랜잭션을 처리할 Client서버에서 [트랜잭션 처리할서버].[DB_Name].dbo.TableName으로

조회가 가능하다. (연결이 정상적인지 확인)


5.분산트랜잭션을 처리할 서버A 와 트랜잭션내에서 DML이 처리되는서버 B라고 했을 때

두 서버 모두 135번 포트를 열어준다.


6.프로시저에서 

set xact_abort on            -- XA 트랜잭션으로 처리 옵션

begin distributed tran        -- 분산트랜잭선 처리

넣은 후 A서버에서 데이터 작업 후 B서버로 작업을 한다.


7. 여기까지왔는데 정상적으로 되지않았다. (여기서 헤멤)

A서버와 B서버가 C클래스까지 같은 네트워크망이여야 가능하다.

내부네트워크망이 Netbios로 등록해줘야 한다.


Netbios등록방법 :  C:\Windows\System32\drivers\etc 경로로 들어가보면

hosts 파일이 있다.

해당파일을 노트패드로 열어보면 

# Copyright (c) 1993-2009 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
#      102.54.94.97     rhino.acme.com          # source server
#       38.25.63.10     x.acme.com              # x client host

# localhost name resolution is handled within DNS itself.
# 127.0.0.1       localhost
# ::1             localhost

이라고 적혀있는데

말그대로 For example 처럼 

B서버를 등록해준다 (텍스트 형태로 저장)
ex) 123.123.123. B

B서버에도 해당파일을 열어
A서버를 등록해준다
ex) 123.123.123.123 A


이렇게 처리후 정상적으로 작동.



Posted by YKYun