• Home
  • About Me
  • Contact
  • Things to do Before I Turn 30

the bofe blog

a twenty something IT professional with a few things to say

Feeds:
Posts
Comments

Problem with Orphaned Users/Logins in SQL Server 2005 Migration

March 14, 2008 by bofe

Scenario:

You’ve run sp_detach_db on SQL Server 2000 and sp_attach_db on SQL Server 2005. Your database is now in 2005 and your application has now been reconfigured to point to the new server… but your application can’t log in.

Create the Login in SQL Server 2005. Logins and Users are different things. Logins apply to the server level, where users apply to the database level. One must have a LOGIN before having a USER.

Use the same password as your application. What’s happened is when you detached the USERS for your database were mapped to a LOGIN (via an ID) on your old server. You may have User(LoginID=1000) but the new login you made has an ID of 2000. Your user is an orphan. Let’s reunite them.

Run this T-SQL:

use databasename;
exec sp_change_users_login
	@action = 'update_one',
	@UserNamePattern = 'username',
	@loginname='loginname',
	@password='pass'

Possibly related posts: (automatically generated)

  • Showdown: MySQL vs. SQL Server 2005 (Backups Edition)
  • Re: Is SQL Server ‘keeping up’ with MySQL?
  • Upgrading Sharepoint 3.0 to SQL 2005 Backend
  • Follow up on Issue: Server principal is not able to access the database und…

Posted in Personal | Tagged dba, migration, sqlserver2005 | No Comments Yet

  • Pages

    • About Me
    • Contact
    • Things to do Before I Turn 30
  • Recent Comments

    • Some Betty on Why the hate?
    • stinkypie on Why the hate?
    • stinkypie on Why the hate?
    • JohnO on Why the hate?
    • Yee on a pancake on Why the hate?
    • adam on Why the hate?
    • JohnO on Why the hate?
    • deezil on Why the hate?
    • Yee on a pancake on Why the hate?
    • Dave on Why the hate?
  • Recently Popular

    • Firefox 3 Constantly Crashes -- advice?
    • Authorizing and Capturing Credit Card Transactions with Authorize.net and PHP/MySQL
    • Review: Safari Beta for Windows
    • Windows Command Line Enhancement
    • Sortables with Scriptaculous, PHP, and MySQL in 6 Easy Steps
    • Sync Google Calendar and Facebook Events
    • How to Use Excel 2007 and Goal Seek to calculate what the minimum grade you need on a final exam
    • Problem with Orphaned Users/Logins in SQL Server 2005 Migration
    • Online Store Ideas
    • Harrison Yonts Trial Updates
  • Archives

  • Tags

    4815162342 advertising ajax apple bofehax byebye css dba delicious links development drm facebook finance firefox Geek gis Google imadork linux mememe Meta metoo money murray Music mysql owensboro Personal personal finance personalfinance philosophy php rss scriptaculous sqlserver sqlserver2005 Tablet PC Uncategorized vmware web Weblogs Web Standards whitewhine work wtf
  • Meta

    • Log in
    • Entries RSS
    • Comments RSS
    • WordPress.com

Blog at WordPress.com.

Theme: Mistylook by Sadish.