Created On:  26 July 2010

Problem:

The topic, Addressing Orphaned Users, is updated in The Borland StarTeam 2009 Installation Guide.

Resolution:

The updated instructions for Addressing Orphaned Users are:

Orphaned Users

When a database user for a corresponding SQL Server Login is undefined or incorrectly defined, SQL Server does not allow the user to log on to that instance. Such a user is said to be an orphaned user of the database on that server instance. A database user can become orphaned if the corresponding SQL Server user name is dropped. Most likely, a database user becomes orphaned after a database is restored or attached to a different instance of SQL Server. Orphans occur if the database user is mapped to a SID that is not present in the new server instance.  Use SQL Server Management Studio or any other tool that executes SQL statements to address all orphaned users before you start or upgrade the StarTeam Server configuration.

Addressing Orphaned Users in SQL Server 2005 and above

Use SQL Server Management Studio or any other tool that executes SQL statements to address all orphaned users before you start or upgrade the StarTeam Server configuration. Use either the system administrator user name (sa) or windows authentication (under an administrative user account) to connect to the database and change the database context for the SQL console to the StarTeam database.

To address all orphaned users:

1. Open a SQL console such as SQL Server Management Studio or Enterprise Manager.

2. Open a new query.

3. Enter the following command to display the user names of all orphaned users:

sp_change_users_login 'REPORT'

4. Enter the following to address the orphaned database owner (dbo). The database user is always orphaned when changing servers.

sp_addlogin <username>, <password>
-- e.g. sp_addlogin dbo, StarTeam123
go

sp_changedbowner <username> -- e.g. sp_changedbowner sa
go
sp_defaultdb <username>, <database name>
--(database name is the StarTeam database)
go

is the appropriate user name, is the appropriate password for the StarTeam Server and   is the StarTeam database

5.  For all other uses who are returned as orphans, repeat the following commands for each of the orphaned users. 

sp_addlogin <username>, <password>
go

EXEC sp_change_users_login 'Update_One', '<orphaned username>', '<new user name>' 

Where the first < Orphaned UserName> is the orphaned user from the previous server and the second is the new login created in the previous step.

6. Enter the following command and this command should not return any rows

sp_change_users_login 'REPORT'

Incident #2461268