The following error is returned when you want to add a relational table after attaching a database:
The database does not have a valid owner, so you cannot install the database relational diagram support object. To continue, use the "file" page or alter in the "database properties" dialog box
The authorization statement sets the database owner as a valid login name, and then adds the database relational diagram support object.
The first method does not work, and the file owner is Sa. After searching for a long time in csdn, a comrade gave the second solution using SSMs. Run in SSMs
Run the following command:
Alter authorization on Database: mydbname to sa
Modify mydbname to the actual database name, and set the owner to sa.
SSMs was not found after some effort, ah. This is also ruined. I have a new idea in mind.
Imagine the troubles of the grid system, followed by Baidu. This solution was found in a forum:
The solution is as follows:
1. Set the compatibility level to 90 (2005 to 90) (2000 to 80)
Use [Master]
Go
Exec DBO. sp_dbcmptlevel @ dbname = 'database name', @ new_cmptlevel = 90
Go
Alternatively, right-click the database you restored, choose Properties> Options> Compatibility Level, select sqlserver2005 (90), and click OK. (Well, I used this solution. Haha
)
When you expand the "database relationship diagram" node under the database, you will be prompted, "This database lacks one or more support objects required to use the database relationship diagram, whether to create", select
Select "yes.
2. If the problem persists after performing the above operations, continue as follows:
Select your database, select "security"-> "user", and select DBO to open the attribute page. If the logon name is empty, create a new query and
Use [your database name]
Exec sp_changedbowner 'sa'
After the execution is successful, select the "database relationship diagram" node and prompt "this database lacks one or more support objects required to use the database relationship diagram, whether to create", and select "yes"
You can. You can see the previously created graph.