How to remove a SQL Server user with db ownership

I need to drop the user using the dbowner schema from the SQL Server database. I can not refuse it, since I get this error message

Failed to fail for user network service. (Microsoft.SqlServer.Smo)

The database principle owns the schema in the database and cannot be deleted. (Microsoft SQL Server, Error: 15138)

When I try to uncheck the scheme owned by this user in order to remove the owner of db, it does nothing. My question is how can I delete this user or change his name from the "network service" to "NT AUTHORITY \ NETWORK SERVICE"

+14
source share
5 answers

, , .

:

AdventureWorks

USE AdventureWorks;
SELECT s.name
FROM sys.schemas s
WHERE s.principal_id = USER_ID('your username');

:

ALTER AUTHORIZATION ON SCHEMA::db_owner TO dbo;

db_owner , .

, .

: SQL SERVER - : : 15138

+10

,

Foo

:

enter image description here

Security → Schemas dbo, Properties:

enter image description here

Then change

Foo

on the

PSE

then I can delete the user I want to delete.

enter image description here

0
source

My problem was also solved with the above solution:

SELECT s.name
FROM sys.schemas s
WHERE s.principal_id = USER_ID('your username');

ALTER AUTHORIZATION ON SCHEMA::db_owner TO dbo;
0
source
ALTER AUTHORIZATION ON SCHEMA::[NT AUTHORITY\SYSTEM] TO dbo
-1
source

Source: https://habr.com/ru/post/1628990/


All Articles