We have a database called 'foo' on the first sql server instance called 'SQL01' that is backed up nightly via a snapshot with Snap Manager for SQL Server and then flex cloned and restored to a second server instance called 'SQL02'. In the database foo there is a sql user called 'someuser' that has datareader and stored procedure privileges.
After the restore operation I cannot access the foo database on SQL02 with the someuser user. I can see that the permissions appear to be set correctly for the user, but can't access the database. The error is "The server principal "someuser" is not able to access the database "foo" under the current security context."
If I remove the user from the database and then add them again it works fine. Any ideas?
Check out sp_change_users_login Do a sp_change_users_login 'report', if there are results, use sp_change_users_login 'autofis','someuser'
you will probably find you need to delete the user out of the database you have restored, then open the user under server security and set its permissions into that DB again
sp_change_users_login is old way of doing things and since you are using SQL Server 2005, try using ALTER USER syntax.
http://sqlblog.com/blogs/greg_low/archive/2009/02/02/much-ado-about-logins-and-sids.aspx
http://msdn.microsoft.com/en-us/library/ms176060.aspx
The server logins are stored in the master database and are not moved with the application DBs. You can create the login at the server level and then use sp_change_users_login 'auto_fix','loginname' as suggested by Sankar. To move a larger set of logins, check this link: How to transfer logins and passwords between instances of SQL Server
To avoid this issue add your user ( the user who is taking backup) as a user of the Backup database, and your user should have (login) access in the new instance.