SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 can't create sql user
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

esthera
Flowing Fount of Yak Knowledge

1393 Posts

Posted - 12/28/2012 :  04:44:38  Show Profile  Reply with Quote
I'm moving a database to a new server

I tried to script the logins but they are not working

I see the users and modified the passwords but i'm getting an error

[Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for user 'xuser'.

any advise
I tried to drop and recreate but when I try dropping in the database itself I get an error

DROP USER [xuser]
GO
Msg 15138, Level 16, State 1, Line 2
The database principal owns a schema in the database, and cannot be dropped.



I moved the database and then the users
should I do the opposite - delete the datbase and then move users and then database?

sodeep
Flowing Fount of Yak Knowledge

USA
7174 Posts

Posted - 12/28/2012 :  09:22:56  Show Profile  Reply with Quote
You don't need to drop database. After you migrate DB,you can either create logins with same username and password and map the logins or if you are doing for muliple dbs and logins then i would suggest you to search for "Transfer logins from one server to other server" kb article
Go to Top of Page

djj55
Constraint Violating Yak Guru

USA
337 Posts

Posted - 12/28/2012 :  09:27:43  Show Profile  Reply with Quote
Also look up orphaned users.
Here is the first topic that came up for me http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=12615

djj
Go to Top of Page

esthera
Flowing Fount of Yak Knowledge

1393 Posts

Posted - 12/29/2012 :  11:59:44  Show Profile  Reply with Quote
this didn't do the trick

dropping the database didn't work either
I would like to delete from both and start again but it doesn't let me drop the user from the database (that was restored from the backup) what else can I do?
Go to Top of Page

jeffw8713
Aged Yak Warrior

USA
799 Posts

Posted - 12/30/2012 :  10:24:54  Show Profile  Reply with Quote
To migrate logins - lookup sp_help_revlogin and install that on the source system. Use that procedure to generate the script to create the logins on the destination.

This script will create the logins with the appropriate SID, which will then map to the users in the database correctly and also creates the logins with the same password as on the source system.
Go to Top of Page

esthera
Flowing Fount of Yak Knowledge

1393 Posts

Posted - 12/30/2012 :  13:42:56  Show Profile  Reply with Quote
thanks the actual problem wasn't with the logins at all - - I didn't have sql authentication checked on the new server
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.05 seconds. Powered By: Snitz Forums 2000