이 페이지에서는 SQL Server의 Always-On 가용성 그룹이 무엇인지, Datastream에서 장애 조치 및 데이터 복구 시나리오에 가용성 그룹을 지원하는 방법을 설명합니다.
Always On 가용성 그룹 개요
SQL Server에서 Always On 가용성 그룹은 재해 복구 시나리오에 맞게 데이터베이스를 준비할 수 있는 고가용성 솔루션입니다.
Always On 가용성 그룹은 비즈니스의 데이터베이스 가용성을 극대화합니다.
가용성 그룹은 가용성 데이터베이스라고 하는 선택된 데이터베이스 집합의 복제된 환경을 지원합니다. 각 그룹에는 읽기 및 쓰기 작업을 위한 기본 데이터베이스 세트 1개와 해당하는 보조 데이터베이스 세트 최대 8개가 포함됩니다. 보조 데이터베이스는 선택적으로 읽기 전용 액세스 또는 백업 작업을 허용할 수 있습니다.
SQL Server 인스턴스의 Always On 가용성 그룹 기본 요건에 관한 자세한 내용은 SQL Server 문서를 참고하세요.
Always On 가용성 그룹과 함께 사용할 수 있도록 Datastream 구성
Datastream은 변경 테이블 CDC 메서드를 사용하여 동기 커밋 가용성 모드를 지원합니다. 이 모드에서는 데이터 동기화가 중지될 때까지 보조 데이터베이스가 상응하는 기본 데이터베이스와 동기화된 상태로 유지됩니다.
트랜잭션 확인은 보조 복제본이 수신되는 트랜잭션 로그 레코드를 디스크에 쓸 때만 클라이언트로 전송됩니다.
Always On 가용성 그룹과 함께 사용할 수 있도록 SQL Server 인스턴스를 구성하려면 장애 조치가 발생할 때 로그를 캡처하도록 SQL Server 에이전트를 사용 설정한 다음 정리 작업을 실행해야 합니다. 이렇게 하려면 먼저 CDC 에이전트 작업 단계를 수정하여 현재 복제본이 실제로 기본 복제본인지 확인해야 합니다. sys.fn_hadr_is_primary_replica 함수를 사용하여 실행합니다.
다음 명령어를 사용하여 인스턴스를 설정합니다.
-- Check if the current replica is a primary for the corresponding database.USE[DATABASE_NAME];DECLARE@DatabaseNameSYSNAME=DB_NAME();IF(SELECTsys.fn_hadr_is_primary_replica(@DatabaseName))=1BEGIN-- If the replica isn't a primary, the code block that follows is skippedEXECUTEsys.sp_cdc_add_job@job_type='capture';EXECUTEsys.sp_cdc_add_job@job_type='cleanup';END
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["이해하기 어려움","hardToUnderstand","thumb-down"],["잘못된 정보 또는 샘플 코드","incorrectInformationOrSampleCode","thumb-down"],["필요한 정보/샘플이 없음","missingTheInformationSamplesINeed","thumb-down"],["번역 문제","translationIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-09-04(UTC)"],[],[],null,["# Work with Always On availability groups\n\nThis page describes what Always-On availability groups in SQL Server are and how\nDatastream supports them for failover and data recovery scenarios.\n\nOverview of Always On availability groups\n-----------------------------------------\n\nIn SQL Server, Always On availability groups are a high-availability solution\nthat lets you prepare your databases for disaster recovery scenarios.\n\nAlways On availability groups maximize database availability for businesses.\nAvailability groups support a replicated environment for a selected set of\ndatabases, known as availability databases. Each group includes one set of\nprimary databases for read and write tasks, and up to eight sets of corresponding\nsecondary databases. The secondary databases can optionally allow read-only\naccess or backup operations.\n\nFor more information about Always On availability groups, see\n[What is an Always On availability group?](https://learn.microsoft.com/en-us/sql/database-engine/availability-groups/windows/overview-of-always-on-availability-groups-sql-server) in the SQL Server\ndocumentation.\n\nFor information about Always On Availability group prerequisites for a SQL\nServer instance, see the [SQL Server documentation](https://learn.microsoft.com/en-us/sql/database-engine/availability-groups/windows/prereqs-restrictions-recommendations-always-on-availability?view=sql-server-ver17&source=recommendations#ServerInstance).\n\nConfigure Datastream for use with Always On availability groups\n---------------------------------------------------------------\n\nDatastream supports *synchronous-commit* availability mode with the\nchange tables CDC method. Under this mode, the secondary database stays\nsynchronised with the corresponding primary until data synchronization stops.\nThe confirmation of a transaction is only sent to the client when the secondary\nreplica writes the incoming transaction log records to a disk.\n\nFor information about availability modes, see\n[Differences between availability modes for an Always On availability group](https://learn.microsoft.com/en-us/sql/database-engine/availability-groups/windows/overview-of-always-on-availability-groups-sql-server).\n\nTo configure your SQL Server instance for use with Always On availability groups,\nyou need to enable SQL Server Agent to capture logs when there's a failover, and\nthen run a clean up job. Before you can do this, you need to modify the CDC\nAgent job steps to check if the current replica is actually the primary. This is\ndone using the `sys.fn_hadr_is_primary_replica` function.\n\nUse the following commands to set up your instance: \n\n -- Check if the current replica is a primary for the corresponding database.\n USE [\u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-n\"\u003eDATABASE_NAME\u003c/span\u003e\u003c/var\u003e];\n DECLARE @DatabaseName SYSNAME = DB_NAME();\n IF (SELECT sys.fn_hadr_is_primary_replica(@DatabaseName)) = 1\n BEGIN\n -- If the replica isn't a primary, the code block that follows is skipped\n EXECUTE sys.sp_cdc_add_job @job_type = 'capture';\n EXECUTE sys.sp_cdc_add_job @job_type = 'cleanup';\n END\n\nWhat's next\n-----------\n\n- Learn more about how Datastream works with [SQL Server sources](/datastream/docs/sources-sqlserver)."]]