You can not use an exclusive lock to lock the database to perform the operation. (Microsoft SQL Server, Error: 5030)

 ALTER DATABASE Test_DB modify name = Howie - change the database name

    EXEC sp_renamedb 'Howie', 'Howie_Wee' - change the database name

    When these changes above, the need to ensure that no one else connect to a database or application, otherwise it will error (exclusive lock can not be used to lock the database to perform the operation (Microsoft SQL Server, Error: 5030))

    You can use the following statement to view:

 

    select spid 
    from master.dbo.sysprocesses 
    where dbid=db_id('Test_DB')

 

    I see here are 142 and 145, and then kill them off

    kill 142

    kill 145

Guess you like

Origin www.cnblogs.com/howie-we/p/12070918.html