Monday, March 12, 2012

Restore problems.

Hi,

I need to restore a database from a server to another, but all tables are not dbo's tables.

I first create the user on the destination instance, and after restoring datas, I try to change rights for this user.

I can't delete or create new rights for this user because it own tables.

How can I restore my users rights database ?If you don't mind to change the owner to DBO (which is how it should have been) you can use sp_changeobjectowner procedure, without having to create the user.|||At this point, I'd probably use sp_change_users_login (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tsqlref/ts_sp_ca-cz_8qzy.asp).

-PatP|||sp_change_users_login will map SID's, but will not allow to do what the poster asked for.|||At least as I read the question, the poster created a login named "foo" because there was a user in the database they were restoring that was already named "foo". If that is the case, and they were expecting their login to have access to the database, then sp_change_users_login would fix the SID values, giving the "foo" login on this server equivalent permissions in this database to what the "foo" login on the original server had.

Once the poster fixes the underlying SID problem, they can then grant or revoke user permissions as they see fit.

Do you think that I missed something?

-PatP|||As I said earlier, if you use sp_changeobjectowner, you don't even need to create the "foo" login to begin with.|||Thanks for all opf us.
I succeed in my problem with sp_changeobjectowner procedure.|||RDJabarov is the man

No comments:

Post a Comment