删除用户后跟创建用户的孤立用户 [英] orphaned users after drop user followed by create user

查看:58
本文介绍了删除用户后跟创建用户的孤立用户的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我在SQL Server 2016服务器上运行的脚本:

Here's my script running on a SQL Server 2016 server:




DROP LOGIN foo GO CREATE LOGIN foo WITH PASSWORD=N'yUlookHere', DEFAULT_DATABASE=master, DEFAULT_LANGUAGE=us_english, CHECK_EXPIRATION=OFF, CHECK_POLICY=OFF GO

- 当然数据库用户foo在这一点上是孤立的
USE foodb
GO
DROP USER如果存在foo - 这不应该消除任何可能性foo是孤儿?
GO
CREATE USER foo FOR LOGIN foo
GO

-- of course database user foo is orphaned at this point USE foodb GO DROP USER IF EXISTS foo -- shouldn't this eliminate any possibility of foo being orphaned? GO CREATE USER foo FOR LOGIN foo GO

生成的用户foo是孤立的。我不明白。考虑到用户首先被丢弃,它不再存在。 CREATE USER应该创建一个全新的unorphaned事件。

The resulting user foo is orphaned. I don't get it. Considering the user is dropped first, it doesn't exist any longer. The CREATE USER should create a completely new unorphaned occurrence of it.

它变得更加混乱。如果我只通过DROP USER语句运行脚本并在执行CREATE USER语句之前等待几分钟,则用户不会被孤立。

It gets even more confusing. If I run the script only through the DROP USER statement and wait a few minutes before executing the CREATE USER statement, the user is not orphaned.

推荐答案

这表明它可能是延迟删除的问题,但如果是这样,那将是一个错误。

That indicates that it could be a matter of deferred delete, but if so it would be a bug.

我做了快速测试,但我无法重复。

I did quick test, but I was not able to repeat it.

什么是"SELECT @@ version"报告?

What does "SELECT @@version" report?

您如何断定用户是孤儿?

How do you conclude that the user is orphaned?


这篇关于删除用户后跟创建用户的孤立用户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆