从sql2000中分离的数据库,reattache 到SQL2005中时,Diagrams(关系图)出现的问题:

本文介绍了解决 SQL Server 中因数据库所有者无效导致无法安装数据库图表支持对象的问题。通过调整兼容级别并更改数据库所有者为有效登录名,使数据库图表功能恢复正常。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

出错信息如下:

TITLE: Microsoft SQL Server Management Studio
------------------------------

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.


我是用windows帐户登陆的。(试了下sa登陆,结果一样)

解决方法:

1. 右键点击数据库,选“properties
2. 点选左侧“Options” 
3. 在'Compatibility Level' 选 'SQL Server 2005(90)'
4. 点选左侧“Files”
5. 在owner里填入 'sa' 
6. OK

至此,Diagrams目录可以使用了。

=======Updated at 2006-2-16
问题原因及解决办法!

不光是从sql2000升级到sql2005,在2台装sql2005的机器间备份/恢复后,问题同样会出现。
微软新闻组的Steven Twitchell 给出问题答案,并说在sp1中应该解决。

When the database does not have a valid owner, the database dialog displays the owner as the logged in user.  (This issue will be fixed in SP1.) 

The "no valid owner" issue usually comes up when databases are owned by SQL-authentication logins and are upgraded, detached/attached to another server, or restored from backup to another server.  The SID (a large number) doesn't match any existing login on the new server, so the owner name remains whatever it was on the old server, but it is marked invalid.  Explicitly setting the owner to a valid principal on the server solves the problem.

There is also a known issue when the UI tries to install the database support objects on databases where the compatibility level is set to 80 (SQL Server 2000).  The installation fails and the UI incorrectly reports that the database has no valid owner.  Setting compatibility level to 90 (SQL Server 2005) before installing the diagram support objects solves this problem.  (This issue will also be fixed in SP1.)

目前我总结的解决方法:

因为备份机器上帐号的SID和恢复机器上的SID不同(即使名字完全一样),所以,最简单的办法是将此数据库的db_owner随便换个,点击Diagrams(关系图)使之可用后,再改回db_owner

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值