Solved

set the role_membership for this user after the restore

Posted on 2014-02-17
2
191 Views
Last Modified: 2014-02-17
Using sql server 2012 std edition

I am restoring a database on another server as part of my sql job and then running some data processing jobs on the restored data.

The problem that I am facing is that the windows user that the data processing job runs under, loses the db_owner role_membership  after the restore so the data processing job fails while running data reads.

How can I set the role membership for this windows user using t-sql after the restore step, and before data processing. I can run this t-sql under a different sql user.

Thanks.
0
Comment
Question by:patd1
2 Comments
 
LVL 10

Accepted Solution

by:
PadawanDBA earned 500 total points
ID: 39865496
You should be able to use:

alter role "db_owner" add member "<usernameHere>";

Open in new window



Edit:

You will likely need to add the user to the database too:

use <databaseNameHere>;

create user "<usernameHere>" for login "<usernameHere>";

Open in new window

0
 

Author Closing Comment

by:patd1
ID: 39865572
Thank You. Alter role works for me.
0

Featured Post

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

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

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.

914 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now