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 2005 Forums
 SQL Server Administration (2005)
 Restoring database- permissio ns problems

Author  Topic 

cornelius
Starting Member

11 Posts

Posted - 2007-05-13 : 09:20:28
Hello.

I have a user who owns jobs and a database. I tried to drop the default database of the user and restore it from a backup file, but without dropping the user first (since I don't want to drop the jobs owned by the user etc.). Now I have a user, "user1", who owns jobs in the system, and a database, "database1", which has a schema (and user permissions) granted to "user1". The problem is I cannot connect as user1 to the database. When I try to connect I get error 4064: "Cannot open user default database".
When I log in as "sa" and try to grant default database to the user ("alter login with default_database = 'database1'" I get an error saying there is already a user with that name in the database mentioned.

Anyone has any idea what to do (without dropping the database and the user and start all over again)?

Thank you

rmiao
Master Smack Fu Yak Hacker

7266 Posts

Posted - 2007-05-13 : 15:19:11
Use sp_helpuser to see which sql login the user maps to. If it's null, fix that with sp_change_users_login.
Go to Top of Page
   

- Advertisement -