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 2005 Forums
 SQL Server Administration (2005)
 Backup and Restore of a user's default database
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

cornelius
Starting Member

Israel
11 Posts

Posted - 05/17/2007 :  13:08:04  Show Profile  Reply with Quote
Hello.
I am trying to perform a backup and restore of a user's default database. the user- "myuser", was created with a default database. I have backed the user database and tried to restore it in different ways and I always get the same error when trying to connect with the user after restore:

"Cannot open user default database.Login failed (error 4064)".

It happens if I don't delete the user before restoring the database.

If I try to delete the user before restore and create it afterwards, when I try to set the default user database to the same database I get the error:

"user, group or role 'myuser' already exist in the database"

And when I try to delete the user from the restored database (in order to recreate it) I cannot, because the user's schema is connected to objects in the database.

Can anyone help?... How do I restore??
Thanx,
Nili.

tkizer
Almighty SQL Goddess

USA
37287 Posts

Posted - 05/17/2007 :  13:16:58  Show Profile  Visit tkizer's Homepage  Reply with Quote
You need to unorphan the account via sp_change_users_login.

Tara Kizer
http://weblogs.sqlteam.com/tarad/
Go to Top of Page

cornelius
Starting Member

Israel
11 Posts

Posted - 05/20/2007 :  03:50:44  Show Profile  Reply with Quote
Thank you Tara!
I executed the procedure and it solved my problem! Finally..
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.06 seconds. Powered By: Snitz Forums 2000