Initially, my answer was as easy as to configure the user connection option to the required number using sp_configure.
sp_configure 'user connections',100
RECONFIGURE
There is a break!!!It can only be done at server level. What about at DB level???
From SQL Server 2005 sp2, there a feature called LOGON Trigger. How about using the feature???Yes, it is very well possible
using Logon trigger by rolling back the connections once it reached a maximum required connections.It is not at DB level, but through Login.
create trigger AuditLogin
on database_Name
with execute as self
for logon
as
begin
IF ORIGINAL_LOGIN()= '< Login Name > ' AND
(SELECT COUNT(*) FROM sys.dm_exec_sessions
WHERE is_user_process = 1 AND
original_login_name = '< Login Name > ) > 10
ROLLBACK;
end
No comments:
Post a Comment