MSSQL The database could not be exclusively locked to perform the operation. (Microsoft SQL Server, Error: 5030)

背景

数据库迁移时,新数据库的 Collocation 和 就数据库 Collocation 不相同,直接修改 Collocation 失败且出现异常:5030

SQL

--1.修改为单用户模式
ALTER DATABASE CustDbName SET SINGLE_USER WITH ROLLBACK IMMEDIATE;
go

--2.修改数据库字符集:Chinese_PRC_90_CI_AS
ALTER DATABASE CustDbName COLLATE Chinese_PRC_90_CI_AS;
go

--3.修改为多用户模式 
ALTER DATABASE CustDbName SET MULTI_USER;
go

 

posted @ 2022-05-11 13:58  Robot-Blog  阅读(276)  评论(0编辑  收藏  举报