locks.sql is used to create the 2 tables in the tempdb database. Here is the script:
/*Count : 2 */
/*Begin_Clear out TempDB Database */
use tempdb
go
if exists (select * from dbo.sysobjects where id = Object_id('.DEX_LOCK') and type = 'U')
begin
drop table DEX_LOCK
end
go
if exists (select * from dbo.sysobjects where id = Object_id('.DEX_SESSION') and type = 'U')
begin
drop table DEX_SESSION
end
go
/*End_Clear out TempDB Database */
/*Begin_BuildLocks smDEX_Build_Locks */
use master
go
if exists (select * from dbo.sysobjects where id = Object_id('.smDEX_Build_Locks') and type = 'P')
begin
drop procedure smDEX_Build_Locks
end
go
create procedure smDEX_Build_Locks
as
exec ('create table tempdb..DEX_LOCK (session_id int, row_id int, table_path_name char(100))')
exec ('create unique index PK_DEX_LOCK on tempdb..DEX_LOCK(row_id,table_path_name)')
exec ('create table tempdb..DEX_SESSION (session_id int identity, sqlsvr_spid smallint)')
exec ('create unique index PK_DEX_SESSION on tempdb..DEX_SESSION(session_id)')
exec ('use tempdb grant insert,update,select,delete on DEX_LOCK to public')
exec ('use tempdb grant insert,update,select,delete on DEX_SESSION to public')
return
go
sp_procoption 'smDEX_Build_Locks','startup','true'
go
smDEX_Build_Locks
go
/*End_BuildLocks smDEX_Build_Locks */