SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2000 Forums
 SQL Server Administration (2000)
 table owner has lost its rights??
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

yonabout
Posting Yak Master

United Kingdom
103 Posts

Posted - 07/14/2009 :  06:26:22  Show Profile  Reply with Quote
Hi,

got a really weird issue.

We've got a database where all the tables are owned by a user called HSADBO. So when the application accesses the table as that user, it owns the tables. About half an hour ago, users couldn't log into the application any more. It turns out that thhe user that owns the tables can't access them propoerly anymore.

If you log on to query analyser with SQL server authentication as the user who is the table owner, you still can't access the tables unless you stick the HSADBO.[table name] qualifier in front of it.

Checked the permissions, and the user still has full access to all the relevant tables etc.

Anyone know
a) how this could happen?
b) how to fix it?

Cheers,

Yonabout

rajdaksha
Aged Yak Warrior

595 Posts

Posted - 07/14/2009 :  06:29:56  Show Profile  Send rajdaksha a Yahoo! Message  Reply with Quote
Hi

sp_changeobjectowner '[OldOwner].[table1]', 'NewOwner'
go

-------------------------
R..
Go to Top of Page

RickD
Slow But Sure Yak Herding Master

United Kingdom
3560 Posts

Posted - 07/14/2009 :  06:50:19  Show Profile  Reply with Quote
I would say that your default schema for this user has changed. To check this, look under the security tab at the database level, on Schemas and make sure the owner of the HSADBO schema is the login you are using.

rajdaksha - That is to change the owner. That is definitely NOT what the OP wants.

Edited by - RickD on 07/14/2009 06:51:33
Go to Top of Page

yonabout
Posting Yak Master

United Kingdom
103 Posts

Posted - 07/14/2009 :  06:52:41  Show Profile  Reply with Quote
Thanks for that.

That's the route we've gone down - we created a new user (HSADummy) and made it the owner of all the tables. Then we deleted the original user (HSADBO), re-created it and then used sp_changeobjectowner to make it the owner of the tables again.

Seems to have worked on the tables we've tested it on, so we'll script it in bulk.

But how can I find out how it happened? This kind of stuff can't just happen randomly can it?

Cheers,

Yonabout
Go to Top of Page

RickD
Slow But Sure Yak Herding Master

United Kingdom
3560 Posts

Posted - 07/14/2009 :  06:57:17  Show Profile  Reply with Quote
Have you had an upgrade or moved objects? The software should really require that all objects are schema qualified if you are using other than the default schema.

You did not need to change the owner, you just needed to ensure the owner of the schema was the HSADBO user.

Edited by - RickD on 07/14/2009 06:58:33
Go to Top of Page

yonabout
Posting Yak Master

United Kingdom
103 Posts

Posted - 07/14/2009 :  08:53:04  Show Profile  Reply with Quote
Thats the weird thing. The schema doesn't appear to have changed at all, and the user is the owner of the schema. Just the same as the same database on a test server, which is fine.

We have had an upgrade - to SP4 (only 4 years after the fact), but that was done at the weekend, and everythings been fine for a couple of days since then - it was just this morning that things suddenly went screwy.

It has been fixed now - we got rid of the user, re-created it and re-made it the owner of all the tables. I just don't want it to happen again!

Cheers,

Yonabout
Go to Top of Page

EMarkM
Starting Member

United Kingdom
16 Posts

Posted - 07/16/2009 :  10:56:22  Show Profile  Reply with Quote
I'm not aware of any way in which such a schema owner change could happen "by accident".

Is there any chance that it was either a malicious attack or an inappropriately-powerful user with insufficient knowledge?
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.07 seconds. Powered By: Snitz Forums 2000