Hi All,
I want to start extended session via job and want it to stop automatically after 2 hours.
How to accomplish it?
ALTER EVENT SESSION <My_XE>
ON SERVER
STATE = START;
GO
ALTER EVENT SESSION <My_XE>
ON SERVER
STATE = STOP;
GO
Thanks,
Sam
Add a waitfor delay line/step to the job to wait 2 hours after the start, and before the stop
ALTER XE START
WAITFOR DELAY '2:00:00'
ALTER XE STOP
February 22, 2023 at 1:42 pm
Exactly that, or, have a second job scheduled two hours after the one that starts it.
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
February 22, 2023 at 7:17 pm
Thank you.
March 2, 2023 at 6:41 am
This was removed by the editor as SPAM
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply