SQL to check blocking session in Teradata

SEL USERNAME ,

    SESSIONNO ,

    HOSTID ,

    IDENTIFYUSER(BLK1USERID) as BockedBy ,

    BLK1SESSNO as BlockedBySessionNO

FROM TABLE

(SYSLIB.MONITORSESSION(-1,'*',0)) AS T1

WHERE (AMPSTATE='BLOCKED' OR PESTATE='BLOCKED')

AND

USERNAME <> IDENTIFYUSER(BLK1USERID)

ORDER BY 1,2;

 

UserName

SessionNo

HostId

Blocked By

Blocked by SessionNo

PR_USER_APP_00001

57257750

1

ArcUser1

0

PR_USER_APP_00001

57257757

1

ArcUser1

0

PR_USER_APP_00001

57257782

1

ArcUser1

0

PR_USER_APP_00001

57257795

1

ArcUser1

0

PR_USER_APP_00001

57259370

1

ArcUser1

0

PR_USER_APP_00001

57259371

1

ArcUser1

0

PR_USER_APP_00001

57259376

1

ArcUser1

0

PR_USER_APP_00001

57259378

1

ArcUser1

0

PR_USER_APP_00001

57259384

1

ArcUser1

0

PR_USER_APP_00001

57259399

1

ArcUser1

0

PR_USER_APP_00001

57259417

1

ArcUser1

0

PR_USER_APP_00001

57260472

1

ArcUser1

0

PR_USER_APP_00001

57259366

1

ArcUser1

0

 

Comments