Enabling Service Broker in SQL Server 2008

前端 未结 5 811
隐瞒了意图╮
隐瞒了意图╮ 2021-01-30 10:28

I am integrating SqlCacheDependency to use in my LinqToSQL datacontext.

I am using an extension class for Linq querys found here - http://code.msdn.microsoft.com/linqtos

5条回答
  •  無奈伤痛
    2021-01-30 11:10

    ok here is how to do this if yours is disabled or you need to restore a backup, which seems to disable it.

    just run this script, it will kill all the process's that a database is using (why you carnt in 2008 manually kill process's unlike 2005 is beyond me) and then set the broker

    USE master
    go
    
    DECLARE @dbname sysname
    
    SET @dbname = 'YourDBName'
    
    DECLARE @spid int
    SELECT @spid = min(spid) from master.dbo.sysprocesses where dbid = db_id(@dbname)
    WHILE @spid IS NOT NULL
    BEGIN
    EXECUTE ('KILL ' + @spid)
    SELECT @spid = min(spid) from master.dbo.sysprocesses where dbid = db_id(@dbname) AND spid > @spid
    END
    
    
    ALTER DATABASE @dbname SET ENABLE_BROKER
    

提交回复
热议问题