This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DECLARE @IsPrimary INT; | |
DECLARE @JobName NVARCHAR(128); | |
-- Check if the current node is the primary replica | |
SELECT @IsPrimary = CASE | |
WHEN role_desc = 'PRIMARY' THEN 1 | |
ELSE 0 | |
END | |
FROM sys.dm_hadr_availability_replica_states AS ars | |
JOIN sys.availability_replicas AS ar |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--open transactions with text and plans | |
--session ID | |
--login name | |
--database context | |
--transaction begin time | |
--how many log records have been generated by the transaction | |
--how much log space has been taken up by those log records | |
--how much log space has been reserved in case the transaction rolls back | |
--the last T-SQL that was executed in the context of the transaction |