Solved

set the role_membership for this user after the restore

Posted on 2014-02-17
2
194 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
[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
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

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

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

Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
I have a large data set and a SSIS package. How can I load this file in multi threading?
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

739 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