Monday, March 26, 2012

Model database has unknown owner

I am trying to run the sp_helpdb stored procedure and am getting the
following results:
Server: Msg 515, Level 16, State 2, Procedure sp_helpdb, Line 53
Cannot insert the value NULL into column '', table ''; column does not
allow nulls. INSERT fails.
The statement has been terminated.
I think I have narrowed it down. The model database has an owner of
unknown. I have tried running this:
ALTER DATABASE model SET SINGLE_USER
DBCC CHECKDB ('model', Repair_Rebuild)
ALTER DATABASE model SET Multi_USER
But the server seems to hang trying to set the db to single user. I
can not detach the model database either. Any suggestions on how to
fix this without losing all of my other database info in the master?
TIA
when you run this
select schema_owner,* from information_schema.schemata
where catalog_name ='model'
what's the schema_owner?
Denis the SQL Menace
http://sqlservercode.blogspot.com/
|||Have you tried just changing the owner to 'sa', which is what it should be?
USE model
EXEC sp_changedbowner 'sa'
HTH
Kalen Delaney, SQL Server MVP
www.solidqualitylearning.com
<jhmosow@.gmail.com> wrote in message
news:1143221417.974191.196120@.i40g2000cwc.googlegr oups.com...
>I am trying to run the sp_helpdb stored procedure and am getting the
> following results:
> Server: Msg 515, Level 16, State 2, Procedure sp_helpdb, Line 53
> Cannot insert the value NULL into column '', table ''; column does not
> allow nulls. INSERT fails.
> The statement has been terminated.
> I think I have narrowed it down. The model database has an owner of
> unknown. I have tried running this:
> ALTER DATABASE model SET SINGLE_USER
> DBCC CHECKDB ('model', Repair_Rebuild)
> ALTER DATABASE model SET Multi_USER
> But the server seems to hang trying to set the db to single user. I
> can not detach the model database either. Any suggestions on how to
> fix this without losing all of my other database info in the master?
> TIA
>
|||When I tried this query:
select schema_owner,* from information_schema.schemata
where catalog_name ='model'
I get:
Server: Msg 208, Level 16, State 1, Line 1
Invalid object name 'information_schema.schemata'.
When I try changing the owner using:
use model
EXEC sp_changedbowner 'sa'
I get:
Server: Msg 15109, Level 16, State 1, Procedure sp_changedbowner, Line
22
Cannot change the owner of the master database.
I am logged in as sa.
|||The sp_changedbowner procedure affects the database you are currently in,
and the message indicates you did not USE model before running the stored
procedure.
First:
USE model
GO
Make sure you are in model:
SELECT db_name()
Once you are in model:
EXEC sp_changedbowner 'sa'
HTH
Kalen Delaney, SQL Server MVP
www.solidqualitylearning.com
<jhmosow@.gmail.com> wrote in message
news:1143292556.116759.304750@.e56g2000cwe.googlegr oups.com...
> When I tried this query:
> select schema_owner,* from information_schema.schemata
> where catalog_name ='model'
> I get:
> Server: Msg 208, Level 16, State 1, Line 1
> Invalid object name 'information_schema.schemata'.
> When I try changing the owner using:
> use model
> EXEC sp_changedbowner 'sa'
> I get:
> Server: Msg 15109, Level 16, State 1, Procedure sp_changedbowner, Line
> 22
> Cannot change the owner of the master database.
> I am logged in as sa.
>
|||I made sure I was in the model database. I set up the following query:
use model
go
SELECT db_name()
go
EXEC sp_changedbowner 'sa'
go
The responses I received was:
(1 row(s) affected)
Server: Msg 15109, Level 16, State 1, Procedure sp_changedbowner, Line
22
Cannot change the owner of the master database.
Query Analyzer does show I am in the Model database.
|||What messages do you get if you do below?
EXEC model..sp_changedbowner 'sa'
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
<jhmosow@.gmail.com> wrote in message news:1143466613.203455.96190@.i40g2000cwc.googlegro ups.com...
>I made sure I was in the model database. I set up the following query:
> use model
> go
> SELECT db_name()
> go
> EXEC sp_changedbowner 'sa'
> go
> The responses I received was:
> (1 row(s) affected)
> Server: Msg 15109, Level 16, State 1, Procedure sp_changedbowner, Line
> 22
> Cannot change the owner of the master database.
> Query Analyzer does show I am in the Model database.
>
|||Running EXEC model..sp_changedbowner 'sa' returns:
Server: Msg 15109, Level 16, State 1, Procedure sp_changedbowner, Line
22
Cannot change the owner of the master database.
|||OK, it seems like SQL Server doesn't allow you to change the owner of the model database, and that
the error message is slightly misleading. Since sp_changedbowner doesn't allow you to change the
owner of model to anything else but "sa", you have to try to find out how and why this was changed
from sa in the first place. How to fix this is then up to you:
* Rebuild the system databases (rebuildm.exe). You will lose all information in the system
databases.
* Hack the system tables. If you don't know how, don't do it. And, it is not supported.- Warning,
warning!!!
* Open a case with MS Support and let them hand-hold you through the process.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
<jhmosow@.gmail.com> wrote in message news:1143471215.461886.94170@.v46g2000cwv.googlegro ups.com...
> Running EXEC model..sp_changedbowner 'sa' returns:
> Server: Msg 15109, Level 16, State 1, Procedure sp_changedbowner, Line
> 22
> Cannot change the owner of the master database.
>

No comments:

Post a Comment