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.
-
Ask your DBA to do the restore. There might be valid reason why the permissions are not given to you.Kin Shah– Kin Shah2016年09月15日 13:51:47 +00:00Commented Sep 15, 2016 at 13:51
2 Answers 2
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.
Use any login with [securityadmin] server role on target to create your user [WebUser] on restored db and assign [db_datareader] role on same.
-
1
securityadmin
doesn't appear among the roles available to the OP.Andriy M– Andriy M2016年09月14日 15:33:35 +00:00Commented Sep 14, 2016 at 15:33