日期:2014-05-16  浏览次数:20490 次

this database does not have a valid owner 的解决办法--【叶子】

前记:别人给我一个数据库备份文件,我本地还原后,打算创建Database Diagram,遇到如下错误:


错误信息:

Database diagram support objects cannot be installed because this database does not have a valid owner. 

To continue, first use the Files page of the Database Properties dialog box or the ALTER AUTHORIZATION statement to set the database owner to a valid login, then add the database diagram support objects.


根据错误提示,显示是缺少有效的owner。

添加owner:

alter authorization on database ::databasename to sa

添加成功后还是不行。


网上查找了一些相关内容:

http://social.microsoft.com/Forums/zh-CN/sqlserverzhchs/thread/f53de20b-7a72-4d78-917c-664b5b2beb8f

根据帖子提示,查看属性-->文件-->owner的文本框是存在内容的。



后来发现是兼容级别的问题,匹配对应的版本就OK了。

具体步骤:

1、右键对应的数据库,选properties,然后点击Options。

2、在Compatibility Level 里面选择对应的数据库版本。


例如还原的是SQL SERVER 2005的备份文件就选择2005,还原的是SQL SERVER 2000的备份文件就选择2000。