执行sp_helpdb提示不能向表的'owner'列插入空值

现象:

有一台测试环境的机器中,执行sp_helpdb,提示下面的错误信息。
不能向表 'tempdb.dbo.#spdbdesc___________________________________________________________________________________________________________00010002498F'的'owner'列插入空值。

Description:

This indicates a problem with your SQL Server installation. At least one of the databases on your database server has a missing or corrupt owner. The system stored procedure "sp_helpdb", which lists your existing databases, requires a valid owner for every database in order to run.

To see what's happening, open Query Analyzer and run: exec sp_helpdb. You will see an error message like the one above.

Common Cause:

Outside of SQL Server, the database owner's Windows account gets deleted. This sours things within SQL Server, it orphans that database.

Solution:

Following is the response I've seen two Microsoft reps post on groups.  <dbname> is the database with the missing or corrupt owner.

1)
Use <dbname>
sp_changedbowner '[new user not in db already]'
  --this will work & sp_helpdb will execute correctly

2) Then execute the same query using sa & it will work:
Use <dbname>
sp_changedbowner 'sa'
   --The dependent aliases were mapped to the new database owner. Database owner changed.
Of course, you may not know which database has the problematic owner. Here's from a Microsoft Rep (view thread):

The database owner SID will become invalid if the owner's Windows account is
deleted.  This causes problems with sp_helpdb because of the NULL account
name returned from SUSER_SNAME()..  You can identify these problem databases
with the script below and correct the problem by executing sp_changedbowner
with a valid login.


    SELECT name
    FROM master..sysdatabases
    WHERE SUSER_SNAME(sid) IS NULL

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值