Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Administration (2000)
 Database / Object ownership with NT Authentication

Author  Topic 

neena
Starting Member

10 Posts

Posted - 2002-02-26 : 14:08:37
I'm creating a database on remote server by running command from sql client using NT Authentication. This NT login has System Administrator server role provileges in SQL Server.

My question is :
1. who will be the database owner - NT Login / sa
2. who will be the object owner.

when I do sp_helpDB, it shows NT Login as database owner. On running command sp_changedbowner 'sa' ,TRUE
it gives me error message - "Msg 15111, Level 16, State 1, Server CITISERV5, Procedure sp_changedbowner, Line 39
The proposed new database owner is already aliased in the database."


I want to make sa as database owner and also object owner.

Pls help....


izaltsman
A custom title

1139 Posts

Posted - 2002-02-26 : 14:25:27
1. who will be the database owner - NT Login / sa

NT Login.

2. who will be the object owner.

Which object? If you create a new object using the same NT Login that created your database (or any other login which happens to be a member of db_owner role), the object will be owned by dbo.

To change the database ownership simply run
EXEC sp_changedbowner 'sa'



Go to Top of Page

neena
Starting Member

10 Posts

Posted - 2002-02-26 : 17:08:16
For creation of DB following steps are run-
1. create empty DB
2. Restore backup (Backup is taken from other SQL machine/location)
3. Insert some records in tables.

This is run from batch file using NT authentication.

After step 1, owner is NT login, I run changedbowner to change owner to 'sa'
Run step2 -restore, now DB owner in sysdatabases table is NT login.
If I try to run changedbowner to make sa as owner, it gives me error that login is already user in db.

do i need to update any sys tables after restore ???

what's the option to make sure database owner is 'sa' at the end.



Go to Top of Page
   

- Advertisement -