Sql-Server

如何撤消分配 db_datareader/db_datawriter 架構的所有權?

  • January 19, 2017

我的意思是

  • db_datareader
  • db_datawriter

數據庫角色。但是,如果有片刻的肚子疼和疲倦,我不小心給了該使用者模式的所有權:

在此處輸入圖像描述

暫時忽略使用者*“擁有”這兩個內置模式在概念上的含義。並且暫時忽略如果使用者擁有這兩個模式甚至是一個問題*(例如,如果我想刪除使用者,內置模式是否會隨之而來)。

我的問題是:我如何撤消它?


隨機敲擊鍵盤上的鍵,結果出來了

改變模式授權::

$$ db_datareader $$到$$ db_datareader $$F5

但這並沒有做任何事情。所以現在是時候諮詢專家了。

Microsoft SQL Server 2005 - 9.00.5057.00 (Intel X86) 2011 年 3 月 25 日 13:50:04 版權所有 (c) 1988-2005 Microsoft Corporation 標準版

alter authorization on schema::[db_datareader] to [dbo]
alter authorization on schema::[db_datareader] to [db_datareader]

alter authorization on schema::[db_datawriter] to [dbo]
alter authorization on schema::[db_datawriter] to [db_datawriter]

執行以下操作將使您的工作變得輕鬆:以 SA 帳戶打開 SQL Server 點擊創建新查詢和過去的打擊查詢,然後點擊執行!完畢。

alter authorization on schema::[db_datareader] to [dbo]
alter authorization on schema::[db_datareader] to [db_datareader]
alter authorization on schema::[db_datawriter] to [dbo]
alter authorization on schema::[db_datawriter] to [db_datawriter]
alter authorization on schema::[db_securityadmin] to [dbo]
alter authorization on schema::[db_securityadmin] to [db_securityadmin]
alter authorization on schema::[db_accessadmin] to [dbo]
alter authorization on schema::[db_accessadmin] to [db_accessadmin]
alter authorization on schema::[db_backupoperator] to [dbo]
alter authorization on schema::[db_backupoperator] to [db_backupoperator]
alter authorization on schema::[db_ddladmin] to [dbo]
alter authorization on schema::[db_ddladmin] to [db_ddladmin]
alter authorization on schema::[db_owner] to [dbo]
alter authorization on schema::[db_owner] to [db_owner]

引用自:https://serverfault.com/questions/516443