Re: End SQL Session (SQL Server)
- From: Erland Sommarskog <esquel@xxxxxxxxxxxxx>
- Date: Thu, 25 Oct 2007 21:58:06 +0000 (UTC)
Jhon (Jhon@xxxxxxxxxxxxxxxxxxxxxxxxx) writes:
I'm System Administrator and I have an special login with permision over
a DB in Productive. We have an support team. When they need to correct
any data in DB, they request the special login in order to change the
data directly in DB. When I give them the special login, if they don't
close the session, they can use it whenever they want. I need to close
the special login in order to they have to request it again.
How do they get the special login? Do you log in with username and password
and then leave them alone on that computer?
You could have a job that runs from SQL Server Agent and which runs a cursor
over
SELECT 'KILL ' + ltrim(str(spid))
FROM sysprocesses
WHERE loginame = 'speciallogin'
AND datediff(MINUTE, login_time, getdate()) > 30
and then uses EXEC() to run these KILL commands. This is somewhat heavy-
handed. You could improve it by adding last_batch to the mix. For instance
if no batch have been submitted for the last ten minutes, kill the
connection.
--
Erland Sommarskog, SQL Server MVP, esquel@xxxxxxxxxxxxx
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
.
- References:
- Re: End SQL Session (SQL Server)
- From: Erland Sommarskog
- Re: End SQL Session (SQL Server)
- Prev by Date: Re: Password MDF
- Next by Date: Re: deny users from accessing server from Management Studio
- Previous by thread: Re: End SQL Session (SQL Server)
- Next by thread: Re: Does local admin rights override SQL server permissions
- Index(es):
Relevant Pages
|
|