contained database authentication 服务器配置选项contained database authentication Server Configuration Option

适用对象:是SQL Server 否Azure SQL 数据库 否Azure Synapse Analytics (SQL DW) 否并行数据仓库APPLIES TO: yesSQL Server noAzure SQL Database noAzure Synapse Analytics (SQL DW) noParallel Data Warehouse

使用 contained database authentication 选项对 SQL Server 数据库引擎SQL Server Database Engine实例启用包含的数据库。Use the contained database authentication option to enable contained databases on the instance of SQL Server 数据库引擎SQL Server Database Engine.

此服务器选项允许您控制 contained database authenticationThis server option allows you to control contained database authentication.

  • 如果 contained database authentication 对实例关闭 (0),则无法创建包含的数据库或将其附加到 数据库引擎Database EngineWhen contained database authentication is off (0) for the instance, contained databases cannot be created, or attached to the 数据库引擎Database Engine.

  • 如果 contained database authentication 对实例打开 (1),则可以创建包含的数据库或将其附加到 数据库引擎Database EngineWhen contained database authentication is on (1) for the instance, contained databases can be created, or attached to the 数据库引擎Database Engine.

包含的数据库包括定义数据库所需的所有数据库设置和元数据,它与安装数据库的 数据库引擎Database Engine 实例没有配置依赖关系。A contained database includes all database settings and metadata required to define the database and has no configuration dependencies on the instance of the 数据库引擎Database Engine where the database is installed. 用户可以连接到数据库而无需在 数据库引擎Database Engine 级别对登录名进行身份验证。Users can connect to the database without authenticating a login at the 数据库引擎Database Engine level. 将数据库与数据库引擎隔离可以轻松地将数据库移到另一个 SQL ServerSQL Server实例。Isolating the database from the Database Engine makes it possible to easily move the database to another instance of SQL ServerSQL Server. 在数据库中包括所有数据库设置有利于数据库所有者管理数据库的所有配置设置。Including all the database settings in the database enables database owners to manage all the configuration settings for the database. 有关包含的数据库的详细信息,请参阅 Contained DatabasesFor more information about contained databases, see Contained Databases.

备注

包含的数据库对于 SQL 数据库SQL DatabaseSQL 数据仓库SQL Data Warehouse 始终处于启用状态,不能禁用。Contained databases are always enabled for SQL 数据库SQL Database and SQL 数据仓库SQL Data Warehouse and cannot be disabled.

如果 SQL ServerSQL Server 实例具有包含数据库,则可以使用 RECONFIGURE WITH OVERRIDE 语句将 contained database authentication 设置为 0。If an instance of SQL ServerSQL Server has any contained databases the contained database authentication setting can be set to 0 by using the RECONFIGURE WITH OVERRIDE statement. contained database authentication 设置为 0 将禁用包含数据库的包含数据库身份验证。Setting contained database authentication to 0 will disable contained database authentication for the contained databases.

重要

启用包含的数据库时,具有 ALTER ANY USER 权限的数据库用户(如 db_owner 和 db_accessadmin 数据库角色的成员)可以授予对数据库的访问权限,并由此授予对 SQL ServerSQL Server实例的访问权限。When contained databases are enabled, database users with the ALTER ANY USER permission, such as members of the db_owner and db_accessadmin database roles, can grant access to databases and by doing so, grant access to the instance of SQL ServerSQL Server. 这意味着控制对服务器的访问权限不再限于 sysadmin 和 securityadmin 固定服务器角色的成员以及具有服务器级别 CONTROL SERVER 和 ALTER ANY LOGIN 权限的登录。This means that control over access to the server is no longer limited to members of the sysadmin and securityadmin fixed server role, and logins with the server level CONTROL SERVER and ALTER ANY LOGIN permission. 在允许包含的数据库之前,应了解与包含的数据库相关的风险。Before allowing contained databases, you should understand the risks associated with contained databases. 有关详细信息,请参阅 Security Best Practices with Contained DatabasesFor more information, see Security Best Practices with Contained Databases.

示例Examples

下面的示例对 数据库引擎Database Engine的实例启用包含的数据库。The following example enables contained databases on the instance of the 数据库引擎Database Engine.

sp_configure 'contained database authentication', 1;  
GO  
RECONFIGURE;  
GO  

另请参阅See Also

sp_configure (Transact-SQL) sp_configure (Transact-SQL)
RECONFIGURE (Transact-SQL) RECONFIGURE (Transact-SQL)
服务器配置选项 (SQL Server)Server Configuration Options (SQL Server)