Share via


jobs.sp_stop_job(Azure 탄력적 작업)(Transact-SQL)

적용 대상:Azure SQL Database

Azure SQL Database용 Azure Elastic Jobs 서비스에서 작업 실행을 중지하도록 탄력적 작업 에이전트에 지시합니다.

이 저장 프로시저는 SQL Server 에이전트 서비스의 SQL Server에서 유사한 개체와 이름을 sp_stop_job 공유합니다. SQL Server 에이전트 버전에 대한 자세한 내용은 sp_stop_job(Transact-SQL)를 참조하세요.

Transact-SQL 구문 표기 규칙

구문

[jobs].sp_stop_job [ @job_execution_id = ] ' job_execution_id '

인수

@job_execution_id

중지할 작업 실행의 ID 번호입니다. job_execution_id 기본값NULL인 uniqueidentifier입니다.

반환 코드 값

0(성공) 또는 1(실패)

사용 권한

sysadmin 고정 서버 역할의 멤버는 기본적으로 이 저장 프로시저를 실행할 수 있습니다. sysadmin의 멤버만 이 저장 프로시저를 사용하여 다른 사용자가 소유한 작업의 특성을 편집할 수 있습니다.

설명

탄력적 작업의 모든 시간은 UTC 표준 시간대를 따릅니다.

현재 작업 실행의 job_execution_id 식별하려면 jobs.job_executions 사용합니다.

예제

작업 실행 식별 및 중지

다음 예제에서는 jobs.job_executions 작업 실행을 식별한 다음 예를 들어 01234567-89ab-cdef-0123-456789abcdef사용하여 작업 실행을 취소하는 job_execution_id방법을 보여 줍니다.

job_database에 연결하고 다음 명령을 실행합니다.

--Connect to the job database specified when creating the job agent

-- View all active executions to determine job_execution_id
SELECT job_name
, job_execution_id
, job_version
, step_id
, is_active
, lifecycle
, start_time
, current_attempts
, current_attempt_start_time
, last_message
, target_group_name
, target_server_name
, target_database_name
FROM jobs.job_executions
WHERE is_active = 1 AND job_name = 'ResultPoolsJob'
ORDER BY start_time DESC;
GO

-- Cancel job execution with the specified job_execution_id
EXEC jobs.sp_stop_job '01234567-89ab-cdef-0123-456789abcdef';