MSG 15138 the Database Principal owns a schema in the database, and cannot be dropped.

Source: Internet
Author: User

Error When deleting a user:

 

MSG 15138, level16, state 1, line 1

The Database Principal owns a schemain the database, and cannot be dropped.

 

Solution (SSMs ):

 

1. Find the user's schema

 

 

2. Find the db_owner In the schema and change the schema owner from test6 to DBO or another user.

 

 

3. delete user test6

 

Or use the following statement to delete the file:

 

--- Query the schema owned by user test6 as db_owner

Use DBA;

Select S. Name

From SYS. schemas s

Where S. principal_id =
User_id ('test6 ');

 

-- Change the owner of db_owner schema to DBO.

Alter authorizationon
Schema: db_ownerto DBO;

 

--- Query the schema owned by user test6 again as null

Select S. Name

From SYS. schemas s

Where S. principal_id =
User_id ('test6 ');

 

-- Delete user test6

Drop user [test6]

 

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.