Tuesday, February 14, 2012

Change Ownership

How do I change ownership of a database table to another user?
I did a restore of a database using our database software. It retained the
user's ownership of a table, but did not restore the users, so basically i
have a user that does not exist to this server owning a table.. confusing!!
I would like to give ownership of this table to a new user I create for this
database. SQL server will not let me create a user with the same name b/c it
says the user exist...it does not. I'm very confused and need help thanks. I
hope this helps.. We are running SQL 2000 SP3a on Windows 2000 Server SP4.Look up sp_changedbowner in BOL (Books OnLine).
Geoff N. Hiten
Microsoft SQL Server MVP
Senior Database Administrator
Careerbuilder.com
I support the Professional Association for SQL Server
www.sqlpass.org
"Adrian Moseley" <amoseley@.personix.fiserv.com> wrote in message
news:%23RxUpJmHEHA.3832@.TK2MSFTNGP10.phx.gbl...
> How do I change ownership of a database table to another user?
> I did a restore of a database using our database software. It retained the
> user's ownership of a table, but did not restore the users, so basically i
> have a user that does not exist to this server owning a table..
confusing!!
> I would like to give ownership of this table to a new user I create for
this
> database. SQL server will not let me create a user with the same name b/c
it
> says the user exist...it does not. I'm very confused and need help thanks.
I
> hope this helps.. We are running SQL 2000 SP3a on Windows 2000 Server SP4.
>|||Hi,
To Add on,
Since you did a restore of database actually your database users also got
restored in the new database, but the lost the SID chain with Master
database syslogins tables. Due to this you will not be able to see the users
either thru enterprise manager or sp_helpuser procedure. But if you query
the "sysusers" table in corresponding database you will be able to see them.
The brink back the chanin you have to execute the procedure
Use <dbname>
go
sp_change_users_login 'Report'
This will Lists the users, and their corresponding security identifiers
(SID), that are in the current database, not linked to any login.
Based on the output you can use 'Update_one' option to rectify the isue.
Refer books online for more information.
Thanks
Hari
MCDBA
"Geoff N. Hiten" <SRDBA@.Careerbuilder.com> wrote in message
news:O5zu#rmHEHA.2924@.TK2MSFTNGP09.phx.gbl...
> Look up sp_changedbowner in BOL (Books OnLine).
> --
> Geoff N. Hiten
> Microsoft SQL Server MVP
> Senior Database Administrator
> Careerbuilder.com
> I support the Professional Association for SQL Server
> www.sqlpass.org
> "Adrian Moseley" <amoseley@.personix.fiserv.com> wrote in message
> news:%23RxUpJmHEHA.3832@.TK2MSFTNGP10.phx.gbl...
the
i
> confusing!!
> this
b/c
> it
thanks.
> I
SP4.
>

No comments:

Post a Comment