Right click on the schema db_ddladmin to select Properties. On the popup window, change dbo to db_ddladmin from Schema onwer and then click OK. Do the same on the schema db_denydatareader.
Cannot alter owned schema from any user
Hello.
My details here below. (I use SQL Server 2019 Express on Windows 10)
SQL Server Management Studio 15.0.18338.0
SQL Server Management Objects (SMO) 16.100.41011.9
Microsoft Analysis Services Client Tools 15.0.19205.0
Microsoft Data Access Components (MDAC) 10.0.17763.1
Microsoft MSXML 3.0 6.0
Microsoft .NET Framework 4.0.30319.42000
Operating System 10.0.17763
I am logged with sysadmin (both SA and Windows Admin, same result)
and a am trying to remove the owned schema to Dbo and another internal user that i created that has access to a db in my server
Accidentally i granted 2 schemas to dbo and to the other users, like this , e.g. (see screenshot)
Then i applied the following query to remove it, elg. for ddladmin permissions
alter authorization
on schema::db_ddladmin
to dbo;
Unfortunately, even after loggin in and out and refreshed many times, the authorization are not dropped.
Is there any particular reason to it?
Thanks in advance.
2 additional answers
Sort by: Most helpful
-
21986829 481 Reputation points
2020-10-30T13:15:27.967+00:00 The error message should tell you why you can't remove it.
It is usually because the schema has objects related to itself.
You would have to change those object's owner before removing -
Erland Sommarskog 110.2K Reputation points
2020-10-30T23:06:24.787+00:00 ...or simply run SELECT * FROM sys.schemas. The column principal_id should be 1 for all schemas that are owned by dbo.