Three solutions for SQL Server databases without valid owners

Source: Internet
Author: User

Problem:

During the development process, the operating system was out of the question and decided to reload the system. However, the database files in SQL Server are not separated and the system is directly in the grid. Attaching the database file to the new system database is normal, but there is a problem when opening the database diagram, as shown in:


Solution: (Three kinds)

1, right-click your database name → properties → file → owner →sa; (This method is found on the Internet and may not be successful)


2, set compatibility level of 90 (2005 is 90,2000 to 80)

(1) Code:
Use [master]
GO
EXEC dbo.sp_dbcmptlevel @dbname = ' database name ', @new_cmptlevel =90
GO

(2) Pinch mouse

Or select the database you restored, right-click, select Properties-----compatibility level, choose sqlserver2005 (90) and then OK. At this point, when you expand the database Diagram node under the database, there is a hint, "This database is missing one or more of the supporting objects required to use the database diagram, whether it is created, or" Yes "is selected.


3. Select your database, then select security → user → select dbo, open the property page, if the login name is empty, create a new query, and then
Use [your database name]
EXEC sp_changedbowner ' sa '



Three solutions for SQL Server databases without valid owners

Related Article

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.