[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

How to restore database permissions

Posted on 2006-11-09
4
Medium Priority
?
1,029 Views
Last Modified: 2011-03-22
We are moving a database from SQL Server 2000 to 2005.  The database seens to to restore OK, but when we run the web application we get numerous errors like "Username does not have select permission on tablename" or "execute permission denied on object storedprocedure1", etc. and we have to manually reset the permissions on every table, view and stored procedure.  How can we restore the database, including all permissions on tables, stored procedures, etc?
0
Comment
Question by:medcare
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 70

Accepted Solution

by:
Scott Pletcher earned 252 total points
ID: 17908237
The users and their permissions *are* still there.  The problem is that the user is not sync'ed up with the login.

Run the code below in Query Analyzer and then run the commands it generates.  That should re-sync the users.

SELECT 'EXEC sp_change_users_login ''UPDATE_ONE'', ''' + su.name + ''', ''' + su.name + ''''
FROM sysusers su
LEFT OUTER JOIN master..syslogins sl ON su.sid = sl.sid
WHERE su.issqluser = 1 AND su.name NOT IN ('guest', 'INFORMATION_SCHEMA')
AND sl.sid IS NULL
0
 
LVL 43

Assisted Solution

by:Eugene Z
Eugene Z earned 248 total points
ID: 17908286
This problem is known as an orphaned user
http://support.microsoft.com/kb/314546
0

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When trying to connect from SSMS v17.x to a SQL Server Integration Services 2016 instance or previous version, you get the error “Connecting to the Integration Services service on the computer failed with the following error: 'The specified service …
Ready to get certified? Check out some courses that help you prepare for third-party exams.
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question