• Grey Twitter Icon
  • Grey Facebook Icon
  • Grey LinkedIn Icon
  • Grey Google+ Icon

© 2016 - 2019 All rights reserved. PigeonSQL.com | Filip Holub

Poweshell program for Backup databases from PROD to TEST environment in MS SQL2016

June 7, 2017

Hi guys, We have not seen you for ages!

Today, I will write about backuping in powershell. I often have to deals with with development depatment refresh databases from production environment to testing environment, almost on daily bases. Therefore I wrote small script that have 40 rows.

 

 

As you can see, you have to fill in SQL instance, three databases and destination share folder for .bak files.

 

 

 

There is condition, if you have not filled in database name script write only 'Empty'

 

 

Here is entire script:

 

 

The course looks like this:

 

 

 

 

This script save me a lot of time, because can use only developers and I do not have to deal with anything. I have created new account that have only role - db_backupoperator. Therefore developers can run under this account and .bak files are saved in testing env..

 

To be honest, I'm not a native developer :D But it works!
Please reload

RECENT POST
Please reload

  • Facebook Social Icon
  • Google+ Social Icon
  • LinkedIn Social Icon
  • Twitter Social Icon