Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
DB Engine
SQL ServerMSDESQL Server CE
Services
Analysis (Data Mining)Analysis (OLAP)DTSIntegration ServicesNotification ServicesReporting Services
Programming
CLRConnectivitySQLXML
Other Technologies
ClusteringEnglish QueryFull-Text SearchReplicationService Broker
General
Data WarehousingPerformanceSecuritySetupSQL Server ToolsOther SQL Server Topics
DirectoryUser Groups
Related Topics
MS AccessOther DB ProductsMS Server Products.NET DevelopmentVB DevelopmentJava DevelopmentMore Topics ...

SQL Server Forum / General / Security / July 2006

Tip: Looking for answers? Try searching our database.

dbowner no more dbower (SID lost)

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
906507N - 27 Jul 2006 23:16 GMT
hello eveybody,

I have an Sql server 2000 installed with several databases.
this instance is configured with both sql server identification and
Windows ID

I have created a login called « john »and this login has a default
database « mydb » (sp_addlogin)

On this default database, i have granted the Access to this login
(sp_grantdbaccess)


a new application has created a new database « newdb » and, for
differents reasons, the program has created again  the « john » login
(same name)

Now, I can Access with this login to the database « newdb » but no more
to the default one « mydb ».
When I say « i can Access... »that means :

Select * from toto is working on « newdb »
(I dont need to write Select * from john.toto)

But with « mydb »,

Select * from toto does not work,
I need to write the select this way :  Select * from john.toto
Since I use an application, I cannot change the sql statement

since john is "dbowner" and has a defaut db "mydb", this is strange

When I read master.dbo.sysusers, the user « john » has a complexe SID  
(« 0x93F921DB3.... »)

When i read master.dbo.sysdatabases :
The new database « newdb » has the same complexe SID (« 0x93F921DB3....
»)
The old database « mydb » has lost the SID witch is replaced with  « 0x01
»

The table toto has the correct UID that is « john » in sysusers table

How can I « reset » "john" owner on all tables from mydb

many thanks
nicolas
Laurentiu Cristofor [MSFT] - 28 Jul 2006 01:34 GMT
It looks like someone has changed the owner of the old database to be sa
(sid = 0x01). You can execute sp_changedbowner to reset the database owner
to be John.

See
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tsqlref/ts_sp_c
a-cz_30s2.asp
,
for more information on sp_changedbowner.

Thanks

Signature

Laurentiu Cristofor [MSFT]
Software Design Engineer
SQL Server Engine
http://blogs.msdn.com/lcris/

This posting is provided "AS IS" with no warranties, and confers no rights.

> hello eveybody,
>
[quoted text clipped - 42 lines]
> many thanks
> nicolas
906507N - 28 Jul 2006 02:00 GMT
many thanks for your help

I try the command but sql server say :

Server: Msg 15110, Level 16, State 1, Procedure sp_changedbowner, Line 47
  The proposed new database owner is already a user in the database

I'm connected with the sa account into the default database of the owner

> It looks like someone has changed the owner of the old database to be
> sa (sid = 0x01). You can execute sp_changedbowner to reset the
[quoted text clipped - 5 lines]
>
> Thanks
Sue Hoegemeier - 28 Jul 2006 17:00 GMT
Try creating a temporary login, change the database to be
owned by that temp login. Then change the database to be
owned by John and drop the temp login. Something like:
use YourDatabase
go
exec sp_addlogin 'TempLogin'
exec sp_changedbowner 'TempLogin'
exec sp_changedbowner 'John'
exec sp_droplogin 'TempLogin'

-Sue

>many thanks for your help
>
[quoted text clipped - 14 lines]
>>
>> Thanks
Laurentiu Cristofor [MSFT] - 28 Jul 2006 18:57 GMT
If this error comes as a result of attempting to make the owner to be
"John", then it means that while the owner was sa, a user was already
created for John in the database. If you now want to make John the database
owner, you should remove that user:

sp_dropuser 'John'

and then you should be able to call

sp_changedbowner 'John'

There is a catch: if 'John' owns objects in the database, you cannot drop
him, so you will have to change the ownership of those objects to someone
else first, by using sp_changeobjectowner.

Thanks

Signature

Laurentiu Cristofor [MSFT]
Software Design Engineer
SQL Server Engine
http://blogs.msdn.com/lcris/

This posting is provided "AS IS" with no warranties, and confers no rights.

> many thanks for your help
>
[quoted text clipped - 14 lines]
>>
>> Thanks
906507N - 28 Jul 2006 19:49 GMT
> many thanks for your help
>
[quoted text clipped - 14 lines]
>>
>> Thanks

sue and Laurentiu,

many thanks for your help
The solution was here

I created a new login, changeobjectowner for each database tables from
old user,delete and create again the old login, changeobjectowner back to
the old user all objects

now, it is correct

again, many thanks for your answers.

nicolas
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.