Solved

How to restore database permissions

Posted on 2006-11-09
4
1,021 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 69

Accepted Solution

by:
Scott Pletcher earned 63 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 62 total points
ID: 17908286
This problem is known as an orphaned user
http://support.microsoft.com/kb/314546
0

Featured Post

Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.

Question has a verified solution.

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

JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
A Stored Procedure in Microsoft SQL Server is a powerful feature that it can be used to execute the Data Manipulation Language (DML) or Data Definition Language (DDL). Depending on business requirements, a single Stored Procedure can return differe…
Via a live example, show how to setup several different housekeeping processes for a SQL Server.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

732 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