--When many connect to your database, this error "has exceeded the lock request timeout period"
--just put the next-to-face stored procedure in your master database and execute it.
1 UsePratice2 SETAnsi_nulls on3 SETQuoted_identifier on4 Go5 6 Create PROC [dbo].[sp_killallprocessindb] @DbName VARCHAR( -)7 as8 IF db_id(@DbName)= NULL9 BEGINTen PRINT 'DataBase dose not Exist' One END A ELSE - BEGIN - DECLARE @killspId VARCHAR( -) the DECLARETmpcursorCURSOR - for - SELECT 'Kill' + CONVERT(VARCHAR, spid) asspId - fromMaster.. sysprocesses + WHERE db_name(dbid)= @DbName - andspid<> @ @spid --terminates a process that is not the current process (not equal to the current process) + anddbid<> 0 --database ID is not 0 A OPENTmpcursor at FETCH NEXT fromTmpcursor - - into @killspId --SELECT INTO @killspId - while @ @FETCH_STATUS = 0 - BEGIN - EXEC(@killspId) in FETCH NEXT fromTmpcursor - into @killspId to + END - the CLOSETmpcursor * deallocateTmpcursor $ ENDPanax Notoginseng - execSp_killallprocessindb'the database to access'
(Reproduced above from: http://www.cnblogs.com/lyhabc/articles/3235601.html)
To view the locked process ID
SELECT ' ID of the blocking process ' ' wait Time (milliseconds) ' ' (session ID) ' from Sys.dm_os_waiting_tasks
SQL Server error: The lock request time-out period has been exceeded. (Microsoft SQL Server, Error: 1222) solution