Restore backup over existing database but keep permissons #8527
-
Hi, Any help would be appreciated. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi @tomaustin700, A database backup on SQL Server contains all permissions too. That means when you overwrite an existing database you will also overwrite the existing permissions with the ones that your backup brings. Therefore that's nothing However, as you mentioned, on way to accomplish this process will be: To give some guidance, take a look at this blog post Replicate permissions to new Login/User with dbatools and all the other ones linked there (like the one that @SQLDBAWithABeard wrote). Let us know if this helps. |
Beta Was this translation helpful? Give feedback.
Hi @tomaustin700,
A database backup on SQL Server contains all permissions too. That means when you overwrite an existing database you will also overwrite the existing permissions with the ones that your backup brings.
Therefore that's nothing
Restore-DbaDatabase
can help with.However, as you mentioned, on way to accomplish this process will be:
1- Script existing permissions (
Export-DbaUser
)2- Restore the database (
Restore-DbaDatabase
)3- Apply permissions exported on step 1 (
Invoke-DbaQuery
)To give some guidance, take a look at this blog post Replicate permissions to new Login/User with dbatools and all the other ones linked there (like the one that @SQLDBAWithABeard wrote).
Let us k…