简体   繁体   English

SQL 服务器:数据库用户访问模式

[英]SQL Server: Database User Access Mode

With Windows SQL Server there are 3 user access mode settings per DB.对于 Windows SQL 服务器,每个 DB 有 3 个用户访问模式设置。

  • Multi_User多用户
  • Single_User单用户
  • Restricted_User受限用户

My question is, when exactly do you put a database in the "Single_User" of the "Restricted_User" mode?我的问题是,您究竟何时将数据库置于“Restricted_User”模式的“Single_User”中?

For example, if you want to update the SQL Server and thus prevent further sessions from being established for the duration of the update?例如,如果您想更新 SQL 服务器,从而防止在更新期间建立进一步的会话?

Typical Restricted_User and Single_User are used when doing maintenance that needs to be done when the applications are offline but you still need to access the data or schema.典型的Restricted_UserSingle_User用于在应用程序处于脱机状态但仍需要访问数据或架构时需要进行的维护。

Examples例子

  • Data migrations that are spanning multiple hours/days accessing multiple tables /databases/files are often done when the system is offline to minimize locking/blocking.跨越多个小时/天访问多个表/数据库/文件的数据迁移通常在系统离线时完成,以最大程度地减少锁定/阻塞。
  • Hardware migrations: Typically when moving to new hardware the database is also but in restricted mode before the service is turned off, to make some full backups, put the database offline, ...硬件迁移:通常在迁移到新硬件时,数据库也在服务关闭之前处于受限模式,以进行一些完整备份,使数据库脱机,...
  • Recovery: When your database is corrupted an you are restoring logs and performing ddbc checkdb (Although this is mostly done on a separate environment)恢复:当您的数据库损坏时,您正在恢复日志并执行 ddbc checkdb(尽管这主要在单独的环境中完成)
  • ... ...

So basically when the DBAs/Developers wants to make sure nobody else can access the database but they still needs to be able to perform tasks.所以基本上当 DBA/开发人员想要确保没有其他人可以访问数据库但他们仍然需要能够执行任务时。

In the enterprise environment this is often a fail-safe, as access to the database will probably be limited by firewalls, user policies when doing one of these tasks.在企业环境中,这通常是一种故障保险,因为在执行其中一项任务时,对数据库的访问可能会受到防火墙、用户策略的限制。

Patching SQL server or the OS is done when the service is stopped, as often OS patches require reboots and SQL Server patches require service restarts.补丁 SQL 服务器或操作系统在服务停止时完成,因为操作系统补丁通常需要重新启动,而 SQL 服务器补丁需要重新启动服务。 When running in a clustered environment, it's done 1 node at the time, to maintain up-time.在集群环境中运行时,它一次完成 1 个节点,以保持正常运行时间。 So restricted access is not used in these cases as the SQL Server is offline.因此在这些情况下不使用受限访问,因为 SQL 服务器处于脱机状态。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM