我最近尝试将来自网络实例的备份还原到我的本地开发 SQL Server。令我惊讶的是,我收到了以下错误消息:
Msg 12824, Level 16, State 1, Line 3 The sp_configure value ‘contained database authentication’ must be set to 1 in order to restore a contained database. You may need to use RECONFIGURE to set the value_in_use. Msg 3013, Level 16, State 1, Line 3 RESTORE DATABASE is terminating abnormally.
我必须遵循哪些步骤才能成功还原数据库?
为了将包含的数据库恢复到不同的 sql server 实例,在本例中是我的本地服务器,“启用包含的数据库”属性必须设置为True。
您可以从管理工作室执行此操作:
ALTER AUTHORIZATION ON DATABASE::ReplaceThisWithYourDatabaseName TO ReplaceThisWithLeastPrivilegeUser;
以下是我实际用于启用/禁用遏制的脚本行:
-- Enable "contained database authentication" EXEC sp_configure 'contained', 1; RECONFIGURE; -- Disable "contained database authentication" EXEC sp_configure 'contained', 0; -- Force disabling of "contained database authentication" RECONFIGURE WITH OVERRIDE;