SQL Server 2000 - 以编程方式限制对数据库所有者的访问?

发布于 2024-07-30 02:00:21 字数 163 浏览 5 评论 0原文

我如何以编程方式将 SQL Server 2000 中数据库的访问权限限制为该数据库的数据库所有者? 示例...如果我在企业管理器中右键单击“Northwind”数据库上的“属性”,则所有者将列为 sa。 如何将对此数据库的访问权限限制为仅 sa 登录名?

How would I programmatically go about limiting the access of a database in SQL Server 2000 to the database owner for that database? Example... if I right-click "Properties" on the "Northwind" database in Enterprise Manager, the Owner is listed as sa. How would I limit access for this database to just the sa login?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

走走停停 2024-08-06 02:00:21

一些想法:

  • 您既不能拒绝也不限制 sa 登录,在 SQL Server 实例中的任何位置
  • 不要日常使用“sa”
  • 限制每个数据库的 db_owner 数据库角色的成员更有意义(SET RESTRICTED_USER 上面)
  • 数据库所有者 ID 相当随机:sa 仅拥有此数据库,因为 sa 创建了它,或者所有权已更改为 sa

除此之外,您的请求背后的原因是什么?

Some thoughts:

  • You can neither deny not restrict the sa login at all, anywhere in a SQL Server Instance
  • Do not use "sa" day to day
  • It makes more sense to limit to the members of the db_owner database role, per database (SET RESTRICTED_USER above)
  • The database owner id is fairly random: sa only owns this because sa created it, or ownership was changed to sa

Other than that, what is the reasoning behind your request?

橘亓 2024-08-06 02:00:21

您可以将数据库设置为 RESTRICTED_USER 可用性。

ALTER DATABASE MyDatabase SET RESTRICTED_USER

-- OR --

ALTER DATABASE MyDatabase SET RESTRICTED_USER WITH ROLLBACK IMMEDIATE

You could set the database to RESTRICTED_USER availability.

ALTER DATABASE MyDatabase SET RESTRICTED_USER

-- OR --

ALTER DATABASE MyDatabase SET RESTRICTED_USER WITH ROLLBACK IMMEDIATE
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文