Solved

which logins are locked?

Posted on 2013-10-30
3
266 Views
Last Modified: 2013-10-30
i could see anything like 'islocked' columns in any of the system views?

could you write   a query that will quickly tell if any login is locked out in the sql server instance?

thanks
0
Comment
Question by:25112
  • 2
3 Comments
 
LVL 15

Assisted Solution

by:pateljitu
pateljitu earned 250 total points
Comment Utility
Please refer to this blog, here is the code sample:
 /*
This script is designed to find the logins those are locked out in the database Server.
It is tested to run on:
SQL 2000 - NO (Login lock feature was not introduced in this SQL version)
SQL 2005 - YES
SQL 2008 - YES
*/
set nocount on
declare  Cur_locked_login cursor for select name from master..syslogins order by name
declare @loginname nvarchar(100)
open Cur_locked_login
fetch next from Cur_locked_login into @loginname
while @@FETCH_STATUS >= 0
begin
if (select LOGINPROPERTY(@loginname,'islocked')) =1
print 'Login -> ' + @loginname +' is LOCKED'
fetch next from Cur_locked_login into @loginname
end
close Cur_locked_login
deallocate Cur_locked_login

Open in new window


http://dbasearch.blogspot.ca/2011/10/sql-login-locked-out-status-check.html
0
 
LVL 21

Expert Comment

by:Tapan Pattanaik
Comment Utility
Hi 25112 ,

Please check this query.

select * from sys.server_principals
where is_disabled = 1
0
 
LVL 21

Accepted Solution

by:
Tapan Pattanaik earned 250 total points
Comment Utility
SELECT LOGINPROPERTY('UserName', 'IsLocked')
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

SQL Server engine let you use a Windows account or a SQL Server account to connect to a SQL Server instance. This can be configured immediatly during the SQL Server installation or after in the Server Authentication section in the Server properties …
Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.
Via a live example, show how to setup several different housekeeping processes for a SQL Server.

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now