jasonhdz
asked on
SQL Server 2012 Concurrent Sessions
I need help in implementing the following:
Implement logon triggers to restrict users from logging on multiple times.
Implement logon triggers to restrict users from logging on multiple times.
You do realize that there is a perfectly good example in SQL Server BOL for CREATE TRIGGER (Transact-SQL), right? Look for Example F
ASKER
No i did not, that is why i asked. But thanks! I will check it out!
ASKER
USE master;
GO
CREATE TRIGGER connection_limit_trigger
ON ALL SERVER WITH EXECUTE AS "JAY-PC\testdba1"
FOR LOGON
AS
BEGIN
IF ORIGINAL_LOGIN()= "JAY-PC\testdba1" AND
(SELECT COUNT(*) FROM sys.dm_exec_sessions
WHERE is_user_process = 1 AND
original_login_name = "JAY-PC\testdba1") > 3
ROLLBACK;
END;
GO
CREATE TRIGGER connection_limit_trigger
ON ALL SERVER WITH EXECUTE AS "JAY-PC\testdba1"
FOR LOGON
AS
BEGIN
IF ORIGINAL_LOGIN()= "JAY-PC\testdba1" AND
(SELECT COUNT(*) FROM sys.dm_exec_sessions
WHERE is_user_process = 1 AND
original_login_name = "JAY-PC\testdba1") > 3
ROLLBACK;
END;
ASKER
from the scrip above, i have the following issues:
1. It looks like the If is looking for a specific user, i need to implement this for every single user login in the db server.
2. Only Windows Login is implemented. It does not appear to recognize the Windows User Identificator
1. It looks like the If is looking for a specific user, i need to implement this for every single user login in the db server.
2. Only Windows Login is implemented. It does not appear to recognize the Windows User Identificator
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.