0

I need to restore my own database backup on another server.

On both servers I have the same user account name with limited privileges (eg WebUser).

On the target server I can't use a sysadmin account, so how can I restore my backup and give access to limited user account WebUser?

Of course I can't use SQL Server Management Studio but only code in my app.

I've tried with an account with this server role

[serveradmin] 
[diskadmin] 
[dbcreator] 

I can restore the backup but can't access it nor give permissions on the database.

Paul White
95.4k30 gold badges440 silver badges689 bronze badges
asked Sep 14, 2016 at 14:36
1
  • Ask your DBA to do the restore. There might be valid reason why the permissions are not given to you. Commented Sep 15, 2016 at 13:51

2 Answers 2

1

I think your main issue is that after restoring the database to your new target user, that your account "WebUser" is effectively orphaned.

You should have your DBA change the SID for WebUser (and any other user that matters) to be the same as in your source server.

Note that this will require dropping the user and re-creating it in the target server. And any other databases will need to be fixed as well.

But this will allow you to restore the database from the source server, to the target server and not have to worry about permissions when you get done.

answered Jun 17, 2019 at 12:16
-1

Use any login with [securityadmin] server role on target to create your user [WebUser] on restored db and assign [db_datareader] role on same.

answered Sep 14, 2016 at 15:18
1
  • 1
    securityadmin doesn't appear among the roles available to the OP. Commented Sep 14, 2016 at 15:33

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.